sapdon 3.0.3 → 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.
- package/README.md +11 -3
- package/doc/api.md +2 -2
- package/doc/oc/index.md +0 -0
- package/doc/sapdon-ts.md +7 -5
- package/package.json +18 -19
- package/{dist/cli/dev-server/server.d.ts → prod/cli/index.d.ts} +9 -3
- package/prod/cli/index.js +1 -0
- package/prod/cli/start.js +1428 -0
- package/{dist → prod}/core/index.d.ts +2325 -1643
- package/prod/core/index.js +59017 -0
- package/{dist → prod}/oc/index.d.ts +3 -3
- package/prod/oc/index.js +1 -0
- package/prod/utils/index.d.ts +41 -0
- package/prod/utils/index.js +1 -0
- package/dist/cli/build.d.ts +0 -7
- package/dist/cli/build.js +0 -234
- package/dist/cli/dev-server/client.d.ts +0 -2
- package/dist/cli/dev-server/client.js +0 -21
- package/dist/cli/dev-server/config.d.ts +0 -3
- package/dist/cli/dev-server/config.js +0 -3
- package/dist/cli/dev-server/handles.d.ts +0 -4
- package/dist/cli/dev-server/handles.js +0 -5
- package/dist/cli/dev-server/hmr.d.ts +0 -1
- package/dist/cli/dev-server/hmr.js +0 -13
- package/dist/cli/dev-server/index.d.ts +0 -4
- package/dist/cli/dev-server/index.js +0 -17
- package/dist/cli/dev-server/server.js +0 -59
- package/dist/cli/dev-server/syncFiles.d.ts +0 -3
- package/dist/cli/dev-server/syncFiles.js +0 -37
- package/dist/cli/index.d.ts +0 -23
- package/dist/cli/index.js +0 -1
- package/dist/cli/init.d.ts +0 -9
- package/dist/cli/init.js +0 -80
- package/dist/cli/load.d.ts +0 -3
- package/dist/cli/load.js +0 -94
- package/dist/cli/start.d.ts +0 -2
- package/dist/cli/start.js +0 -2
- package/dist/cli/tools/textureSet.d.ts +0 -13
- package/dist/cli/tools/textureSet.js +0 -103
- package/dist/cli/utils.d.ts +0 -13
- package/dist/cli/utils.js +0 -89
- package/dist/core/addon/biome.d.ts +0 -22
- package/dist/core/addon/biome.js +0 -27
- package/dist/core/addon/block/block.d.ts +0 -41
- package/dist/core/addon/block/block.js +0 -46
- package/dist/core/addon/controllers/animationController.d.ts +0 -43
- package/dist/core/addon/controllers/animationController.js +0 -73
- package/dist/core/addon/entity/clientEntity.d.ts +0 -107
- package/dist/core/addon/entity/clientEntity.js +0 -149
- package/dist/core/addon/entity/entity.d.ts +0 -42
- package/dist/core/addon/entity/entity.js +0 -50
- package/dist/core/addon/feature/oreFeature.d.ts +0 -19
- package/dist/core/addon/feature/oreFeature.js +0 -24
- package/dist/core/addon/featureRule.d.ts +0 -20
- package/dist/core/addon/featureRule.js +0 -25
- package/dist/core/addon/item/attachable.d.ts +0 -94
- package/dist/core/addon/item/attachable.js +0 -134
- package/dist/core/addon/item/item.d.ts +0 -19
- package/dist/core/addon/item/item.js +0 -26
- package/dist/core/addon/manifest.d.ts +0 -49
- package/dist/core/addon/manifest.js +0 -65
- package/dist/core/addon/menuCategory.d.ts +0 -6
- package/dist/core/addon/menuCategory.js +0 -7
- package/dist/core/addon/recipe/baseRecipe.d.ts +0 -12
- package/dist/core/addon/recipe/baseRecipe.js +0 -23
- package/dist/core/addon/recipe/data.d.ts +0 -66
- package/dist/core/addon/recipe/data.js +0 -74
- package/dist/core/addon/recipe/furnace.d.ts +0 -17
- package/dist/core/addon/recipe/furnace.js +0 -43
- package/dist/core/addon/recipe/shaped.d.ts +0 -26
- package/dist/core/addon/recipe/shaped.js +0 -53
- package/dist/core/addon/recipe/shapeless.d.ts +0 -18
- package/dist/core/addon/recipe/shapeless.js +0 -36
- package/dist/core/biome/biome.d.ts +0 -14
- package/dist/core/biome/biome.js +0 -23
- package/dist/core/biome/biomeComponent.d.ts +0 -46
- package/dist/core/biome/biomeComponent.js +0 -77
- package/dist/core/block/basicBlock.d.ts +0 -48
- package/dist/core/block/basicBlock.js +0 -105
- package/dist/core/block/block.d.ts +0 -32
- package/dist/core/block/block.js +0 -92
- package/dist/core/block/blockComponent.d.ts +0 -187
- package/dist/core/block/blockComponent.js +0 -500
- package/dist/core/block/cropBlock.d.ts +0 -4
- package/dist/core/block/cropBlock.js +0 -27
- package/dist/core/block/geometryBlock.d.ts +0 -12
- package/dist/core/block/geometryBlock.js +0 -16
- package/dist/core/block/oreBlock.d.ts +0 -9
- package/dist/core/block/oreBlock.js +0 -25
- package/dist/core/block/rotatableBlock.d.ts +0 -27
- package/dist/core/block/rotatableBlock.js +0 -107
- package/dist/core/block/tileBlock.d.ts +0 -17
- package/dist/core/block/tileBlock.js +0 -125
- package/dist/core/entity/basicEntity.d.ts +0 -111
- package/dist/core/entity/basicEntity.js +0 -170
- package/dist/core/entity/behavior/followMob.d.ts +0 -12
- package/dist/core/entity/behavior/followMob.js +0 -35
- package/dist/core/entity/behavior/followParent.d.ts +0 -7
- package/dist/core/entity/behavior/followParent.js +0 -15
- package/dist/core/entity/behavior/randomStroll.d.ts +0 -31
- package/dist/core/entity/behavior/randomStroll.js +0 -63
- package/dist/core/entity/behavior/tempt.d.ts +0 -73
- package/dist/core/entity/behavior/tempt.js +0 -134
- package/dist/core/entity/bundles/basicBundle.d.ts +0 -13
- package/dist/core/entity/bundles/basicBundle.js +0 -45
- package/dist/core/entity/clientEntity.d.ts +0 -20
- package/dist/core/entity/clientEntity.js +0 -37
- package/dist/core/entity/componets/entityComponet.d.ts +0 -202
- package/dist/core/entity/componets/entityComponet.js +0 -347
- package/dist/core/entity/data/nativeEntityData.d.ts +0 -9
- package/dist/core/entity/data/nativeEntityData.js +0 -38
- package/dist/core/entity/entity.d.ts +0 -15
- package/dist/core/entity/entity.js +0 -18
- package/dist/core/entity/nativeEntity.d.ts +0 -8
- package/dist/core/entity/nativeEntity.js +0 -28
- package/dist/core/entity/navigation/walk.d.ts +0 -23
- package/dist/core/entity/navigation/walk.js +0 -56
- package/dist/core/entity/projectile.d.ts +0 -3
- package/dist/core/entity/projectile.js +0 -7
- package/dist/core/factory/biomeFactory.d.ts +0 -4
- package/dist/core/factory/biomeFactory.js +0 -13
- package/dist/core/factory/blockFactory.d.ts +0 -34
- package/dist/core/factory/blockFactory.js +0 -143
- package/dist/core/factory/entityFactory.d.ts +0 -17
- package/dist/core/factory/entityFactory.js +0 -75
- package/dist/core/factory/featureFactory.d.ts +0 -6
- package/dist/core/factory/featureFactory.js +0 -23
- package/dist/core/factory/itemExtra.d.ts +0 -8
- package/dist/core/factory/itemExtra.js +0 -9
- package/dist/core/factory/itemFactory.d.ts +0 -27
- package/dist/core/factory/itemFactory.js +0 -112
- package/dist/core/factory/recipeFactory.d.ts +0 -18
- package/dist/core/factory/recipeFactory.js +0 -39
- package/dist/core/factory/uiFactory.d.ts +0 -12
- package/dist/core/factory/uiFactory.js +0 -32
- package/dist/core/feature/oreFeature.d.ts +0 -10
- package/dist/core/feature/oreFeature.js +0 -11
- package/dist/core/feature-rule/condition/biomeFilter.d.ts +0 -26
- package/dist/core/feature-rule/condition/biomeFilter.js +0 -36
- package/dist/core/feature-rule/condition/featureConditions.d.ts +0 -27
- package/dist/core/feature-rule/condition/featureConditions.js +0 -37
- package/dist/core/feature-rule/distribution/coordinateDistribution.d.ts +0 -17
- package/dist/core/feature-rule/distribution/coordinateDistribution.js +0 -23
- package/dist/core/feature-rule/distribution/featureDistribution.d.ts +0 -31
- package/dist/core/feature-rule/distribution/featureDistribution.js +0 -41
- package/dist/core/feature-rule/featureRule.d.ts +0 -17
- package/dist/core/feature-rule/featureRule.js +0 -26
- package/dist/core/index.js +0 -1
- package/dist/core/item/armor.d.ts +0 -21
- package/dist/core/item/armor.js +0 -90
- package/dist/core/item/attachable.d.ts +0 -6
- package/dist/core/item/attachable.js +0 -26
- package/dist/core/item/food.d.ts +0 -24
- package/dist/core/item/food.js +0 -38
- package/dist/core/item/item.d.ts +0 -36
- package/dist/core/item/item.js +0 -69
- package/dist/core/item/itemComponents.d.ts +0 -113
- package/dist/core/item/itemComponents.js +0 -225
- package/dist/core/registry.d.ts +0 -12
- package/dist/core/registry.js +0 -16
- package/dist/core/texture.d.ts +0 -18
- package/dist/core/texture.js +0 -38
- package/dist/core/ui/buttonMapping.d.ts +0 -97
- package/dist/core/ui/buttonMapping.js +0 -132
- package/dist/core/ui/dataBindingObject.d.ts +0 -97
- package/dist/core/ui/dataBindingObject.js +0 -134
- package/dist/core/ui/elements/button.d.ts +0 -21
- package/dist/core/ui/elements/button.js +0 -101
- package/dist/core/ui/elements/collectionPanel.d.ts +0 -12
- package/dist/core/ui/elements/collectionPanel.js +0 -53
- package/dist/core/ui/elements/grid.d.ts +0 -8
- package/dist/core/ui/elements/grid.js +0 -33
- package/dist/core/ui/elements/image.d.ts +0 -13
- package/dist/core/ui/elements/image.js +0 -55
- package/dist/core/ui/elements/label.d.ts +0 -14
- package/dist/core/ui/elements/label.js +0 -61
- package/dist/core/ui/elements/panel.d.ts +0 -11
- package/dist/core/ui/elements/panel.js +0 -49
- package/dist/core/ui/elements/scrollingPanel.d.ts +0 -14
- package/dist/core/ui/elements/scrollingPanel.js +0 -59
- package/dist/core/ui/elements/stackPanel.d.ts +0 -14
- package/dist/core/ui/elements/stackPanel.js +0 -37
- package/dist/core/ui/elements/uiElement.d.ts +0 -53
- package/dist/core/ui/elements/uiElement.js +0 -129
- package/dist/core/ui/properties/control.d.ts +0 -214
- package/dist/core/ui/properties/control.js +0 -286
- package/dist/core/ui/properties/dataBinding.d.ts +0 -6
- package/dist/core/ui/properties/dataBinding.js +0 -16
- package/dist/core/ui/properties/factory.d.ts +0 -37
- package/dist/core/ui/properties/factory.js +0 -62
- package/dist/core/ui/properties/gridProp.d.ts +0 -65
- package/dist/core/ui/properties/gridProp.js +0 -90
- package/dist/core/ui/properties/input.d.ts +0 -97
- package/dist/core/ui/properties/input.js +0 -134
- package/dist/core/ui/properties/layout.d.ts +0 -105
- package/dist/core/ui/properties/layout.js +0 -145
- package/dist/core/ui/properties/scrollView.d.ts +0 -105
- package/dist/core/ui/properties/scrollView.js +0 -145
- package/dist/core/ui/properties/sound.d.ts +0 -47
- package/dist/core/ui/properties/sound.js +0 -66
- package/dist/core/ui/properties/sprite.d.ts +0 -161
- package/dist/core/ui/properties/sprite.js +0 -222
- package/dist/core/ui/properties/text.d.ts +0 -135
- package/dist/core/ui/properties/text.js +0 -187
- package/dist/core/ui/registry/uiSystemRegistry.d.ts +0 -8
- package/dist/core/ui/registry/uiSystemRegistry.js +0 -26
- package/dist/core/ui/systems/chest.d.ts +0 -5
- package/dist/core/ui/systems/chest.js +0 -21
- package/dist/core/ui/systems/containerUISystem.d.ts +0 -67
- package/dist/core/ui/systems/containerUISystem.js +0 -214
- package/dist/core/ui/systems/guidebook.d.ts +0 -9
- package/dist/core/ui/systems/guidebook.js +0 -206
- package/dist/core/ui/systems/serverForm.d.ts +0 -13
- package/dist/core/ui/systems/serverForm.js +0 -116
- package/dist/core/ui/systems/system.d.ts +0 -16
- package/dist/core/ui/systems/system.js +0 -37
- package/dist/oc/index.js +0 -1
- package/doc/cli.md +0 -24
- /package/doc/hello_sapdon/{sapdon/344/275/277/347/224/250/346/225/231/347/250/213.md" → hello_sapdon.md} +0 -0
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text 类
|
|
3
|
-
*
|
|
4
|
-
* 该类表示一个文本控件,用于管理文本内容及其样式属性。
|
|
5
|
-
*
|
|
6
|
-
* 属性:
|
|
7
|
-
* - text: string - 文本内容(默认值:空字符串)
|
|
8
|
-
* - color: Vector [r, g, b] - 文本颜色(RGB 值,范围 0.0 到 1.0,默认值:[1.0, 1.0, 1.0])
|
|
9
|
-
* - locked_color: Vector [r, g, b] - 父级禁用时的文本颜色
|
|
10
|
-
* - shadow: boolean - 是否显示文本阴影(默认值:false)
|
|
11
|
-
* - hide_hyphen: boolean - 是否隐藏断词连字符(默认值:false)
|
|
12
|
-
* - notify_on_ellipses: string[] - 文本出现省略号时需通知的控件名称数组
|
|
13
|
-
* - enable_profanity_filter: boolean - 是否启用脏话过滤(默认值:false)
|
|
14
|
-
* - locked_alpha: float - 父级禁用时的透明度
|
|
15
|
-
* - font_size: enum - 字体大小(可能值:small, normal, large, extra_large,默认值:normal)
|
|
16
|
-
* - font_scale_factor: float - 字体缩放比例(默认值:1.0)
|
|
17
|
-
* - localize: boolean - 是否启用本地化翻译(默认值:false)
|
|
18
|
-
* - line_padding: number - 行间距
|
|
19
|
-
* - font_type: enum - 字体类型(可能值:default, rune, unicode, smooth, MinecraftTen 或自定义字体,默认值:default)
|
|
20
|
-
* - backup_font_type: enum - 备用字体类型(默认值:default)
|
|
21
|
-
* - text_alignment: enum - 文本对齐方式(未定义时根据 anchor_from 和 anchor_to 自动调整)
|
|
22
|
-
*/
|
|
23
|
-
export class Text {
|
|
24
|
-
constructor() {
|
|
25
|
-
/*
|
|
26
|
-
this.text = '';
|
|
27
|
-
this.color = [1.0, 1.0, 1.0];
|
|
28
|
-
this.locked_color = null;
|
|
29
|
-
this.shadow = false;
|
|
30
|
-
this.hide_hyphen = false;
|
|
31
|
-
this.notify_on_ellipses = [];
|
|
32
|
-
this.enable_profanity_filter = false;
|
|
33
|
-
this.locked_alpha = null;
|
|
34
|
-
this.font_size = 'normal';
|
|
35
|
-
this.font_scale_factor = 1.0;
|
|
36
|
-
this.localize = false;
|
|
37
|
-
this.line_padding = null;
|
|
38
|
-
this.font_type = 'default';
|
|
39
|
-
this.backup_font_type = 'default';
|
|
40
|
-
this.text_alignment = null;
|
|
41
|
-
*/
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 设置文本内容。
|
|
45
|
-
* @param {string} text - 文本内容
|
|
46
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
47
|
-
*/
|
|
48
|
-
setText(text = '') {
|
|
49
|
-
this.text = text;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 设置文本颜色。
|
|
54
|
-
* @param {number[]} color - RGB 颜色值(格式:[r, g, b],默认值:[1.0, 1.0, 1.0])
|
|
55
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
56
|
-
*/
|
|
57
|
-
setColor(color = [1.0, 1.0, 1.0]) {
|
|
58
|
-
this.color = color;
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 设置父级禁用时的文本颜色。
|
|
63
|
-
* @param {number[]} lockedColor - RGB 颜色值(格式:[r, g, b])
|
|
64
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
65
|
-
*/
|
|
66
|
-
setLockedColor(lockedColor) {
|
|
67
|
-
this.locked_color = lockedColor;
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* 设置是否显示文本阴影。
|
|
72
|
-
* @param {boolean} shadow - 是否显示阴影(默认值:false)
|
|
73
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
74
|
-
*/
|
|
75
|
-
setShadow(shadow = false) {
|
|
76
|
-
this.shadow = shadow;
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 设置是否隐藏断词连字符。
|
|
81
|
-
* @param {boolean} hide - 是否隐藏连字符(默认值:false)
|
|
82
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
83
|
-
*/
|
|
84
|
-
setHideHyphen(hide = false) {
|
|
85
|
-
this.hide_hyphen = hide;
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 设置文本出现省略号时需通知的控件名称数组。
|
|
90
|
-
* @param {string[]} controls - 控件名称数组
|
|
91
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
92
|
-
*/
|
|
93
|
-
setNotifyOnEllipses(controls) {
|
|
94
|
-
this.notify_on_ellipses = controls;
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* 添加一个需通知省略号事件的控件名称。
|
|
99
|
-
* @param {string} controlName - 控件名称
|
|
100
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
101
|
-
*/
|
|
102
|
-
addNotifyOnEllipses(controlName) {
|
|
103
|
-
this.notify_on_ellipses.push(controlName);
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* 设置是否启用脏话过滤。
|
|
108
|
-
* @param {boolean} enable - 是否启用过滤(默认值:false)
|
|
109
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
110
|
-
*/
|
|
111
|
-
setEnableProfanityFilter(enable = false) {
|
|
112
|
-
this.enable_profanity_filter = enable;
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 设置父级禁用时的透明度。
|
|
117
|
-
* @param {number} alpha - 透明度(范围:0.0 到 1.0)
|
|
118
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
119
|
-
*/
|
|
120
|
-
setLockedAlpha(alpha) {
|
|
121
|
-
this.locked_alpha = alpha;
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* 设置字体大小。
|
|
126
|
-
* @param {string} size - 字体大小(可能值:small, normal, large, extra_large,默认值:normal)
|
|
127
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
128
|
-
*/
|
|
129
|
-
setFontSize(size = 'normal') {
|
|
130
|
-
this.font_size = size;
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* 设置字体缩放比例。
|
|
135
|
-
* @param {number} factor - 缩放比例(默认值:1.0)
|
|
136
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
137
|
-
*/
|
|
138
|
-
setFontScaleFactor(factor = 1.0) {
|
|
139
|
-
this.font_scale_factor = factor;
|
|
140
|
-
return this;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* 设置是否启用本地化翻译。
|
|
144
|
-
* @param {boolean} localize - 是否启用本地化(默认值:false)
|
|
145
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
146
|
-
*/
|
|
147
|
-
setLocalize(localize = false) {
|
|
148
|
-
this.localize = localize;
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* 设置行间距。
|
|
153
|
-
* @param {number} padding - 行间距
|
|
154
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
155
|
-
*/
|
|
156
|
-
setLinePadding(padding) {
|
|
157
|
-
this.line_padding = padding;
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* 设置字体类型。
|
|
162
|
-
* @param {string} font - 字体类型(可能值:default, rune, unicode 等,默认值:default)
|
|
163
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
164
|
-
*/
|
|
165
|
-
setFontType(font = 'default') {
|
|
166
|
-
this.font_type = font;
|
|
167
|
-
return this;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* 设置备用字体类型。
|
|
171
|
-
* @param {string} backupFont - 备用字体类型(默认值:default)
|
|
172
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
173
|
-
*/
|
|
174
|
-
setBackupFontType(backupFont = 'default') {
|
|
175
|
-
this.backup_font_type = backupFont;
|
|
176
|
-
return this;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* 设置文本对齐方式。
|
|
180
|
-
* @param {string} alignment - 对齐方式(例如:left, right, center)
|
|
181
|
-
* @returns {Text} 返回当前实例以支持链式调用
|
|
182
|
-
*/
|
|
183
|
-
setTextAlignment(alignment) {
|
|
184
|
-
this.text_alignment = alignment;
|
|
185
|
-
return this;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export class UISystemRegistry {
|
|
2
|
-
static "__#3@#ui_system_map": Map<any, any>;
|
|
3
|
-
static "__#3@#ui_def_list": any[];
|
|
4
|
-
static registerUISystem(ui_system: any): void;
|
|
5
|
-
static getUISystemList(): any[];
|
|
6
|
-
static addOuterUIdefs(ui_defs: any): void;
|
|
7
|
-
static getUIdefList(): any[];
|
|
8
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export class UISystemRegistry {
|
|
2
|
-
// 私有静态字段
|
|
3
|
-
static #ui_system_map = new Map();
|
|
4
|
-
static #ui_def_list = [];
|
|
5
|
-
// 注册 UISystem
|
|
6
|
-
static registerUISystem(ui_system) {
|
|
7
|
-
const ui_system_path = ui_system.path + ui_system.name + ".json";
|
|
8
|
-
this.#ui_system_map.set(ui_system_path, ui_system);
|
|
9
|
-
}
|
|
10
|
-
// 获取所有注册的 UISystem
|
|
11
|
-
static getUISystemList() {
|
|
12
|
-
return Array.from(this.#ui_system_map.values());
|
|
13
|
-
}
|
|
14
|
-
// 添加外部 UI 定义
|
|
15
|
-
static addOuterUIdefs(ui_defs) {
|
|
16
|
-
if (!Array.isArray(ui_defs)) {
|
|
17
|
-
throw new Error("参数必须是一个数组");
|
|
18
|
-
}
|
|
19
|
-
this.#ui_def_list = this.#ui_def_list.concat(ui_defs);
|
|
20
|
-
}
|
|
21
|
-
// 获取 UI 定义列表(剔除 "ui/server_form")
|
|
22
|
-
static getUIdefList() {
|
|
23
|
-
const combinedList = this.#ui_def_list.concat(Array.from(this.#ui_system_map.keys()));
|
|
24
|
-
return combinedList.filter(item => item !== "ui/server_form");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Modifications, UIElement } from "../elements/uiElement.js";
|
|
2
|
-
import { UISystem } from "./system.js";
|
|
3
|
-
const small_chest_screen = new UIElement("small_chest_screen", undefined, "common.inventory_screen_common");
|
|
4
|
-
small_chest_screen.addVariable("new_container_title|default", "$container_title");
|
|
5
|
-
export class ChestUISystem {
|
|
6
|
-
static chest_screen = new UISystem("chest:chest_screen", "ui/");
|
|
7
|
-
static registerContainerUI(new_container_title, ui_system_root_panel) {
|
|
8
|
-
small_chest_screen.addModification({
|
|
9
|
-
array_name: "variables",
|
|
10
|
-
operation: Modifications.OPERATION.INSERT_BACK,
|
|
11
|
-
value: [
|
|
12
|
-
{
|
|
13
|
-
requires: `($new_container_title = '${new_container_title}')`,
|
|
14
|
-
$root_panel: ui_system_root_panel,
|
|
15
|
-
$screen_content: ui_system_root_panel
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
});
|
|
19
|
-
this.chest_screen.addElement(small_chest_screen);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自定义容器 UI 系统类,用于创建和管理容器界面。
|
|
3
|
-
* 支持动态添加网格项、设置标题、调整尺寸等功能。
|
|
4
|
-
*/
|
|
5
|
-
export class ContainerUISystem {
|
|
6
|
-
/**
|
|
7
|
-
* 构造函数,初始化容器 UI 系统。
|
|
8
|
-
* @param {string} identifier - 容器的唯一标识符。
|
|
9
|
-
* @param {string} path - 资源路径。
|
|
10
|
-
*/
|
|
11
|
-
constructor(identifier: string, path: string);
|
|
12
|
-
system: UISystem;
|
|
13
|
-
title: string;
|
|
14
|
-
root_panel_size: number[];
|
|
15
|
-
gridDimension: number[];
|
|
16
|
-
output_grids: any[];
|
|
17
|
-
main_panel: Panel;
|
|
18
|
-
grids: Grid;
|
|
19
|
-
setInputGrid(output_arr: any): void;
|
|
20
|
-
/**
|
|
21
|
-
* 向网格中添加一个网格项。
|
|
22
|
-
* @param {number[]} grid_position - 网格项的位置 [行, 列] 用于定位实体的背包槽。
|
|
23
|
-
* @param {number[]} offset - 网格项的偏移量 [x, y]。
|
|
24
|
-
* @param {Object} [options] - 可选参数,用于配置网格项。
|
|
25
|
-
* @param {boolean} [options.enable=true] - 是否启用该网格项,默认为 true。
|
|
26
|
-
* @param {number[]} [options.size] - 网格项的大小 [宽度, 高度]。
|
|
27
|
-
* @param {UIElement[]} [options.background_images] - 网格项的背景图片控件。
|
|
28
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
29
|
-
*/
|
|
30
|
-
addGridItem(grid_position: number[], offset: number[], options?: {
|
|
31
|
-
enable?: boolean | undefined;
|
|
32
|
-
size?: number[] | undefined;
|
|
33
|
-
background_images?: UIElement[] | undefined;
|
|
34
|
-
}): ContainerUISystem;
|
|
35
|
-
addInputGrid(grid_position: any, offset: any, options: any): void;
|
|
36
|
-
addOutputGrid(grid_position: any, offset: any, options: any): void;
|
|
37
|
-
/**
|
|
38
|
-
* 向主面板中添加一个 UI 元素。
|
|
39
|
-
* @param {Object} element - 要添加的 UI 元素。
|
|
40
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
41
|
-
*/
|
|
42
|
-
addElementToMain(element: Object): ContainerUISystem;
|
|
43
|
-
/**
|
|
44
|
-
* 设置网格的维度(行和列)。
|
|
45
|
-
* @param {number[]} dimension - 网格的维度 [行数, 列数]。
|
|
46
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
47
|
-
*/
|
|
48
|
-
setGridDimension(dimension: number[]): ContainerUISystem;
|
|
49
|
-
/**
|
|
50
|
-
* 设置容器的标题。
|
|
51
|
-
* @param {string} title - 容器的标题。
|
|
52
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
53
|
-
*/
|
|
54
|
-
setTitle(title: string): ContainerUISystem;
|
|
55
|
-
/**
|
|
56
|
-
* 设置根面板的尺寸。
|
|
57
|
-
* @param {number[]} size - 根面板的尺寸 [宽度, 高度]。
|
|
58
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
59
|
-
*/
|
|
60
|
-
setSize(size: number[]): ContainerUISystem;
|
|
61
|
-
setItemMatrix(n: any, matrix: any): void;
|
|
62
|
-
#private;
|
|
63
|
-
}
|
|
64
|
-
import { UISystem } from "./system.js";
|
|
65
|
-
import { Panel } from "../elements/panel.js";
|
|
66
|
-
import { Grid } from "../elements/grid.js";
|
|
67
|
-
import { UIElement } from "../elements/uiElement.js";
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { Grid } from "../elements/grid.js";
|
|
2
|
-
import { Label } from "../elements/label.js";
|
|
3
|
-
import { Panel } from "../elements/panel.js";
|
|
4
|
-
import { StackPanel } from "../elements/stackPanel.js";
|
|
5
|
-
import { UIElement } from "../elements/uiElement.js";
|
|
6
|
-
import { Control } from "../properties/control.js";
|
|
7
|
-
import { GridProp } from "../properties/gridProp.js";
|
|
8
|
-
import { Layout } from "../properties/layout.js";
|
|
9
|
-
import { Text } from "../properties/text.js";
|
|
10
|
-
import { ChestUISystem } from "./chest.js";
|
|
11
|
-
import { UISystem } from "./system.js";
|
|
12
|
-
/**
|
|
13
|
-
* 自定义容器 UI 系统类,用于创建和管理容器界面。
|
|
14
|
-
* 支持动态添加网格项、设置标题、调整尺寸等功能。
|
|
15
|
-
*/
|
|
16
|
-
export class ContainerUISystem {
|
|
17
|
-
/** @private 网格项的数量 */
|
|
18
|
-
#gridItemNum = 3;
|
|
19
|
-
/**
|
|
20
|
-
* 构造函数,初始化容器 UI 系统。
|
|
21
|
-
* @param {string} identifier - 容器的唯一标识符。
|
|
22
|
-
* @param {string} path - 资源路径。
|
|
23
|
-
*/
|
|
24
|
-
constructor(identifier, path) {
|
|
25
|
-
this.system = new UISystem(identifier, path);
|
|
26
|
-
this.title = "自定义容器";
|
|
27
|
-
this.root_panel_size = [200, 200];
|
|
28
|
-
this.gridDimension = [3, 1];
|
|
29
|
-
this.output_grids = []; // 记录输出槽
|
|
30
|
-
this.main_panel = new Panel("main_panel");
|
|
31
|
-
this.grids = new Grid("grids");
|
|
32
|
-
// 初始化
|
|
33
|
-
this.#register();
|
|
34
|
-
this.#updateSystem();
|
|
35
|
-
}
|
|
36
|
-
setInputGrid(output_arr) {
|
|
37
|
-
this.output_grids = output_arr;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 向网格中添加一个网格项。
|
|
41
|
-
* @param {number[]} grid_position - 网格项的位置 [行, 列] 用于定位实体的背包槽。
|
|
42
|
-
* @param {number[]} offset - 网格项的偏移量 [x, y]。
|
|
43
|
-
* @param {Object} [options] - 可选参数,用于配置网格项。
|
|
44
|
-
* @param {boolean} [options.enable=true] - 是否启用该网格项,默认为 true。
|
|
45
|
-
* @param {number[]} [options.size] - 网格项的大小 [宽度, 高度]。
|
|
46
|
-
* @param {UIElement[]} [options.background_images] - 网格项的背景图片控件。
|
|
47
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
48
|
-
*/
|
|
49
|
-
addGridItem(grid_position, offset, options) {
|
|
50
|
-
const gridItem = new UIElement("grid_item", undefined, "chest.chest_grid_item");
|
|
51
|
-
gridItem.addProp("offset", offset);
|
|
52
|
-
gridItem.addProp("enable", options.enable);
|
|
53
|
-
gridItem.addProp("size", options.size);
|
|
54
|
-
gridItem.addVariable("background_images|default", options.background_images);
|
|
55
|
-
this.grids.addGridItem(grid_position, gridItem);
|
|
56
|
-
this.#updateSystem();
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
addInputGrid(grid_position, offset, options) {
|
|
60
|
-
this.addGridItem(grid_position, offset, options);
|
|
61
|
-
}
|
|
62
|
-
addOutputGrid(grid_position, offset, options) {
|
|
63
|
-
//设置
|
|
64
|
-
options.enable = false;
|
|
65
|
-
this.addGridItem(grid_position, offset, options);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 向主面板中添加一个 UI 元素。
|
|
69
|
-
* @param {Object} element - 要添加的 UI 元素。
|
|
70
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
71
|
-
*/
|
|
72
|
-
addElementToMain(element) {
|
|
73
|
-
this.main_panel.addControl(element);
|
|
74
|
-
this.#updateSystem();
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 设置网格的维度(行和列)。
|
|
79
|
-
* @param {number[]} dimension - 网格的维度 [行数, 列数]。
|
|
80
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
81
|
-
*/
|
|
82
|
-
setGridDimension(dimension) {
|
|
83
|
-
this.gridDimension = dimension;
|
|
84
|
-
this.#gridItemNum = dimension[0] * dimension[1];
|
|
85
|
-
this.#updateSystem();
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 设置容器的标题。
|
|
90
|
-
* @param {string} title - 容器的标题。
|
|
91
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
92
|
-
*/
|
|
93
|
-
setTitle(title) {
|
|
94
|
-
this.title = title;
|
|
95
|
-
this.#updateSystem();
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 设置根面板的尺寸。
|
|
100
|
-
* @param {number[]} size - 根面板的尺寸 [宽度, 高度]。
|
|
101
|
-
* @returns {ContainerUISystem} 返回当前实例以支持链式调用。
|
|
102
|
-
*/
|
|
103
|
-
setSize(size) {
|
|
104
|
-
this.root_panel_size = size;
|
|
105
|
-
this.#updateSystem();
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
setItemMatrix(n, matrix) {
|
|
109
|
-
//5*5
|
|
110
|
-
//设置
|
|
111
|
-
this.setGridDimension([1, n]); //n*n列
|
|
112
|
-
const offset_marix = [];
|
|
113
|
-
for (let i = 0; i < n; i++)
|
|
114
|
-
offset_marix.push([(-18) * Math.floor(n / 2), i * (-18)]);
|
|
115
|
-
//现在他们在右上角了
|
|
116
|
-
console.log("offoset:" + offset_marix);
|
|
117
|
-
matrix.forEach((row, rowIndex) => {
|
|
118
|
-
console.log("row:" + row);
|
|
119
|
-
row.forEach((value, colIndex) => {
|
|
120
|
-
if (value === 0)
|
|
121
|
-
return;
|
|
122
|
-
console.log("value:" + value);
|
|
123
|
-
//y
|
|
124
|
-
offset_marix[value - 1][1] += rowIndex * (18);
|
|
125
|
-
//x
|
|
126
|
-
offset_marix[value - 1][0] += colIndex * (18);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
offset_marix.forEach((v, i) => {
|
|
130
|
-
if (this.output_grids.indexOf(v)) {
|
|
131
|
-
this.addOutputGrid([0, i], v);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
this.addGridItem([0, i], v);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* 注册容器 UI 系统。
|
|
139
|
-
* @private
|
|
140
|
-
*/
|
|
141
|
-
#register() {
|
|
142
|
-
ChestUISystem.registerContainerUI(this.system.name, `${this.system.namespace}.container_root_panel`);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* 更新 UI 系统,根据当前属性重新构建 UI。
|
|
146
|
-
* @private
|
|
147
|
-
*/
|
|
148
|
-
#updateSystem() {
|
|
149
|
-
const container_root_panel = new Panel("container_root_panel");
|
|
150
|
-
// 设置根面板的尺寸
|
|
151
|
-
container_root_panel.setLayout(new Layout().setSize(this.root_panel_size));
|
|
152
|
-
// 添加控件
|
|
153
|
-
container_root_panel.addControls([
|
|
154
|
-
// 通用面板
|
|
155
|
-
{
|
|
156
|
-
"common_panel@common.common_panel": {},
|
|
157
|
-
},
|
|
158
|
-
// 飞行动画图标按钮
|
|
159
|
-
{
|
|
160
|
-
"inventory_selected_icon_button@common.inventory_selected_icon_button": {},
|
|
161
|
-
},
|
|
162
|
-
// 主内容面板
|
|
163
|
-
new StackPanel("container_panel")
|
|
164
|
-
.setControl(new Control().setLayer(2))
|
|
165
|
-
// 标题
|
|
166
|
-
.addStack(["100%", "10%"], new Label("title")
|
|
167
|
-
.setControl(new Control().setLayer(12))
|
|
168
|
-
.setText(new Text().setText(this.title).setColor([0, 0, 0])))
|
|
169
|
-
// 自定义网格
|
|
170
|
-
.addStack(["100%", "40%"],
|
|
171
|
-
//有一丢丢bug
|
|
172
|
-
this.main_panel.control =
|
|
173
|
-
this.grids.setGridProp(new GridProp()
|
|
174
|
-
.setGridDimensions(this.gridDimension)
|
|
175
|
-
.setGridItemTemplate("chest.chest_grid_item")).setCollectionName("container_items"))
|
|
176
|
-
// 玩家库存面板
|
|
177
|
-
.addStack(["100%", "50%"], new Panel("inventory_panel").addControls([
|
|
178
|
-
// 玩家背包
|
|
179
|
-
{
|
|
180
|
-
"inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {},
|
|
181
|
-
},
|
|
182
|
-
// 物品栏
|
|
183
|
-
{
|
|
184
|
-
"hotbar_grid@common.hotbar_grid_template": {},
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {},
|
|
188
|
-
},
|
|
189
|
-
])),
|
|
190
|
-
]);
|
|
191
|
-
// 更新系统
|
|
192
|
-
this.system.addElement(container_root_panel);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* 例子
|
|
197
|
-
*
|
|
198
|
-
* // 创建一个新的容器 UI 系统
|
|
199
|
-
const containerUI = new ContainerUISystem("custom_container", "ui/");
|
|
200
|
-
|
|
201
|
-
// 设置标题和尺寸
|
|
202
|
-
containerUI.setTitle("我的自定义容器").setSize([300, 400]);
|
|
203
|
-
|
|
204
|
-
// 设置网格维度(2 行 1 列)
|
|
205
|
-
containerUI.setGridDimension([2, 1]);
|
|
206
|
-
|
|
207
|
-
// 添加网格项
|
|
208
|
-
containerUI.addGridItem([0, 0], [10, 10]); // 在将实体背包(0, 0) 项映射于此,偏移量为 [10, 10]
|
|
209
|
-
containerUI.addGridItem([1, 0], [20, 20]); // 在将实体背包(1, 0) 项映射于此,偏移量为 [20, 20]
|
|
210
|
-
|
|
211
|
-
// 向主面板添加自定义元素
|
|
212
|
-
const customElement = new Panel("custom_element");
|
|
213
|
-
containerUI.addElementToMain(customElement);
|
|
214
|
-
*/
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export class Guidebook {
|
|
2
|
-
constructor(identifier: any, path: any);
|
|
3
|
-
system: UISystem;
|
|
4
|
-
addPageBinding(page_name: any, left_control_name: any, right_control_name: any): this;
|
|
5
|
-
addPage(page_name: any, left_control: any, right_control: any): this;
|
|
6
|
-
addElement(element: any): this;
|
|
7
|
-
#private;
|
|
8
|
-
}
|
|
9
|
-
import { UISystem } from "./system.js";
|