package field
import "github.com/Diarkis/diarkis/client/go/modules/field"
Index
-
type Field
- func NewFieldAsTCP(tcpClient *tcp.Client) *Field
- func NewFieldAsUDP(udpClient *udp.Client) *Field
- func (f *Field) Disappear()
- func (f *Field) Join(x, y, z int64, syncLimit uint16, filterID uint8, msg []byte, reliable bool)
- func (f *Field) Leave(reliable bool)
- func (f *Field) OnDisappear(cb func(string))
- func (f *Field) OnJoin(cb func(msg []byte))
- func (f *Field) OnLeave(cb func([]byte))
- func (f *Field) OnReconnect(cb func())
- func (f *Field) OnSync(cb func(msg []byte))
- func (f *Field) SetupAsTCP(tcpClient *tcp.Client) bool
- func (f *Field) SetupAsUDP(udpClient *udp.Client) bool
- func (f *Field) Sync(x, y, z int64, syncLimit uint16, filterID uint8, msg []byte, reliable bool)
Types
type Field
type Field struct { }
Field represents Diarkis Field client
func NewFieldAsTCP
func NewFieldAsTCP(tcpClient *tcp.Client) *Field
NewFieldAsTCP creates a Diarkis Field client as TCP
func NewFieldAsUDP
func NewFieldAsUDP(udpClient *udp.Client) *Field
NewFieldAsUDP creates a Diarkis Field client as UDP
func (*Field) Disappear
func (f *Field) Disappear()
Disappear sends out disappear to users in view.
func (*Field) Join
func (f *Field) Join(x, y, z int64, syncLimit uint16, filterID uint8, msg []byte, reliable bool)
Join sends join data to the server. Joins a Diarkis field. - x: current x-coordinate of the client - y: current y-coordinate of the client - z: current z-coordinate of the client - syncLimit: number of synchronization - filterID: unique ID of the custom filter to be applied for this user's synchronization process. - msg: message to send with sync request - reliable: whether or not to use reliable UDP on UDP connection
func (*Field) Leave
func (f *Field) Leave(reliable bool)
Leave sends leave data to the server. Leaves from the field you have joined - reliable: whether or not to use reliable UDP on UDP connection
func (*Field) OnDisappear
func (f *Field) OnDisappear(cb func(string))
OnDisappear assigns a callback to be invoked upon field disappear event The callback is called with the following arguments: - msg: message from server upon field sync
func (*Field) OnJoin
func (f *Field) OnJoin(cb func(msg []byte))
OnJoin assigns a callback to be invoked upon field join event The callback is called with the following arguments: - msg: message from server upon field sync
func (*Field) OnLeave
func (f *Field) OnLeave(cb func([]byte))
OnLeave assigns a callback to be invoked upon field leave event The callback is called with the following arguments: - msg: message from server upon field leave
func (*Field) OnReconnect
func (f *Field) OnReconnect(cb func())
OnReconnect assigns a callback to re-connect event
func (*Field) OnSync
func (f *Field) OnSync(cb func(msg []byte))
OnSync assigns a callback to be invoked upon field sync event The callback is called with the following arguments: - msg: message from server upon field sync
func (*Field) SetupAsTCP
func (f *Field) SetupAsTCP(tcpClient *tcp.Client) bool
SetupAsTCP sets up Diarkis Field client as TCP
func (*Field) SetupAsUDP
func (f *Field) SetupAsUDP(udpClient *udp.Client) bool
SetupAsUDP sets up Diarkis Field client as UDP
func (*Field) Sync
func (f *Field) Sync(x, y, z int64, syncLimit uint16, filterID uint8, msg []byte, reliable bool)
Sync synchronizes a connected field client with the given parameters - x: current x-coordinate of the client - y: current y-coordinate of the client - z: current z-coordinate of the client - syncLimit: number of synchronization - filterID: unique ID of the custom filter to be applied for this user's synchronization process. - msg: message to send with sync request - reliable: whether or not to use reliable UDP on UDP connection