gate

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFlags

func NewFlags() []cli.Flag

func NewUserInfo

func NewUserInfo() interface{}

Types

type GameSelector

type GameSelector struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGameSelector

func NewGameSelector(g *Gate, c *cli.Context) *GameSelector

func (*GameSelector) Run

func (gs *GameSelector) Run() error

func (*GameSelector) SelectGame

func (gs *GameSelector) SelectGame(userID string, userName string) (*UserInfo, Metadata)

func (*GameSelector) UpdateUserInfo

func (gs *GameSelector) UpdateUserInfo(info *UserInfo)

type Gate

type Gate struct {
	ID int16
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() (*Gate, error)

func (*Gate) Action

func (g *Gate) Action(c *cli.Context) error

func (*Gate) After

func (g *Gate) After(c *cli.Context) error

func (*Gate) GateResult

func (g *Gate) GateResult()

func (*Gate) Run

func (g *Gate) Run(arguments []string) error

func (*Gate) Stop

func (g *Gate) Stop()

type GinServer

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

func NewGinServer

func NewGinServer(g *Gate, c *cli.Context) *GinServer

func (*GinServer) Run

func (s *GinServer) Run() error

type Metadata

type Metadata map[string]string

type MicroService

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

func NewMicroService

func NewMicroService(g *Gate, c *ucli.Context) *MicroService

func (*MicroService) GetDefaultGameID

func (s *MicroService) GetDefaultGameID() int16

func (*MicroService) GetServiceMetadatas

func (s *MicroService) GetServiceMetadatas(name string) []map[string]string

func (*MicroService) Run

func (s *MicroService) Run() error

func (*MicroService) StoreWrite

func (s *MicroService) StoreWrite(key string, value string)

type PubSub

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

func NewPubSub

func NewPubSub(g *Gate) *PubSub

func (*PubSub) PubGateResult

func (ps *PubSub) PubGateResult(ctx context.Context, win bool) error

/////////////////////////////////// publish handle ///////////////////////////////////

type RpcHandler

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

func NewRpcHandler

func NewRpcHandler(g *Gate, ucli *cli.Context) *RpcHandler

func (*RpcHandler) CallGetRemoteLiteAccount

func (h *RpcHandler) CallGetRemoteLiteAccount(acctID int64) (*pbGame.GetRemoteLiteAccountReply, error)

/////////////////////////////////////////// rpc call ///////////////////////////////////////////

func (*RpcHandler) CallUpdatePlayerExp

func (h *RpcHandler) CallUpdatePlayerExp(id int64) (*pbGame.UpdatePlayerExpReply, error)

func (*RpcHandler) GetGateStatus

func (h *RpcHandler) GetGateStatus(ctx context.Context, req *pbGate.GateEmptyMessage, rsp *pbGate.GetGateStatusReply) error

/////////////////////////////////////////// rpc receive ///////////////////////////////////////////

func (*RpcHandler) UpdateUserInfo

type UserInfo

type UserInfo struct {
	UserID      int64       `bson:"_id"`
	AccountID   int64       `bson:"account_id"`
	GameID      int16       `bson:"game_id"`
	PlayerID    int64       `bson:"player_id"`
	PlayerName  string      `bson:"player_name"`
	PlayerLevel int32       `bson:"player_level"`
	Expire      *time.Timer `bson:"-"`
}

func (*UserInfo) GetExpire

func (u *UserInfo) GetExpire() *time.Timer

func (*UserInfo) GetObjID

func (u *UserInfo) GetObjID() interface{}

func (*UserInfo) ResetExpire

func (u *UserInfo) ResetExpire()

func (*UserInfo) StopExpire

func (u *UserInfo) StopExpire()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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