event

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2018 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionString

func ActionString(a Action) string

ActionString acts for action.String() in declarative mode.

Types

type Action

type Action interface{}

Action is a client action.

type Cast

type Cast struct {
	AbilityID ulid.ID
	Source    ulid.ID
	Targets   []ulid.ID
	Position  geometry.Vec3
}

Cast represents a ability launch.

type E

type E struct {
	ID     ulid.ID
	TS     time.Time
	Source ulid.ID
	Action Action
}

E is a game event triggered by an entity or mechanic.

type Feedback

type Feedback struct {
	AbilityID ulid.ID
	Source    ulid.ID
	Target    ulid.ID
}

Feedback represents a ability feedback of ability run by Source on target.

type Listener

type Listener struct {
	ID     ulid.ID // ID aliases a token ID OR an entity ID
	Action QAction
	Pool   ulid.ID
}

Listener requires the receiver to create a new listener with subject ID.

type ListenerMapper

type ListenerMapper interface {
	SetListener(Listener) error
	GetListener(ListenerSubset) (Listener, error)
	DelListener(ListenerSubset) error
}

ListenerMapper handle listener data interactions.

type ListenerSubset

type ListenerSubset struct {
	ID ulid.ID
}

ListenerSubset retrieves listener per ID.

type Mapper

type Mapper interface {
	SetEvent(E, ulid.ID) error
	ListEvent(Subset) ([]E, error)
}

Mapper wraps action interactions.

type Message

type Message = redis.Message

Message alias a redis message.

type Move

type Move struct {
	Source   ulid.ID
	Target   ulid.ID
	Position geometry.Vec3
}

Move represents a unit move.

type QAction

type QAction uint8

QAction is an action required for a queue.

const (
	// Open requires the queue to open.
	Open QAction = 0
	// Close requires the queue to close.
	Close QAction = 1
)

type QListenerMapper

type QListenerMapper interface {
	PublishListener(Listener, ulid.ID) error
	SubscribeListener(ulid.ID) *Subscription
}

QListenerMapper handles send/receive methods for listeners.

type QMapper

type QMapper interface {
	PublishEvent(E, ulid.ID) error
	SubscribeEvent(ulid.ID) *Subscription
}

QMapper must be implemented by a queue.

type QRecurrerMapper

type QRecurrerMapper interface {
	PublishRecurrer(Recurrer, ulid.ID) error
	SubscribeRecurrer(ulid.ID) *Subscription
}

QRecurrerMapper handles send/receive methods for recurrers.

type Recurrer

type Recurrer struct {
	TokenID  ulid.ID
	EntityID ulid.ID
	Action   QAction
	Pool     ulid.ID
}

Recurrer requires the receiver to create a new recurrer with subject ID.

type RecurrerMapper

type RecurrerMapper interface {
	SetRecurrer(Recurrer) error
	GetRecurrer(RecurrerSubset) (Recurrer, error)
	DelRecurrer(RecurrerSubset) error
}

RecurrerMapper handles set/get methods for recurrers.

type RecurrerSubset

type RecurrerSubset struct {
	TokenID ulid.ID
}

RecurrerSubset retrieves recurrer by Token ID.

type Subscription

type Subscription = redis.PubSub

Subscription alias a redis subscription.

type Subset

type Subset struct {
	Key string
	Min int64
}

Subset is a subset for actions. Internally usage done with ZRangeWithScores.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL