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,145 +0,0 @@
1
- /**
2
- * ScrollView 类
3
- *
4
- * 该类表示一个滚动视图控件,用于管理滚动行为及其相关属性。
5
- *
6
- * 属性:
7
- * - scrollbar_track_button: string - 滚动条轨道按钮的 ID
8
- * - scrollbar_touch_button: string - 滚动条触摸按钮的 ID
9
- * - scroll_speed: number - 滚动速度
10
- * - gesture_control_enabled: boolean - 是否启用手势控制
11
- * - always_handle_scrolling: boolean - 是否始终处理滚动
12
- * - touch_mode: boolean - 是否启用触摸模式
13
- * - scrollbar_box: string - 滚动条滑块子元素的名称
14
- * - scrollbar_track: string - 滚动条轨道子元素的名称
15
- * - scroll_view_port: string - 视口子元素的名称
16
- * - scroll_content: string - 内容根父元素的名称
17
- * - scroll_box_and_track_panel: string - 包含滚动条滑块和轨道的子元素名称
18
- * - jump_to_bottom_on_update: boolean - 是否在更新时跳转到底部
19
- */
20
- export class ScrollView {
21
- constructor() {
22
- /*
23
- this.scrollbar_track_button = '';
24
- this.scrollbar_touch_button = '';
25
- this.scroll_speed = null;
26
- this.gesture_control_enabled = false;
27
- this.always_handle_scrolling = false;
28
- this.touch_mode = false;
29
- this.scrollbar_box = '';
30
- this.scrollbar_track = '';
31
- this.scroll_view_port = '';
32
- this.scroll_content = '';
33
- this.scroll_box_and_track_panel = '';
34
- this.jump_to_bottom_on_update = false;
35
- */
36
- }
37
- /**
38
- * 设置滚动条轨道按钮的 ID。
39
- * @param {string} buttonId - 滚动条轨道按钮的 ID
40
- * @returns {ScrollView} 返回当前实例以支持链式调用
41
- */
42
- setScrollbarTrackButton(buttonId) {
43
- this.scrollbar_track_button = buttonId;
44
- return this;
45
- }
46
- /**
47
- * 设置滚动条触摸按钮的 ID。
48
- * @param {string} buttonId - 滚动条触摸按钮的 ID
49
- * @returns {ScrollView} 返回当前实例以支持链式调用
50
- */
51
- setScrollbarTouchButton(buttonId) {
52
- this.scrollbar_touch_button = buttonId;
53
- return this;
54
- }
55
- /**
56
- * 设置滚动速度。
57
- * @param {number} speed - 滚动速度
58
- * @returns {ScrollView} 返回当前实例以支持链式调用
59
- */
60
- setScrollSpeed(speed) {
61
- this.scroll_speed = speed;
62
- return this;
63
- }
64
- /**
65
- * 设置是否启用手势控制。
66
- * @param {boolean} enabled - 是否启用手势控制(默认值:false)
67
- * @returns {ScrollView} 返回当前实例以支持链式调用
68
- */
69
- setGestureControlEnabled(enabled = false) {
70
- this.gesture_control_enabled = enabled;
71
- return this;
72
- }
73
- /**
74
- * 设置是否始终处理滚动。
75
- * @param {boolean} alwaysHandle - 是否始终处理滚动(默认值:false)
76
- * @returns {ScrollView} 返回当前实例以支持链式调用
77
- */
78
- setAlwaysHandleScrolling(alwaysHandle = false) {
79
- this.always_handle_scrolling = alwaysHandle;
80
- return this;
81
- }
82
- /**
83
- * 设置是否启用触摸模式。
84
- * @param {boolean} touchMode - 是否启用触摸模式(默认值:false)
85
- * @returns {ScrollView} 返回当前实例以支持链式调用
86
- */
87
- setTouchMode(touchMode = false) {
88
- this.touch_mode = touchMode;
89
- return this;
90
- }
91
- /**
92
- * 设置滚动条滑块子元素的名称。
93
- * @param {string} boxName - 滚动条滑块子元素的名称
94
- * @returns {ScrollView} 返回当前实例以支持链式调用
95
- */
96
- setScrollbarBox(boxName) {
97
- this.scrollbar_box = boxName;
98
- return this;
99
- }
100
- /**
101
- * 设置滚动条轨道子元素的名称。
102
- * @param {string} trackName - 滚动条轨道子元素的名称
103
- * @returns {ScrollView} 返回当前实例以支持链式调用
104
- */
105
- setScrollbarTrack(trackName) {
106
- this.scrollbar_track = trackName;
107
- return this;
108
- }
109
- /**
110
- * 设置视口子元素的名称。
111
- * @param {string} viewPortName - 视口子元素的名称
112
- * @returns {ScrollView} 返回当前实例以支持链式调用
113
- */
114
- setScrollViewPort(viewPortName) {
115
- this.scroll_view_port = viewPortName;
116
- return this;
117
- }
118
- /**
119
- * 设置内容根父元素的名称。
120
- * @param {string} contentName - 内容根父元素的名称
121
- * @returns {ScrollView} 返回当前实例以支持链式调用
122
- */
123
- setScrollContent(contentName) {
124
- this.scroll_content = contentName;
125
- return this;
126
- }
127
- /**
128
- * 设置包含滚动条滑块和轨道的子元素名称。
129
- * @param {string} panelName - 包含滚动条滑块和轨道的子元素名称
130
- * @returns {ScrollView} 返回当前实例以支持链式调用
131
- */
132
- setScrollBoxAndTrackPanel(panelName) {
133
- this.scroll_box_and_track_panel = panelName;
134
- return this;
135
- }
136
- /**
137
- * 设置是否在更新时跳转到底部。
138
- * @param {boolean} jump - 是否在更新时跳转到底部(默认值:false)
139
- * @returns {ScrollView} 返回当前实例以支持链式调用
140
- */
141
- setJumpToBottomOnUpdate(jump = false) {
142
- this.jump_to_bottom_on_update = jump;
143
- return this;
144
- }
145
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * Sound 类
3
- *
4
- * 该类表示一个声音控件,用于管理声音播放及其相关属性。
5
- *
6
- * 属性:
7
- * - sound_name: string - 声音名称(定义在 RP/sounds/sound_definitions.json 文件中)
8
- * - sound_volume: float - 声音音量(默认值:1.0)
9
- * - sound_pitch: float - 声音音调(默认值:1.0)
10
- * - sounds: Array of sound objects - 触发事件时播放的声音数组
11
- */
12
- export class Sound {
13
- /**
14
- * 设置声音名称。
15
- * @param {string} name - 声音名称(定义在 RP/sounds/sound_definitions.json 文件中)
16
- * @returns {Sound} 返回当前实例以支持链式调用
17
- */
18
- setSoundName(name: string): Sound;
19
- sound_name: string | undefined;
20
- /**
21
- * 设置声音音量。
22
- * @param {number} volume - 音量(范围:0.0 到 1.0,默认值:1.0)
23
- * @returns {Sound} 返回当前实例以支持链式调用
24
- */
25
- setSoundVolume(volume?: number): Sound;
26
- sound_volume: number | undefined;
27
- /**
28
- * 设置声音音调。
29
- * @param {number} pitch - 音调(默认值:1.0)
30
- * @returns {Sound} 返回当前实例以支持链式调用
31
- */
32
- setSoundPitch(pitch?: number): Sound;
33
- sound_pitch: number | undefined;
34
- /**
35
- * 设置触发事件时播放的声音数组。
36
- * @param {object[]} sounds - 声音对象数组
37
- * @returns {Sound} 返回当前实例以支持链式调用
38
- */
39
- setSounds(sounds: object[]): Sound;
40
- sounds: object[] | undefined;
41
- /**
42
- * 添加一个声音对象到声音数组。
43
- * @param {object} sound - 声音对象
44
- * @returns {Sound} 返回当前实例以支持链式调用
45
- */
46
- addSound(sound: object): Sound;
47
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * Sound 类
3
- *
4
- * 该类表示一个声音控件,用于管理声音播放及其相关属性。
5
- *
6
- * 属性:
7
- * - sound_name: string - 声音名称(定义在 RP/sounds/sound_definitions.json 文件中)
8
- * - sound_volume: float - 声音音量(默认值:1.0)
9
- * - sound_pitch: float - 声音音调(默认值:1.0)
10
- * - sounds: Array of sound objects - 触发事件时播放的声音数组
11
- */
12
- export class Sound {
13
- constructor() {
14
- /*
15
- this.sound_name = '';
16
- this.sound_volume = 1.0;
17
- this.sound_pitch = 1.0;
18
- this.sounds = [];
19
- */
20
- }
21
- /**
22
- * 设置声音名称。
23
- * @param {string} name - 声音名称(定义在 RP/sounds/sound_definitions.json 文件中)
24
- * @returns {Sound} 返回当前实例以支持链式调用
25
- */
26
- setSoundName(name) {
27
- this.sound_name = name;
28
- return this;
29
- }
30
- /**
31
- * 设置声音音量。
32
- * @param {number} volume - 音量(范围:0.0 到 1.0,默认值:1.0)
33
- * @returns {Sound} 返回当前实例以支持链式调用
34
- */
35
- setSoundVolume(volume = 1.0) {
36
- this.sound_volume = volume;
37
- return this;
38
- }
39
- /**
40
- * 设置声音音调。
41
- * @param {number} pitch - 音调(默认值:1.0)
42
- * @returns {Sound} 返回当前实例以支持链式调用
43
- */
44
- setSoundPitch(pitch = 1.0) {
45
- this.sound_pitch = pitch;
46
- return this;
47
- }
48
- /**
49
- * 设置触发事件时播放的声音数组。
50
- * @param {object[]} sounds - 声音对象数组
51
- * @returns {Sound} 返回当前实例以支持链式调用
52
- */
53
- setSounds(sounds) {
54
- this.sounds = sounds;
55
- return this;
56
- }
57
- /**
58
- * 添加一个声音对象到声音数组。
59
- * @param {object} sound - 声音对象
60
- * @returns {Sound} 返回当前实例以支持链式调用
61
- */
62
- addSound(sound) {
63
- this.sounds.push(sound);
64
- return this;
65
- }
66
- }
@@ -1,161 +0,0 @@
1
- /**
2
- * Sprite 类
3
- *
4
- * 该类表示一个 Sprite 控件,用于管理图像纹理及其相关属性。
5
- *
6
- * 属性:
7
- * - texture: string - 图像路径(从包根目录开始,例如:"textures/ui/White")
8
- * - allow_debug_missing_texture: boolean - 是否在纹理未找到时显示缺失纹理(默认值:true)
9
- * - uv: Vector [u, v] - 纹理映射的起始位置
10
- * - uv_size: Vector [width, height] - 纹理映射的大小
11
- * - texture_file_system: string - 纹理来源(默认值:InUserPackage)
12
- * - nineslice_size: int or Vector [x0, y0, x1, y1] - 9-slice 分割大小
13
- * - tiled: boolean or enum - 是否平铺纹理(可能值:true/false, x, y)
14
- * - tiled_scale: Vector [sX, sY] - 平铺纹理的缩放比例(默认值:false)
15
- * - clip_direction: enum - 裁剪方向的起始点(可能值:left, right, up, down, center)
16
- * - clip_ratio: float - 裁剪比例(范围:0.0 到 1.0)
17
- * - clip_pixelperfect: boolean - 是否尽可能保持像素精确裁剪
18
- * - keep_ratio: boolean - 是否在调整大小时保持比例(默认值:true)
19
- * - bilinear: boolean - 是否在调整大小时使用双线性函数(默认值:false)
20
- * - fill: boolean - 是否拉伸图像以适应大小(默认值:false)
21
- * - $fit_to_width: boolean - 是否适应宽度
22
- * - zip_folder: string - 压缩文件夹路径
23
- * - grayscale: boolean - 是否以黑白渲染图像(默认值:false)
24
- * - force_texture_reload: boolean - 是否在纹理路径更改时强制重新加载图像
25
- * - base_size: Vector [width, height] - 基础大小
26
- */
27
- export class Sprite {
28
- /**
29
- * 设置图像纹理路径。
30
- * @param {string} texture - 图像路径(例如:"textures/ui/White")
31
- * @returns {Sprite} 返回当前实例以支持链式调用
32
- */
33
- setTexture(texture: string): Sprite;
34
- texture: string | undefined;
35
- /**
36
- * 设置是否在纹理未找到时显示缺失纹理。
37
- * @param {boolean} allow - 是否显示缺失纹理(默认值:true)
38
- * @returns {Sprite} 返回当前实例以支持链式调用
39
- */
40
- setAllowDebugMissingTexture(allow?: boolean): Sprite;
41
- allow_debug_missing_texture: boolean | undefined;
42
- /**
43
- * 设置纹理映射的起始位置。
44
- * @param {number[]} uv - 起始位置,格式为 [u, v]
45
- * @returns {Sprite} 返回当前实例以支持链式调用
46
- */
47
- setUV(uv: number[]): Sprite;
48
- uv: number[] | undefined;
49
- /**
50
- * 设置纹理映射的大小。
51
- * @param {number[]} uvSize - 大小,格式为 [width, height]
52
- * @returns {Sprite} 返回当前实例以支持链式调用
53
- */
54
- setUVSize(uvSize: number[]): Sprite;
55
- uv_size: number[] | undefined;
56
- /**
57
- * 设置纹理来源。
58
- * @param {string} source - 纹理来源(可能值:InUserPackage, InAppPackage, RawPath, RawPersistent, InSettingsDir, InExternalDir, InServerPackage, InDataDir, InUserDir, InWorldDir, StoreCache, Usage is Unknown)
59
- * @returns {Sprite} 返回当前实例以支持链式调用
60
- */
61
- setTextureFileSystem(source?: string): Sprite;
62
- texture_file_system: string | undefined;
63
- /**
64
- * 设置 9-slice 分割大小。
65
- * @param {number|number[]} size - 9-slice 分割大小(可以是单个数字或 [x0, y0, x1, y1] 数组)
66
- * @returns {Sprite} 返回当前实例以支持链式调用
67
- */
68
- setNineSliceSize(size: number | number[]): Sprite;
69
- nineslice_size: number | number[] | undefined;
70
- /**
71
- * 设置是否平铺纹理。
72
- * @param {boolean|string} tiled - 是否平铺纹理(可能值:true/false, x, y)
73
- * @returns {Sprite} 返回当前实例以支持链式调用
74
- */
75
- setTiled(tiled: boolean | string): Sprite;
76
- tiled: string | boolean | undefined;
77
- /**
78
- * 设置平铺纹理的缩放比例。
79
- * @param {number[]} scale - 缩放比例,格式为 [sX, sY](默认值:[1, 1])
80
- * @returns {Sprite} 返回当前实例以支持链式调用
81
- */
82
- setTiledScale(scale?: number[]): Sprite;
83
- tiled_scale: number[] | undefined;
84
- /**
85
- * 设置裁剪方向的起始点。
86
- * @param {string} direction - 裁剪方向(可能值:left, right, up, down, center)
87
- * @returns {Sprite} 返回当前实例以支持链式调用
88
- */
89
- setClipDirection(direction: string): Sprite;
90
- clip_direction: string | undefined;
91
- /**
92
- * 设置裁剪比例。
93
- * @param {number} ratio - 裁剪比例(范围:0.0 到 1.0)
94
- * @returns {Sprite} 返回当前实例以支持链式调用
95
- */
96
- setClipRatio(ratio: number): Sprite;
97
- clip_ratio: number | undefined;
98
- /**
99
- * 设置是否尽可能保持像素精确裁剪。
100
- * @param {boolean} pixelPerfect - 是否保持像素精确裁剪
101
- * @returns {Sprite} 返回当前实例以支持链式调用
102
- */
103
- setClipPixelPerfect(pixelPerfect?: boolean): Sprite;
104
- clip_pixelperfect: boolean | undefined;
105
- /**
106
- * 设置是否在调整大小时保持比例。
107
- * @param {boolean} keep - 是否保持比例(默认值:true)
108
- * @returns {Sprite} 返回当前实例以支持链式调用
109
- */
110
- setKeepRatio(keep?: boolean): Sprite;
111
- keep_ratio: boolean | undefined;
112
- /**
113
- * 设置是否在调整大小时使用双线性函数。
114
- * @param {boolean} bilinear - 是否使用双线性函数(默认值:false)
115
- * @returns {Sprite} 返回当前实例以支持链式调用
116
- */
117
- setBilinear(bilinear?: boolean): Sprite;
118
- bilinear: boolean | undefined;
119
- /**
120
- * 设置是否拉伸图像以适应大小。
121
- * @param {boolean} fill - 是否拉伸图像(默认值:false)
122
- * @returns {Sprite} 返回当前实例以支持链式调用
123
- */
124
- setFill(fill?: boolean): Sprite;
125
- fill: boolean | undefined;
126
- /**
127
- * 设置是否适应宽度。
128
- * @param {boolean} fit - 是否适应宽度
129
- * @returns {Sprite} 返回当前实例以支持链式调用
130
- */
131
- setFitToWidth(fit?: boolean): Sprite;
132
- $fit_to_width: boolean | undefined;
133
- /**
134
- * 设置压缩文件夹路径。
135
- * @param {string} folder - 压缩文件夹路径
136
- * @returns {Sprite} 返回当前实例以支持链式调用
137
- */
138
- setZipFolder(folder: string): Sprite;
139
- zip_folder: string | undefined;
140
- /**
141
- * 设置是否以黑白渲染图像。
142
- * @param {boolean} grayscale - 是否以黑白渲染图像(默认值:false)
143
- * @returns {Sprite} 返回当前实例以支持链式调用
144
- */
145
- setGrayscale(grayscale?: boolean): Sprite;
146
- grayscale: boolean | undefined;
147
- /**
148
- * 设置是否在纹理路径更改时强制重新加载图像。
149
- * @param {boolean} force - 是否强制重新加载图像
150
- * @returns {Sprite} 返回当前实例以支持链式调用
151
- */
152
- setForceTextureReload(force?: boolean): Sprite;
153
- force_texture_reload: boolean | undefined;
154
- /**
155
- * 设置基础大小。
156
- * @param {number[]} size - 基础大小,格式为 [width, height]
157
- * @returns {Sprite} 返回当前实例以支持链式调用
158
- */
159
- setBaseSize(size: number[]): Sprite;
160
- base_size: number[] | undefined;
161
- }
@@ -1,222 +0,0 @@
1
- /**
2
- * Sprite 类
3
- *
4
- * 该类表示一个 Sprite 控件,用于管理图像纹理及其相关属性。
5
- *
6
- * 属性:
7
- * - texture: string - 图像路径(从包根目录开始,例如:"textures/ui/White")
8
- * - allow_debug_missing_texture: boolean - 是否在纹理未找到时显示缺失纹理(默认值:true)
9
- * - uv: Vector [u, v] - 纹理映射的起始位置
10
- * - uv_size: Vector [width, height] - 纹理映射的大小
11
- * - texture_file_system: string - 纹理来源(默认值:InUserPackage)
12
- * - nineslice_size: int or Vector [x0, y0, x1, y1] - 9-slice 分割大小
13
- * - tiled: boolean or enum - 是否平铺纹理(可能值:true/false, x, y)
14
- * - tiled_scale: Vector [sX, sY] - 平铺纹理的缩放比例(默认值:false)
15
- * - clip_direction: enum - 裁剪方向的起始点(可能值:left, right, up, down, center)
16
- * - clip_ratio: float - 裁剪比例(范围:0.0 到 1.0)
17
- * - clip_pixelperfect: boolean - 是否尽可能保持像素精确裁剪
18
- * - keep_ratio: boolean - 是否在调整大小时保持比例(默认值:true)
19
- * - bilinear: boolean - 是否在调整大小时使用双线性函数(默认值:false)
20
- * - fill: boolean - 是否拉伸图像以适应大小(默认值:false)
21
- * - $fit_to_width: boolean - 是否适应宽度
22
- * - zip_folder: string - 压缩文件夹路径
23
- * - grayscale: boolean - 是否以黑白渲染图像(默认值:false)
24
- * - force_texture_reload: boolean - 是否在纹理路径更改时强制重新加载图像
25
- * - base_size: Vector [width, height] - 基础大小
26
- */
27
- export class Sprite {
28
- constructor() {
29
- /*
30
- this.texture = '';
31
- this.allow_debug_missing_texture = true;
32
- this.uv = null;
33
- this.uv_size = null;
34
- this.texture_file_system = 'InUserPackage';
35
- this.nineslice_size = null;
36
- this.tiled = false;
37
- this.tiled_scale = [1, 1];
38
- this.clip_direction = null;
39
- this.clip_ratio = null;
40
- this.clip_pixelperfect = false;
41
- this.keep_ratio = true;
42
- this.bilinear = false;
43
- this.fill = false;
44
- this.$fit_to_width = false;
45
- this.zip_folder = '';
46
- this.grayscale = false;
47
- this.force_texture_reload = false;
48
- this.base_size = null;
49
- */
50
- }
51
- /**
52
- * 设置图像纹理路径。
53
- * @param {string} texture - 图像路径(例如:"textures/ui/White")
54
- * @returns {Sprite} 返回当前实例以支持链式调用
55
- */
56
- setTexture(texture) {
57
- this.texture = texture;
58
- return this;
59
- }
60
- /**
61
- * 设置是否在纹理未找到时显示缺失纹理。
62
- * @param {boolean} allow - 是否显示缺失纹理(默认值:true)
63
- * @returns {Sprite} 返回当前实例以支持链式调用
64
- */
65
- setAllowDebugMissingTexture(allow = true) {
66
- this.allow_debug_missing_texture = allow;
67
- return this;
68
- }
69
- /**
70
- * 设置纹理映射的起始位置。
71
- * @param {number[]} uv - 起始位置,格式为 [u, v]
72
- * @returns {Sprite} 返回当前实例以支持链式调用
73
- */
74
- setUV(uv) {
75
- this.uv = uv;
76
- return this;
77
- }
78
- /**
79
- * 设置纹理映射的大小。
80
- * @param {number[]} uvSize - 大小,格式为 [width, height]
81
- * @returns {Sprite} 返回当前实例以支持链式调用
82
- */
83
- setUVSize(uvSize) {
84
- this.uv_size = uvSize;
85
- return this;
86
- }
87
- /**
88
- * 设置纹理来源。
89
- * @param {string} source - 纹理来源(可能值:InUserPackage, InAppPackage, RawPath, RawPersistent, InSettingsDir, InExternalDir, InServerPackage, InDataDir, InUserDir, InWorldDir, StoreCache, Usage is Unknown)
90
- * @returns {Sprite} 返回当前实例以支持链式调用
91
- */
92
- setTextureFileSystem(source = 'InUserPackage') {
93
- this.texture_file_system = source;
94
- return this;
95
- }
96
- /**
97
- * 设置 9-slice 分割大小。
98
- * @param {number|number[]} size - 9-slice 分割大小(可以是单个数字或 [x0, y0, x1, y1] 数组)
99
- * @returns {Sprite} 返回当前实例以支持链式调用
100
- */
101
- setNineSliceSize(size) {
102
- this.nineslice_size = size;
103
- return this;
104
- }
105
- /**
106
- * 设置是否平铺纹理。
107
- * @param {boolean|string} tiled - 是否平铺纹理(可能值:true/false, x, y)
108
- * @returns {Sprite} 返回当前实例以支持链式调用
109
- */
110
- setTiled(tiled) {
111
- this.tiled = tiled;
112
- return this;
113
- }
114
- /**
115
- * 设置平铺纹理的缩放比例。
116
- * @param {number[]} scale - 缩放比例,格式为 [sX, sY](默认值:[1, 1])
117
- * @returns {Sprite} 返回当前实例以支持链式调用
118
- */
119
- setTiledScale(scale = [1, 1]) {
120
- this.tiled_scale = scale;
121
- return this;
122
- }
123
- /**
124
- * 设置裁剪方向的起始点。
125
- * @param {string} direction - 裁剪方向(可能值:left, right, up, down, center)
126
- * @returns {Sprite} 返回当前实例以支持链式调用
127
- */
128
- setClipDirection(direction) {
129
- this.clip_direction = direction;
130
- return this;
131
- }
132
- /**
133
- * 设置裁剪比例。
134
- * @param {number} ratio - 裁剪比例(范围:0.0 到 1.0)
135
- * @returns {Sprite} 返回当前实例以支持链式调用
136
- */
137
- setClipRatio(ratio) {
138
- this.clip_ratio = ratio;
139
- return this;
140
- }
141
- /**
142
- * 设置是否尽可能保持像素精确裁剪。
143
- * @param {boolean} pixelPerfect - 是否保持像素精确裁剪
144
- * @returns {Sprite} 返回当前实例以支持链式调用
145
- */
146
- setClipPixelPerfect(pixelPerfect = false) {
147
- this.clip_pixelperfect = pixelPerfect;
148
- return this;
149
- }
150
- /**
151
- * 设置是否在调整大小时保持比例。
152
- * @param {boolean} keep - 是否保持比例(默认值:true)
153
- * @returns {Sprite} 返回当前实例以支持链式调用
154
- */
155
- setKeepRatio(keep = true) {
156
- this.keep_ratio = keep;
157
- return this;
158
- }
159
- /**
160
- * 设置是否在调整大小时使用双线性函数。
161
- * @param {boolean} bilinear - 是否使用双线性函数(默认值:false)
162
- * @returns {Sprite} 返回当前实例以支持链式调用
163
- */
164
- setBilinear(bilinear = false) {
165
- this.bilinear = bilinear;
166
- return this;
167
- }
168
- /**
169
- * 设置是否拉伸图像以适应大小。
170
- * @param {boolean} fill - 是否拉伸图像(默认值:false)
171
- * @returns {Sprite} 返回当前实例以支持链式调用
172
- */
173
- setFill(fill = false) {
174
- this.fill = fill;
175
- return this;
176
- }
177
- /**
178
- * 设置是否适应宽度。
179
- * @param {boolean} fit - 是否适应宽度
180
- * @returns {Sprite} 返回当前实例以支持链式调用
181
- */
182
- setFitToWidth(fit = false) {
183
- this.$fit_to_width = fit;
184
- return this;
185
- }
186
- /**
187
- * 设置压缩文件夹路径。
188
- * @param {string} folder - 压缩文件夹路径
189
- * @returns {Sprite} 返回当前实例以支持链式调用
190
- */
191
- setZipFolder(folder) {
192
- this.zip_folder = folder;
193
- return this;
194
- }
195
- /**
196
- * 设置是否以黑白渲染图像。
197
- * @param {boolean} grayscale - 是否以黑白渲染图像(默认值:false)
198
- * @returns {Sprite} 返回当前实例以支持链式调用
199
- */
200
- setGrayscale(grayscale = false) {
201
- this.grayscale = grayscale;
202
- return this;
203
- }
204
- /**
205
- * 设置是否在纹理路径更改时强制重新加载图像。
206
- * @param {boolean} force - 是否强制重新加载图像
207
- * @returns {Sprite} 返回当前实例以支持链式调用
208
- */
209
- setForceTextureReload(force = false) {
210
- this.force_texture_reload = force;
211
- return this;
212
- }
213
- /**
214
- * 设置基础大小。
215
- * @param {number[]} size - 基础大小,格式为 [width, height]
216
- * @returns {Sprite} 返回当前实例以支持链式调用
217
- */
218
- setBaseSize(size) {
219
- this.base_size = size;
220
- return this;
221
- }
222
- }