@safe-engine/pixi 1.0.1 → 7.0.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/app.d.ts +3 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +41 -81
- package/dist/components/GUIComponent.d.ts +15 -14
- package/dist/components/GUIComponent.d.ts.map +1 -1
- package/dist/components/GUIComponent.js +68 -138
- package/dist/components/NodeComp.d.ts +7 -6
- package/dist/components/NodeComp.d.ts.map +1 -1
- package/dist/components/NodeComp.js +223 -305
- package/dist/components/RenderComponent.d.ts +8 -7
- package/dist/components/RenderComponent.d.ts.map +1 -1
- package/dist/components/RenderComponent.js +25 -56
- package/dist/core/Color.js +1 -1
- package/dist/core/LoadingBar.d.ts +9 -1
- package/dist/core/LoadingBar.d.ts.map +1 -1
- package/dist/core/LoadingBar.js +50 -46
- package/dist/core/Size.js +3 -6
- package/dist/helper/html-text-parser.js +34 -34
- package/dist/helper/utils.d.ts +2 -8
- package/dist/helper/utils.d.ts.map +1 -1
- package/dist/helper/utils.js +22 -46
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -18
- package/dist/systems/GUISystem.d.ts +3 -4
- package/dist/systems/GUISystem.d.ts.map +1 -1
- package/dist/systems/GUISystem.js +67 -89
- package/dist/systems/RenderSystem.d.ts +1 -3
- package/dist/systems/RenderSystem.d.ts.map +1 -1
- package/dist/systems/RenderSystem.js +51 -85
- package/package.json +4 -4
- package/src/app.ts +53 -51
- package/src/components/GUIComponent.ts +140 -145
- package/src/components/NodeComp.ts +416 -409
- package/src/components/RenderComponent.ts +7 -6
- package/src/core/LoadingBar.ts +63 -33
- package/src/index.ts +4 -6
- package/src/systems/GUISystem.ts +67 -82
- package/src/systems/RenderSystem.ts +70 -100
- package/tsconfig.json +1 -1
- package/src/components/EnhancedComponent.ts +0 -57
- package/src/core/Scene.ts +0 -17
- package/src/core/decorator.ts +0 -18
- package/src/gworld.ts +0 -17
- package/src/helper/utils.ts +0 -64
|
@@ -1,146 +1,141 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { LoadingBar, LoadingBarMode } from '../core/LoadingBar'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const _htmlTextParser = new HtmlTextParser()
|
|
9
|
-
export const FillType = {
|
|
10
|
-
HORIZONTAL: 0,
|
|
11
|
-
VERTICAL: 1,
|
|
12
|
-
RADIAL: 2,
|
|
13
|
-
}
|
|
14
|
-
type Keys = keyof typeof FillType
|
|
15
|
-
type Values = (typeof FillType)[Keys]
|
|
16
|
-
|
|
17
|
-
export class ButtonComp extends NoRenderComponentX {
|
|
18
|
-
normalImage: string
|
|
19
|
-
selectedImage: string
|
|
20
|
-
disableImage: string
|
|
21
|
-
zoomScale: number
|
|
22
|
-
onPress: (target: ButtonComp) => void
|
|
23
|
-
|
|
24
|
-
setOnPress(cb: (target: ButtonComp) => void) {
|
|
25
|
-
this.onPress = cb
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
set enabled(val) {
|
|
29
|
-
this.node.instance.interactive = val
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class ProgressBarComp extends NoRenderComponentX {
|
|
34
|
-
mode = LoadingBarMode.BAR
|
|
35
|
-
private _progress: number
|
|
36
|
-
isReverse: boolean
|
|
37
|
-
|
|
38
|
-
get progress() {
|
|
39
|
-
return this._progress
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
set progress(val: number) {
|
|
43
|
-
this._progress = val
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export class LabelComp extends ComponentX {
|
|
49
|
-
font: string
|
|
50
|
-
string: string
|
|
51
|
-
size = 64
|
|
52
|
-
|
|
53
|
-
getString() {
|
|
54
|
-
if (this.node.instance instanceof Text) {
|
|
55
|
-
return this.node.instance.text
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
setString(val: string) {
|
|
60
|
-
if (this.node.instance instanceof Text) {
|
|
61
|
-
this.node.instance.text = val
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
getSize() {
|
|
66
|
-
if (this.node.instance instanceof Text) {
|
|
67
|
-
return this.node.instance.style.fontSize
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
setSize(val) {
|
|
71
|
-
if (this.node.instance instanceof Text) {
|
|
72
|
-
this.node.instance.style.fontSize = val
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
getFont() {
|
|
77
|
-
if (this.node.instance instanceof Text) {
|
|
78
|
-
return this.node.instance.style.fontFamily as string
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
setFont(val: string) {
|
|
83
|
-
// console.log('set font', val, Assets.get(val))
|
|
84
|
-
if (this.node.instance instanceof Text) {
|
|
85
|
-
if (Assets.get(val)) this.node.instance.style.fontFamily = Assets.get(val).family
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export class ScrollView extends ComponentX {
|
|
91
|
-
width: number
|
|
92
|
-
height: number
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export class BlockInputEventsComp extends NoRenderComponentX {}
|
|
96
|
-
|
|
97
|
-
export class ProgressTimerComp extends ComponentX {
|
|
98
|
-
spriteFrame: string
|
|
99
|
-
fillType: Values
|
|
100
|
-
fillRange: number
|
|
101
|
-
fillCenter: Point
|
|
102
|
-
isReverse: boolean
|
|
103
|
-
|
|
104
|
-
getFillRange() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export class
|
|
138
|
-
color: typeof Color4B
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
export class LabelShadowComp extends NoRenderComponentX {
|
|
143
|
-
color: typeof Color4B
|
|
144
|
-
blur: number
|
|
145
|
-
offset: Point
|
|
1
|
+
import { ComponentX, NoRenderComponentX } from '@safe-engine/core'
|
|
2
|
+
import { Assets, Container, Point, Text } from 'pixi.js'
|
|
3
|
+
|
|
4
|
+
import { Color4B } from '../core/Color'
|
|
5
|
+
import { LoadingBar, LoadingBarMode, ProgressTimer } from '../core/LoadingBar'
|
|
6
|
+
import { NodeComp } from './NodeComp'
|
|
7
|
+
|
|
8
|
+
// const _htmlTextParser = new HtmlTextParser()
|
|
9
|
+
export const FillType = {
|
|
10
|
+
HORIZONTAL: 0,
|
|
11
|
+
VERTICAL: 1,
|
|
12
|
+
RADIAL: 2,
|
|
13
|
+
}
|
|
14
|
+
type Keys = keyof typeof FillType
|
|
15
|
+
type Values = (typeof FillType)[Keys]
|
|
16
|
+
|
|
17
|
+
export class ButtonComp extends NoRenderComponentX<NodeComp> {
|
|
18
|
+
normalImage: string
|
|
19
|
+
selectedImage: string
|
|
20
|
+
disableImage: string
|
|
21
|
+
zoomScale: number
|
|
22
|
+
onPress: (target: ButtonComp) => void
|
|
23
|
+
|
|
24
|
+
setOnPress(cb: (target: ButtonComp) => void) {
|
|
25
|
+
this.onPress = cb
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set enabled(val) {
|
|
29
|
+
this.node.instance.interactive = val
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class ProgressBarComp extends NoRenderComponentX<NodeComp<LoadingBar>> {
|
|
34
|
+
mode = LoadingBarMode.BAR
|
|
35
|
+
private _progress: number
|
|
36
|
+
isReverse: boolean
|
|
37
|
+
|
|
38
|
+
get progress() {
|
|
39
|
+
return this._progress
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set progress(val: number) {
|
|
43
|
+
this._progress = val
|
|
44
|
+
this.node.instance.progress = val
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class LabelComp extends ComponentX<NodeComp<Text>> {
|
|
49
|
+
font: string
|
|
50
|
+
string: string
|
|
51
|
+
size = 64
|
|
52
|
+
|
|
53
|
+
getString() {
|
|
54
|
+
if (this.node.instance instanceof Text) {
|
|
55
|
+
return this.node.instance.text
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setString(val: string) {
|
|
60
|
+
if (this.node.instance instanceof Text) {
|
|
61
|
+
this.node.instance.text = val
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getSize() {
|
|
66
|
+
if (this.node.instance instanceof Text) {
|
|
67
|
+
return this.node.instance.style.fontSize
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
setSize(val) {
|
|
71
|
+
if (this.node.instance instanceof Text) {
|
|
72
|
+
this.node.instance.style.fontSize = val
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getFont() {
|
|
77
|
+
if (this.node.instance instanceof Text) {
|
|
78
|
+
return this.node.instance.style.fontFamily as string
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
setFont(val: string) {
|
|
83
|
+
// console.log('set font', val, Assets.get(val))
|
|
84
|
+
if (this.node.instance instanceof Text) {
|
|
85
|
+
if (Assets.get(val)) this.node.instance.style.fontFamily = Assets.get(val).family
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export class ScrollView extends ComponentX<NodeComp<Container>> {
|
|
91
|
+
width: number
|
|
92
|
+
height: number
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export class BlockInputEventsComp extends NoRenderComponentX<NodeComp<Container>> { }
|
|
96
|
+
|
|
97
|
+
export class ProgressTimerComp extends ComponentX<NodeComp<ProgressTimer>> {
|
|
98
|
+
spriteFrame: string
|
|
99
|
+
fillType: Values
|
|
100
|
+
fillRange: number
|
|
101
|
+
fillCenter: Point
|
|
102
|
+
isReverse: boolean
|
|
103
|
+
|
|
104
|
+
getFillRange() {
|
|
105
|
+
return this.node.instance.progress
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
setFillStart(val: number) {
|
|
109
|
+
this.node.instance.fillCenter.x = val
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
setFillRange(val: number) {
|
|
113
|
+
// console.log('setFillRange', this.node.instance);
|
|
114
|
+
this.node.instance.progress = val
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export class RichTextComp extends ComponentX<NodeComp<Text>> {
|
|
119
|
+
protected font: string
|
|
120
|
+
protected string: string
|
|
121
|
+
protected size: number
|
|
122
|
+
|
|
123
|
+
getString() {
|
|
124
|
+
return this.string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setString(val: string) {
|
|
128
|
+
this.string = val
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class LabelOutlineComp extends NoRenderComponentX<NodeComp> {
|
|
133
|
+
color: typeof Color4B
|
|
134
|
+
width: number
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class LabelShadowComp extends NoRenderComponentX<NodeComp> {
|
|
138
|
+
color: typeof Color4B
|
|
139
|
+
blur: number
|
|
140
|
+
offset: Point
|
|
146
141
|
}
|