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.
- package/README.md +8 -1
- package/doc/api.md +2 -2
- package/package.json +18 -19
- package/{dist → prod}/cli/index.d.ts +1 -1
- package/prod/cli/index.js +1 -0
- package/{dist → prod}/cli/start.js +997 -967
- package/{dist → prod}/core/index.d.ts +2155 -1652
- package/prod/core/index.js +59017 -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 -236
- 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.d.ts +0 -14
- 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 -45
- package/dist/cli/index.js +0 -90
- 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/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/controllers/render_controllers.js +0 -162
- 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/BasicMoveBundle.js +0 -8
- package/dist/core/entity/bundles/basicBundle.d.ts +0 -13
- package/dist/core/entity/bundles/basicBundle.js +0 -38
- 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 -354
- package/dist/core/entity/data/nativeEntityData.d.ts +0 -9
- package/dist/core/entity/data/nativeEntityData.js +0 -38
- package/dist/core/entity/dummyEntity.js +0 -14
- package/dist/core/entity/entity.d.ts +0 -15
- package/dist/core/entity/entity.js +0 -11
- 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 -17
- 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/actor.js +0 -44
- package/dist/oc/core.js +0 -201
- package/dist/oc/input.js +0 -67
- package/dist/oc/optional.js +0 -31
- /package/{dist → prod}/oc/index.d.ts +0 -0
- /package/{dist → prod}/oc/index.js +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Control } from "../properties/control.js";
|
|
2
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
3
|
-
import { Factory } from "../properties/factory.js";
|
|
4
|
-
import { Layout } from "../properties/layout.js";
|
|
5
|
-
import { UIElement } from "./uiElement.js";
|
|
6
|
-
export class CollectionPanel extends UIElement {
|
|
7
|
-
constructor(id, template) {
|
|
8
|
-
super(id, "collection_panel", template);
|
|
9
|
-
this.control = new Control();
|
|
10
|
-
this.layout = new Layout();
|
|
11
|
-
this.dataBinding = new DataBinding();
|
|
12
|
-
this.factory = new Factory();
|
|
13
|
-
}
|
|
14
|
-
setCollectionName(collection_name) {
|
|
15
|
-
this.addProp("collection_name", collection_name);
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
setLayout(layout) {
|
|
19
|
-
if (!(layout instanceof Layout))
|
|
20
|
-
new Error("参数需要Layout类");
|
|
21
|
-
this.layout = layout;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
serialize() {
|
|
25
|
-
//序列化
|
|
26
|
-
// 复制Layout的属性
|
|
27
|
-
for (const key in this.layout) {
|
|
28
|
-
if (this.layout.hasOwnProperty(key)) {
|
|
29
|
-
this.properties.set(key, this.layout[key]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// 复制DataBinding的属性
|
|
33
|
-
for (const key in this.dataBinding) {
|
|
34
|
-
if (this.dataBinding.hasOwnProperty(key)) {
|
|
35
|
-
this.properties.set(key, this.dataBinding[key]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// 复制Factory的属性
|
|
39
|
-
for (const key in this.factory) {
|
|
40
|
-
if (this.factory.hasOwnProperty(key)) {
|
|
41
|
-
this.properties.set(key, this.factory[key]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// 复制Control的属性
|
|
45
|
-
for (const key in this.control) {
|
|
46
|
-
if (this.control.hasOwnProperty(key)) {
|
|
47
|
-
this.properties.set(key, this.control[key]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// 调用父类的serialize方法
|
|
51
|
-
return super.serialize();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export class Grid extends CollectionPanel {
|
|
2
|
-
gridNum: number;
|
|
3
|
-
grid: GridProp;
|
|
4
|
-
setGridProp(grid_prop: any): this;
|
|
5
|
-
addGridItem(grid_position: any, content: any): this;
|
|
6
|
-
}
|
|
7
|
-
import { CollectionPanel } from "./collectionPanel.js";
|
|
8
|
-
import { GridProp } from "../properties/gridProp.js";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { GridProp } from "../properties/gridProp.js";
|
|
2
|
-
import { CollectionPanel } from "./collectionPanel.js";
|
|
3
|
-
import { Panel } from "./panel.js";
|
|
4
|
-
export class Grid extends CollectionPanel {
|
|
5
|
-
constructor(id, template) {
|
|
6
|
-
super(id, template);
|
|
7
|
-
this.gridNum = 0;
|
|
8
|
-
this.grid = new GridProp();
|
|
9
|
-
}
|
|
10
|
-
setGridProp(grid_prop) {
|
|
11
|
-
this.grid = grid_prop;
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
addGridItem(grid_position, content) {
|
|
15
|
-
const grid_item = new Panel(`grid_item_${this.gridNum}`);
|
|
16
|
-
grid_item.addProp("grid_position", grid_position);
|
|
17
|
-
grid_item.addControl(content);
|
|
18
|
-
this.addControl(grid_item);
|
|
19
|
-
this.gridNum++;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
serialize() {
|
|
23
|
-
// 复制grid的属性
|
|
24
|
-
for (const key in this.grid) {
|
|
25
|
-
if (this.grid.hasOwnProperty(key)) {
|
|
26
|
-
this.properties.set(key, this.grid[key]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//类型修正
|
|
30
|
-
this.properties.set("type", "grid");
|
|
31
|
-
return super.serialize();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export class Image extends UIElement {
|
|
2
|
-
constructor(id: any, template: any);
|
|
3
|
-
sprite: Sprite;
|
|
4
|
-
layout: Layout;
|
|
5
|
-
dataBinding: DataBinding;
|
|
6
|
-
factory: Factory;
|
|
7
|
-
setSprite(sprite: any): this;
|
|
8
|
-
}
|
|
9
|
-
import { UIElement } from "./uiElement.js";
|
|
10
|
-
import { Sprite } from "../properties/sprite.js";
|
|
11
|
-
import { Layout } from "../properties/layout.js";
|
|
12
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
13
|
-
import { Factory } from "../properties/factory.js";
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Control } from "../properties/control.js";
|
|
2
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
3
|
-
import { Factory } from "../properties/factory.js";
|
|
4
|
-
import { Layout } from "../properties/layout.js";
|
|
5
|
-
import { Sprite } from "../properties/sprite.js";
|
|
6
|
-
import { UIElement } from "./uiElement.js";
|
|
7
|
-
export class Image extends UIElement {
|
|
8
|
-
constructor(id, template) {
|
|
9
|
-
super(id, "image", template);
|
|
10
|
-
this.sprite = new Sprite();
|
|
11
|
-
this.control = new Control();
|
|
12
|
-
this.layout = new Layout();
|
|
13
|
-
this.dataBinding = new DataBinding();
|
|
14
|
-
this.factory = new Factory();
|
|
15
|
-
}
|
|
16
|
-
setSprite(sprite) {
|
|
17
|
-
this.sprite = sprite;
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
serialize() {
|
|
21
|
-
//合并属性
|
|
22
|
-
// 复制Sprite的属性
|
|
23
|
-
for (const key in this.sprite) {
|
|
24
|
-
if (this.sprite.hasOwnProperty(key)) {
|
|
25
|
-
this.properties.set(key, this.sprite[key]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// 复制Layout的属性
|
|
29
|
-
for (const key in this.layout) {
|
|
30
|
-
if (this.layout.hasOwnProperty(key)) {
|
|
31
|
-
this.properties.set(key, this.layout[key]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// 复制DataBinding的属性
|
|
35
|
-
for (const key in this.dataBinding) {
|
|
36
|
-
if (this.dataBinding.hasOwnProperty(key)) {
|
|
37
|
-
this.properties.set(key, this.dataBinding[key]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// 复制Factory的属性
|
|
41
|
-
for (const key in this.factory) {
|
|
42
|
-
if (this.factory.hasOwnProperty(key)) {
|
|
43
|
-
this.properties.set(key, this.factory[key]);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// 复制Control的属性
|
|
47
|
-
for (const key in this.control) {
|
|
48
|
-
if (this.control.hasOwnProperty(key)) {
|
|
49
|
-
this.properties.set(key, this.control[key]);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// 调用父类的serialize方法
|
|
53
|
-
return super.serialize();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class Label extends UIElement {
|
|
2
|
-
constructor(id: any, template: any);
|
|
3
|
-
text: Text;
|
|
4
|
-
layout: Layout;
|
|
5
|
-
dataBinding: DataBinding;
|
|
6
|
-
factory: Factory;
|
|
7
|
-
setLayout(layout: any): this;
|
|
8
|
-
setText(text: any): this;
|
|
9
|
-
}
|
|
10
|
-
import { UIElement } from "./uiElement.js";
|
|
11
|
-
import { Text } from "../properties/text.js";
|
|
12
|
-
import { Layout } from "../properties/layout.js";
|
|
13
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
14
|
-
import { Factory } from "../properties/factory.js";
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Control } from "../properties/control.js";
|
|
2
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
3
|
-
import { Factory } from "../properties/factory.js";
|
|
4
|
-
import { Layout } from "../properties/layout.js";
|
|
5
|
-
import { Text } from "../properties/text.js";
|
|
6
|
-
import { UIElement } from "./uiElement.js";
|
|
7
|
-
export class Label extends UIElement {
|
|
8
|
-
constructor(id, template) {
|
|
9
|
-
super(id, "label", template);
|
|
10
|
-
this.text = new Text();
|
|
11
|
-
this.control = new Control();
|
|
12
|
-
this.layout = new Layout();
|
|
13
|
-
this.dataBinding = new DataBinding();
|
|
14
|
-
this.factory = new Factory();
|
|
15
|
-
}
|
|
16
|
-
setLayout(layout) {
|
|
17
|
-
if (!(layout instanceof Layout))
|
|
18
|
-
new Error("参数需要Layout类");
|
|
19
|
-
this.layout = layout;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
setText(text) {
|
|
23
|
-
this.text = text;
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
serialize() {
|
|
27
|
-
//合并属性
|
|
28
|
-
// 复制Text的属性
|
|
29
|
-
for (const key in this.text) {
|
|
30
|
-
if (this.text.hasOwnProperty(key)) {
|
|
31
|
-
this.properties.set(key, this.text[key]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// 复制Layout的属性
|
|
35
|
-
for (const key in this.layout) {
|
|
36
|
-
if (this.layout.hasOwnProperty(key)) {
|
|
37
|
-
this.properties.set(key, this.layout[key]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// 复制DataBinding的属性
|
|
41
|
-
for (const key in this.dataBinding) {
|
|
42
|
-
if (this.dataBinding.hasOwnProperty(key)) {
|
|
43
|
-
this.properties.set(key, this.dataBinding[key]);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// 复制Factory的属性
|
|
47
|
-
for (const key in this.factory) {
|
|
48
|
-
if (this.factory.hasOwnProperty(key)) {
|
|
49
|
-
this.properties.set(key, this.factory[key]);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// 复制Control的属性
|
|
53
|
-
for (const key in this.control) {
|
|
54
|
-
if (this.control.hasOwnProperty(key)) {
|
|
55
|
-
this.properties.set(key, this.control[key]);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// 调用父类的serialize方法
|
|
59
|
-
return super.serialize();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class Panel extends UIElement {
|
|
2
|
-
constructor(id: any, template: any);
|
|
3
|
-
layout: Layout;
|
|
4
|
-
dataBinding: DataBinding;
|
|
5
|
-
factory: Factory;
|
|
6
|
-
setLayout(layout: any): this;
|
|
7
|
-
}
|
|
8
|
-
import { UIElement } from "./uiElement.js";
|
|
9
|
-
import { Layout } from "../properties/layout.js";
|
|
10
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
11
|
-
import { Factory } from "../properties/factory.js";
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Control } from "../properties/control.js";
|
|
2
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
3
|
-
import { Factory } from "../properties/factory.js";
|
|
4
|
-
import { Layout } from "../properties/layout.js";
|
|
5
|
-
import { UIElement } from "./uiElement.js";
|
|
6
|
-
export class Panel extends UIElement {
|
|
7
|
-
constructor(id, template) {
|
|
8
|
-
super(id, "panel", template);
|
|
9
|
-
this.control = new Control();
|
|
10
|
-
this.layout = new Layout();
|
|
11
|
-
this.dataBinding = new DataBinding();
|
|
12
|
-
this.factory = new Factory();
|
|
13
|
-
}
|
|
14
|
-
setLayout(layout) {
|
|
15
|
-
if (!(layout instanceof Layout))
|
|
16
|
-
new Error("参数需要Layout类");
|
|
17
|
-
this.layout = layout;
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
serialize() {
|
|
21
|
-
//序列化
|
|
22
|
-
// 复制Layout的属性
|
|
23
|
-
for (const key in this.layout) {
|
|
24
|
-
if (this.layout.hasOwnProperty(key)) {
|
|
25
|
-
this.properties.set(key, this.layout[key]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// 复制DataBinding的属性
|
|
29
|
-
for (const key in this.dataBinding) {
|
|
30
|
-
if (this.dataBinding.hasOwnProperty(key)) {
|
|
31
|
-
this.properties.set(key, this.dataBinding[key]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// 复制Factory的属性
|
|
35
|
-
for (const key in this.factory) {
|
|
36
|
-
if (this.factory.hasOwnProperty(key)) {
|
|
37
|
-
this.properties.set(key, this.factory[key]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// 复制Control的属性
|
|
41
|
-
for (const key in this.control) {
|
|
42
|
-
if (this.control.hasOwnProperty(key)) {
|
|
43
|
-
this.properties.set(key, this.control[key]);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// 调用父类的serialize方法
|
|
47
|
-
return super.serialize();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class ScrollingPanel extends UIElement {
|
|
2
|
-
constructor(id: any, template: any);
|
|
3
|
-
input: Input;
|
|
4
|
-
scrollView: ScrollView;
|
|
5
|
-
layout: Layout;
|
|
6
|
-
dataBinding: DataBinding;
|
|
7
|
-
factory: Factory;
|
|
8
|
-
}
|
|
9
|
-
import { UIElement } from "./uiElement.js";
|
|
10
|
-
import { Input } from "../properties/input.js";
|
|
11
|
-
import { ScrollView } from "../properties/scrollView.js";
|
|
12
|
-
import { Layout } from "../properties/layout.js";
|
|
13
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
14
|
-
import { Factory } from "../properties/factory.js";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Control } from "../properties/control.js";
|
|
2
|
-
import { DataBinding } from "../properties/dataBinding.js";
|
|
3
|
-
import { Factory } from "../properties/factory.js";
|
|
4
|
-
import { Input } from "../properties/input.js";
|
|
5
|
-
import { Layout } from "../properties/layout.js";
|
|
6
|
-
import { ScrollView } from "../properties/scrollView.js";
|
|
7
|
-
import { UIElement } from "./uiElement.js";
|
|
8
|
-
export class ScrollingPanel extends UIElement {
|
|
9
|
-
constructor(id, template) {
|
|
10
|
-
super(id, "scroll_view", template);
|
|
11
|
-
this.input = new Input();
|
|
12
|
-
this.scrollView = new ScrollView();
|
|
13
|
-
this.control = new Control();
|
|
14
|
-
this.layout = new Layout();
|
|
15
|
-
this.dataBinding = new DataBinding();
|
|
16
|
-
this.factory = new Factory();
|
|
17
|
-
}
|
|
18
|
-
serialize() {
|
|
19
|
-
//合并属性
|
|
20
|
-
// 复制Input的属性
|
|
21
|
-
for (const key in this.input) {
|
|
22
|
-
if (this.input.hasOwnProperty(key)) {
|
|
23
|
-
this.properties.set(key, this.input[key]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// 复制scrollView的属性
|
|
27
|
-
for (const key in this.scrollView) {
|
|
28
|
-
if (this.scrollView.hasOwnProperty(key)) {
|
|
29
|
-
this.properties.set(key, this.scrollView[key]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// 复制Layout的属性
|
|
33
|
-
for (const key in this.layout) {
|
|
34
|
-
if (this.layout.hasOwnProperty(key)) {
|
|
35
|
-
this.properties.set(key, this.layout[key]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// 复制DataBinding的属性
|
|
39
|
-
for (const key in this.dataBinding) {
|
|
40
|
-
if (this.dataBinding.hasOwnProperty(key)) {
|
|
41
|
-
this.properties.set(key, this.dataBinding[key]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// 复制Factory的属性
|
|
45
|
-
for (const key in this.factory) {
|
|
46
|
-
if (this.factory.hasOwnProperty(key)) {
|
|
47
|
-
this.properties.set(key, this.factory[key]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// 复制Control的属性
|
|
51
|
-
for (const key in this.control) {
|
|
52
|
-
if (this.control.hasOwnProperty(key)) {
|
|
53
|
-
this.properties.set(key, this.control[key]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// 调用父类的serialize方法
|
|
57
|
-
return super.serialize();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class StackPanel extends Panel {
|
|
2
|
-
type: string;
|
|
3
|
-
orientation: string;
|
|
4
|
-
stackNum: number;
|
|
5
|
-
addStack(size: any, content: any, debug?: boolean): this;
|
|
6
|
-
/**
|
|
7
|
-
* Possible values:
|
|
8
|
-
vertical
|
|
9
|
-
horizontal
|
|
10
|
-
* @param {*} orientation
|
|
11
|
-
*/
|
|
12
|
-
setOrientation(orientation: any): this;
|
|
13
|
-
}
|
|
14
|
-
import { Panel } from "./panel.js";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Layout } from "../properties/layout.js";
|
|
2
|
-
import { Panel } from "./panel.js";
|
|
3
|
-
export class StackPanel extends Panel {
|
|
4
|
-
constructor(id, template) {
|
|
5
|
-
super(id, template);
|
|
6
|
-
this.type = "stack_panel";
|
|
7
|
-
this.orientation = "vertical";
|
|
8
|
-
this.stackNum = 0;
|
|
9
|
-
//init
|
|
10
|
-
this.setLayout(new Layout().setSize(["100%", "100%"]));
|
|
11
|
-
}
|
|
12
|
-
addStack(size, content, debug = false) {
|
|
13
|
-
const stack = new Panel(`stack${this.stackNum}`)
|
|
14
|
-
.setLayout(new Layout().setSize(size))
|
|
15
|
-
.addControl(content);
|
|
16
|
-
if (debug)
|
|
17
|
-
stack.enableDebug();
|
|
18
|
-
this.addControl(stack);
|
|
19
|
-
this.stackNum++;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Possible values:
|
|
24
|
-
vertical
|
|
25
|
-
horizontal
|
|
26
|
-
* @param {*} orientation
|
|
27
|
-
*/
|
|
28
|
-
setOrientation(orientation) {
|
|
29
|
-
this.orientation = orientation;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
serialize() {
|
|
33
|
-
this.properties.set("type", "stack_panel");
|
|
34
|
-
this.properties.set("orientation", this.orientation);
|
|
35
|
-
return super.serialize();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export class UIElement {
|
|
2
|
-
constructor(name: any, type: any, template: any);
|
|
3
|
-
type: any;
|
|
4
|
-
id: any;
|
|
5
|
-
name: any;
|
|
6
|
-
control: Control;
|
|
7
|
-
properties: Map<any, any>;
|
|
8
|
-
variables: Map<any, any>;
|
|
9
|
-
modifications: any[];
|
|
10
|
-
enableDebug(): this;
|
|
11
|
-
setControl(control: any): this;
|
|
12
|
-
addControl(control: any): this;
|
|
13
|
-
addControls(controls: any): this;
|
|
14
|
-
addVariable(name: any, value: any): this;
|
|
15
|
-
addProp(name: any, value: any): this;
|
|
16
|
-
addModification(modification: any): this;
|
|
17
|
-
serialize(): {
|
|
18
|
-
[x: number]: any;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Modifications
|
|
23
|
-
To modify JSON UI in a non-intrusive way, you can use the modifications property to modify previously existing JSON UI elements from other packs (usually vanilla JSON UI files). Doing this makes sure only necessary parts are modified unless otherwise intended, to improve compatibility with other packs that modify the JSON UI.
|
|
24
|
-
|
|
25
|
-
Modification Description
|
|
26
|
-
insert_back insert at end of array
|
|
27
|
-
insert_front insert at start of array
|
|
28
|
-
insert_after insert after target in array
|
|
29
|
-
insert_before insert before target in array
|
|
30
|
-
move_back move target to end of array
|
|
31
|
-
move_front move target to start of array
|
|
32
|
-
move_after move target after second target
|
|
33
|
-
move_before move target before second target
|
|
34
|
-
swap swap first target with second target
|
|
35
|
-
replace replace first target with second target
|
|
36
|
-
remove remove target
|
|
37
|
-
*/
|
|
38
|
-
export class Modifications {
|
|
39
|
-
static OPERATION: Readonly<{
|
|
40
|
-
INSERT_BACK: "insert_back";
|
|
41
|
-
INSERT_FRONT: "insert_front";
|
|
42
|
-
INSERT_AFTER: "insert_after";
|
|
43
|
-
INSERT_BEFORE: "insert_before";
|
|
44
|
-
MOVE_BACK: "move_back";
|
|
45
|
-
MOVE_FRONT: "move_front";
|
|
46
|
-
MOVE_AFTER: "move_after";
|
|
47
|
-
MOVE_BEFORE: "move_before";
|
|
48
|
-
SWAP: "swap";
|
|
49
|
-
REPLACE: "replace";
|
|
50
|
-
REMOVE: "remove";
|
|
51
|
-
}>;
|
|
52
|
-
}
|
|
53
|
-
import { Control } from "../properties/control.js";
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Elements
|
|
3
|
-
A JSON UI element is the basic form of data within JSON UI. Elements must have a unique name for each namespace so as to not have a conflict with other elements of the same name yet may have different functions.
|
|
4
|
-
|
|
5
|
-
Here the element type is label so it will render a text of Hello World when called:
|
|
6
|
-
|
|
7
|
-
vanilla/ui/example_file.json
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
"test_element": {
|
|
11
|
-
"type": "label",
|
|
12
|
-
"text": "Hello World"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
Types
|
|
16
|
-
The following are some of the element types, which are possible values for the type property:
|
|
17
|
-
|
|
18
|
-
label - for creating text objects
|
|
19
|
-
image - for rendering images from a filepath provided
|
|
20
|
-
button - for creating interactive and clickable elements
|
|
21
|
-
panel - an empty container where you can store all other elements that may overlap to each other
|
|
22
|
-
stack_panel - an empty container where you can store all other elements in a stack that doesn't overlap to each other
|
|
23
|
-
grid - uses another element as a template, and then renders it repeatedly in multiple rows and columns
|
|
24
|
-
factory - renders an element based off of another element, is capable of calling hardcoded values and variables
|
|
25
|
-
custom - is paired with another property renderer which renders hardcoded JSON UI elements
|
|
26
|
-
screen - elements that are called by the game directly, usually root panel elements
|
|
27
|
-
*/
|
|
28
|
-
import { Control } from "../properties/control.js";
|
|
29
|
-
// 基础元素类
|
|
30
|
-
export class UIElement {
|
|
31
|
-
constructor(name, type, template) {
|
|
32
|
-
this.type = type;
|
|
33
|
-
this.id = template ? `${name}@${template}` : name;
|
|
34
|
-
this.name = name;
|
|
35
|
-
this.control = new Control();
|
|
36
|
-
this.properties = new Map().set("type", type);
|
|
37
|
-
this.variables = new Map();
|
|
38
|
-
this.modifications = [];
|
|
39
|
-
}
|
|
40
|
-
enableDebug() {
|
|
41
|
-
this.control.addControl({
|
|
42
|
-
"debug_board": {
|
|
43
|
-
"type": "image",
|
|
44
|
-
"texture": "textures/ui/focus_border_white",
|
|
45
|
-
"nineslice_size": 1,
|
|
46
|
-
"size": ["100%", "100%"]
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
setControl(control) {
|
|
52
|
-
this.control = control;
|
|
53
|
-
return this;
|
|
54
|
-
}
|
|
55
|
-
addControl(control) {
|
|
56
|
-
//console.log("control: ", control)
|
|
57
|
-
if (control instanceof UIElement) {
|
|
58
|
-
this.control.addControl(control.serialize());
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this.control.addControl(control);
|
|
62
|
-
}
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
addControls(controls) {
|
|
66
|
-
for (let i in controls) {
|
|
67
|
-
this.addControl(controls[i]);
|
|
68
|
-
}
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
addVariable(name, value) {
|
|
72
|
-
this.variables.set(`$${name}`, value);
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
addProp(name, value) {
|
|
76
|
-
this.properties.set(name, value);
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
addModification(modification) {
|
|
80
|
-
this.modifications.push({
|
|
81
|
-
array_name: modification.array_name,
|
|
82
|
-
operation: modification.operation,
|
|
83
|
-
value: modification.value
|
|
84
|
-
});
|
|
85
|
-
this.addProp("modifications", this.modifications);
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
serialize() {
|
|
89
|
-
const json = Object.fromEntries(this.properties);
|
|
90
|
-
Object.assign(json, Object.fromEntries(this.variables));
|
|
91
|
-
return {
|
|
92
|
-
[this.id]: json
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
//Modifications 方法
|
|
97
|
-
/**
|
|
98
|
-
* Modifications
|
|
99
|
-
To modify JSON UI in a non-intrusive way, you can use the modifications property to modify previously existing JSON UI elements from other packs (usually vanilla JSON UI files). Doing this makes sure only necessary parts are modified unless otherwise intended, to improve compatibility with other packs that modify the JSON UI.
|
|
100
|
-
|
|
101
|
-
Modification Description
|
|
102
|
-
insert_back insert at end of array
|
|
103
|
-
insert_front insert at start of array
|
|
104
|
-
insert_after insert after target in array
|
|
105
|
-
insert_before insert before target in array
|
|
106
|
-
move_back move target to end of array
|
|
107
|
-
move_front move target to start of array
|
|
108
|
-
move_after move target after second target
|
|
109
|
-
move_before move target before second target
|
|
110
|
-
swap swap first target with second target
|
|
111
|
-
replace replace first target with second target
|
|
112
|
-
remove remove target
|
|
113
|
-
*/
|
|
114
|
-
// Modifications操作类型常量类
|
|
115
|
-
export class Modifications {
|
|
116
|
-
static OPERATION = Object.freeze({
|
|
117
|
-
INSERT_BACK: "insert_back",
|
|
118
|
-
INSERT_FRONT: "insert_front",
|
|
119
|
-
INSERT_AFTER: "insert_after",
|
|
120
|
-
INSERT_BEFORE: "insert_before",
|
|
121
|
-
MOVE_BACK: "move_back",
|
|
122
|
-
MOVE_FRONT: "move_front",
|
|
123
|
-
MOVE_AFTER: "move_after",
|
|
124
|
-
MOVE_BEFORE: "move_before",
|
|
125
|
-
SWAP: "swap",
|
|
126
|
-
REPLACE: "replace",
|
|
127
|
-
REMOVE: "remove"
|
|
128
|
-
});
|
|
129
|
-
}
|