robot_mgr

package
v0.0.0-...-2692626 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GMessageFuncMap = make(messageFuncMap)
View Source
var GProfiler = NewProfiler()
View Source
var LockOnlineRobot sync.RWMutex

Functions

func BattleGatewayCreateRoomMsg

func BattleGatewayCreateRoomMsg(robot *Robot) error

func BattleGatewayGetRoomListMsg

func BattleGatewayGetRoomListMsg(robot *Robot) error

func BattleGatewayJoinBattleRoomMsg

func BattleGatewayJoinBattleRoomMsg(robot *Robot) error

func BattleGatewayJoinRoomMsg

func BattleGatewayJoinRoomMsg(robot *Robot) error

func BattleGatewayKCPHeartBeatMsg

func BattleGatewayKCPHeartBeatMsg(robot *Robot) error

func BattleGatewayKCPVerifyTokenMsg

func BattleGatewayKCPVerifyTokenMsg(robot *Robot) error

func BattleGatewayRoomChooseLevelMsg

func BattleGatewayRoomChooseLevelMsg(robot *Robot) error

func BattleGatewayTCPHeartBeatMsg

func BattleGatewayTCPHeartBeatMsg(robot *Robot) error

func BattleGatewayTCPVerifyTokenMsg

func BattleGatewayTCPVerifyTokenMsg(robot *Robot) error

func BattleGatewayTestMsg

func BattleGatewayTestMsg(robot *Robot) error

func Disconnect

func Disconnect(robot *Robot) error

Disconnect 断开连接

func GenerateSessionID

func GenerateSessionID() uint32

func Invalid

func Invalid(robot *Robot) error

Invalid 非法请求

func Offline

func Offline(robot *Robot) error

Offline 下线

func RoomBattleStartMsg

func RoomBattleStartMsg(robot *Robot) error

func RoomEndMsg

func RoomEndMsg(robot *Robot) error

func RoomExitRoomMsg

func RoomExitRoomMsg(robot *Robot) error

func RoomFrameDataMsg

func RoomFrameDataMsg(robot *Robot) error

func RoomGetRoomUserDetailInformationMsg

func RoomGetRoomUserDetailInformationMsg(robot *Robot) error

func RoomStartMsg

func RoomStartMsg(robot *Robot) error

func RoomUserReadyMsg

func RoomUserReadyMsg(robot *Robot) error

func WorldCreatUserMsg

func WorldCreatUserMsg(robot *Robot) error

func WorldEnterBattleGatewayMsg

func WorldEnterBattleGatewayMsg(robot *Robot) error

func WorldGetUserMsg

func WorldGetUserMsg(robot *Robot) error

func WorldSetPrimaryWeaponMsg

func WorldSetPrimaryWeaponMsg(robot *Robot) error

func WorldSetSecondaryWeaponMsg

func WorldSetSecondaryWeaponMsg(robot *Robot) error

func WorldStageCreateRegionMsg

func WorldStageCreateRegionMsg(robot *Robot) error

func WorldStatRoomEndMsg

func WorldStatRoomEndMsg(robot *Robot) error

func WorldTaskCompleteMsg

func WorldTaskCompleteMsg(robot *Robot) error

func WorldUserChatMsg

func WorldUserChatMsg(robot *Robot) error

func WorldVerifyTokenMsg

func WorldVerifyTokenMsg(robot *Robot) error

Types

type Profiler

type Profiler struct {
	CurrentUserNum int // 当前在线用户数
	TotalUserNum   int // 本次测试用户总数

	ChanUserOffline         chan string
	ChanSendNum             chan int
	ChanSuccessNum          chan int
	ChanErrorNum            chan int
	ChanCycleSuccessSendNum chan int
	ChanCycleResponseNum    chan int
	ChanCycleSendNum        chan int
	ChanCostTime            chan int
	ChanConnectFailedNum    chan int

	RunTicks int // 运行次数
	// contains filtered or unexported fields
}

func NewProfiler

func NewProfiler() *Profiler

func (*Profiler) AddConnectFailedNum

func (p *Profiler) AddConnectFailedNum(n int)

func (*Profiler) AddCurrentUserNum

func (p *Profiler) AddCurrentUserNum(n int)

func (*Profiler) AddCurrentUserTotalNum

func (p *Profiler) AddCurrentUserTotalNum(n int)

func (*Profiler) AddCycleResponseNum

func (p *Profiler) AddCycleResponseNum(n int)

func (*Profiler) AddCycleSendNum

func (p *Profiler) AddCycleSendNum(n int)

func (*Profiler) AddCycleSuccessSendNum

func (p *Profiler) AddCycleSuccessSendNum(n int)

func (*Profiler) AddErrorNum

func (p *Profiler) AddErrorNum(n int)

func (*Profiler) AddSendNum

func (p *Profiler) AddSendNum(n int)

func (*Profiler) AddSuccessNum

func (p *Profiler) AddSuccessNum(n int)

func (*Profiler) ExecuteCostTime

func (p *Profiler) ExecuteCostTime(costMs int)

func (*Profiler) ShowLog

func (p *Profiler) ShowLog()

func (*Profiler) Watch

func (p *Profiler) Watch()

type Robot

type Robot struct {
	Account   string
	Name      string
	UID       uint64
	ExistUser bool   //是否有创角
	ServerId  uint32 // 所属服务器ID

	WorldTCPClient xrtcp.Client
	WorldIP        string
	WorldPort      uint16
	WorldToken     string

	BattleGatewayTCPClient xrtcp.Client
	BattleGatewayInfo      *battle_gateway_mgr.BattleGateway // 战斗网关信息.
	BattleGatewayToken     string

	IsCompleteLogin bool // 是否完成登录流程(包括http登录,连接world服、battle gateway服,并拉取用户数据)

	IsPause bool // 是否暂停

	InRoom            uint32               // 是否在房间中 需要用atomic原子操作 所以用了uint32类型
	InBattle          bool                 // 战斗中
	FrameMillisecond  *xrtimer.Millisecond // 发送帧数据定时器
	ServerFrameID     uint32               // 服务器返回的帧ID
	LastSendFrameID   uint32               // 上次发送给服务器的帧ID
	FrameHealthUpload uint32               // 服务器返回的帧同步健康值

	SendMessageTimeMap sync.Map // 用户发送各个消息的开始时间
	LastResultId       uint32   // 上个请求结果

	DBInventory *common_proto.DBInventory // 用户DB数据
	// contains filtered or unexported fields
}

func (*Robot) ConnectBGW

func (p *Robot) ConnectBGW(OnParsePacket xrtcp.OnUnmarshalPacket, OnPacket xrtcp.OnPacket, OnDisconnect xrtcp.OnDisconnect) error

func (*Robot) ConnectWorld

func (p *Robot) ConnectWorld(OnParsePacket xrtcp.OnUnmarshalPacket, OnPacket xrtcp.OnPacket, OnDisconnect xrtcp.OnDisconnect) error

func (*Robot) Init

func (p *Robot) Init()

func (*Robot) Offline

func (p *Robot) Offline() error

Offline 离线

func (*Robot) Online

func (p *Robot) Online(OnParsePacket xrtcp.OnUnmarshalPacket, OnPacket xrtcp.OnPacket, OnDisconnect xrtcp.OnDisconnect) error

func (*Robot) ResetBattle

func (p *Robot) ResetBattle()

func (*Robot) Send2BGS

func (p *Robot) Send2BGS(pb proto.Message, messageID uint32, sessionID uint32, resultID uint32, frameID uint32) error

func (*Robot) Send2World

func (p *Robot) Send2World(pb proto.Message, messageID uint32, sessionID uint32, resultID uint32, frameID uint32) error

func (*Robot) StartMessageTicker

func (p *Robot) StartMessageTicker()

func (*Robot) String

func (p *Robot) String() string

type RobotMap

type RobotMap map[*xrtcp.Remote]*Robot

type RobotMgr

type RobotMgr struct {
	TimerMgr  xrtimer.Mgr
	TimeMgr   xrutil.TimeMgr
	EventChan chan interface{}

	OnlineRobotMap  RobotMap //在线
	OfflineRobotMap RobotMap //离线
	BGSRobotMap     RobotMap //在线

	ReadyRobotChan chan interface{} //准备就绪(即将上线) robot
}
var GRobotMgr RobotMgr

func (*RobotMgr) AddBGSRobot

func (p *RobotMgr) AddBGSRobot(robot *Robot)

func (*RobotMgr) AddOfflineRobot

func (p *RobotMgr) AddOfflineRobot(robot *Robot)

func (*RobotMgr) AddOnlineRobot

func (p *RobotMgr) AddOnlineRobot(robot *Robot)

func (*RobotMgr) DelBGSRobot

func (p *RobotMgr) DelBGSRobot(robot *Robot)

func (*RobotMgr) DelOfflineRobot

func (p *RobotMgr) DelOfflineRobot(robot *Robot)

func (*RobotMgr) DelOnlineRobot

func (p *RobotMgr) DelOnlineRobot(robot *Robot)

func (*RobotMgr) FindBGSOnline

func (p *RobotMgr) FindBGSOnline(remote *xrtcp.Remote) *Robot

func (*RobotMgr) FindOffline

func (p *RobotMgr) FindOffline(client *xrtcp.Client) *Robot

func (*RobotMgr) FindOnline

func (p *RobotMgr) FindOnline(remote *xrtcp.Remote) *Robot

func (*RobotMgr) Init

func (p *RobotMgr) Init() error

Jump to

Keyboard shortcuts

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