game

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: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFlags

func NewFlags() []cli.Flag

Types

type AccountManager

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

func NewAccountManager

func NewAccountManager(ctx *cli.Context, g *Game) *AccountManager

func (*AccountManager) AccountExecute

func (am *AccountManager) AccountExecute(sock transport.Socket, handler player.DelayHandleFunc) error

add handler to account's execute channel, will be dealed by account's run goroutine

func (*AccountManager) AccountLogon

func (am *AccountManager) AccountLogon(ctx context.Context, userID int64, accountID int64, accountName string, sock transport.Socket) error

func (*AccountManager) BroadCast

func (am *AccountManager) BroadCast(msg proto.Message)

func (*AccountManager) CreatePlayer

func (am *AccountManager) CreatePlayer(acct *player.Account, name string) (*player.Player, error)

func (*AccountManager) Exit

func (am *AccountManager) Exit()

func (*AccountManager) GetAccountById

func (am *AccountManager) GetAccountById(acctId int64) *player.Account

func (*AccountManager) GetAccountIdBySock

func (am *AccountManager) GetAccountIdBySock(sock transport.Socket) int64

func (*AccountManager) GetLitePlayer

func (am *AccountManager) GetLitePlayer(playerId int64) (player.LitePlayer, error)

func (*AccountManager) GetPlayerByAccount

func (am *AccountManager) GetPlayerByAccount(acct *player.Account) (*player.Player, error)

func (*AccountManager) Main

func (am *AccountManager) Main(ctx context.Context) error

func (*AccountManager) OnLitePlayerEvicted

func (am *AccountManager) OnLitePlayerEvicted(key lru.Key, value interface{})

func (*AccountManager) Run

func (am *AccountManager) Run(ctx context.Context) error

func (*AccountManager) SelectPlayer

func (am *AccountManager) SelectPlayer(acct *player.Account, id int64) (*player.Player, error)

todo omitempty

type Game

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

func New

func New() *Game

func (*Game) Action

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

func (*Game) Run

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

func (*Game) StartGate

func (g *Game) StartGate()

///////////////////////////////////////////////////// pubsub /////////////////////////////////////////////////////

func (*Game) Stop

func (g *Game) Stop()

type GinServer

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

func NewGinServer

func NewGinServer(ctx *cli.Context, g *Game) *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 MC_AccountTest

type MC_AccountTest struct {
	AccountId int64  `protobuf:"varint,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`
	Name      string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}

func (*MC_AccountTest) GetName

func (msg *MC_AccountTest) GetName() string

type MicroService

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

func NewMicroService

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

func (*MicroService) Run

func (s *MicroService) Run() error

type MsgHandler

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

func NewMsgHandler

func NewMsgHandler(g *Game) *MsgHandler

type PubSub

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

func NewPubSub

func NewPubSub(g *Game) *PubSub

func (*PubSub) PubStartGate

func (ps *PubSub) PubStartGate(ctx context.Context, c *pbAccount.LiteAccount) error

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

func (*PubSub) PubSyncPlayerInfo

func (ps *PubSub) PubSyncPlayerInfo(ctx context.Context, p *player.LitePlayer) error

type RpcHandler

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

func NewRpcHandler

func NewRpcHandler(g *Game) *RpcHandler

func (*RpcHandler) CallGetGateStatus

func (h *RpcHandler) CallGetGateStatus(ctx context.Context) (*pbGate.GetGateStatusReply, error)

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

func (*RpcHandler) CallGetRemoteLitePlayer

func (h *RpcHandler) CallGetRemoteLitePlayer(playerID int64) (*pbGame.GetRemoteLitePlayerReply, error)

func (*RpcHandler) CallStartStageCombat

func (h *RpcHandler) CallStartStageCombat(p *player.Player) (*pbCombat.StartStageCombatReply, error)

func (*RpcHandler) CallSyncPlayerInfo

func (h *RpcHandler) CallSyncPlayerInfo(userId int64, info *player.LitePlayer) (*pbGate.SyncPlayerInfoReply, error)

func (*RpcHandler) CallUpdateUserInfo

func (h *RpcHandler) CallUpdateUserInfo(c *player.Account) (*pbGate.GateEmptyMessage, error)

func (*RpcHandler) GetRemoteLitePlayer

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

func (*RpcHandler) UpdatePlayerExp

type TcpServer

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

func NewTcpServer

func NewTcpServer(ctx *cli.Context, g *Game) *TcpServer

func (*TcpServer) Exit

func (s *TcpServer) Exit()

func (*TcpServer) Run

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

type WsServer

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

func NewWsServer

func NewWsServer(ctx *cli.Context, g *Game) *WsServer

func (*WsServer) Exit

func (s *WsServer) Exit()

func (*WsServer) Run

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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