@safe-engine/cocos 1.7.1 → 1.8.1
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/dist/animation/AnimationComponent.d.ts +1 -1
- package/dist/animation/AnimationComponent.d.ts.map +1 -1
- package/dist/animation/AnimationComponent.js +2 -2
- package/dist/animation/AnimationSystem.js +1 -1
- package/dist/app.js +3 -3
- package/dist/box2d-wasm/PhysicsComponent.d.ts +1 -1
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsComponent.js +1 -1
- package/dist/collider/CollideComponent.d.ts +1 -1
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.js +1 -1
- package/dist/collider/CollideSystem.js +1 -1
- package/dist/collider/index.d.ts +1 -0
- package/dist/collider/index.d.ts.map +1 -1
- package/dist/collider/index.js +1 -0
- package/dist/dragonbones/index.d.ts +1 -1
- package/dist/dragonbones/index.d.ts.map +1 -1
- package/dist/dragonbones/index.js +2 -2
- package/dist/gui/GUIComponent.d.ts +93 -0
- package/dist/gui/GUIComponent.d.ts.map +1 -0
- package/dist/gui/GUIComponent.js +77 -0
- package/dist/gui/GUISystem.d.ts +15 -0
- package/dist/gui/GUISystem.d.ts.map +1 -0
- package/dist/gui/GUISystem.js +112 -0
- package/dist/gui/index.d.ts +3 -0
- package/dist/gui/index.d.ts.map +1 -0
- package/dist/gui/index.js +2 -0
- package/dist/gworld/EnhancedComponent.d.ts +22 -0
- package/dist/gworld/EnhancedComponent.d.ts.map +1 -0
- package/dist/gworld/EnhancedComponent.js +44 -0
- package/dist/gworld/NodeComp.d.ts +153 -0
- package/dist/gworld/NodeComp.d.ts.map +1 -0
- package/dist/gworld/NodeComp.js +337 -0
- package/dist/gworld/NodePool.d.ts +9 -0
- package/dist/gworld/NodePool.d.ts.map +1 -0
- package/dist/gworld/NodePool.js +23 -0
- package/dist/gworld/Scene.d.ts +5 -0
- package/dist/gworld/Scene.d.ts.map +1 -0
- package/dist/gworld/Scene.js +14 -0
- package/dist/gworld/components/CollideComponent.d.ts +2 -2
- package/dist/gworld/components/EnhancedComponent.d.ts +2 -2
- package/dist/gworld/components/GUIComponent.d.ts +4 -4
- package/dist/gworld/components/NoRenderComponent.d.ts +3 -3
- package/dist/gworld/components/NodeComp.d.ts +2 -2
- package/dist/gworld/components/RenderComponent.d.ts +4 -4
- package/dist/gworld/core/NodePool.d.ts +1 -1
- package/dist/gworld/core/Scene.d.ts +1 -1
- package/dist/gworld/core/decorator.d.ts +2 -2
- package/dist/gworld/decorator.d.ts +9 -0
- package/dist/gworld/decorator.d.ts.map +1 -0
- package/dist/gworld/decorator.js +13 -0
- package/dist/gworld/index.d.ts +5 -0
- package/dist/gworld/index.d.ts.map +1 -1
- package/dist/gworld/index.js +5 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/norender/NoRenderComponent.d.ts +37 -0
- package/dist/norender/NoRenderComponent.d.ts.map +1 -0
- package/dist/norender/NoRenderComponent.js +41 -0
- package/dist/norender/NoRenderSystem.d.ts +16 -0
- package/dist/norender/NoRenderSystem.d.ts.map +1 -0
- package/dist/norender/NoRenderSystem.js +75 -0
- package/dist/norender/index.d.ts +3 -0
- package/dist/norender/index.d.ts.map +1 -0
- package/dist/norender/index.js +2 -0
- package/dist/render/RenderComponent.d.ts +48 -0
- package/dist/render/RenderComponent.d.ts.map +1 -0
- package/dist/render/RenderComponent.js +80 -0
- package/dist/render/RenderSystem.d.ts +21 -0
- package/dist/render/RenderSystem.d.ts.map +1 -0
- package/dist/render/RenderSystem.js +74 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +2 -0
- package/dist/richtext/RichTextComp.d.ts +1 -1
- package/dist/richtext/RichTextComp.d.ts.map +1 -1
- package/dist/richtext/RichTextComp.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../src/animation/AnimationComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../src/animation/AnimationComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AAGtC,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,oBAAY,QAAQ;IAClB,OAAO,IAAI;IACX,MAAM,IAAI;IACV,IAAI,IAAI;IACR,QAAQ,KAAK;IACb,OAAO,KAAK;IACZ,WAAW,KAAK;IAChB,eAAe,KAAK;CACrB;AAED,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,SAAS;IACjB,KAAK,EAAE;QAAE,WAAW,EAAE,eAAe,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5D,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;KAAE,CAAA;CACrC;AAED,qBAAa,aAAa;IACxB,OAAc,QAAQ,kBAAW;IAC1B,MAAM,SAAK;IACX,KAAK,SAAI;IACT,QAAQ,WAAkB;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAK;IACrB,QAAQ,SAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAID,qBAAa,aAAc,SAAQ,iBAAiB;IAClD,WAAW,EAAE,aAAa,CAAA;IAC1B,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,OAAO,CAAI;IACnB,OAAO,CAAC,WAAW,CAAe;gBAEtB,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO;IAOnF,KAAK;IASL,MAAM,CAAC,EAAE,EAAE,KAAK;IAqChB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;IAMvB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM;IAoBlB,KAAK;IAKL,MAAM;IAKN,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM;CAI1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EnhancedComponent } from '
|
|
2
|
-
import { SpriteRender } from '../
|
|
1
|
+
import { EnhancedComponent } from '..';
|
|
2
|
+
import { SpriteRender } from '../render';
|
|
3
3
|
export var WrapMode;
|
|
4
4
|
(function (WrapMode) {
|
|
5
5
|
WrapMode[WrapMode["Default"] = 0] = "Default";
|
package/dist/app.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CollideSystem } from './collider/CollideSystem';
|
|
2
|
+
import { GUISystem } from './gui';
|
|
2
3
|
import { GameWorld } from './gworld';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { RenderSystem } from './gworld/systems/RenderSystem';
|
|
4
|
+
import { NoRenderSystem } from './norender';
|
|
5
|
+
import { RenderSystem } from './render';
|
|
6
6
|
export function initWorld(defaultFont) {
|
|
7
7
|
GameWorld.Instance.systems.add(RenderSystem);
|
|
8
8
|
GameWorld.Instance.systems.add(CollideSystem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsComponent.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EA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AAQ,CAAC,GAAG,EAAE,IAAI,EASrB;IAED,IAAI,QAAQ,IAXM,IAAI,CAarB;CACF;AAED,UAAU,uBAAuB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B;AACD,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,uBAAuB,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CAS3H;AACD,UAAU,0BAA0B;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B;AACD,qBAAa,qBAAsB,SAAQ,kBAAkB,CAAC,0BAA0B,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CAAG;AACxI,UAAU,2BAA2B;IACnC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IACxC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B;AACD,qBAAa,sBAAuB,SAAQ,kBAAkB,CAAC,2BAA2B,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAA;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAYnC,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,GAAG,CAAC,EAAE,MA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AAI,CAAC,CAAA;CACpB;AAED,qBAAa,eAAgB,SAAQ,QAAQ,CAAC,oBAAoB,CAAC;IACjE,IAAI,MAAM,IAAI,IAAI,EAAE,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,EAExB;IAED,MAAM,CAAC,EAAE,KAAA,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ;CAqB7B;AAED,oBAAY,aAAa;IACvB,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AASD,qBAAa,QAAQ;IACnB,UAAU,EAAE,QAAQ,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,eAAe,EAAE,OAAO,CAAA;IACxB,gBAAgB,EAAE,OAAO,CAAA;gBAEb,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAsBpD,WAAW;IAeX,IAAI;CAyBL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventTypes } from 'entityx-ts';
|
|
2
2
|
import { GameWorld } from '../gworld';
|
|
3
|
-
import { NodeComp } from '../gworld/
|
|
3
|
+
import { NodeComp } from '../gworld/NodeComp';
|
|
4
4
|
import { BoxCollider, CircleCollider, Collider, CollisionType, Contract, PolygonCollider } from './CollideComponent';
|
|
5
5
|
export function shouldCollider(colA, colB) {
|
|
6
6
|
const groupA = colA.node.group;
|
package/dist/collider/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collider/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,cAAc,CAAC,KAAA,EAAE,KAAK,UAAQ,QAS3D"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collider/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAElC,wBAAgB,aAAa,CAAC,cAAc,CAAC,KAAA,EAAE,KAAK,UAAQ,QAS3D"}
|
package/dist/collider/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GameWorld } from '../gworld';
|
|
2
2
|
import { CollideSystem } from './CollideSystem';
|
|
3
|
+
export * from './CollideComponent';
|
|
3
4
|
export function setupCollider(colliderMatrix, debug = false) {
|
|
4
5
|
GameWorld.Instance.systems.add(CollideSystem);
|
|
5
6
|
GameWorld.Instance.listUpdate.push(CollideSystem);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
2
|
import { GameWorld } from '../gworld';
|
|
3
|
-
import { ComponentX } from '../gworld/
|
|
3
|
+
import { ComponentX } from '../gworld/decorator';
|
|
4
4
|
import { BaseComponentProps } from '../safex';
|
|
5
5
|
export type DragonBonesEventData = {
|
|
6
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragonbones/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragonbones/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG7C,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACnD,MA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AE,GAAG,CAAA;IACX,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAI;IAOxC,gBAAgB;IAShB,QAAQ,CAAC,OAAO,EAAE,OAAO;IAIzB,YAAY,CAAC,SAAS,EAAE,KAAK;CAG9B;AAED,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,SAAS,CAAC,aAAa,EAAE,YAAY;IAyDrC,MAAM,CAAC,QAAQ,EAAE,aAAa;CAW/B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,QAIhD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventTypes } from 'entityx-ts';
|
|
2
|
-
import { NodeComp } from '../gworld/
|
|
3
|
-
import { ComponentX } from '../gworld/
|
|
2
|
+
import { NodeComp } from '../gworld/NodeComp';
|
|
3
|
+
import { ComponentX } from '../gworld/decorator';
|
|
4
4
|
import { PixiDragonBonesSprite } from './PixiDragonBonesSprite';
|
|
5
5
|
export class DragonBonesComp extends ComponentX {
|
|
6
6
|
armature;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ComponentX, NoRenderComponentX } from '../gworld/decorator';
|
|
2
|
+
import { Color4B, Size, Vec2 } from '../polyfills';
|
|
3
|
+
import { BaseComponentProps, ColorSource } from '../safex';
|
|
4
|
+
export declare const FillType: {
|
|
5
|
+
HORIZONTAL: number;
|
|
6
|
+
VERTICAL: number;
|
|
7
|
+
RADIAL: number;
|
|
8
|
+
};
|
|
9
|
+
type Keys = keyof typeof FillType;
|
|
10
|
+
type Values = (typeof FillType)[Keys];
|
|
11
|
+
interface ButtonCompProps {
|
|
12
|
+
normalImage?: string;
|
|
13
|
+
selectedImage?: string;
|
|
14
|
+
disableImage?: string;
|
|
15
|
+
zoomScale?: number;
|
|
16
|
+
onPress?: (target: ButtonComp) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class ButtonComp extends NoRenderComponentX<ButtonCompProps> {
|
|
19
|
+
clickEvents: any[];
|
|
20
|
+
setOnPress(cb: (target: ButtonComp) => void): void;
|
|
21
|
+
}
|
|
22
|
+
interface ProgressTimerProps {
|
|
23
|
+
spriteFrame: string;
|
|
24
|
+
fillType?: number;
|
|
25
|
+
fillRange?: number;
|
|
26
|
+
fillCenter?: Vec2;
|
|
27
|
+
isReverse?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare class ProgressTimerComp extends ComponentX<ProgressTimerProps & BaseComponentProps<ProgressTimerComp>, cc.ProgressTimer & cc.Node> {
|
|
30
|
+
spriteFrame: string;
|
|
31
|
+
fillType: Values;
|
|
32
|
+
fillRange: number;
|
|
33
|
+
fillCenter: Vec2;
|
|
34
|
+
isReverse: boolean;
|
|
35
|
+
getFillRange(): number;
|
|
36
|
+
setFillStart(val: number): void;
|
|
37
|
+
setFillRange(val: number): void;
|
|
38
|
+
}
|
|
39
|
+
interface LabelCompProps {
|
|
40
|
+
font?: string;
|
|
41
|
+
string?: string;
|
|
42
|
+
size?: number;
|
|
43
|
+
}
|
|
44
|
+
interface LabelOutlineCompProps {
|
|
45
|
+
color: ColorSource;
|
|
46
|
+
width: number;
|
|
47
|
+
}
|
|
48
|
+
interface LabelShadowCompProps {
|
|
49
|
+
color: ColorSource;
|
|
50
|
+
blur: number;
|
|
51
|
+
offset: Vec2;
|
|
52
|
+
}
|
|
53
|
+
export declare class LabelComp extends ComponentX<LabelCompProps & BaseComponentProps<LabelComp>, ccui.Text> {
|
|
54
|
+
get string(): string;
|
|
55
|
+
set string(val: string);
|
|
56
|
+
}
|
|
57
|
+
export declare class LabelOutlineComp extends NoRenderComponentX<LabelOutlineCompProps> {
|
|
58
|
+
color: typeof Color4B;
|
|
59
|
+
width: Float;
|
|
60
|
+
}
|
|
61
|
+
export declare class LabelShadowComp extends NoRenderComponentX<LabelShadowCompProps> {
|
|
62
|
+
color: typeof Color4B;
|
|
63
|
+
blur: Float;
|
|
64
|
+
offset: Size;
|
|
65
|
+
}
|
|
66
|
+
export declare enum ScrollViewDirection {
|
|
67
|
+
NONE,
|
|
68
|
+
HORIZONTAL,
|
|
69
|
+
VERTICAL,
|
|
70
|
+
BOTH
|
|
71
|
+
}
|
|
72
|
+
interface ScrollViewProps {
|
|
73
|
+
viewSize: Size;
|
|
74
|
+
contentSize: Size;
|
|
75
|
+
direction?: ScrollViewDirection;
|
|
76
|
+
}
|
|
77
|
+
export declare class ScrollViewComp extends ComponentX<ScrollViewProps & BaseComponentProps<ScrollViewComp>, cc.ScrollView> {
|
|
78
|
+
zoom(scale: number): void;
|
|
79
|
+
}
|
|
80
|
+
interface InputCompProps {
|
|
81
|
+
placeHolder?: string;
|
|
82
|
+
font?: string;
|
|
83
|
+
size?: Integer;
|
|
84
|
+
maxLength?: Integer;
|
|
85
|
+
isPassword?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export declare class InputComp extends ComponentX<InputCompProps & BaseComponentProps<InputComp>, ccui.TextField> {
|
|
88
|
+
get string(): string;
|
|
89
|
+
}
|
|
90
|
+
export declare class BlockInputEventsComp extends NoRenderComponentX {
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=GUIComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GUIComponent.d.ts","sourceRoot":"","sources":["../../src/gui/GUIComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE1D,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AACD,KAAK,IAAI,GAAG,MAAM,OAAO,QAAQ,CAAA;AACjC,KAAK,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;AAErC,UAAU,eAAe;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA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0,0 +1,77 @@
|
|
|
1
|
+
import { ComponentX, NoRenderComponentX } from '../gworld/decorator';
|
|
2
|
+
import { Vec2 } from '../polyfills';
|
|
3
|
+
export const FillType = {
|
|
4
|
+
HORIZONTAL: 0,
|
|
5
|
+
VERTICAL: 1,
|
|
6
|
+
RADIAL: 2,
|
|
7
|
+
};
|
|
8
|
+
export class ButtonComp extends NoRenderComponentX {
|
|
9
|
+
// texType: ccui.Widget.TextureType
|
|
10
|
+
clickEvents = [];
|
|
11
|
+
setOnPress(cb) {
|
|
12
|
+
this.props.onPress = cb;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class ProgressTimerComp extends ComponentX {
|
|
16
|
+
spriteFrame;
|
|
17
|
+
fillType;
|
|
18
|
+
fillRange;
|
|
19
|
+
fillCenter;
|
|
20
|
+
isReverse;
|
|
21
|
+
getFillRange() {
|
|
22
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
23
|
+
return this.node.instance.getPercentage() * 0.01;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
setFillStart(val) {
|
|
27
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
28
|
+
this.node.instance.setMidpoint(Vec2(val, val));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
setFillRange(val) {
|
|
32
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
33
|
+
this.node.instance.setPercentage(val * 100);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class LabelComp extends ComponentX {
|
|
38
|
+
get string() {
|
|
39
|
+
return this.props.string;
|
|
40
|
+
}
|
|
41
|
+
set string(val) {
|
|
42
|
+
this.props.string = val;
|
|
43
|
+
if (this.node.instance instanceof ccui.Text) {
|
|
44
|
+
this.node.instance.setString(val);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class LabelOutlineComp extends NoRenderComponentX {
|
|
49
|
+
color;
|
|
50
|
+
width;
|
|
51
|
+
}
|
|
52
|
+
export class LabelShadowComp extends NoRenderComponentX {
|
|
53
|
+
color;
|
|
54
|
+
blur;
|
|
55
|
+
offset;
|
|
56
|
+
}
|
|
57
|
+
export var ScrollViewDirection;
|
|
58
|
+
(function (ScrollViewDirection) {
|
|
59
|
+
ScrollViewDirection[ScrollViewDirection["NONE"] = cc.SCROLLVIEW_DIRECTION_NONE] = "NONE";
|
|
60
|
+
ScrollViewDirection[ScrollViewDirection["HORIZONTAL"] = cc.SCROLLVIEW_DIRECTION_HORIZONTAL] = "HORIZONTAL";
|
|
61
|
+
ScrollViewDirection[ScrollViewDirection["VERTICAL"] = cc.SCROLLVIEW_DIRECTION_VERTICAL] = "VERTICAL";
|
|
62
|
+
ScrollViewDirection[ScrollViewDirection["BOTH"] = cc.SCROLLVIEW_DIRECTION_BOTH] = "BOTH";
|
|
63
|
+
})(ScrollViewDirection || (ScrollViewDirection = {}));
|
|
64
|
+
export class ScrollViewComp extends ComponentX {
|
|
65
|
+
zoom(scale) {
|
|
66
|
+
if (this.node.instance instanceof cc.ScrollView) {
|
|
67
|
+
this.node.instance.getContainer().setScale(scale);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class InputComp extends ComponentX {
|
|
72
|
+
get string() {
|
|
73
|
+
return this.node.instance.getString();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export class BlockInputEventsComp extends NoRenderComponentX {
|
|
77
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
|
+
export declare class GUISystem implements System {
|
|
3
|
+
defaultFont: string;
|
|
4
|
+
configure(event_manager: EventManager): void;
|
|
5
|
+
private onAddButtonComp;
|
|
6
|
+
private onAddProgressTimerComp;
|
|
7
|
+
private onAddLabelComp;
|
|
8
|
+
private onAddLabelOutlineComp;
|
|
9
|
+
private onAddLabelShadowComp;
|
|
10
|
+
private onAddScrollViewComp;
|
|
11
|
+
private onAddBlockInputEventsComp;
|
|
12
|
+
private onAddInputComp;
|
|
13
|
+
update(entities: EntityManager, events: EventManager, dt: number): any;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=GUISystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAMlG,qBAAa,SAAU,YAAW,MAAM;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,aAAa,EAAE,YAAY;IAWrC,OAAO,CAAC,eAAe,CAuBtB;IAED,OAAO,CAAC,sBAAsB,CAc7B;IAED,OAAO,CAAC,cAAc,CAMrB;IAED,OAAO,CAAC,qBAAqB,CAM5B;IAED,OAAO,CAAC,oBAAoB,CAM3B;IAED,OAAO,CAAC,mBAAmB,CAU1B;IAED,OAAO,CAAC,yBAAyB,CAOhC;IAED,OAAO,CAAC,cAAc,CAWrB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { EventTypes } from 'entityx-ts';
|
|
2
|
+
import { NodeComp } from '../gworld';
|
|
3
|
+
import { TouchEventRegister } from '../norender';
|
|
4
|
+
import { Vec2 } from '../polyfills';
|
|
5
|
+
import { BlockInputEventsComp, ButtonComp, FillType, InputComp, LabelComp, LabelOutlineComp, LabelShadowComp, ProgressTimerComp, ScrollViewComp } from './GUIComponent';
|
|
6
|
+
export class GUISystem {
|
|
7
|
+
defaultFont;
|
|
8
|
+
configure(event_manager) {
|
|
9
|
+
event_manager.subscribe(EventTypes.ComponentAdded, ButtonComp, this.onAddButtonComp);
|
|
10
|
+
event_manager.subscribe(EventTypes.ComponentAdded, ProgressTimerComp, this.onAddProgressTimerComp);
|
|
11
|
+
event_manager.subscribe(EventTypes.ComponentAdded, LabelComp, this.onAddLabelComp);
|
|
12
|
+
event_manager.subscribe(EventTypes.ComponentAdded, LabelOutlineComp, this.onAddLabelOutlineComp);
|
|
13
|
+
event_manager.subscribe(EventTypes.ComponentAdded, LabelShadowComp, this.onAddLabelShadowComp);
|
|
14
|
+
event_manager.subscribe(EventTypes.ComponentAdded, ScrollViewComp, this.onAddScrollViewComp);
|
|
15
|
+
event_manager.subscribe(EventTypes.ComponentAdded, InputComp, this.onAddInputComp);
|
|
16
|
+
event_manager.subscribe(EventTypes.ComponentAdded, BlockInputEventsComp, this.onAddBlockInputEventsComp);
|
|
17
|
+
}
|
|
18
|
+
onAddButtonComp = ({ entity, component: button }) => {
|
|
19
|
+
const nodeComp = entity.getComponent(NodeComp);
|
|
20
|
+
const { zoomScale = 1.2 } = button.props;
|
|
21
|
+
button.node = nodeComp;
|
|
22
|
+
const lastScaleX = nodeComp.scaleX;
|
|
23
|
+
const lastScaleY = nodeComp.scaleY;
|
|
24
|
+
const touchComp = entity.assign(new TouchEventRegister());
|
|
25
|
+
touchComp.props.onTouchStart = function (touch) {
|
|
26
|
+
const p = touch.getLocation();
|
|
27
|
+
// console.log('onTouchBegan', p, lastScaleX, lastScaleY)
|
|
28
|
+
const rect = nodeComp.getBoundingBox();
|
|
29
|
+
const nodeSpaceLocation = nodeComp.parent.convertToNodeSpace(p);
|
|
30
|
+
if (rect.contains(nodeSpaceLocation) && button.enabled && nodeComp.active) {
|
|
31
|
+
const scale = cc.scaleTo(0.3, zoomScale * lastScaleX, lastScaleY * zoomScale);
|
|
32
|
+
nodeComp.runAction(scale);
|
|
33
|
+
button.props.onPress(button);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
touchComp.props.onTouchEnd = function () {
|
|
37
|
+
const scale = cc.scaleTo(0.3, lastScaleX, lastScaleY);
|
|
38
|
+
nodeComp.runAction(scale);
|
|
39
|
+
};
|
|
40
|
+
touchComp.props.onTouchCancel = touchComp.props.onTouchEnd;
|
|
41
|
+
};
|
|
42
|
+
onAddProgressTimerComp = ({ entity, component: bar }) => {
|
|
43
|
+
const { spriteFrame, fillType = FillType.HORIZONTAL, fillRange = 1, fillCenter = Vec2(0, 0) } = bar.props;
|
|
44
|
+
const frame = cc.spriteFrameCache.getSpriteFrame(spriteFrame);
|
|
45
|
+
const sprite = new cc.Sprite(frame || spriteFrame);
|
|
46
|
+
const pTimer = new cc.ProgressTimer(sprite);
|
|
47
|
+
const ptt = fillType === FillType.RADIAL ? cc.ProgressTimer.TYPE_RADIAL : cc.ProgressTimer.TYPE_BAR;
|
|
48
|
+
pTimer.setType(ptt);
|
|
49
|
+
if (fillType !== FillType.RADIAL) {
|
|
50
|
+
const rate = fillType === FillType.HORIZONTAL ? cc.p(1, 0) : cc.p(0, 1);
|
|
51
|
+
pTimer.setBarChangeRate(rate);
|
|
52
|
+
}
|
|
53
|
+
pTimer.setPercentage(fillRange * 100);
|
|
54
|
+
pTimer.setMidpoint(fillCenter);
|
|
55
|
+
bar.node = entity.assign(new NodeComp(pTimer, entity));
|
|
56
|
+
};
|
|
57
|
+
onAddLabelComp = ({ entity, component: label }) => {
|
|
58
|
+
const { string = '', font = this.defaultFont, size = 64 } = label.props;
|
|
59
|
+
const fontName = cc.path.basename(font, '.ttf');
|
|
60
|
+
const node = new ccui.Text(string, fontName, size);
|
|
61
|
+
node.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM);
|
|
62
|
+
label.node = entity.assign(new NodeComp(node, entity));
|
|
63
|
+
};
|
|
64
|
+
onAddLabelOutlineComp = ({ entity, component: outline }) => {
|
|
65
|
+
const { color, width } = outline.props;
|
|
66
|
+
const node = entity.getComponent(NodeComp);
|
|
67
|
+
if (node.instance instanceof ccui.Text) {
|
|
68
|
+
node.instance.enableOutline(color, width);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
onAddLabelShadowComp = ({ entity, component: shadow }) => {
|
|
72
|
+
const { color, blur, offset } = shadow.props;
|
|
73
|
+
const node = entity.getComponent(NodeComp);
|
|
74
|
+
if (node.instance instanceof ccui.Text) {
|
|
75
|
+
node.instance.enableShadow(color, offset, blur);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
onAddScrollViewComp = ({ entity, component: scrollView }) => {
|
|
79
|
+
const { viewSize, contentSize, direction = cc.SCROLLVIEW_DIRECTION_VERTICAL } = scrollView.props;
|
|
80
|
+
const node = new cc.ScrollView(viewSize);
|
|
81
|
+
node.setContentSize(contentSize);
|
|
82
|
+
node.setViewSize(viewSize);
|
|
83
|
+
node.setDirection(direction);
|
|
84
|
+
// node.setContentOffset(cc.p(0, viewSize.height - contentSize.height))
|
|
85
|
+
// node.setTouchEnabled(false)
|
|
86
|
+
node.setBounceable(false);
|
|
87
|
+
scrollView.node = entity.assign(new NodeComp(node, entity));
|
|
88
|
+
};
|
|
89
|
+
onAddBlockInputEventsComp = ({ entity, component: blockInput }) => {
|
|
90
|
+
const node = entity.getComponent(NodeComp);
|
|
91
|
+
if (node.instance instanceof ccui.ImageView) {
|
|
92
|
+
node.instance.setTouchEnabled(true);
|
|
93
|
+
node.instance.setScale9Enabled(true);
|
|
94
|
+
}
|
|
95
|
+
blockInput.node = node;
|
|
96
|
+
};
|
|
97
|
+
onAddInputComp = ({ entity, component: textInput }) => {
|
|
98
|
+
const { placeHolder = '', font = this.defaultFont, size = 64, maxLength = 20, isPassword = false } = textInput.props;
|
|
99
|
+
const textField = new ccui.TextField();
|
|
100
|
+
textField.setPlaceHolder(placeHolder);
|
|
101
|
+
textField.setFontName(font);
|
|
102
|
+
textField.setFontSize(size);
|
|
103
|
+
textField.setTextColor(cc.color(255, 255, 255));
|
|
104
|
+
textField.setMaxLengthEnabled(true);
|
|
105
|
+
textField.setMaxLength(maxLength);
|
|
106
|
+
textField.setPasswordEnabled(isPassword);
|
|
107
|
+
textInput.node = entity.assign(new NodeComp(textField, entity));
|
|
108
|
+
};
|
|
109
|
+
update() {
|
|
110
|
+
// throw new Error('Method not implemented.');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gui/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Constructor } from 'entityx-ts';
|
|
2
|
+
import { BaseComponentProps } from '../safex';
|
|
3
|
+
import { NodeComp } from './NodeComp';
|
|
4
|
+
export declare class EnhancedComponent<Props = object, N extends NodeComp<any> = NodeComp<any>> {
|
|
5
|
+
static hasRender: boolean;
|
|
6
|
+
props: Props;
|
|
7
|
+
node: N;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
constructor(data?: BaseComponentProps<EnhancedComponent> & Props);
|
|
10
|
+
init(data?: Props): void;
|
|
11
|
+
addComponent<T extends EnhancedComponent>(instance: T): T;
|
|
12
|
+
getComponent<T extends EnhancedComponent>(component: Constructor<T>): T;
|
|
13
|
+
schedule(callback: (arg: any) => void, interval: number, repeat?: number, delay?: number): void;
|
|
14
|
+
unschedule(callback: (arg: any) => void): void;
|
|
15
|
+
unscheduleAllCallbacks(): void;
|
|
16
|
+
scheduleOnce(callback: (arg: any) => void, delay: number, key?: string): void;
|
|
17
|
+
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
18
|
+
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
19
|
+
isEqual(other: EnhancedComponent): boolean;
|
|
20
|
+
}
|
|
21
|
+
export type ComponentType = EnhancedComponent | NodeComp;
|
|
22
|
+
//# sourceMappingURL=EnhancedComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedComponent.d.ts","sourceRoot":"","sources":["../../src/gworld/EnhancedComponent.ts"],"names":[],"mappings":"AAAA,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C;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class EnhancedComponent {
|
|
2
|
+
static hasRender = true;
|
|
3
|
+
props = {};
|
|
4
|
+
node;
|
|
5
|
+
enabled = true;
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.init(data);
|
|
8
|
+
}
|
|
9
|
+
init(data) {
|
|
10
|
+
if (data) {
|
|
11
|
+
// console.log('constructor', this.constructor.name, data)
|
|
12
|
+
Object.keys(data).forEach((key) => {
|
|
13
|
+
this.props[key] = data[key];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
addComponent(instance) {
|
|
18
|
+
return this.node.addComponent(instance);
|
|
19
|
+
}
|
|
20
|
+
getComponent(component) {
|
|
21
|
+
return this.node.getComponent(component);
|
|
22
|
+
}
|
|
23
|
+
schedule(callback, interval, repeat = cc.macro.REPEAT_FOREVER, delay = 0) {
|
|
24
|
+
this.node.instance.schedule(callback.bind(this), interval, repeat, delay);
|
|
25
|
+
}
|
|
26
|
+
unschedule(callback) {
|
|
27
|
+
this.node.instance.unschedule(callback.bind(this));
|
|
28
|
+
}
|
|
29
|
+
unscheduleAllCallbacks() {
|
|
30
|
+
this.node.instance.unscheduleAllCallbacks();
|
|
31
|
+
}
|
|
32
|
+
scheduleOnce(callback, delay, key) {
|
|
33
|
+
this.node.instance.scheduleOnce(callback, delay, key);
|
|
34
|
+
}
|
|
35
|
+
getComponentsInChildren(component) {
|
|
36
|
+
return this.node.getComponentsInChildren(component);
|
|
37
|
+
}
|
|
38
|
+
getComponentInChildren(component) {
|
|
39
|
+
return this.node.getComponentInChildren(component);
|
|
40
|
+
}
|
|
41
|
+
isEqual(other) {
|
|
42
|
+
return this.node.entity.id === other.node.entity.id;
|
|
43
|
+
}
|
|
44
|
+
}
|