@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.
Files changed (45) hide show
  1. package/dist/app.d.ts +3 -2
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +41 -81
  4. package/dist/components/GUIComponent.d.ts +15 -14
  5. package/dist/components/GUIComponent.d.ts.map +1 -1
  6. package/dist/components/GUIComponent.js +68 -138
  7. package/dist/components/NodeComp.d.ts +7 -6
  8. package/dist/components/NodeComp.d.ts.map +1 -1
  9. package/dist/components/NodeComp.js +223 -305
  10. package/dist/components/RenderComponent.d.ts +8 -7
  11. package/dist/components/RenderComponent.d.ts.map +1 -1
  12. package/dist/components/RenderComponent.js +25 -56
  13. package/dist/core/Color.js +1 -1
  14. package/dist/core/LoadingBar.d.ts +9 -1
  15. package/dist/core/LoadingBar.d.ts.map +1 -1
  16. package/dist/core/LoadingBar.js +50 -46
  17. package/dist/core/Size.js +3 -6
  18. package/dist/helper/html-text-parser.js +34 -34
  19. package/dist/helper/utils.d.ts +2 -8
  20. package/dist/helper/utils.d.ts.map +1 -1
  21. package/dist/helper/utils.js +22 -46
  22. package/dist/index.d.ts +4 -6
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -18
  25. package/dist/systems/GUISystem.d.ts +3 -4
  26. package/dist/systems/GUISystem.d.ts.map +1 -1
  27. package/dist/systems/GUISystem.js +67 -89
  28. package/dist/systems/RenderSystem.d.ts +1 -3
  29. package/dist/systems/RenderSystem.d.ts.map +1 -1
  30. package/dist/systems/RenderSystem.js +51 -85
  31. package/package.json +4 -4
  32. package/src/app.ts +53 -51
  33. package/src/components/GUIComponent.ts +140 -145
  34. package/src/components/NodeComp.ts +416 -409
  35. package/src/components/RenderComponent.ts +7 -6
  36. package/src/core/LoadingBar.ts +63 -33
  37. package/src/index.ts +4 -6
  38. package/src/systems/GUISystem.ts +67 -82
  39. package/src/systems/RenderSystem.ts +70 -100
  40. package/tsconfig.json +1 -1
  41. package/src/components/EnhancedComponent.ts +0 -57
  42. package/src/core/Scene.ts +0 -17
  43. package/src/core/decorator.ts +0 -18
  44. package/src/gworld.ts +0 -17
  45. package/src/helper/utils.ts +0 -64
@@ -1,146 +1,141 @@
1
- import { Assets, Point, Text } from 'pixi.js'
2
-
3
- import { Color4B } from '../core/Color'
4
- import { ComponentX, NoRenderComponentX } from '../core/decorator'
5
- import { LoadingBar, LoadingBarMode } from '../core/LoadingBar'
6
- import { HtmlTextParser } from '../helper/html-text-parser'
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
- ;(this.node.instance as LoadingBar).progress = val
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
- // if (this.node.instance instanceof cc.ProgressTimer) {
106
- // return this.node.instance.getPercentage() * 0.01
107
- // }
108
- }
109
-
110
- setFillStart(val: number) {
111
- // if (this.node.instance instanceof cc.ProgressTimer) {
112
- // this.node.instance.setMidpoint(Vec2(val, val))
113
- // }
114
- }
115
-
116
- setFillRange(val: number) {
117
- // if (this.node.instance instanceof cc.ProgressTimer) {
118
- // this.node.instance.setPercentage(val * 100)
119
- // }
120
- }
121
- }
122
-
123
- export class RichTextComp extends ComponentX {
124
- protected font: string
125
- protected string: string
126
- protected size: number
127
-
128
- getString() {
129
- return this.string
130
- }
131
-
132
- setString(val: string) {
133
- this.string = val
134
- }
135
- }
136
-
137
- export class LabelOutlineComp extends NoRenderComponentX {
138
- color: typeof Color4B
139
- width: number
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
  }