Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Events ¶
type Events[T any] struct { // contains filtered or unexported fields }
func (*Events[T]) AddListener ¶
func (e *Events[T]) AddListener(listeners ...PacketHandler[T])
AddListener adds a listener to the event. The listener will be called when the packet with the same ID is received. The listener will be called in the order of priority. The listeners cannot have multiple same ID.
func (*Events[T]) AddTicker ¶
func (e *Events[T]) AddTicker(tickers ...TickHandler[T])
func (*Events[T]) GetHandlers ¶
func (e *Events[T]) GetHandlers(id int32) *HandlerHeap[T]
type HandlerHeap ¶
type HandlerHeap[T any] []PacketHandler[T]
HandlerHeap is PriorityQueue<PacketHandlerFunc>
func (HandlerHeap[T]) Len ¶
func (h HandlerHeap[T]) Len() int
func (HandlerHeap[T]) Less ¶
func (h HandlerHeap[T]) Less(i, j int) bool
func (*HandlerHeap[T]) Pop ¶
func (h *HandlerHeap[T]) Pop() interface{}
func (*HandlerHeap[T]) Push ¶
func (h *HandlerHeap[T]) Push(x interface{})
func (HandlerHeap[T]) Swap ¶
func (h HandlerHeap[T]) Swap(i, j int)
type PacketHandler ¶
type PacketQueue ¶
type PacketQueue struct {
// contains filtered or unexported fields
}
func NewPacketQueue ¶
func NewPacketQueue() (p *PacketQueue)
func (*PacketQueue) Close ¶
func (p *PacketQueue) Close()
func (*PacketQueue) Push ¶
func (p *PacketQueue) Push(packet pk.Packet)
type TickHandler ¶
Click to show internal directories.
Click to hide internal directories.