atsf4g_go_robot_user

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCreateUser

func RegisterCreateUser(f func(openId string, socketUrl string, logHandler func(format string, a ...any),
	enableActorLog bool, unpack UserReceiveUnpackFunc, createMsg UserReceiveCreateMessageFunc) User, unpack UserReceiveUnpackFunc, createMsg UserReceiveCreateMessageFunc)

Types

type TaskActionUser

type TaskActionUser struct {
	base.TaskActionBase
	User User
	Fn   func(*TaskActionUser) error
}

func (*TaskActionUser) AfterYield

func (t *TaskActionUser) AfterYield()

func (*TaskActionUser) BeforeYield

func (t *TaskActionUser) BeforeYield()

func (*TaskActionUser) HookRun

func (t *TaskActionUser) HookRun() error

func (*TaskActionUser) Log

func (t *TaskActionUser) Log(format string, a ...any)

type User

type User interface {
	IsLogin() bool
	Logout()
	AllocSequence() uint64
	ReceiveHandler(unpack UserReceiveUnpackFunc, createMsg UserReceiveCreateMessageFunc)
	SendReq(action *TaskActionUser, csMsg proto.Message, csHead proto.Message,
		csBody proto.Message, rpcName string, sequence uint64, needRsp bool) (int32, proto.Message, error)
	TakeActionGuard()
	ReleaseActionGuard()
	RunTask(timeout time.Duration, f func(*TaskActionUser) error, name string) *TaskActionUser
	RunTaskDefaultTimeout(f func(*TaskActionUser) error, name string) *TaskActionUser
	AddOnClosedHandler(f func(User))
	Log(format string, a ...any)
	AwaitReceiveHandlerClose()
	InitHeartbeatFunc(func(User) error)

	GetLoginCode() string
	GetLogined() bool
	GetOpenId() string
	GetAccessToken() string
	GetUserId() uint64
	GetZoneId() uint32

	SetLoginCode(string)
	SetUserId(uint64)
	SetZoneId(uint32)
	SetLogined(bool)
	SetHeartbeatInterval(time.Duration)
	SetLastPingTime(time.Time)
	SetHasGetInfo(bool)
	RegisterMessageHandler(rpcName string, f func(*TaskActionUser, proto.Message, int32) error)

	GetExtralData(key string) any
	SetExtralData(key string, value any)
}

func CreateUser

func CreateUser(openId string, socketUrl string, logHandler func(format string, a ...any), enableActorLog bool) User

type UserReceiveCreateMessageFunc

type UserReceiveCreateMessageFunc func() proto.Message

type UserReceiveUnpackFunc

type UserReceiveUnpackFunc func(proto.Message) (
	rpcName string,
	typeName string,
	errorCode int32,
	msgHead proto.Message,
	bodyBin []byte,
	sequence uint64,
	err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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