Documentation ¶
Overview ¶
Package Model provides a post-compiled representation of the scripts.
Index ¶
- Constants
- type ActionModel
- type Actions
- type Aliases
- type CallbackModel
- type ClassModel
- type Classes
- type EnumModel
- type Enumerations
- type EventModel
- type EventModelCallbacks
- type Events
- type InstanceModel
- type Instances
- type ListenerModel
- type ListenerOptions
- type Model
- type ParserAction
- type PropertyModel
- type PropertyType
- type RankedStringIds
- type RelationModel
- type RelationStyle
- type Relations
- type SingleToPlural
- type Value
- type Values
Constants ¶
const ( NumProperty PropertyType = "NumProperty" TextProperty = "TextProperty" PointerProperty = "PointerProperty" EnumProperty = "EnumProperty" )
const ( OneToOne RelationStyle = "OneToOne" OneToMany = "OneToMany" ManyToOne = "ManyToOne" ManyToMany = "ManyToMany" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionModel ¶
type ActionModel struct { Id ident.Id `json:"id"` Name string `json:"name"` // Original Name EventId ident.Id `json:"event"` // Related Event NounTypes []ident.Id `json:"nouns"` // Classes DefaultActions []ident.Id `json:"actions"` // Callbacks }
func (ActionModel) String ¶
func (a ActionModel) String() string
type Actions ¶
type Actions map[ident.Id]*ActionModel
type Aliases ¶
type Aliases map[string]RankedStringIds
Aliases maps names typed by the player to ids.
type CallbackModel ¶
func (CallbackModel) String ¶
func (m CallbackModel) String() (ret string)
type ClassModel ¶
type ClassModel struct { Id ident.Id `json:"id"` Parents []ident.Id `json:"parents"` Plural string `json:"plural"` Singular string `json:"singular"` Properties []PropertyModel `json:"properties"` }
func (ClassModel) FindProperty ¶
func (cls ClassModel) FindProperty(name string) (ret *PropertyModel, okay bool)
func (ClassModel) GetProperty ¶
func (cls ClassModel) GetProperty(id ident.Id) (ret *PropertyModel, okay bool)
FindProperty does not search parent classes.
func (ClassModel) Parent ¶
func (cls ClassModel) Parent() (ret ident.Id)
func (ClassModel) String ¶
func (cls ClassModel) String() string
type Classes ¶
type Classes map[ident.Id]*ClassModel
type Enumerations ¶
type EventModel ¶
type EventModel struct { Id ident.Id `json:"id"` Name string `json:"name"` Capture EventModelCallbacks `json:"capture,omitempty"` Bubble EventModelCallbacks `json:"bubble,omitempty"` }
func (EventModel) String ¶
func (e EventModel) String() string
type EventModelCallbacks ¶
type EventModelCallbacks []ListenerModel
type Events ¶
type Events map[ident.Id]*EventModel
type InstanceModel ¶
type InstanceModel struct { Id ident.Id `json:"id"` Class ident.Id `json:"type"` Name string `json:"name"` Values Values `json:"values,omitempty"` }
func (*InstanceModel) GetId ¶
func (n *InstanceModel) GetId() ident.Id
func (*InstanceModel) GetOriginalName ¶
func (n *InstanceModel) GetOriginalName() string
func (*InstanceModel) GetParentClass ¶
func (n *InstanceModel) GetParentClass() ident.Id
func (*InstanceModel) String ¶
func (n *InstanceModel) String() string
type Instances ¶
type Instances map[ident.Id]*InstanceModel
type ListenerModel ¶
type ListenerModel struct { Instance, Class, Callback ident.Id // Game callback triggered by cb listener. Options ListenerOptions }
For scenes we dont want to bake these into the class or instances; its cheating, but for now using the same structure for class and instance. NOTE: Instance can be empty if its a class based listener. For the sake of sharing: Even though we listen to events, we point to the action.
func (ListenerModel) GetId ¶
func (cb ListenerModel) GetId() (ret ident.Id)
Return name of instance ( or class ).
func (ListenerModel) UseAfterQueue ¶
func (cb ListenerModel) UseAfterQueue() bool
UseAfterQueue if the listener wants to trigger after a successful event cycle.
func (ListenerModel) UseTargetOnly ¶
func (cb ListenerModel) UseTargetOnly() bool
UseTargetOnly if the listener wants callback only when directly targeted. ( ie. Event.Target == Event.CurrentTarget )
type ListenerOptions ¶
type ListenerOptions int
const ( EventTargetOnly ListenerOptions = 1 << iota EventQueueAfter EventPreventDefault )
type Model ¶
type Model struct { Actions Actions `json:"actions"` Classes Classes `json:"classes"` Enumerations Enumerations `json:"enums"` Events Events `json:"events"` Instances Instances `json:"instances"` Aliases Aliases `json:"aliases"` ParserActions []ParserAction `json:"parsings"` Relations Relations `json:"relation"` SingleToPlural SingleToPlural `json:"plurals"` }
Model: Compiled results of a sashimi story.
func (*Model) PrintModel ¶
type ParserAction ¶
ParserAction commands that beome an action
type PropertyModel ¶
type PropertyModel struct { Id ident.Id `json:"id"` Type PropertyType `json:"type"` Name string `json:"name"` // pointer, relation Relates ident.Id `json:"relates,omitempty"` // relation Relation ident.Id `json:"relation,omitempty"` // num, text, pointer, relation; but, not enum IsMany bool `json:"many,omitempty"` }
type PropertyType ¶
type PropertyType string
type RankedStringIds ¶
RankedStringIds allows a single name to map to multiple resources. Earlier resources are preferred in cases of conflict.
type RelationModel ¶
type RelationModel struct { Id ident.Id `json:"id"` // unique id Name string `json:"name"` // user specified name Style RelationStyle `json:"style"` Source ident.Id `json:"src"` // property ids Target ident.Id `json:"tgt"` // property ids }
Relation represents a property-pair. Each relation becomes one table.
func (RelationModel) String ¶
func (r RelationModel) String() string
type RelationStyle ¶
type RelationStyle string
type Relations ¶
type Relations map[ident.Id]*RelationModel