75 lines
1.9 KiB
Go
75 lines
1.9 KiB
Go
package entity
|
|
|
|
import (
|
|
"mongo.games.com/game/gamesrv/slotspkg/internal/generic/key"
|
|
"mongo.games.com/game/gamesrv/slotspkg/internal/module/shared"
|
|
"mongo.games.com/game/gamesrv/slotspkg/slots/desc"
|
|
)
|
|
|
|
// PrepareNodeDesc prepares node desc for current node
|
|
func (e *Entity) PrepareNodeDesc() {
|
|
e.NodeDesc = e.GetCursorNodeDesc()
|
|
}
|
|
|
|
// PrepareNextNodeDesc prepares node desc for current node
|
|
func (e *Entity) PrepareNextNodeDesc() {
|
|
e.NextNodeDesc = e.GetNodeDesc(e.NextNode())
|
|
}
|
|
|
|
func (e *Entity) Desc() *desc.NodeDesc {
|
|
return e.NodeDesc
|
|
}
|
|
|
|
// NewNodeDesc creates new NodeDesc
|
|
func (e *Entity) NewNodeDesc(node *shared.Node) *desc.NodeDesc {
|
|
theme := e.Theme
|
|
category := key.Base
|
|
nodeType := node.GetType()
|
|
class := node.GetClass()
|
|
return desc.NewNodeDesc(theme, category, nodeType, class, e.Shell)
|
|
}
|
|
|
|
func (e *Entity) NewNodeDescWithNodeType(nodeType string) *desc.NodeDesc {
|
|
node := e.CursorNode()
|
|
theme := e.Theme
|
|
category := key.Base
|
|
class := node.GetClass()
|
|
return desc.NewNodeDesc(theme, category, nodeType, class, e.Shell)
|
|
}
|
|
|
|
// GetCursorNodeDesc gets node desc for specific node with cheating
|
|
func (e *Entity) GetCursorNodeDesc() *desc.NodeDesc {
|
|
n := e.NewNodeDesc(e.CursorNode())
|
|
|
|
if !e.CheatFormationSeqsDesc(n) {
|
|
e.SelectFormationSeqsDesc(n)
|
|
}
|
|
|
|
return n
|
|
}
|
|
|
|
// GetNodeDesc gets node desc for specific node
|
|
func (e *Entity) GetNodeDesc(node *shared.Node) *desc.NodeDesc {
|
|
n := e.NewNodeDesc(node)
|
|
e.SelectFormationSeqsDesc(n)
|
|
return n
|
|
}
|
|
|
|
func (e *Entity) CheatFormationSeqsDesc(n *desc.NodeDesc) bool {
|
|
v, ok := e.Data[key.MachineFormationSeqsDesc]
|
|
if !ok {
|
|
return false
|
|
}
|
|
nodeType := v.(string)
|
|
if nodeType == "" {
|
|
return false
|
|
}
|
|
n.FormationSeqsDesc = n.GetFormationSeqDescs(nodeType)
|
|
delete(e.Data, key.MachineFormationSeqsDesc)
|
|
return true
|
|
}
|
|
|
|
func (e *Entity) SelectFormationSeqsDesc(n *desc.NodeDesc) {
|
|
n.FormationSeqsDesc = n.GetFormationSeqDescs(n.NodeType)
|
|
}
|