sapdon 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +8 -1
  2. package/doc/api.md +2 -2
  3. package/package.json +18 -19
  4. package/{dist → prod}/cli/index.d.ts +1 -1
  5. package/prod/cli/index.js +1 -0
  6. package/{dist → prod}/cli/start.js +997 -967
  7. package/{dist → prod}/core/index.d.ts +2155 -1652
  8. package/prod/core/index.js +59017 -0
  9. package/prod/utils/index.d.ts +41 -0
  10. package/prod/utils/index.js +1 -0
  11. package/dist/cli/build.d.ts +0 -7
  12. package/dist/cli/build.js +0 -236
  13. package/dist/cli/dev-server/client.d.ts +0 -2
  14. package/dist/cli/dev-server/client.js +0 -21
  15. package/dist/cli/dev-server/config.d.ts +0 -3
  16. package/dist/cli/dev-server/config.js +0 -3
  17. package/dist/cli/dev-server/handles.d.ts +0 -4
  18. package/dist/cli/dev-server/handles.js +0 -5
  19. package/dist/cli/dev-server/hmr.d.ts +0 -1
  20. package/dist/cli/dev-server/hmr.js +0 -13
  21. package/dist/cli/dev-server/index.d.ts +0 -4
  22. package/dist/cli/dev-server/index.js +0 -17
  23. package/dist/cli/dev-server/server.d.ts +0 -14
  24. package/dist/cli/dev-server/server.js +0 -59
  25. package/dist/cli/dev-server/syncFiles.d.ts +0 -3
  26. package/dist/cli/dev-server/syncFiles.js +0 -45
  27. package/dist/cli/index.js +0 -90
  28. package/dist/cli/init.d.ts +0 -9
  29. package/dist/cli/init.js +0 -80
  30. package/dist/cli/load.d.ts +0 -3
  31. package/dist/cli/load.js +0 -94
  32. package/dist/cli/start.d.ts +0 -2
  33. package/dist/cli/tools/textureSet.d.ts +0 -13
  34. package/dist/cli/tools/textureSet.js +0 -103
  35. package/dist/cli/utils.d.ts +0 -13
  36. package/dist/cli/utils.js +0 -89
  37. package/dist/core/addon/biome.d.ts +0 -22
  38. package/dist/core/addon/biome.js +0 -27
  39. package/dist/core/addon/block/block.d.ts +0 -41
  40. package/dist/core/addon/block/block.js +0 -46
  41. package/dist/core/addon/controllers/animationController.d.ts +0 -43
  42. package/dist/core/addon/controllers/animationController.js +0 -73
  43. package/dist/core/addon/controllers/render_controllers.js +0 -162
  44. package/dist/core/addon/entity/clientEntity.d.ts +0 -107
  45. package/dist/core/addon/entity/clientEntity.js +0 -149
  46. package/dist/core/addon/entity/entity.d.ts +0 -42
  47. package/dist/core/addon/entity/entity.js +0 -50
  48. package/dist/core/addon/feature/oreFeature.d.ts +0 -19
  49. package/dist/core/addon/feature/oreFeature.js +0 -24
  50. package/dist/core/addon/featureRule.d.ts +0 -20
  51. package/dist/core/addon/featureRule.js +0 -25
  52. package/dist/core/addon/item/attachable.d.ts +0 -94
  53. package/dist/core/addon/item/attachable.js +0 -134
  54. package/dist/core/addon/item/item.d.ts +0 -19
  55. package/dist/core/addon/item/item.js +0 -26
  56. package/dist/core/addon/manifest.d.ts +0 -49
  57. package/dist/core/addon/manifest.js +0 -65
  58. package/dist/core/addon/menuCategory.d.ts +0 -6
  59. package/dist/core/addon/menuCategory.js +0 -7
  60. package/dist/core/addon/recipe/baseRecipe.d.ts +0 -12
  61. package/dist/core/addon/recipe/baseRecipe.js +0 -23
  62. package/dist/core/addon/recipe/data.d.ts +0 -66
  63. package/dist/core/addon/recipe/data.js +0 -74
  64. package/dist/core/addon/recipe/furnace.d.ts +0 -17
  65. package/dist/core/addon/recipe/furnace.js +0 -43
  66. package/dist/core/addon/recipe/shaped.d.ts +0 -26
  67. package/dist/core/addon/recipe/shaped.js +0 -53
  68. package/dist/core/addon/recipe/shapeless.d.ts +0 -18
  69. package/dist/core/addon/recipe/shapeless.js +0 -36
  70. package/dist/core/biome/biome.d.ts +0 -14
  71. package/dist/core/biome/biome.js +0 -23
  72. package/dist/core/biome/biomeComponent.d.ts +0 -46
  73. package/dist/core/biome/biomeComponent.js +0 -77
  74. package/dist/core/block/basicBlock.d.ts +0 -48
  75. package/dist/core/block/basicBlock.js +0 -105
  76. package/dist/core/block/block.d.ts +0 -32
  77. package/dist/core/block/block.js +0 -92
  78. package/dist/core/block/blockComponent.d.ts +0 -187
  79. package/dist/core/block/blockComponent.js +0 -500
  80. package/dist/core/block/cropBlock.d.ts +0 -4
  81. package/dist/core/block/cropBlock.js +0 -27
  82. package/dist/core/block/geometryBlock.d.ts +0 -12
  83. package/dist/core/block/geometryBlock.js +0 -16
  84. package/dist/core/block/oreBlock.d.ts +0 -9
  85. package/dist/core/block/oreBlock.js +0 -25
  86. package/dist/core/block/rotatableBlock.d.ts +0 -27
  87. package/dist/core/block/rotatableBlock.js +0 -107
  88. package/dist/core/block/tileBlock.d.ts +0 -17
  89. package/dist/core/block/tileBlock.js +0 -125
  90. package/dist/core/entity/basicEntity.d.ts +0 -111
  91. package/dist/core/entity/basicEntity.js +0 -170
  92. package/dist/core/entity/behavior/followMob.d.ts +0 -12
  93. package/dist/core/entity/behavior/followMob.js +0 -35
  94. package/dist/core/entity/behavior/followParent.d.ts +0 -7
  95. package/dist/core/entity/behavior/followParent.js +0 -15
  96. package/dist/core/entity/behavior/randomStroll.d.ts +0 -31
  97. package/dist/core/entity/behavior/randomStroll.js +0 -63
  98. package/dist/core/entity/behavior/tempt.d.ts +0 -73
  99. package/dist/core/entity/behavior/tempt.js +0 -134
  100. package/dist/core/entity/bundles/BasicMoveBundle.js +0 -8
  101. package/dist/core/entity/bundles/basicBundle.d.ts +0 -13
  102. package/dist/core/entity/bundles/basicBundle.js +0 -38
  103. package/dist/core/entity/clientEntity.d.ts +0 -20
  104. package/dist/core/entity/clientEntity.js +0 -37
  105. package/dist/core/entity/componets/entityComponet.d.ts +0 -202
  106. package/dist/core/entity/componets/entityComponet.js +0 -354
  107. package/dist/core/entity/data/nativeEntityData.d.ts +0 -9
  108. package/dist/core/entity/data/nativeEntityData.js +0 -38
  109. package/dist/core/entity/dummyEntity.js +0 -14
  110. package/dist/core/entity/entity.d.ts +0 -15
  111. package/dist/core/entity/entity.js +0 -11
  112. package/dist/core/entity/nativeEntity.d.ts +0 -8
  113. package/dist/core/entity/nativeEntity.js +0 -28
  114. package/dist/core/entity/navigation/walk.d.ts +0 -23
  115. package/dist/core/entity/navigation/walk.js +0 -56
  116. package/dist/core/entity/projectile.d.ts +0 -3
  117. package/dist/core/entity/projectile.js +0 -7
  118. package/dist/core/factory/biomeFactory.d.ts +0 -4
  119. package/dist/core/factory/biomeFactory.js +0 -13
  120. package/dist/core/factory/blockFactory.d.ts +0 -34
  121. package/dist/core/factory/blockFactory.js +0 -143
  122. package/dist/core/factory/entityFactory.d.ts +0 -17
  123. package/dist/core/factory/entityFactory.js +0 -75
  124. package/dist/core/factory/featureFactory.d.ts +0 -6
  125. package/dist/core/factory/featureFactory.js +0 -23
  126. package/dist/core/factory/itemExtra.d.ts +0 -8
  127. package/dist/core/factory/itemExtra.js +0 -9
  128. package/dist/core/factory/itemFactory.d.ts +0 -27
  129. package/dist/core/factory/itemFactory.js +0 -112
  130. package/dist/core/factory/recipeFactory.d.ts +0 -18
  131. package/dist/core/factory/recipeFactory.js +0 -39
  132. package/dist/core/factory/uiFactory.d.ts +0 -12
  133. package/dist/core/factory/uiFactory.js +0 -32
  134. package/dist/core/feature/oreFeature.d.ts +0 -10
  135. package/dist/core/feature/oreFeature.js +0 -11
  136. package/dist/core/feature-rule/condition/biomeFilter.d.ts +0 -26
  137. package/dist/core/feature-rule/condition/biomeFilter.js +0 -36
  138. package/dist/core/feature-rule/condition/featureConditions.d.ts +0 -27
  139. package/dist/core/feature-rule/condition/featureConditions.js +0 -37
  140. package/dist/core/feature-rule/distribution/coordinateDistribution.d.ts +0 -17
  141. package/dist/core/feature-rule/distribution/coordinateDistribution.js +0 -23
  142. package/dist/core/feature-rule/distribution/featureDistribution.d.ts +0 -31
  143. package/dist/core/feature-rule/distribution/featureDistribution.js +0 -41
  144. package/dist/core/feature-rule/featureRule.d.ts +0 -17
  145. package/dist/core/feature-rule/featureRule.js +0 -26
  146. package/dist/core/index.js +0 -1
  147. package/dist/core/item/armor.d.ts +0 -21
  148. package/dist/core/item/armor.js +0 -90
  149. package/dist/core/item/attachable.d.ts +0 -6
  150. package/dist/core/item/attachable.js +0 -26
  151. package/dist/core/item/food.d.ts +0 -24
  152. package/dist/core/item/food.js +0 -38
  153. package/dist/core/item/item.d.ts +0 -36
  154. package/dist/core/item/item.js +0 -69
  155. package/dist/core/item/itemComponents.d.ts +0 -113
  156. package/dist/core/item/itemComponents.js +0 -225
  157. package/dist/core/registry.d.ts +0 -12
  158. package/dist/core/registry.js +0 -17
  159. package/dist/core/texture.d.ts +0 -18
  160. package/dist/core/texture.js +0 -38
  161. package/dist/core/ui/buttonMapping.d.ts +0 -97
  162. package/dist/core/ui/buttonMapping.js +0 -132
  163. package/dist/core/ui/dataBindingObject.d.ts +0 -97
  164. package/dist/core/ui/dataBindingObject.js +0 -134
  165. package/dist/core/ui/elements/button.d.ts +0 -21
  166. package/dist/core/ui/elements/button.js +0 -101
  167. package/dist/core/ui/elements/collectionPanel.d.ts +0 -12
  168. package/dist/core/ui/elements/collectionPanel.js +0 -53
  169. package/dist/core/ui/elements/grid.d.ts +0 -8
  170. package/dist/core/ui/elements/grid.js +0 -33
  171. package/dist/core/ui/elements/image.d.ts +0 -13
  172. package/dist/core/ui/elements/image.js +0 -55
  173. package/dist/core/ui/elements/label.d.ts +0 -14
  174. package/dist/core/ui/elements/label.js +0 -61
  175. package/dist/core/ui/elements/panel.d.ts +0 -11
  176. package/dist/core/ui/elements/panel.js +0 -49
  177. package/dist/core/ui/elements/scrollingPanel.d.ts +0 -14
  178. package/dist/core/ui/elements/scrollingPanel.js +0 -59
  179. package/dist/core/ui/elements/stackPanel.d.ts +0 -14
  180. package/dist/core/ui/elements/stackPanel.js +0 -37
  181. package/dist/core/ui/elements/uiElement.d.ts +0 -53
  182. package/dist/core/ui/elements/uiElement.js +0 -129
  183. package/dist/core/ui/properties/control.d.ts +0 -214
  184. package/dist/core/ui/properties/control.js +0 -286
  185. package/dist/core/ui/properties/dataBinding.d.ts +0 -6
  186. package/dist/core/ui/properties/dataBinding.js +0 -16
  187. package/dist/core/ui/properties/factory.d.ts +0 -37
  188. package/dist/core/ui/properties/factory.js +0 -62
  189. package/dist/core/ui/properties/gridProp.d.ts +0 -65
  190. package/dist/core/ui/properties/gridProp.js +0 -90
  191. package/dist/core/ui/properties/input.d.ts +0 -97
  192. package/dist/core/ui/properties/input.js +0 -134
  193. package/dist/core/ui/properties/layout.d.ts +0 -105
  194. package/dist/core/ui/properties/layout.js +0 -145
  195. package/dist/core/ui/properties/scrollView.d.ts +0 -105
  196. package/dist/core/ui/properties/scrollView.js +0 -145
  197. package/dist/core/ui/properties/sound.d.ts +0 -47
  198. package/dist/core/ui/properties/sound.js +0 -66
  199. package/dist/core/ui/properties/sprite.d.ts +0 -161
  200. package/dist/core/ui/properties/sprite.js +0 -222
  201. package/dist/core/ui/properties/text.d.ts +0 -135
  202. package/dist/core/ui/properties/text.js +0 -187
  203. package/dist/core/ui/registry/uiSystemRegistry.d.ts +0 -8
  204. package/dist/core/ui/registry/uiSystemRegistry.js +0 -26
  205. package/dist/core/ui/systems/chest.d.ts +0 -5
  206. package/dist/core/ui/systems/chest.js +0 -21
  207. package/dist/core/ui/systems/containerUISystem.d.ts +0 -67
  208. package/dist/core/ui/systems/containerUISystem.js +0 -214
  209. package/dist/core/ui/systems/guidebook.d.ts +0 -9
  210. package/dist/core/ui/systems/guidebook.js +0 -206
  211. package/dist/core/ui/systems/serverForm.d.ts +0 -13
  212. package/dist/core/ui/systems/serverForm.js +0 -116
  213. package/dist/core/ui/systems/system.d.ts +0 -16
  214. package/dist/core/ui/systems/system.js +0 -37
  215. package/dist/oc/actor.js +0 -44
  216. package/dist/oc/core.js +0 -201
  217. package/dist/oc/input.js +0 -67
  218. package/dist/oc/optional.js +0 -31
  219. /package/{dist → prod}/oc/index.d.ts +0 -0
  220. /package/{dist → prod}/oc/index.js +0 -0
@@ -1,17 +0,0 @@
1
- export class GRegistry {
2
- static dataList = [];
3
- /**
4
- * 生成注册器
5
- * @param {string} name 文件名字
6
- * @param {string} root 根目录,如 "behavior"、"resource" 等
7
- * @param {string} path 数据的路径,如 "blocks/"、"items/"、"recipes/" 等
8
- * @param {string} data 实例 必须包含 toJson 方法
9
- */
10
- static register(name, root, path, data) {
11
- console.log("client:",data)
12
- GRegistry.dataList.push({ name, root, path, data });
13
- }
14
- static getDataList() {
15
- return [...GRegistry.dataList];
16
- }
17
- }
@@ -1,18 +0,0 @@
1
- export class ItemTextureManager {
2
- static item_texture_sets: Map<any, any>;
3
- static getItemTextureSet(): Map<any, any>;
4
- static getItemTextures(): any;
5
- static registerTextureData(texture_name: any, texture_data: any): void;
6
- static registerTexture(texture_name: any, texture_path: any): void;
7
- }
8
- export class terrainTextureManager {
9
- static terrain_texture_sets: Map<any, any>;
10
- static getTerrainTextureSet(): Map<any, any>;
11
- static getTerrainTextures(): any;
12
- static registerTextureData(texture_name: any, texture_data: any): void;
13
- static registerTexture(texture_name: any, texture_path: any): void;
14
- }
15
- export namespace FlipbookTextures {
16
- let flipbook_textures: never[];
17
- function registerFlipbookTexture(atlas_tile: any, texture: any, ticks_per_frame: any, options?: {}): void;
18
- }
@@ -1,38 +0,0 @@
1
- export class ItemTextureManager {
2
- static item_texture_sets = new Map();
3
- static getItemTextureSet() {
4
- return this.item_texture_sets;
5
- }
6
- static getItemTextures() {
7
- return Object.fromEntries(this.item_texture_sets);
8
- }
9
- static registerTextureData(texture_name, texture_data) {
10
- this.item_texture_sets.set(texture_name, texture_data);
11
- }
12
- static registerTexture(texture_name, texture_path) {
13
- this.registerTextureData(texture_name, { textures: texture_path });
14
- }
15
- }
16
- export class terrainTextureManager {
17
- static terrain_texture_sets = new Map();
18
- static getTerrainTextureSet() {
19
- return this.terrain_texture_sets;
20
- }
21
- static getTerrainTextures() {
22
- return Object.fromEntries(this.terrain_texture_sets);
23
- }
24
- static registerTextureData(texture_name, texture_data) {
25
- this.terrain_texture_sets.set(texture_name, texture_data);
26
- }
27
- static registerTexture(texture_name, texture_path) {
28
- this.registerTextureData(texture_name, { textures: texture_path });
29
- }
30
- }
31
- export const FlipbookTextures = {
32
- flipbook_textures: [],
33
- registerFlipbookTexture(atlas_tile, texture, ticks_per_frame, options = {}) {
34
- const flipbook_texture = { "atlas_tile": atlas_tile, "flipbook_texture": texture, ticks_per_frame };
35
- Object.assign(flipbook_texture, options);
36
- this.flipbook_textures.push(flipbook_texture);
37
- }
38
- };
@@ -1,97 +0,0 @@
1
- /**
2
- * ButtonMapping 类
3
- *
4
- * 该类表示按钮映射配置,用于定义输入事件的映射关系。
5
- *
6
- * 属性:
7
- * - ignored: boolean - 是否忽略映射(默认值:false)
8
- * - from_button_id: string - 触发事件的按钮 ID
9
- * - to_button_id: string - 事件触发时执行的按钮 ID
10
- * - mapping_type: enum - 映射类型(可能值:global, pressed, double_pressed, focused)
11
- * - scope: enum - 映射范围(可能值:view, controller)
12
- * - input_mode_condition: enum - 输入模式条件(可能值:not_gaze, not_gamepad, gamepad_and_not_gaze)
13
- * - ignore_input_scope: boolean - 是否忽略输入范围
14
- * - consume_event: boolean - 是否消耗事件
15
- * - handle_select: boolean - 是否处理选择事件
16
- * - handle_deselect: boolean - 是否处理取消选择事件
17
- * - button_up_right_of_first_refusal: boolean - 是否在首次拒绝后处理按钮释放事件
18
- */
19
- export class ButtonMapping {
20
- ignored: boolean;
21
- from_button_id: string;
22
- to_button_id: string;
23
- mapping_type: string | null;
24
- scope: string | null;
25
- input_mode_condition: string | null;
26
- ignore_input_scope: boolean;
27
- consume_event: boolean;
28
- handle_select: boolean;
29
- handle_deselect: boolean;
30
- button_up_right_of_first_refusal: boolean;
31
- /**
32
- * 设置是否忽略映射。
33
- * @param {boolean} ignored - 是否忽略映射(默认值:false)
34
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
35
- */
36
- setIgnored(ignored?: boolean): ButtonMapping;
37
- /**
38
- * 设置触发事件的按钮 ID。
39
- * @param {string} fromButtonId - 触发事件的按钮 ID
40
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
41
- */
42
- setFromButtonId(fromButtonId: string): ButtonMapping;
43
- /**
44
- * 设置事件触发时执行的按钮 ID。
45
- * @param {string} toButtonId - 事件触发时执行的按钮 ID
46
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
47
- */
48
- setToButtonId(toButtonId: string): ButtonMapping;
49
- /**
50
- * 设置映射类型。
51
- * @param {string} mappingType - 映射类型(可能值:global, pressed, double_pressed, focused)
52
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
53
- */
54
- setMappingType(mappingType: string): ButtonMapping;
55
- /**
56
- * 设置映射范围。
57
- * @param {string} scope - 映射范围(可能值:view, controller)
58
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
59
- */
60
- setScope(scope: string): ButtonMapping;
61
- /**
62
- * 设置输入模式条件。
63
- * @param {string} condition - 输入模式条件(可能值:not_gaze, not_gamepad, gamepad_and_not_gaze)
64
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
65
- */
66
- setInputModeCondition(condition: string): ButtonMapping;
67
- /**
68
- * 设置是否忽略输入范围。
69
- * @param {boolean} ignore - 是否忽略输入范围
70
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
71
- */
72
- setIgnoreInputScope(ignore?: boolean): ButtonMapping;
73
- /**
74
- * 设置是否消耗事件。
75
- * @param {boolean} consume - 是否消耗事件
76
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
77
- */
78
- setConsumeEvent(consume?: boolean): ButtonMapping;
79
- /**
80
- * 设置是否处理选择事件。
81
- * @param {boolean} handle - 是否处理选择事件
82
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
83
- */
84
- setHandleSelect(handle?: boolean): ButtonMapping;
85
- /**
86
- * 设置是否处理取消选择事件。
87
- * @param {boolean} handle - 是否处理取消选择事件
88
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
89
- */
90
- setHandleDeselect(handle?: boolean): ButtonMapping;
91
- /**
92
- * 设置是否在首次拒绝后处理按钮释放事件。
93
- * @param {boolean} handle - 是否处理按钮释放事件
94
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
95
- */
96
- setButtonUpRightOfFirstRefusal(handle?: boolean): ButtonMapping;
97
- }
@@ -1,132 +0,0 @@
1
- /**
2
- * ButtonMapping 类
3
- *
4
- * 该类表示按钮映射配置,用于定义输入事件的映射关系。
5
- *
6
- * 属性:
7
- * - ignored: boolean - 是否忽略映射(默认值:false)
8
- * - from_button_id: string - 触发事件的按钮 ID
9
- * - to_button_id: string - 事件触发时执行的按钮 ID
10
- * - mapping_type: enum - 映射类型(可能值:global, pressed, double_pressed, focused)
11
- * - scope: enum - 映射范围(可能值:view, controller)
12
- * - input_mode_condition: enum - 输入模式条件(可能值:not_gaze, not_gamepad, gamepad_and_not_gaze)
13
- * - ignore_input_scope: boolean - 是否忽略输入范围
14
- * - consume_event: boolean - 是否消耗事件
15
- * - handle_select: boolean - 是否处理选择事件
16
- * - handle_deselect: boolean - 是否处理取消选择事件
17
- * - button_up_right_of_first_refusal: boolean - 是否在首次拒绝后处理按钮释放事件
18
- */
19
- export class ButtonMapping {
20
- constructor() {
21
- this.ignored = false;
22
- this.from_button_id = '';
23
- this.to_button_id = '';
24
- this.mapping_type = null;
25
- this.scope = null;
26
- this.input_mode_condition = null;
27
- this.ignore_input_scope = false;
28
- this.consume_event = false;
29
- this.handle_select = false;
30
- this.handle_deselect = false;
31
- this.button_up_right_of_first_refusal = false;
32
- }
33
- /**
34
- * 设置是否忽略映射。
35
- * @param {boolean} ignored - 是否忽略映射(默认值:false)
36
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
37
- */
38
- setIgnored(ignored = false) {
39
- this.ignored = ignored;
40
- return this;
41
- }
42
- /**
43
- * 设置触发事件的按钮 ID。
44
- * @param {string} fromButtonId - 触发事件的按钮 ID
45
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
46
- */
47
- setFromButtonId(fromButtonId) {
48
- this.from_button_id = fromButtonId;
49
- return this;
50
- }
51
- /**
52
- * 设置事件触发时执行的按钮 ID。
53
- * @param {string} toButtonId - 事件触发时执行的按钮 ID
54
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
55
- */
56
- setToButtonId(toButtonId) {
57
- this.to_button_id = toButtonId;
58
- return this;
59
- }
60
- /**
61
- * 设置映射类型。
62
- * @param {string} mappingType - 映射类型(可能值:global, pressed, double_pressed, focused)
63
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
64
- */
65
- setMappingType(mappingType) {
66
- this.mapping_type = mappingType;
67
- return this;
68
- }
69
- /**
70
- * 设置映射范围。
71
- * @param {string} scope - 映射范围(可能值:view, controller)
72
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
73
- */
74
- setScope(scope) {
75
- this.scope = scope;
76
- return this;
77
- }
78
- /**
79
- * 设置输入模式条件。
80
- * @param {string} condition - 输入模式条件(可能值:not_gaze, not_gamepad, gamepad_and_not_gaze)
81
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
82
- */
83
- setInputModeCondition(condition) {
84
- this.input_mode_condition = condition;
85
- return this;
86
- }
87
- /**
88
- * 设置是否忽略输入范围。
89
- * @param {boolean} ignore - 是否忽略输入范围
90
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
91
- */
92
- setIgnoreInputScope(ignore = false) {
93
- this.ignore_input_scope = ignore;
94
- return this;
95
- }
96
- /**
97
- * 设置是否消耗事件。
98
- * @param {boolean} consume - 是否消耗事件
99
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
100
- */
101
- setConsumeEvent(consume = false) {
102
- this.consume_event = consume;
103
- return this;
104
- }
105
- /**
106
- * 设置是否处理选择事件。
107
- * @param {boolean} handle - 是否处理选择事件
108
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
109
- */
110
- setHandleSelect(handle = false) {
111
- this.handle_select = handle;
112
- return this;
113
- }
114
- /**
115
- * 设置是否处理取消选择事件。
116
- * @param {boolean} handle - 是否处理取消选择事件
117
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
118
- */
119
- setHandleDeselect(handle = false) {
120
- this.handle_deselect = handle;
121
- return this;
122
- }
123
- /**
124
- * 设置是否在首次拒绝后处理按钮释放事件。
125
- * @param {boolean} handle - 是否处理按钮释放事件
126
- * @returns {ButtonMapping} 返回当前实例以支持链式调用
127
- */
128
- setButtonUpRightOfFirstRefusal(handle = false) {
129
- this.button_up_right_of_first_refusal = handle;
130
- return this;
131
- }
132
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * DataBinding 类
3
- *
4
- * 该类表示数据绑定配置,用于将硬编码值或变量绑定到元素属性。
5
- *
6
- * 属性:
7
- * - ignored: boolean - 是否忽略绑定(默认值:false)
8
- * - binding_type: enum - 绑定类型(可能值:global, view, collection, collection_details, none)
9
- * - binding_name: string - 数据绑定名称或条件的值
10
- * - binding_name_override: string - 应用 binding_name 值的 UI 元素属性名称
11
- * - binding_collection_name: string - 要使用的集合名称
12
- * - binding_collection_prefix: string - 集合前缀
13
- * - binding_condition: enum - 数据绑定的条件(可能值:always, always_when_visible, visible, once, none, visibility_changed)
14
- * - source_control_name: string - 要观察其属性值的 UI 元素名称
15
- * - source_property_name: string - 存储 source_control_name 引用的 UI 元素的属性值
16
- * - target_property_name: string - 应用 source_property_name 值的 UI 元素属性
17
- * - resolve_sibling_scope: boolean - 是否允许选择同级元素而非子元素(默认值:false)
18
- */
19
- export class DataBindingObject {
20
- /**
21
- * 设置是否忽略绑定。
22
- * @param {boolean} ignored - 是否忽略绑定(默认值:false)
23
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
24
- */
25
- setIgnored(ignored?: boolean): DataBindingObject;
26
- ignored: boolean | undefined;
27
- /**
28
- * 设置绑定类型。
29
- * @param {string} type - 绑定类型(可能值:global, view, collection, collection_details, none)
30
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
31
- */
32
- setBindingType(type: string): DataBindingObject;
33
- binding_type: string | undefined;
34
- /**
35
- * 设置数据绑定名称或条件的值。
36
- * @param {string} name - 数据绑定名称或条件的值
37
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
38
- */
39
- setBindingName(name: string): DataBindingObject;
40
- binding_name: string | undefined;
41
- /**
42
- * 设置应用 binding_name 值的 UI 元素属性名称。
43
- * @param {string} nameOverride - 应用 binding_name 值的 UI 元素属性名称
44
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
45
- */
46
- setBindingNameOverride(nameOverride: string): DataBindingObject;
47
- binding_name_override: string | undefined;
48
- /**
49
- * 设置要使用的集合名称。
50
- * @param {string} collectionName - 集合名称
51
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
52
- */
53
- setBindingCollectionName(collectionName: string): DataBindingObject;
54
- binding_collection_name: string | undefined;
55
- /**
56
- * 设置集合前缀。
57
- * @param {string} prefix - 集合前缀
58
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
59
- */
60
- setBindingCollectionPrefix(prefix: string): DataBindingObject;
61
- binding_collection_prefix: string | undefined;
62
- /**
63
- * 设置数据绑定的条件。
64
- * @param {string} condition - 数据绑定的条件(可能值:always, always_when_visible, visible, once, none, visibility_changed)
65
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
66
- */
67
- setBindingCondition(condition: string): DataBindingObject;
68
- binding_condition: string | undefined;
69
- /**
70
- * 设置要观察其属性值的 UI 元素名称。
71
- * @param {string} controlName - UI 元素名称
72
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
73
- */
74
- setSourceControlName(controlName: string): DataBindingObject;
75
- source_control_name: string | undefined;
76
- /**
77
- * 设置存储 source_control_name 引用的 UI 元素的属性值。
78
- * @param {string} propertyName - 属性名称
79
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
80
- */
81
- setSourcePropertyName(propertyName: string): DataBindingObject;
82
- source_property_name: string | undefined;
83
- /**
84
- * 设置应用 source_property_name 值的 UI 元素属性。
85
- * @param {string} propertyName - 属性名称
86
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
87
- */
88
- setTargetPropertyName(propertyName: string): DataBindingObject;
89
- target_property_name: string | undefined;
90
- /**
91
- * 设置是否允许选择同级元素而非子元素。
92
- * @param {boolean} resolve - 是否允许选择同级元素(默认值:false)
93
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
94
- */
95
- setResolveSiblingScope(resolve?: boolean): DataBindingObject;
96
- resolve_sibling_scope: boolean | undefined;
97
- }
@@ -1,134 +0,0 @@
1
- /**
2
- * DataBinding 类
3
- *
4
- * 该类表示数据绑定配置,用于将硬编码值或变量绑定到元素属性。
5
- *
6
- * 属性:
7
- * - ignored: boolean - 是否忽略绑定(默认值:false)
8
- * - binding_type: enum - 绑定类型(可能值:global, view, collection, collection_details, none)
9
- * - binding_name: string - 数据绑定名称或条件的值
10
- * - binding_name_override: string - 应用 binding_name 值的 UI 元素属性名称
11
- * - binding_collection_name: string - 要使用的集合名称
12
- * - binding_collection_prefix: string - 集合前缀
13
- * - binding_condition: enum - 数据绑定的条件(可能值:always, always_when_visible, visible, once, none, visibility_changed)
14
- * - source_control_name: string - 要观察其属性值的 UI 元素名称
15
- * - source_property_name: string - 存储 source_control_name 引用的 UI 元素的属性值
16
- * - target_property_name: string - 应用 source_property_name 值的 UI 元素属性
17
- * - resolve_sibling_scope: boolean - 是否允许选择同级元素而非子元素(默认值:false)
18
- */
19
- export class DataBindingObject {
20
- constructor() {
21
- /*
22
- this.ignored = false;
23
- this.binding_type = null;
24
- this.binding_name = '';
25
- this.binding_name_override = '';
26
- this.binding_collection_name = '';
27
- this.binding_collection_prefix = '';
28
- this.binding_condition = null;
29
- this.source_control_name = '';
30
- this.source_property_name = '';
31
- this.target_property_name = '';
32
- this.resolve_sibling_scope = false;
33
- */
34
- }
35
- /**
36
- * 设置是否忽略绑定。
37
- * @param {boolean} ignored - 是否忽略绑定(默认值:false)
38
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
39
- */
40
- setIgnored(ignored = false) {
41
- this.ignored = ignored;
42
- return this;
43
- }
44
- /**
45
- * 设置绑定类型。
46
- * @param {string} type - 绑定类型(可能值:global, view, collection, collection_details, none)
47
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
48
- */
49
- setBindingType(type) {
50
- this.binding_type = type;
51
- return this;
52
- }
53
- /**
54
- * 设置数据绑定名称或条件的值。
55
- * @param {string} name - 数据绑定名称或条件的值
56
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
57
- */
58
- setBindingName(name) {
59
- this.binding_name = name;
60
- return this;
61
- }
62
- /**
63
- * 设置应用 binding_name 值的 UI 元素属性名称。
64
- * @param {string} nameOverride - 应用 binding_name 值的 UI 元素属性名称
65
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
66
- */
67
- setBindingNameOverride(nameOverride) {
68
- this.binding_name_override = nameOverride;
69
- return this;
70
- }
71
- /**
72
- * 设置要使用的集合名称。
73
- * @param {string} collectionName - 集合名称
74
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
75
- */
76
- setBindingCollectionName(collectionName) {
77
- this.binding_collection_name = collectionName;
78
- return this;
79
- }
80
- /**
81
- * 设置集合前缀。
82
- * @param {string} prefix - 集合前缀
83
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
84
- */
85
- setBindingCollectionPrefix(prefix) {
86
- this.binding_collection_prefix = prefix;
87
- return this;
88
- }
89
- /**
90
- * 设置数据绑定的条件。
91
- * @param {string} condition - 数据绑定的条件(可能值:always, always_when_visible, visible, once, none, visibility_changed)
92
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
93
- */
94
- setBindingCondition(condition) {
95
- this.binding_condition = condition;
96
- return this;
97
- }
98
- /**
99
- * 设置要观察其属性值的 UI 元素名称。
100
- * @param {string} controlName - UI 元素名称
101
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
102
- */
103
- setSourceControlName(controlName) {
104
- this.source_control_name = controlName;
105
- return this;
106
- }
107
- /**
108
- * 设置存储 source_control_name 引用的 UI 元素的属性值。
109
- * @param {string} propertyName - 属性名称
110
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
111
- */
112
- setSourcePropertyName(propertyName) {
113
- this.source_property_name = propertyName;
114
- return this;
115
- }
116
- /**
117
- * 设置应用 source_property_name 值的 UI 元素属性。
118
- * @param {string} propertyName - 属性名称
119
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
120
- */
121
- setTargetPropertyName(propertyName) {
122
- this.target_property_name = propertyName;
123
- return this;
124
- }
125
- /**
126
- * 设置是否允许选择同级元素而非子元素。
127
- * @param {boolean} resolve - 是否允许选择同级元素(默认值:false)
128
- * @returns {DataBindingObject} 返回当前实例以支持链式调用
129
- */
130
- setResolveSiblingScope(resolve = false) {
131
- this.resolve_sibling_scope = resolve;
132
- return this;
133
- }
134
- }
@@ -1,21 +0,0 @@
1
- export class Button extends UIElement {
2
- constructor(id: any, template: any);
3
- input: Input;
4
- sound: Sound;
5
- layout: Layout;
6
- dataBinding: DataBinding;
7
- factory: Factory;
8
- setDefaultControl(default_control: any): this;
9
- setHoverControl(hover_control: any): this;
10
- setPressedControl(pressed_control: any): this;
11
- setLockedControl(locked_control: any): this;
12
- setInput(input: any): this;
13
- setSound(sound: any): this;
14
- setLayout(layout: any): this;
15
- }
16
- import { UIElement } from "./uiElement.js";
17
- import { Input } from "../properties/input.js";
18
- import { Sound } from "../properties/sound.js";
19
- import { Layout } from "../properties/layout.js";
20
- import { DataBinding } from "../properties/dataBinding.js";
21
- import { Factory } from "../properties/factory.js";
@@ -1,101 +0,0 @@
1
- /**
2
- * Button ​
3
- Property Name Type Default Value Description
4
- default_control string Name of the child control that will be displayed only in the default state
5
- hover_control string Name of the child control that will be displayed only in the hover state
6
- pressed_control string Name of the child control that will be displayed only in the pressed state
7
- locked_control string Name of the child control that will be displayed only in the locked state
8
- */
9
- import { Control } from "../properties/control.js";
10
- import { DataBinding } from "../properties/dataBinding.js";
11
- import { Factory } from "../properties/factory.js";
12
- import { Input } from "../properties/input.js";
13
- import { Layout } from "../properties/layout.js";
14
- import { Sound } from "../properties/sound.js";
15
- import { UIElement } from "./uiElement.js";
16
- export class Button extends UIElement {
17
- constructor(id, template) {
18
- super(id, "button", template);
19
- this.input = new Input();
20
- this.sound = new Sound();
21
- this.control = new Control();
22
- this.layout = new Layout();
23
- this.dataBinding = new DataBinding();
24
- this.factory = new Factory();
25
- }
26
- setDefaultControl(default_control) {
27
- this.addProp("default_control", default_control);
28
- return this;
29
- }
30
- setHoverControl(hover_control) {
31
- this.addProp("hover_control", hover_control);
32
- return this;
33
- }
34
- setPressedControl(pressed_control) {
35
- this.addProp("pressed_control", pressed_control);
36
- return this;
37
- }
38
- setLockedControl(locked_control) {
39
- this.addProp("locked_control", locked_control);
40
- return this;
41
- }
42
- setInput(input) {
43
- if (!(input instanceof Input))
44
- new Error("需求Input类");
45
- this.input = input;
46
- return this;
47
- }
48
- setSound(sound) {
49
- if (!(sound instanceof Sound))
50
- new Error("需求Sound类");
51
- this.sound = sound;
52
- return this;
53
- }
54
- setLayout(layout) {
55
- if (!(layout instanceof Layout))
56
- new Error("参数需要Layout类");
57
- this.layout = layout;
58
- return this;
59
- }
60
- serialize() {
61
- //序列化
62
- // 复制Layout的属性
63
- for (const key in this.layout) {
64
- if (this.layout.hasOwnProperty(key)) {
65
- this.properties.set(key, this.layout[key]);
66
- }
67
- }
68
- // 复制input的属性
69
- for (const key in this.input) {
70
- if (this.input.hasOwnProperty(key)) {
71
- this.properties.set(key, this.input[key]);
72
- }
73
- }
74
- // 复制sound的属性
75
- for (const key in this.sound) {
76
- if (this.sound.hasOwnProperty(key)) {
77
- this.properties.set(key, this.sound[key]);
78
- }
79
- }
80
- // 复制DataBinding的属性
81
- for (const key in this.dataBinding) {
82
- if (this.dataBinding.hasOwnProperty(key)) {
83
- this.properties.set(key, this.dataBinding[key]);
84
- }
85
- }
86
- // 复制Factory的属性
87
- for (const key in this.factory) {
88
- if (this.factory.hasOwnProperty(key)) {
89
- this.properties.set(key, this.factory[key]);
90
- }
91
- }
92
- // 复制Control的属性
93
- for (const key in this.control) {
94
- if (this.control.hasOwnProperty(key)) {
95
- this.properties.set(key, this.control[key]);
96
- }
97
- }
98
- // 调用父类的serialize方法
99
- return super.serialize();
100
- }
101
- }
@@ -1,12 +0,0 @@
1
- export class CollectionPanel extends UIElement {
2
- constructor(id: any, template: any);
3
- layout: Layout;
4
- dataBinding: DataBinding;
5
- factory: Factory;
6
- setCollectionName(collection_name: any): this;
7
- setLayout(layout: any): this;
8
- }
9
- import { UIElement } from "./uiElement.js";
10
- import { Layout } from "../properties/layout.js";
11
- import { DataBinding } from "../properties/dataBinding.js";
12
- import { Factory } from "../properties/factory.js";