Documentation ¶
Index ¶
- Constants
- func GetClientCommandByProto(protoMessage proto.Message) int32
- func GetCommandByProto(cmdEnumName string, protoMessage proto.Message) int32
- func GetEnumValueNameOfProtoMessage(protoMessage proto.Message) string
- func GetResCommand(reqCommand int32) int32
- func GetShortNameOfProtoMessage(protoMessage proto.Message) string
- type MockClient
- func (this *MockClient) OnAccountRes(res *pb.AccountRes)
- func (this *MockClient) OnCoinRes(res *pb.CoinRes)
- func (this *MockClient) OnCreatePlayerRes(res *pb.CreatePlayerRes)
- func (this *MockClient) OnErrorRes(res *pb.ErrorRes)
- func (this *MockClient) OnFinishQuestRes(res *pb.FinishQuestRes)
- func (this *MockClient) OnGateRouteClientPacketError(res *pb.GateRouteClientPacketError)
- func (this *MockClient) OnGuildCreateRes(res *pb.GuildCreateRes)
- func (this *MockClient) OnGuildDataViewRes(res *pb.GuildDataViewRes)
- func (this *MockClient) OnGuildJoinAgreeRes(res *pb.GuildJoinAgreeRes)
- func (this *MockClient) OnGuildJoinReqOpResult(res *pb.GuildJoinReqOpResult)
- func (this *MockClient) OnGuildJoinReqTip(res *pb.GuildJoinReqTip)
- func (this *MockClient) OnGuildJoinRes(res *pb.GuildJoinRes)
- func (this *MockClient) OnGuildListRes(res *pb.GuildListRes)
- func (this *MockClient) OnInputCmd(cmd string)
- func (this *MockClient) OnLoginRes(res *pb.LoginRes)
- func (this *MockClient) OnPlayerEntryGameRes(res *pb.PlayerEntryGameRes)
- func (this *MockClient) Send(message proto.Message, opts ...SendOption) bool
- type MockClientHandler
- type TestClient
- func (this *TestClient) Exit()
- func (this *TestClient) Init(ctx context.Context, useGate bool, useWebsocket bool, serverAddr string, ...) bool
- func (this *TestClient) OnInputCmd(cmd string)
- func (this *TestClient) OnUpdate(ctx context.Context, updateCount int64)
- func (this *TestClient) Run(ctx context.Context)
Constants ¶
View Source
const ( // 客户端和服务器之间的消息号定义 CmdClientEnumName = "CmdClient" // 对应proto/cmd_client.proto里的enum CmdClient )
Variables ¶
This section is empty.
Functions ¶
func GetClientCommandByProto ¶
func GetCommandByProto ¶
func GetEnumValueNameOfProtoMessage ¶
proto.Message对应的消息号枚举值名 本项目的消息号的规范: Cmd_MessageName
func GetResCommand ¶
本项目的request和response的消息号规范: resCmd = reqCmd + 1
Types ¶
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
模拟客户端
func (*MockClient) OnAccountRes ¶
func (this *MockClient) OnAccountRes(res *pb.AccountRes)
func (*MockClient) OnCoinRes ¶
func (this *MockClient) OnCoinRes(res *pb.CoinRes)
func (*MockClient) OnCreatePlayerRes ¶
func (this *MockClient) OnCreatePlayerRes(res *pb.CreatePlayerRes)
func (*MockClient) OnErrorRes ¶
func (this *MockClient) OnErrorRes(res *pb.ErrorRes)
func (*MockClient) OnFinishQuestRes ¶
func (this *MockClient) OnFinishQuestRes(res *pb.FinishQuestRes)
func (*MockClient) OnGateRouteClientPacketError ¶
func (this *MockClient) OnGateRouteClientPacketError(res *pb.GateRouteClientPacketError)
func (*MockClient) OnGuildCreateRes ¶
func (this *MockClient) OnGuildCreateRes(res *pb.GuildCreateRes)
func (*MockClient) OnGuildDataViewRes ¶
func (this *MockClient) OnGuildDataViewRes(res *pb.GuildDataViewRes)
func (*MockClient) OnGuildJoinAgreeRes ¶
func (this *MockClient) OnGuildJoinAgreeRes(res *pb.GuildJoinAgreeRes)
func (*MockClient) OnGuildJoinReqOpResult ¶
func (this *MockClient) OnGuildJoinReqOpResult(res *pb.GuildJoinReqOpResult)
func (*MockClient) OnGuildJoinReqTip ¶
func (this *MockClient) OnGuildJoinReqTip(res *pb.GuildJoinReqTip)
func (*MockClient) OnGuildJoinRes ¶
func (this *MockClient) OnGuildJoinRes(res *pb.GuildJoinRes)
func (*MockClient) OnGuildListRes ¶
func (this *MockClient) OnGuildListRes(res *pb.GuildListRes)
func (*MockClient) OnInputCmd ¶
func (this *MockClient) OnInputCmd(cmd string)
测试命令 支持的命令,详见https://github.com/fish-tennis/gserver/gameserver/test_cmd.go
func (*MockClient) OnLoginRes ¶
func (this *MockClient) OnLoginRes(res *pb.LoginRes)
func (*MockClient) OnPlayerEntryGameRes ¶
func (this *MockClient) OnPlayerEntryGameRes(res *pb.PlayerEntryGameRes)
type MockClientHandler ¶
type MockClientHandler struct { DefaultConnectionHandler // contains filtered or unexported fields }
func NewMockClientHandler ¶
func NewMockClientHandler(protoCodec Codec) *MockClientHandler
func (*MockClientHandler) OnRecvPacket ¶
func (this *MockClientHandler) OnRecvPacket(connection Connection, packet Packet)
type TestClient ¶
type TestClient struct {
// contains filtered or unexported fields
}
客户端测试 可以管理多个模拟的客户端
func (*TestClient) Exit ¶
func (this *TestClient) Exit()
func (*TestClient) OnInputCmd ¶
func (this *TestClient) OnInputCmd(cmd string)
func (*TestClient) OnUpdate ¶
func (this *TestClient) OnUpdate(ctx context.Context, updateCount int64)
func (*TestClient) Run ¶
func (this *TestClient) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.