@safe-engine/cocos 2.5.20 → 2.6.2
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.
|
@@ -7,14 +7,16 @@ export declare const FillType: {
|
|
|
7
7
|
RADIAL: number;
|
|
8
8
|
};
|
|
9
9
|
interface ButtonCompProps {
|
|
10
|
-
|
|
10
|
+
spriteFrame: string;
|
|
11
11
|
selectedImage?: string;
|
|
12
12
|
disableImage?: string;
|
|
13
|
-
param?: string;
|
|
14
13
|
zoomScale?: number;
|
|
14
|
+
capInsets?: [number, number, number, number];
|
|
15
15
|
onPress?: (target: ButtonComp) => void;
|
|
16
16
|
}
|
|
17
|
-
export declare class ButtonComp extends ComponentX<ButtonCompProps> {
|
|
17
|
+
export declare class ButtonComp extends ComponentX<ButtonCompProps & BaseComponentProps<ButtonComp>, ccui.Button> {
|
|
18
|
+
get spriteFrame(): string;
|
|
19
|
+
set spriteFrame(spriteFrame: string);
|
|
18
20
|
}
|
|
19
21
|
interface ProgressTimerProps {
|
|
20
22
|
spriteFrame: string;
|
|
@@ -52,9 +54,24 @@ interface ScrollViewProps {
|
|
|
52
54
|
isScrollToTop?: boolean;
|
|
53
55
|
isBounced?: boolean;
|
|
54
56
|
}
|
|
55
|
-
export declare class ScrollViewComp extends ComponentX<ScrollViewProps & BaseComponentProps<ScrollViewComp>,
|
|
57
|
+
export declare class ScrollViewComp extends ComponentX<ScrollViewProps & BaseComponentProps<ScrollViewComp>, cc.ScrollView> {
|
|
56
58
|
zoom(scale: number): void;
|
|
57
59
|
}
|
|
60
|
+
export declare enum ListViewDirection {
|
|
61
|
+
NONE,
|
|
62
|
+
HORIZONTAL,
|
|
63
|
+
VERTICAL,
|
|
64
|
+
BOTH
|
|
65
|
+
}
|
|
66
|
+
interface ListViewProps {
|
|
67
|
+
viewSize: Size;
|
|
68
|
+
contentSize: Size;
|
|
69
|
+
direction?: ListViewDirection;
|
|
70
|
+
isScrollToTop?: boolean;
|
|
71
|
+
isBounced?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export declare class ListViewComp extends ComponentX<ListViewProps & BaseComponentProps<ListViewComp>, ccui.ScrollView> {
|
|
74
|
+
}
|
|
58
75
|
interface InputCompProps {
|
|
59
76
|
placeHolder?: string;
|
|
60
77
|
font?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GUIComponent.d.ts","sourceRoot":"","sources":["../../src/gui/GUIComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AACpD,OAAO,EAAE,UAAU,EAAU,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEzC,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAID,UAAU,eAAe;IACvB,WAAW,
|
|
1
|
+
{"version":3,"file":"GUIComponent.d.ts","sourceRoot":"","sources":["../../src/gui/GUIComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AACpD,OAAO,EAAE,UAAU,EAAU,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEzC,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAID,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CACvC;AACD,qBAAa,UAAW,SAAQ,UAAU,CAAC,eAAe,GAAG,kBAAkB,CAAC,U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AC;CAAG;AAExG,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AACD,qBAAa,cAAe,SAAQ,UAAU,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;IAC/G,KAAK;IAIL,QAAQ;CAWT"}
|
package/dist/gui/GUIComponent.js
CHANGED
|
@@ -6,6 +6,17 @@ export const FillType = {
|
|
|
6
6
|
RADIAL: 2,
|
|
7
7
|
};
|
|
8
8
|
export class ButtonComp extends ComponentX {
|
|
9
|
+
get spriteFrame() {
|
|
10
|
+
return this.props.spriteFrame;
|
|
11
|
+
}
|
|
12
|
+
set spriteFrame(spriteFrame) {
|
|
13
|
+
this.props.spriteFrame = spriteFrame;
|
|
14
|
+
if (this.node && this.node.instance instanceof ccui.Button) {
|
|
15
|
+
const frame = cc.spriteFrameCache.getSpriteFrame(spriteFrame);
|
|
16
|
+
const textureType = !frame ? ccui.Widget.LOCAL_TEXTURE : ccui.Widget.PLIST_TEXTURE;
|
|
17
|
+
this.node.instance.loadTextureNormal(spriteFrame, textureType);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
9
20
|
}
|
|
10
21
|
export class ProgressTimerComp extends ComponentX {
|
|
11
22
|
get fillRange() {
|
|
@@ -37,10 +48,10 @@ export class LabelComp extends ComponentX {
|
|
|
37
48
|
}
|
|
38
49
|
export var ScrollViewDirection;
|
|
39
50
|
(function (ScrollViewDirection) {
|
|
40
|
-
ScrollViewDirection[ScrollViewDirection["NONE"] =
|
|
41
|
-
ScrollViewDirection[ScrollViewDirection["HORIZONTAL"] =
|
|
42
|
-
ScrollViewDirection[ScrollViewDirection["VERTICAL"] =
|
|
43
|
-
ScrollViewDirection[ScrollViewDirection["BOTH"] =
|
|
51
|
+
ScrollViewDirection[ScrollViewDirection["NONE"] = cc.SCROLLVIEW_DIRECTION_NONE] = "NONE";
|
|
52
|
+
ScrollViewDirection[ScrollViewDirection["HORIZONTAL"] = cc.SCROLLVIEW_DIRECTION_HORIZONTAL] = "HORIZONTAL";
|
|
53
|
+
ScrollViewDirection[ScrollViewDirection["VERTICAL"] = cc.SCROLLVIEW_DIRECTION_VERTICAL] = "VERTICAL";
|
|
54
|
+
ScrollViewDirection[ScrollViewDirection["BOTH"] = cc.SCROLLVIEW_DIRECTION_BOTH] = "BOTH";
|
|
44
55
|
})(ScrollViewDirection || (ScrollViewDirection = {}));
|
|
45
56
|
export class ScrollViewComp extends ComponentX {
|
|
46
57
|
zoom(scale) {
|
|
@@ -49,6 +60,15 @@ export class ScrollViewComp extends ComponentX {
|
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
}
|
|
63
|
+
export var ListViewDirection;
|
|
64
|
+
(function (ListViewDirection) {
|
|
65
|
+
ListViewDirection[ListViewDirection["NONE"] = ccui.ScrollView.DIR_NONE] = "NONE";
|
|
66
|
+
ListViewDirection[ListViewDirection["HORIZONTAL"] = ccui.ScrollView.DIR_HORIZONTAL] = "HORIZONTAL";
|
|
67
|
+
ListViewDirection[ListViewDirection["VERTICAL"] = ccui.ScrollView.DIR_VERTICAL] = "VERTICAL";
|
|
68
|
+
ListViewDirection[ListViewDirection["BOTH"] = ccui.ScrollView.DIR_BOTH] = "BOTH";
|
|
69
|
+
})(ListViewDirection || (ListViewDirection = {}));
|
|
70
|
+
export class ListViewComp extends ComponentX {
|
|
71
|
+
}
|
|
52
72
|
export class InputComp extends ComponentX {
|
|
53
73
|
get string() {
|
|
54
74
|
return this.node.instance.getString();
|
|
@@ -75,4 +95,6 @@ export class GridLayoutComp extends ComponentX {
|
|
|
75
95
|
Object.defineProperty(ProgressTimerComp.prototype, 'render', { value: render });
|
|
76
96
|
Object.defineProperty(LabelComp.prototype, 'render', { value: render });
|
|
77
97
|
Object.defineProperty(ScrollViewComp.prototype, 'render', { value: render });
|
|
98
|
+
Object.defineProperty(ListViewComp.prototype, 'render', { value: render });
|
|
78
99
|
Object.defineProperty(InputComp.prototype, 'render', { value: render });
|
|
100
|
+
Object.defineProperty(ButtonComp.prototype, 'render', { value: render });
|
package/dist/gui/GUISystem.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAenF,qBAAa,SAAU,YAAW,MAAM;IACtC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,aAAa,EAAE,YAAY;IAWrC,OAAO,CAAC,eAAe,CAuBtB;IAED,OAAO,CAAC,sBAAsB,CAc7B;IAED,OAAO,CAAC,cAAc,CAerB;IAED,OAAO,CAAC,mBAAmB,CAU1B;IAED,OAAO,CAAC,iBAAiB,CAUxB;IAED,OAAO,CAAC,cAAc,CAWrB;IAED,OAAO,CAAC,eAAe,CAetB;IAED,OAAO,CAAC,mBAAmB,CAG1B;CAKF"}
|
package/dist/gui/GUISystem.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EventTypes } from 'entityx-ts';
|
|
2
2
|
import { NodeComp } from '../core/NodeComp';
|
|
3
|
-
import { TouchEventRegister } from '../norender';
|
|
4
3
|
import { Vec2 } from '../polyfills';
|
|
5
|
-
import { ButtonComp, FillType, GridLayoutComp, InputComp, LabelComp, ProgressTimerComp, ScrollViewComp, WidgetComp } from './GUIComponent';
|
|
4
|
+
import { ButtonComp, FillType, GridLayoutComp, InputComp, LabelComp, ListViewComp, ProgressTimerComp, ScrollViewComp, WidgetComp, } from './GUIComponent';
|
|
6
5
|
export class GUISystem {
|
|
7
6
|
static defaultFont;
|
|
8
7
|
configure(event_manager) {
|
|
@@ -10,34 +9,35 @@ export class GUISystem {
|
|
|
10
9
|
event_manager.subscribe(EventTypes.ComponentAdded, ProgressTimerComp, this.onAddProgressTimerComp);
|
|
11
10
|
event_manager.subscribe(EventTypes.ComponentAdded, LabelComp, this.onAddLabelComp);
|
|
12
11
|
event_manager.subscribe(EventTypes.ComponentAdded, ScrollViewComp, this.onAddScrollViewComp);
|
|
12
|
+
event_manager.subscribe(EventTypes.ComponentAdded, ListViewComp, this.onAddListViewComp);
|
|
13
13
|
event_manager.subscribe(EventTypes.ComponentAdded, InputComp, this.onAddInputComp);
|
|
14
14
|
event_manager.subscribe(EventTypes.ComponentAdded, WidgetComp, this.onAddWidgetComp);
|
|
15
15
|
event_manager.subscribe(EventTypes.ComponentAdded, GridLayoutComp, this.onAddGridLayoutComp);
|
|
16
16
|
}
|
|
17
17
|
onAddButtonComp = ({ entity, component: button }) => {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
18
|
+
const { zoomScale = 1.2, capInsets, spriteFrame, selectedImage, disableImage, onPress } = button.props;
|
|
19
|
+
const frame = cc.spriteFrameCache.getSpriteFrame(spriteFrame);
|
|
20
|
+
const textureType = !frame ? ccui.Widget.LOCAL_TEXTURE : ccui.Widget.PLIST_TEXTURE;
|
|
21
|
+
// console.log('onAddButtonComp', spriteFrame, textureType, ccui.Widget.PLIST_TEXTURE)
|
|
22
|
+
const node = new ccui.Button(spriteFrame, selectedImage, disableImage, textureType);
|
|
23
|
+
node.setZoomScale(0);
|
|
24
|
+
if (onPress) {
|
|
25
|
+
const lastScale = node.scale;
|
|
26
|
+
node.addTouchEventListener((sender, type) => {
|
|
27
|
+
if (type === ccui.Widget.TOUCH_BEGAN) {
|
|
28
|
+
sender.setScale(zoomScale * lastScale);
|
|
29
|
+
}
|
|
30
|
+
else if (type === ccui.Widget.TOUCH_ENDED || type === ccui.Widget.TOUCH_CANCELED) {
|
|
31
|
+
sender.setScale(lastScale);
|
|
32
|
+
onPress(button);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (capInsets) {
|
|
37
|
+
node.setScale9Enabled(true);
|
|
38
|
+
node.setCapInsets(cc.rect(...capInsets));
|
|
39
|
+
}
|
|
40
|
+
button.node = entity.assign(new NodeComp(node, entity));
|
|
41
41
|
};
|
|
42
42
|
onAddProgressTimerComp = ({ entity, component: bar }) => {
|
|
43
43
|
const { spriteFrame, fillType = FillType.HORIZONTAL, fillRange = 1, fillCenter = Vec2(0, 0) } = bar.props;
|
|
@@ -71,60 +71,28 @@ export class GUISystem {
|
|
|
71
71
|
label.node = entity.assign(new NodeComp(node, entity));
|
|
72
72
|
};
|
|
73
73
|
onAddScrollViewComp = ({ entity, component: scrollView }) => {
|
|
74
|
-
const { viewSize, contentSize, isScrollToTop, isBounced, direction =
|
|
74
|
+
const { viewSize, contentSize, isScrollToTop, isBounced, direction = cc.SCROLLVIEW_DIRECTION_VERTICAL } = scrollView.props;
|
|
75
|
+
const node = new cc.ScrollView(viewSize);
|
|
76
|
+
node.setViewSize(viewSize);
|
|
77
|
+
node.setContentSize(contentSize);
|
|
78
|
+
node.setDirection(direction);
|
|
79
|
+
if (isScrollToTop !== undefined)
|
|
80
|
+
node.setContentOffset(cc.p(0, viewSize.height - contentSize.height));
|
|
81
|
+
// node.setTouchEnabled(false)
|
|
82
|
+
node.setBounceable(isBounced !== undefined);
|
|
83
|
+
scrollView.node = entity.assign(new NodeComp(node, entity));
|
|
84
|
+
};
|
|
85
|
+
onAddListViewComp = ({ entity, component: listView }) => {
|
|
86
|
+
const { viewSize, contentSize, isScrollToTop, isBounced, direction = ccui.ScrollView.DIR_VERTICAL } = listView.props;
|
|
75
87
|
const node = new ccui.ScrollView();
|
|
76
88
|
node.setContentSize(viewSize);
|
|
77
89
|
node.setInnerContainerSize(contentSize);
|
|
78
90
|
node.setDirection(direction);
|
|
79
91
|
if (isScrollToTop)
|
|
80
92
|
node.scrollToTop(0, true);
|
|
81
|
-
node.setTouchEnabled(false)
|
|
93
|
+
// node.setTouchEnabled(false)
|
|
82
94
|
node.setBounceEnabled(isBounced !== undefined);
|
|
83
|
-
|
|
84
|
-
let moved = false;
|
|
85
|
-
const container = node._innerContainer;
|
|
86
|
-
// console.log('ccui.ScrollView', container)
|
|
87
|
-
cc.eventManager.addListener({
|
|
88
|
-
event: cc.EventListener.TOUCH_ONE_BY_ONE,
|
|
89
|
-
swallowTouches: false, // để ScrollView vẫn scroll
|
|
90
|
-
onTouchBegan(touch, event) {
|
|
91
|
-
moved = false;
|
|
92
|
-
return node.onTouchBegan(touch, event);
|
|
93
|
-
},
|
|
94
|
-
onTouchMoved(touch, event) {
|
|
95
|
-
node.onTouchMoved(touch, event);
|
|
96
|
-
const delta = touch.getDelta();
|
|
97
|
-
if (Math.abs(delta.y) > 5)
|
|
98
|
-
moved = true;
|
|
99
|
-
},
|
|
100
|
-
onTouchEnded(touch, event) {
|
|
101
|
-
node.onTouchEnded(touch, event);
|
|
102
|
-
if (moved)
|
|
103
|
-
return;
|
|
104
|
-
const local = container.convertToNodeSpace(touch.getLocation());
|
|
105
|
-
const items = scrollView.node.children;
|
|
106
|
-
items.forEach((item) => {
|
|
107
|
-
const itemPos = item.position;
|
|
108
|
-
const itemSize = item.contentSize;
|
|
109
|
-
const rect = cc.rect(itemPos.x - itemSize.width * item.anchorX, itemPos.y - itemSize.height * item.anchorY, itemSize.width, itemSize.height);
|
|
110
|
-
if (cc.rectContainsPoint(rect, local)) {
|
|
111
|
-
// console.log('Clicked item', item, item.entity)
|
|
112
|
-
const buttonComp = item.getComponent(ButtonComp);
|
|
113
|
-
if (buttonComp && buttonComp.props.onPress) {
|
|
114
|
-
const { zoomScale = 1.2 } = buttonComp.props;
|
|
115
|
-
const lastScaleX = buttonComp.node.scaleX;
|
|
116
|
-
const lastScaleY = buttonComp.node.scaleY;
|
|
117
|
-
const scale = cc.scaleTo(0.15, zoomScale * lastScaleX, lastScaleY * zoomScale);
|
|
118
|
-
const scaleBack = cc.scaleTo(0.15, lastScaleX, lastScaleY);
|
|
119
|
-
const seq = cc.sequence(scale, scaleBack);
|
|
120
|
-
buttonComp.node.runAction(seq);
|
|
121
|
-
buttonComp.props.onPress(buttonComp);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
// console.log('onTouchEnded', touch.getLocation(), local, items)
|
|
126
|
-
},
|
|
127
|
-
}, container);
|
|
95
|
+
listView.node = entity.assign(new NodeComp(node, entity));
|
|
128
96
|
};
|
|
129
97
|
onAddInputComp = ({ entity, component: textInput }) => {
|
|
130
98
|
const { placeHolder = '', font = GUISystem.defaultFont, size = 64, maxLength = 20, isPassword = false } = textInput.props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-engine/cocos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "safe-engine with cocos renderer support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@cocos/dragonbones-js": "^1.0.2",
|
|
25
25
|
"@esotericsoftware/spine-core": "^4.2.98",
|
|
26
26
|
"box2d-wasm": "^7.0.0",
|
|
27
|
-
"cocos-html5-ts": "^2.1.
|
|
27
|
+
"cocos-html5-ts": "^2.1.7",
|
|
28
28
|
"entityx-ts": "^2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"author": "",
|