ingamemodel

package
v0.0.0-...-523d496 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionState

type ConnectionState int

ConnectionState is a connection state of game user

const (
	Ready ConnectionState = iota
	Active
	Disconnected
)

type GameClient

type GameClient struct {
	Info       GameClientInfo       `json:"info"`
	IngameInfo IngameInfo           `json:"ingame_info"`
	Conn       GameClientConnection `json:"conn"`
}

GameClientInfo user client data type in game

func ActivateClient

func ActivateClient(userID uint32) (GameClient, error)

ActivateClient Activate client

func NewGameClient

func NewGameClient() GameClient

NewGameClient creates game client already registered

type GameClientConnection

type GameClientConnection struct {
	ConnState ConnectionState `json:"conn_state"`
}

GameClientConnection

type GameClientInfo

type GameClientInfo struct {
	UserID   uint32 `json:"user_id"`
	Username string `json:"username"`
}

GameClientInfo

type GameMethod

type GameMethod struct {
	MethodType GemeMethodType `json:"method"`
	Content    string         `json:"content"`
}

type GameReq

type GameReq struct {
	Session     model.Session `json:"session"`
	GameMethods []GameMethod  `json:"methods"`
}

type GameRes

type GameRes struct {
	//Status   model.StatusRes `json:"status"`
	Response []GameResUnit `json:"response"`
}

type GameResUnit

type GameResUnit struct {
	UserID  uint32       `json:"user_id"`
	Methods []GameMethod `json:"methods"`
}

type GemeMethodType

type GemeMethodType int
const (
	//Game Request Type: ReqType
	Idle GemeMethodType = iota //Enter World
	EnterWorld
	ExitWorld
	Chat
	Move
	GetIngameClientsInfo // server -> client only
)

type IngameInfo

type IngameInfo struct {
	Transform Transform `json:"transform"`
}

func NewIngameInfo

func NewIngameInfo() IngameInfo

type Transform

type Transform struct {
	Position Vector3 `json:"position,string"`
	Rotation Vector3 `json:"rotation,string"`
}

Transform user location, rotation

func NewTransform

func NewTransform(position Vector3, rotation Vector3) Transform

type Vector3

type Vector3 struct {
	X float32
	Y float32
	Z float32
}

Vevtor3 (x,y,z)

func NewVector3

func NewVector3(x, y, z float32) Vector3

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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