-
Notifications
You must be signed in to change notification settings - Fork 0
/
itfc.go
54 lines (48 loc) · 1.18 KB
/
itfc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package ecs
import (
"github.com/15mga/kiwi/ds"
"github.com/15mga/kiwi/util"
)
type IComponent interface {
Entity() *Entity
setEntity(entity *Entity)
Type() TComponent
// Init 添加到Entity时调用
Init()
// Start Entity添加到Scene时调用
Start()
Dispose()
}
type ISystem interface {
Type() TSystem
Frame() *Frame
Scene() *Scene
FrameBefore() *ds.FnLink
FrameAfter() *ds.FnLink
OnBeforeStart()
OnStart(frame *Frame)
OnAfterStart()
OnStop()
OnUpdate()
PutJob(name JobName, data ...any)
DoJob(name JobName)
BindJob(name JobName, handler util.FnAnySlc)
BindPJob(name JobName, fn util.FnAnySlc)
BindPFnJob(name JobName, fn FnLinkAnySlc)
PTagComponents(tag string, fn func(IComponent)) ([]IComponent, bool)
PTagComponentsWithParams(tag string, fn func(IComponent, []any), params ...any) ([]IComponent, bool)
PTagComponentsToFnLink(tag string, fn func(IComponent, *ds.FnLink)) ([]IComponent, bool)
PTagComponentsToFnLinkWithParams(tag string, fn func(IComponent, []any, *ds.FnLink), params ...any) ([]IComponent, bool)
}
type IEvent interface {
Type() TEvent
}
type (
TJob uint8
FnLinkAnySlc func(*ds.FnLink, []any)
)
const (
JobDef TJob = iota
JobP
JobPLink
)