@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
package/src/helper/utils.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ComponentAddedEvent,
|
|
3
|
-
Constructor, EntityManager, EventManager, EventReceive,
|
|
4
|
-
System
|
|
5
|
-
} from 'entityx-ts'
|
|
6
|
-
|
|
7
|
-
import { ComponentX, NodeComp } from '..'
|
|
8
|
-
import { GameWorld } from '../gworld'
|
|
9
|
-
|
|
10
|
-
export function registerSystem<T extends ComponentX>(component: Constructor<T>) {
|
|
11
|
-
if (GameWorld.Instance.systems.isRegistered(`${component.name}System`)) {
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
class NewSystem implements System {
|
|
15
|
-
configure(event_manager: EventManager) {
|
|
16
|
-
console.log('configure registerSystem', component.name)
|
|
17
|
-
event_manager.subscribe(ComponentAddedEvent(component), this)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
receive(type: string, event: EventReceive) {
|
|
21
|
-
switch (type) {
|
|
22
|
-
case ComponentAddedEvent(component): {
|
|
23
|
-
const ett = event.entity
|
|
24
|
-
const newComp: any = ett.getComponent(component)
|
|
25
|
-
newComp.node = ett.getComponent(NodeComp)
|
|
26
|
-
break
|
|
27
|
-
}
|
|
28
|
-
default:
|
|
29
|
-
break
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
update(entities: EntityManager, events: EventManager, dt: number) {
|
|
33
|
-
for (const entt of entities.entities_with_components(component)) {
|
|
34
|
-
const comp = entt.getComponent(component)
|
|
35
|
-
// console.log('comp', comp.constructor.name, typeof comp['update'] === 'function')
|
|
36
|
-
if (comp.node.active && typeof comp['update'] === 'function') {
|
|
37
|
-
comp['update'](dt)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
Object.defineProperty(NewSystem, 'name', { value: `${component.name}System` })
|
|
43
|
-
GameWorld.Instance.systems.add(NewSystem)
|
|
44
|
-
GameWorld.Instance.systems.configureOnce(NewSystem)
|
|
45
|
-
GameWorld.Instance.listUpdate.push(NewSystem)
|
|
46
|
-
return NewSystem
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function instantiate<T>(ComponentType: Constructor<T>, data?: any): T {
|
|
50
|
-
return (ComponentType as any).create(data)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class Size {
|
|
54
|
-
constructor(width, height) {
|
|
55
|
-
this.width = width
|
|
56
|
-
this.height = height
|
|
57
|
-
}
|
|
58
|
-
width: number
|
|
59
|
-
height: number
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function size(width: number, height: number) {
|
|
63
|
-
return new Size(width, height)
|
|
64
|
-
}
|