Documentation ¶
Index ¶
- func ComponentTypeMap() map[string]uint64
- func SaveComponent(history *[]ComponentHistory, c chan ComponentHistory, doneChan chan bool)
- type ActionProcessor
- type AvroSchema
- type ComponentHistory
- type ComponentType
- type ComponentWithIdAndType
- type Componenter
- type Entity
- type EntityID
- type EntityListener
- type EventListener
- type EventSequencePhase
- type EventTracker
- type EventType
- type Eventer
- type Game
- func (g *Game) CreateEntity() EntityID
- func (g *Game) GetComponent(entityID EntityID, componentType ComponentType) Componenter
- func (g *Game) GetGameUUID() string
- func (g *Game) GetHistoryLen() int
- func (g *Game) GetOperator(operator OperatorType) Operator
- func (g *Game) GetRuleSection(section SectionType) Ruler
- func (g *Game) Init()
- func (g *Game) RegisterOperator(operator OperatorType, op Operator)
- func (g *Game) RegisterRuleSection(section SectionType, rule Rule)
- func (g *Game) Run()
- func (g *Game) SaveHistory()
- func (g *Game) SetComponent(entityID EntityID, component Componenter)
- func (g *Game) Terminate()
- type GameDataView
- type GameEventSequence
- type GameTime
- type InitializableRecorder
- type KeyValue
- type Operator
- type OperatorNode
- type OperatorRegistry
- type OperatorType
- type Recorder
- type Rule
- type RuleList
- type RuleRegistry
- type RuleSection
- type Ruler
- type SectionType
- type TimedEvent
- type Timeline
- func (t *Timeline) AddEventListener(e EventType, p EventSequencePhase, l EventListener)
- func (t *Timeline) AddTracker(e EventType, p EventSequencePhase, l EventTracker)
- func (t *Timeline) PopEvent() Eventer
- func (t *Timeline) Resolve()
- func (t *Timeline) RunNextEvent()
- func (t *Timeline) ScheduleEvent(e Eventer, time GameTime)
- func (t *Timeline) SetRecorder(r InitializableRecorder)
- func (t *Timeline) StackEvent(e Eventer)
- type TimelineHistory
- type TrackerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentTypeMap ¶
func SaveComponent ¶
func SaveComponent(history *[]ComponentHistory, c chan ComponentHistory, doneChan chan bool)
Types ¶
type ActionProcessor ¶
type AvroSchema ¶
type AvroSchema string
type ComponentHistory ¶
type ComponentHistory struct { HistoryId uint64 EventSequence GameEventSequence EntityID EntityID Component Componenter }
type ComponentType ¶
type ComponentType string
type ComponentWithIdAndType ¶
type ComponentWithIdAndType struct { ComponentType ComponentType Component Componenter }
type Componenter ¶
type Componenter interface {
GetComponentType() ComponentType
}
type EntityListener ¶
type EntityListener interface { // OnEntityAdded is called when an entity is added. // entityID is the unique identifier of the added entity. OnEntityAdded(entityID EntityID) // OnEntityRemoved is called when an entity is removed. // entityID is the unique identifier of the removed entity. OnEntityRemoved(entityID EntityID) // OnComponentAdded is called when a component is added to an entity. // entityID is the unique identifier of the entity. // componentTypeID is the unique identifier of the component type. // component is the instance of the added component. OnComponentAdded(entityID EntityID, componentType ComponentType, component any) // OnComponentRemoved is called when a component is removed from an entity. // entityID is the unique identifier of the entity. // componentTypeID is the unique identifier of the component type. OnComponentRemoved(entityID EntityID, componentType ComponentType) }
EntityListener is an interface that defines methods for responding to changes in entities and their components. Implementers of this interface can handle events when entities are added or removed, and when components are added or removed from entities.
type EventListener ¶
type EventListener interface {
On(ev Eventer, phase EventSequencePhase, t *Timeline)
}
type EventSequencePhase ¶
type EventSequencePhase int
const ( OnSchedule EventSequencePhase = 0 OnCancel EventSequencePhase = 1 OnStack EventSequencePhase = 2 OnPop EventSequencePhase = 3 OnStackCancel EventSequencePhase = 4 OnEvent EventSequencePhase = 5 After EventSequencePhase = 6 )
type EventTracker ¶
type EventTracker interface { GetType() TrackerType GetSchema() AvroSchema Track(seq GameEventSequence, ev Eventer, phase EventSequencePhase, gdv GameDataView, rec Recorder) }
type Game ¶
func (*Game) CreateEntity ¶
func (*Game) GetComponent ¶
func (g *Game) GetComponent(entityID EntityID, componentType ComponentType) Componenter
func (*Game) GetGameUUID ¶
func (*Game) GetHistoryLen ¶
func (*Game) GetOperator ¶
func (g *Game) GetOperator(operator OperatorType) Operator
func (*Game) GetRuleSection ¶
func (g *Game) GetRuleSection(section SectionType) Ruler
func (*Game) RegisterOperator ¶
func (g *Game) RegisterOperator(operator OperatorType, op Operator)
func (*Game) RegisterRuleSection ¶
func (g *Game) RegisterRuleSection(section SectionType, rule Rule)
func (*Game) SaveHistory ¶
func (g *Game) SaveHistory()
func (*Game) SetComponent ¶
func (g *Game) SetComponent(entityID EntityID, component Componenter)
type GameDataView ¶
type GameDataView interface { GetGameUUID() string GetComponent(entityID EntityID, componentType ComponentType) Componenter }
type GameEventSequence ¶
type GameEventSequence uint64
type InitializableRecorder ¶
type InitializableRecorder interface { Init(trackertype TrackerType, schema AvroSchema) Record(trackertype TrackerType, entityID any) }
type Operator ¶
type Operator interface {
Evaluate(OperatorNode) bool
}
type OperatorNode ¶
type OperatorNode struct { Operator string `json:"operator"` Children []OperatorNode }
type OperatorRegistry ¶
type OperatorRegistry struct {
Operators map[OperatorType]Operator
}
type OperatorType ¶
type OperatorType string
type Recorder ¶
type Recorder interface { // Init(trackertype TrackerType, schema AvroSchema) Record(trackertype TrackerType, entityID any) }
type RuleList ¶
type RuleList struct {
Sections []RuleSection `json:"sections"`
}
type RuleRegistry ¶
type RuleRegistry struct {
// contains filtered or unexported fields
}
func (*RuleRegistry) GetOperator ¶
func (r *RuleRegistry) GetOperator(operator OperatorType) Operator
func (*RuleRegistry) GetRuleSection ¶
func (r *RuleRegistry) GetRuleSection(section SectionType) Ruler
func (*RuleRegistry) RegisterOperator ¶
func (r *RuleRegistry) RegisterOperator(operator OperatorType, op Operator)
func (*RuleRegistry) RegisterRuleSection ¶
func (r *RuleRegistry) RegisterRuleSection(section SectionType, rule Rule)
type RuleSection ¶
type SectionType ¶
type SectionType string
type TimedEvent ¶
type Timeline ¶
type Timeline struct { CurrentSequence GameEventSequence CurrentTime GameTime Game *Game // contains filtered or unexported fields }
func (*Timeline) AddEventListener ¶
func (t *Timeline) AddEventListener(e EventType, p EventSequencePhase, l EventListener)
func (*Timeline) AddTracker ¶
func (t *Timeline) AddTracker(e EventType, p EventSequencePhase, l EventTracker)
func (*Timeline) RunNextEvent ¶
func (t *Timeline) RunNextEvent()
func (*Timeline) ScheduleEvent ¶
func (*Timeline) SetRecorder ¶
func (t *Timeline) SetRecorder(r InitializableRecorder)
func (*Timeline) StackEvent ¶
type TimelineHistory ¶
type TimelineHistory struct { EventSequence GameEventSequence EventSequencePhase EventSequencePhase Eventer Eventer }
type TrackerType ¶
type TrackerType string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.