proxy

package
v0.0.0-...-c314f80 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delay

type Delay interface {
	Add(delayTime time.Duration, f func(ts int64, args interface{}), arg interface{}) int64
	Range(f func(ts int64, args interface{}) bool)
	Del(f func(ts int64, args interface{}) bool)
}

type Game

type Game interface {
	Init(ctx context.Context, delay GameDelay, pMgr GamePMgr, pMsg PlayerMsg, log GameLog) error
	PlayerMaxNum() int
	PlayerJoin(userKey interface{}, exist bool, view bool)
	PlayerOp(userKey interface{}, exist bool, view bool)
	PlayerExit(userKey interface{}, view bool)
	PlayerOfflineKickOut() time.Duration
	PlayerAuto(userKey interface{})
	Msg(userKey interface{}, data interface{})
	Begin(quick bool)
	End()
	Auto() *GameAuto
	Quick(num int) bool
	QuickTs() time.Duration
	View() bool
	DisbandTs() time.Duration
	IpLimit() bool
	DistanceLimit() int
	Finish(disband bool)
}

type GameAuto

type GameAuto struct {
	AutoTs    time.Duration
	ReadyOpTs time.Duration
	OpTs      time.Duration
}

type GameDelay

type GameDelay interface {
	DelayFunc(delayTs time.Duration, f func(args interface{}), args interface{})
	DelayMsg(delayTs time.Duration, userKey []interface{}, data ...interface{})
}

type GameLog

type GameLog interface {
	Debug(s string, fields ...log.Field)
	Info(s string, fields ...log.Field)
	Warn(s string, fields ...log.Field)
	Err(s string, fields ...log.Field)
}

type GamePMgr

type GamePMgr interface {
	Get(key interface{}) *player.Player
	Len(filter ...func(*player.Player) bool) int
	Range(f func(key interface{}, p *player.Player) bool)
}

type Msg

type Msg struct {
	Kind    MsgKind
	UserKey interface{}
	Data    interface{}
}

type MsgKind

type MsgKind int
const (
	MsgKindPlayerJoin    MsgKind = iota // 玩家加入
	MsgKindPlayerExit                   // 玩家退出
	MsgKindPlayerReady                  // 玩家准备
	MsgKindDisband                      // 申请解散
	MsgKindDisbandReject                // 拒绝解散
	MsgKindQuick                        // 申请少人开局
	MsgKindQuickReject                  // 拒绝少人开局
	MsgKindDisbandIdle                  // 解散房间
	MsgKindDisbandForce                 // 强制解散房间
	MsgKindGame                         // 游戏操作
	MsgKindByUser                       // 自定义
)

type MsgKindPlayerJoinData

type MsgKindPlayerJoinData struct {
	Player *player.Player
}

type MsgKindPlayerReadyData

type MsgKindPlayerReadyData struct {
	Site uint32
}

type PlayerMsg

type PlayerMsg interface {
	Send(ctx context.Context, userKey []interface{}, data ...interface{}) error
	ReConn(ctx context.Context, userKey []interface{}) error
}

Jump to

Keyboard shortcuts

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