testclient

package
v0.0.0-...-75a5ccb Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 客户端和服务器之间的消息号定义
	CmdClientEnumName = "CmdClient" // 对应proto/cmd_client.proto里的enum CmdClient
)

Variables

This section is empty.

Functions

func GetClientCommandByProto

func GetClientCommandByProto(protoMessage proto.Message) int32

func GetCommandByProto

func GetCommandByProto(cmdEnumName string, protoMessage proto.Message) int32

func GetEnumValueNameOfProtoMessage

func GetEnumValueNameOfProtoMessage(protoMessage proto.Message) string

proto.Message对应的消息号枚举值名 本项目的消息号的规范: Cmd_MessageName

func GetResCommand

func GetResCommand(reqCommand int32) int32

本项目的request和response的消息号规范: resCmd = reqCmd + 1

func GetShortNameOfProtoMessage

func GetShortNameOfProtoMessage(protoMessage proto.Message) string

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)

func (*MockClient) Send

func (this *MockClient) Send(message proto.Message, opts ...SendOption) bool

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

func (this *TestClient) Init(ctx context.Context, useGate bool, useWebsocket bool, serverAddr string,
	mockClientAccountPrefix string, mockClientNum int, mockClientBeginId int) bool

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)

Jump to

Keyboard shortcuts

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