Documentation
¶
Index ¶
- Variables
- type CostMode
- type Event
- type EventPlayerJoinFailKind
- type GameBase
- func (g *GameBase) Auto() *proxy.GameAuto
- func (g *GameBase) Begin(quick bool)
- func (g *GameBase) DisbandTs() time.Duration
- func (g *GameBase) DistanceLimit() int
- func (g *GameBase) End()
- func (g *GameBase) Finish(disband bool)
- func (g *GameBase) GameEnd()
- func (g *GameBase) Init(ctx context.Context, delay proxy.GameDelay, pMgr proxy.GamePMgr, ...) error
- func (g *GameBase) IpLimit() bool
- func (g *GameBase) Msg(userKey interface{}, data interface{})
- func (g *GameBase) PlayerAuto(userKey interface{})
- func (g *GameBase) PlayerExit(userKey interface{}, view bool)
- func (g *GameBase) PlayerJoin(userKey interface{}, exist bool, view bool)
- func (g *GameBase) PlayerMaxNum() int
- func (g *GameBase) PlayerOfflineKickOut() time.Duration
- func (g *GameBase) PlayerOp(userKey interface{}, exist bool, view bool)
- func (g *GameBase) Quick(num int) bool
- func (g *GameBase) QuickTs() time.Duration
- func (g *GameBase) View() bool
- type Happy
- type Plugin
- type RoundBeginPolicy
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PanicDoneExit = errors.New("done exit") PanicGameEnd = errors.New("game end") )
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
RoundBegin func(h Happy, curRound, maxRound uint32, pMgr *pmgr.PMgr, extend map[string]interface{})
RoundEnd func(h Happy, curRound, maxRound uint32, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerJoinSuccess func(h Happy, key interface{}, pMgr *pmgr.PMgr, alreadyExist bool, extend map[string]interface{})
PlayerJoinFail func(h Happy, key interface{}, kind EventPlayerJoinFailKind, extend map[string]interface{})
PlayerExit func(h Happy, key interface{}, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerReady func(h Happy, key interface{}, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerLine func(h Happy, key interface{}, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerOp func(h Happy, key interface{}, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerAuto func(h Happy, key interface{}, pMgr *pmgr.PMgr, extend map[string]interface{})
PlayerSite func(h Happy, key interface{}, mgr *pmgr.PMgr, extend map[string]interface{})
PlayerScore func(h Happy, key interface{}, mgr *pmgr.PMgr, extend map[string]interface{})
Cost func(h Happy, mode CostMode, back bool, pMgr *pmgr.PMgr, extend map[string]interface{})
DisbandAgree func(h Happy, ts time.Duration, deadlineTs int64, userKey interface{}, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
DisbandReject func(h Happy, ts time.Duration, deadlineTs int64, userKey interface{}, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
DisbandPass func(h Happy, deadlineTs int64, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
DisbandFail func(h Happy, deadlineTs int64, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
QuickAgree func(h Happy, ts time.Duration, deadlineTs int64, userKey interface{}, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
QuickReject func(h Happy, ts time.Duration, deadlineTs int64, userKey interface{}, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
QuickPass func(h Happy, deadlineTs int64, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
QuickFail func(h Happy, deadlineTs int64, pMgr *pmgr.PMgr, op map[interface{}]bool, extend map[string]interface{})
Finish func(h Happy, curRound, maxRound uint32, pMgr *pmgr.PMgr, disband bool, extend map[string]interface{})
}
type EventPlayerJoinFailKind ¶
type EventPlayerJoinFailKind int
const ( EventPlayerJoinFailKindFull EventPlayerJoinFailKind = iota // 人数已满 EventPlayerJoinFailKindViewOff // 禁止观战 EventPlayerJoinFailKindLocationOff // 定位未开启 EventPlayerJoinFailKindLocationIpSame // 定位IP相同 EventPlayerJoinFailKindLocationTooClose // 定位距离过近 )
type GameBase ¶
type GameBase struct {
Ctx context.Context
PMgr proxy.GamePMgr
PMsg proxy.PlayerMsg
Delay proxy.GameDelay
Log proxy.GameLog
}
func (*GameBase) DistanceLimit ¶
func (*GameBase) PlayerAuto ¶
func (g *GameBase) PlayerAuto(userKey interface{})
func (*GameBase) PlayerExit ¶
func (*GameBase) PlayerJoin ¶
func (*GameBase) PlayerMaxNum ¶
func (*GameBase) PlayerOfflineKickOut ¶
type Happy ¶
type Happy interface {
Context() context.Context
Init() error
Resume(begin bool, curRound uint32)
Run(resume bool)
Cost(mode CostMode)
Event(e *Event)
Heartbeat(interval time.Duration) error
Msg(msg *proxy.Msg)
MsgByUser(f func(userKey interface{}, data interface{}, delay proxy.Delay, curRound, maxRound uint32, pMgr *pmgr.PMgr, extend map[string]interface{}))
Owner(userKey interface{})
PlayerMsg(msg proxy.PlayerMsg)
Plugin(p *Plugin)
RoundBeginPolicy(policy RoundBeginPolicy)
LogSetting(path string, level log.Level) error
Log() *log.Logger
}
type Plugin ¶
type Plugin struct {
PlayerExitDisband func(userKey interface{}, ownerUserKey interface{}, extend map[string]interface{}) bool
DisbandMinAgreeNum func(num int) int
DisbandDeadlinePass func(extend map[string]interface{}) bool
QuickMinAgreeNum func(num int) int
QuickDeadlinePass func(extend map[string]interface{}) bool
LocationDistance func(origin *player.Location, des ...*player.Location) ([]int, error)
}
type RoundBeginPolicy ¶
type RoundBeginPolicy int
const ( RoundBeginPolicyAllPlayerReady RoundBeginPolicy = iota // 所有玩家准备 RoundBeginPolicyFullPlayer // 满员 )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.