gate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 39 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) Exit

func (gs *GameSelector) Exit(ctx context.Context)

func (*GameSelector) Main

func (gs *GameSelector) Main(ctx context.Context) error

func (*GameSelector) OnUserEvicted

func (gs *GameSelector) OnUserEvicted(key lru.Key, value interface{})

user evicted callback

func (*GameSelector) Run

func (gs *GameSelector) Run(ctx context.Context) error

func (*GameSelector) SelectGame

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

func (*GameSelector) UpdateUserInfo

func (gs *GameSelector) UpdateUserInfo(req *pbGate.UpdateUserInfoRequest) error

type Gate

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

func New

func New() *Gate

func (*Gate) Action

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

func (*Gate) GateResult

func (g *Gate) GateResult() error

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, ctx *cli.Context) *GinServer

func (*GinServer) Exit

func (s *GinServer) Exit(ctx context.Context)

func (*GinServer) Main

func (s *GinServer) Main(ctx *cli.Context) error

func (*GinServer) Run

func (s *GinServer) Run(ctx *cli.Context) error

type Metadata

type Metadata map[string]string

type MicroService

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

func NewMicroService

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

func (*MicroService) GetServiceMetadatas

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

func (*MicroService) Run

func (s *MicroService) Run(ctx context.Context) error

func (*MicroService) SelectGameEntry

func (s *MicroService) SelectGameEntry() (int, error)

func (*MicroService) StoreWrite

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

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) CallGetRemoteLitePlayer

func (h *RpcHandler) CallGetRemoteLitePlayer(id int64) (*pbGame.GetRemoteLitePlayerReply, 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) SyncPlayerInfo

func (*RpcHandler) UpdateUserInfo

type UserInfo

type UserInfo struct {
	store.StoreObjector `bson:"-" json:"-"`

	UserID      int64  `bson:"_id" json:"_id"`
	AccountID   int64  `bson:"account_id" json:"account_id"`
	PlayerID    int64  `bson:"player_id" json:"player_id"`
	PlayerName  string `bson:"player_name" json:"player_name"`
	PlayerLevel int32  `bson:"player_level" json:"player_level"`
}

func (*UserInfo) AfterLoad

func (u *UserInfo) AfterLoad() error

func (*UserInfo) GetObjID

func (u *UserInfo) GetObjID() int64

func (*UserInfo) GetStoreIndex

func (u *UserInfo) GetStoreIndex() int64

Jump to

Keyboard shortcuts

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