/
unsafe_component.go
68 lines (55 loc) · 1.45 KB
/
unsafe_component.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package ec
import (
"git.golaxy.org/core/event"
"git.golaxy.org/core/util/uid"
"reflect"
)
// Deprecated: UnsafeComponent 访问组件内部函数
func UnsafeComponent(comp Component) _UnsafeComponent {
return _UnsafeComponent{
Component: comp,
}
}
type _UnsafeComponent struct {
Component
}
// Init 初始化
func (uc _UnsafeComponent) Init(name string, entity Entity, composite Component) {
uc.init(name, entity, composite)
}
// SetId 设置Id
func (uc _UnsafeComponent) SetId(id uid.Id) {
uc.setId(id)
}
// SetFixed 设置为固定的(不可删除)
func (uc _UnsafeComponent) SetFixed(v bool) {
uc.setFixed(v)
}
// GetFixed 获取是否为固定的(不可删除)
func (uc _UnsafeComponent) GetFixed() bool {
return uc.getFixed()
}
// SetState 设置状态
func (uc _UnsafeComponent) SetState(state ComponentState) {
uc.setState(state)
}
// SetReflected 设置反射值
func (uc _UnsafeComponent) SetReflected(v reflect.Value) {
uc.setReflected(v)
}
// GetReflected 获取反射值
func (uc _UnsafeComponent) GetReflected() reflect.Value {
return uc.getReflected()
}
// GetComposite 获取扩展者
func (uc _UnsafeComponent) GetComposite() Component {
return uc.getComposite()
}
// EventComponentDestroySelf 事件:组件销毁自身
func (uc _UnsafeComponent) EventComponentDestroySelf() event.IEvent {
return uc.eventComponentDestroySelf()
}
// CleanHooks 清理所有的托管hook
func (uc _UnsafeComponent) CleanHooks() {
uc.cleanHooks()
}