From 6800da7f9620c735c1696fac35ceb918367d8d4f Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 25 Apr 2024 16:19:22 +0800 Subject: [PATCH] fix jsx APIs. [skip CI] --- Assets/Script/Lib/Dora/en/dora.d.ts | 8 +++--- Assets/Script/Lib/Dora/en/jsx.d.ts | 16 ++++++------ Assets/Script/Lib/Dora/zh-Hans/dora.d.ts | 8 +++--- Assets/Script/Lib/Dora/zh-Hans/jsx.d.ts | 32 ++++++++++++------------ Assets/Script/Lib/dora-x.lua | 2 +- Source/Physics/PhysicsWorld.cpp | 1 + Tools/dora-jsx/dora-x.ts | 2 +- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/Assets/Script/Lib/Dora/en/dora.d.ts b/Assets/Script/Lib/Dora/en/dora.d.ts index 0a7d8a4f3..ab7cbffe2 100644 --- a/Assets/Script/Lib/Dora/en/dora.d.ts +++ b/Assets/Script/Lib/Dora/en/dora.d.ts @@ -2711,11 +2711,11 @@ class Node extends Object { /** Whether the node has children. */ readonly hasChildren: boolean; - /** The children of the node as an Array object, could be nil. */ - readonly children: Array; + /** The children of the node as an Array object, could be undefined. */ + readonly children?: Array; - /** The parent node of the node. */ - readonly parent: Node; + /** The parent node of the node, could be undefined. */ + readonly parent?: Node; /** The bounding box of the node as a Rect object. */ readonly boundingBox: Rect; diff --git a/Assets/Script/Lib/Dora/en/jsx.d.ts b/Assets/Script/Lib/Dora/en/jsx.d.ts index 28ec6565c..2f7d6b0cc 100644 --- a/Assets/Script/Lib/Dora/en/jsx.d.ts +++ b/Assets/Script/Lib/Dora/en/jsx.d.ts @@ -418,12 +418,12 @@ class Dot { /** * The X position of the dot. */ - x: number; + x?: number; /** * The Y position of the dot. */ - y: number; + y?: number; /** * The radius of the dot. @@ -469,12 +469,12 @@ class Segment { } class Polygon { - /* + /** * The vertices of the polygon. */ verts: dora.Vec2.Type[]; - /* + /** * The fill color of the polygon in format 0xffffffff (ARGB, default is white). */ fillColor?: number; @@ -491,12 +491,12 @@ class Polygon { } class Rectangle { - /* + /** * The width of the rectangle. */ width: number; - /* + /** * The height of the rectangle. */ height: number; @@ -511,7 +511,7 @@ class Rectangle { */ centerY?: number; - /* + /** * The fill color of the rectangle in format 0xffffffff (ARGB, default is white). */ fillColor?: number; @@ -528,7 +528,7 @@ class Rectangle { } class Verts { - /* + /** * The list of vertices and their colors in format 0xffffffff (ARGB). */ verts: [vert: dora.Vec2.Type, color: number][]; diff --git a/Assets/Script/Lib/Dora/zh-Hans/dora.d.ts b/Assets/Script/Lib/Dora/zh-Hans/dora.d.ts index 721ab0391..586520e6c 100644 --- a/Assets/Script/Lib/Dora/zh-Hans/dora.d.ts +++ b/Assets/Script/Lib/Dora/zh-Hans/dora.d.ts @@ -2714,11 +2714,11 @@ class Node extends Object { /** 节点是否有子节点。 */ readonly hasChildren: boolean; - /** 节点的子节点,为Array对象,可能为nil。 */ - readonly children: Array; + /** 节点的子节点,为Array对象,可能为undefined。 */ + readonly children?: Array; - /** 节点的父节点。 */ - readonly parent: Node; + /** 节点的父节点,,可能为undefined。 */ + readonly parent?: Node; /** 节点的边界框,为Rect对象。 */ readonly boundingBox: Rect; diff --git a/Assets/Script/Lib/Dora/zh-Hans/jsx.d.ts b/Assets/Script/Lib/Dora/zh-Hans/jsx.d.ts index 77101d501..039f2585c 100644 --- a/Assets/Script/Lib/Dora/zh-Hans/jsx.d.ts +++ b/Assets/Script/Lib/Dora/zh-Hans/jsx.d.ts @@ -416,22 +416,22 @@ class Model extends Playable { class Dot { /** - * 点的X坐标位置。 + * 圆点的X坐标位置。 */ - x: number; + x?: number; /** - * 点的Y坐标位置。 + * 圆点的Y坐标位置。 */ - y: number; + y?: number; /** - * 点的半径。 + * 圆点的半径。 */ radius: number; /** - * 点的颜色,格式为0xffffffff(ARGB),默认为白色。 + * 圆点的颜色,格式为0xffffffff(ARGB),默认为白色。 */ color?: number; } @@ -469,13 +469,13 @@ class Segment { } class Polygon { - /* + /** * 多边形的顶点。 */ verts: dora.Vec2.Type[]; - /* - * 多边形的填充颜色(默认为白色)。 + /** + * 多边形的填充颜色,格式为0xffffffff(ARGB),默认为白色。 */ fillColor?: number; @@ -485,18 +485,18 @@ class Polygon { borderWidth?: number; /** - * 边框的颜色(默认为白色)。 + * 边框的颜色,格式为0xffffffff(ARGB),默认为白色。 */ borderColor?: number; } class Rectangle { - /* + /** * 矩形的长。 */ width: number; - /* + /** * 矩形的宽。 */ height: number; @@ -511,8 +511,8 @@ class Rectangle { */ centerY?: number; - /* - * 矩形的填充颜色(默认为白色)。 + /** + * 矩形的填充颜色,格式为0xffffffff(ARGB),默认为白色。 */ fillColor?: number; @@ -522,13 +522,13 @@ class Rectangle { borderWidth?: number; /** - * 边框的颜色(默认为白色)。 + * 边框的颜色,格式为0xffffffff(ARGB),默认为白色。 */ borderColor?: number; } class Verts { - /* + /** * 包含要绘制的顶点及其颜色的列表,颜色格式为0xffffffff(ARGB)。 */ verts: [vert: dora.Vec2.Type, color: number][]; diff --git a/Assets/Script/Lib/dora-x.lua b/Assets/Script/Lib/dora-x.lua index cbc3966eb..700b2455c 100644 --- a/Assets/Script/Lib/dora-x.lua +++ b/Assets/Script/Lib/dora-x.lua @@ -511,7 +511,7 @@ do -- 290 do -- 306 local dot = child.props -- 310 node:drawDot( -- 311 - dora.Vec2(dot.x, dot.y), -- 312 + dora.Vec2(dot.x or 0, dot.y or 0), -- 312 dot.radius, -- 313 dora.Color(dot.color or 4294967295) -- 314 ) -- 314 diff --git a/Source/Physics/PhysicsWorld.cpp b/Source/Physics/PhysicsWorld.cpp index 939d6f9fc..78e4a373a 100644 --- a/Source/Physics/PhysicsWorld.cpp +++ b/Source/Physics/PhysicsWorld.cpp @@ -176,6 +176,7 @@ bool PhysicsWorld::init() { _filters[i].groupIndex = i; _filters[i].categoryBits = 1 << i; _filters[i].maskBits = 0; + setShouldContact(i, i, true); } Node::scheduleFixedUpdate(); return true; diff --git a/Tools/dora-jsx/dora-x.ts b/Tools/dora-jsx/dora-x.ts index 573471450..9480fb187 100644 --- a/Tools/dora-jsx/dora-x.ts +++ b/Tools/dora-jsx/dora-x.ts @@ -309,7 +309,7 @@ let getDrawNode: (this: void, enode: React.Element) => dora.DrawNode.Type; case 'dot-shape': { const dot = child.props as JSX.Dot; node.drawDot( - dora.Vec2(dot.x, dot.y), + dora.Vec2(dot.x ?? 0, dot.y ?? 0), dot.radius, dora.Color(dot.color ?? 0xffffffff) );