mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-12 18:52:27 +08:00
实现更多的触发器
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
)
|
||||
|
||||
type DbSceneGroup struct {
|
||||
VariableMap map[string]int32
|
||||
KillConfigMap map[uint32]bool
|
||||
GadgetStateMap map[uint32]uint8
|
||||
}
|
||||
|
||||
type DbScene struct {
|
||||
SceneId uint32
|
||||
UnlockPointMap map[uint32]bool
|
||||
SceneGroupMap map[uint32]*DbSceneGroup
|
||||
}
|
||||
|
||||
type DbWorld struct {
|
||||
@@ -31,6 +39,7 @@ func NewScene(sceneId uint32) *DbScene {
|
||||
r := &DbScene{
|
||||
SceneId: sceneId,
|
||||
UnlockPointMap: make(map[uint32]bool),
|
||||
SceneGroupMap: make(map[uint32]*DbSceneGroup),
|
||||
}
|
||||
return r
|
||||
}
|
||||
@@ -70,3 +79,59 @@ func (s *DbScene) CheckPointUnlock(pointId uint32) bool {
|
||||
_, exist := s.UnlockPointMap[pointId]
|
||||
return exist
|
||||
}
|
||||
|
||||
func (s *DbScene) GetSceneGroupById(groupId uint32) *DbSceneGroup {
|
||||
dbSceneGroup, exist := s.SceneGroupMap[groupId]
|
||||
if !exist {
|
||||
dbSceneGroup = &DbSceneGroup{
|
||||
VariableMap: make(map[string]int32),
|
||||
KillConfigMap: make(map[uint32]bool),
|
||||
GadgetStateMap: make(map[uint32]uint8),
|
||||
}
|
||||
s.SceneGroupMap[groupId] = dbSceneGroup
|
||||
}
|
||||
return dbSceneGroup
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) GetVariableByName(name string) int32 {
|
||||
return g.VariableMap[name]
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) SetVariable(name string, value int32) {
|
||||
g.VariableMap[name] = value
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) CheckVariableExist(name string) bool {
|
||||
_, exist := g.VariableMap[name]
|
||||
return exist
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) AddKill(configId uint32) {
|
||||
g.KillConfigMap[configId] = true
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) CheckIsKill(configId uint32) bool {
|
||||
_, exist := g.KillConfigMap[configId]
|
||||
return exist
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) RemoveAllKill() {
|
||||
g.KillConfigMap = make(map[uint32]bool)
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) GetGadgetState(configId uint32) uint8 {
|
||||
state, exist := g.GadgetStateMap[configId]
|
||||
if !exist {
|
||||
return constant.GADGET_STATE_DEFAULT
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) ChangeGadgetState(configId uint32, state uint8) {
|
||||
g.GadgetStateMap[configId] = state
|
||||
}
|
||||
|
||||
func (g *DbSceneGroup) CheckGadgetExist(configId uint32) bool {
|
||||
_, exist := g.GadgetStateMap[configId]
|
||||
return exist
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user