atsf4g_go_robot_user_impl

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

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

Types

type CmdAction

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

type RpcTimeout

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

type User

type User struct {
	OpenId string
	UserId uint64
	ZoneId uint32

	AccessToken string
	LoginCode   string

	Logined           bool
	HasGetInfo        bool
	HeartbeatInterval time.Duration
	LastPingTime      time.Time
	Closed            atomic.Bool
	// contains filtered or unexported fields
}

func NewUser

func NewUser(openId string, conn *websocket.Conn, bufferWriter *log.LogBufferedRotatingWriter, logHandler func(format string, a ...any)) *User

func (*User) AddOnClosedHandler

func (u *User) AddOnClosedHandler(f func(user user_data.User))

func (*User) AllocSequence

func (user *User) AllocSequence() uint64

func (*User) AwaitReceiveHandlerClose

func (user *User) AwaitReceiveHandlerClose()

func (*User) Close

func (user *User) Close()

func (*User) GetAccessToken

func (user *User) GetAccessToken() string

func (*User) GetExtralData

func (user *User) GetExtralData(key string) any

func (*User) GetLoginCode

func (user *User) GetLoginCode() string

func (*User) GetLogined

func (user *User) GetLogined() bool

func (*User) GetOpenId

func (user *User) GetOpenId() string

func (*User) GetUserId

func (user *User) GetUserId() uint64

func (*User) GetZoneId

func (user *User) GetZoneId() uint32

func (*User) InitHeartbeatFunc

func (user *User) InitHeartbeatFunc(f func(user_data.User) error)

func (*User) IsLogin

func (u *User) IsLogin() bool

func (*User) Log

func (user *User) Log(format string, a ...any)

func (*User) Logout

func (u *User) Logout()

func (*User) ReceiveHandler

func (user *User) ReceiveHandler(unpack user_data.UserReceiveUnpackFunc, createMsg user_data.UserReceiveCreateMessageFunc)

func (*User) RegisterMessageHandler

func (user *User) RegisterMessageHandler(rpcName string, f func(*user_data.TaskActionUser, proto.Message, int32) error)

func (*User) ReleaseActionGuard

func (u *User) ReleaseActionGuard()

func (*User) RunTask

func (user *User) RunTask(timeout time.Duration, f func(*user_data.TaskActionUser) error, name string) *user_data.TaskActionUser

func (*User) RunTaskDefaultTimeout

func (user *User) RunTaskDefaultTimeout(f func(*user_data.TaskActionUser) error, name string) *user_data.TaskActionUser

func (*User) SendReq

func (user *User) SendReq(action *user_data.TaskActionUser, csMsg proto.Message,
	csHead proto.Message, csBody proto.Message, rpcName string, sequence uint64, needRsp bool) (int32, proto.Message, error)

func (*User) SetExtralData

func (user *User) SetExtralData(key string, value any)

func (*User) SetHasGetInfo

func (user *User) SetHasGetInfo(d bool)

func (*User) SetHeartbeatInterval

func (user *User) SetHeartbeatInterval(d time.Duration)

func (*User) SetLastPingTime

func (user *User) SetLastPingTime(d time.Time)

func (*User) SetLoginCode

func (user *User) SetLoginCode(d string)

func (*User) SetLogined

func (user *User) SetLogined(d bool)

func (*User) SetUserId

func (user *User) SetUserId(d uint64)

func (*User) SetZoneId

func (user *User) SetZoneId(d uint32)

func (*User) TakeActionGuard

func (u *User) TakeActionGuard()

Jump to

Keyboard shortcuts

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