testclient

package
v0.0.0-...-cd3927d Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 对应proto文件里的package导出名
	ProtoPackageName = "gserver"
)

Variables

This section is empty.

Functions

func GetCommandByProto

func GetCommandByProto(protoMessage proto.Message) int32

func GetFullMessageName

func GetFullMessageName(packageName, messageName string) string

func GetMd5Password

func GetMd5Password(password string) string

账号协议不要发明文密码,而且要加一些混淆词,防止被"撞库"

func InitCommandMappingFromFile

func InitCommandMappingFromFile(file string)

Types

type MockClient

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

模拟客户端

func (*MockClient) OnAccountRes

func (c *MockClient) OnAccountRes(res *pb.AccountRes, errorCode int)

func (*MockClient) OnActivitySync

func (c *MockClient) OnActivitySync(res *pb.ActivitySync)

func (*MockClient) OnBagsSync

func (c *MockClient) OnBagsSync(res *pb.BagsSync)

func (*MockClient) OnBaseInfoSync

func (c *MockClient) OnBaseInfoSync(res *pb.BaseInfoSync)

func (*MockClient) OnCreatePlayerRes

func (c *MockClient) OnCreatePlayerRes(res *pb.CreatePlayerRes, errorCode int)

func (*MockClient) OnElemContainerUpdate

func (c *MockClient) OnElemContainerUpdate(res *pb.ElemContainerUpdate)

func (*MockClient) OnErrorRes

func (c *MockClient) OnErrorRes(res *pb.ErrorRes)

func (*MockClient) OnExchangeRes

func (c *MockClient) OnExchangeRes(res *pb.ExchangeRes)

func (*MockClient) OnExchangeSync

func (c *MockClient) OnExchangeSync(res *pb.ExchangeSync)

func (*MockClient) OnExchangeUpdate

func (c *MockClient) OnExchangeUpdate(res *pb.ExchangeUpdate)

func (*MockClient) OnFinishQuestRes

func (c *MockClient) OnFinishQuestRes(res *pb.FinishQuestRes)

func (*MockClient) OnGateRouteClientPacketError

func (c *MockClient) OnGateRouteClientPacketError(res *pb.GateRouteClientPacketError)

func (*MockClient) OnGuildCreateRes

func (c *MockClient) OnGuildCreateRes(res *pb.GuildCreateRes)

func (*MockClient) OnGuildDataViewRes

func (c *MockClient) OnGuildDataViewRes(res *pb.GuildDataViewRes)

func (*MockClient) OnGuildJoinAgreeRes

func (c *MockClient) OnGuildJoinAgreeRes(res *pb.GuildJoinAgreeRes)

func (*MockClient) OnGuildJoinReqOpResult

func (c *MockClient) OnGuildJoinReqOpResult(res *pb.GuildJoinReqOpResult)

func (*MockClient) OnGuildJoinReqTip

func (c *MockClient) OnGuildJoinReqTip(res *pb.GuildJoinReqTip)

func (*MockClient) OnGuildJoinRes

func (c *MockClient) OnGuildJoinRes(res *pb.GuildJoinRes)

func (*MockClient) OnGuildListRes

func (c *MockClient) OnGuildListRes(res *pb.GuildListRes)

func (*MockClient) OnGuildSync

func (c *MockClient) OnGuildSync(res *pb.GuildSync)

func (*MockClient) OnInputCmd

func (c *MockClient) OnInputCmd(cmd string)

测试命令 支持的命令,详见https://github.com/fish-tennis/gserver/gameserver/test_cmd.go

func (*MockClient) OnItemUseRes

func (c *MockClient) OnItemUseRes(res *pb.ItemUseRes)

func (*MockClient) OnLoginRes

func (c *MockClient) OnLoginRes(res *pb.LoginRes, errorCode int)

func (*MockClient) OnPlayerEntryGameRes

func (c *MockClient) OnPlayerEntryGameRes(res *pb.PlayerEntryGameRes, errorCode int)

func (*MockClient) OnQuestSync

func (c *MockClient) OnQuestSync(res *pb.QuestSync)

func (*MockClient) OnQuestUpdate

func (c *MockClient) OnQuestUpdate(res *pb.QuestUpdate)

func (*MockClient) Send

func (c *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 (h *MockClientHandler) OnRecvPacket(connection Connection, packet Packet)

type TestClient

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

客户端测试 可以管理多个模拟的客户端

func (*TestClient) Exit

func (t *TestClient) Exit()

func (*TestClient) Init

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

func (*TestClient) OnInputCmd

func (t *TestClient) OnInputCmd(cmd string)

func (*TestClient) OnUpdate

func (t *TestClient) OnUpdate(ctx context.Context, updateCount int64)

func (*TestClient) Run

func (t *TestClient) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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