common

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

common.go

Index

Constants

View Source
const (
	// tick milliseconds
	TickInterval = int64(100)
	// queue service channel capacity
	QueueCapacity = int(10000)
	// check interval to broadcast position in queue. in seconds
	QueueCheckInterval = int64(2)
)

QueueService const config

View Source
const (
	// Listen port
	Port = ":9001"
	// simulate validate token sleep time in milliseconds
	ValidateTokenSleep = int64(100)
)

TcpServer const

View Source
const (
	// max online player count
	MaxOnline int32 = 20000
)

======================================================================= constant config start you can modify these const ======================================================================= PlayerManager const config

Variables

This section is empty.

Functions

func GetNowTimeMilli

func GetNowTimeMilli() int64

----------------------------------------------------------- utils

func Hash

func Hash(s string) uint32

func NextGuid

func NextGuid() uint64

func PlayerManagerIns

func PlayerManagerIns() *playerManager

Types

type MsgWrap

type MsgWrap struct {
	// contains filtered or unexported fields
}

func NewMsgWrap

func NewMsgWrap(session *Session, data proto.ProtoMessage) *MsgWrap

func (*MsgWrap) Data

func (m *MsgWrap) Data() proto.ProtoMessage

func (*MsgWrap) Session

func (m *MsgWrap) Session() *Session

type Player

type Player struct {
	// contains filtered or unexported fields
}

----------------------------------------------------------- just a sample

func NewPlayer

func NewPlayer(roleId int64, accId string) *Player

func (*Player) AccId

func (p *Player) AccId() string

func (*Player) RoleId

func (p *Player) RoleId() int64

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conn net.Conn, obj interface{}, rw *bufio.ReadWriter) *Session

func (*Session) Conn

func (s *Session) Conn() net.Conn

func (*Session) Id

func (s *Session) Id() uint64

func (*Session) Obj

func (s *Session) Obj() interface{}

func (*Session) ReaderWriter

func (s *Session) ReaderWriter() *bufio.ReadWriter

Jump to

Keyboard shortcuts

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