Documentation ¶
Index ¶
- type Round
- func (slf *Round[Data]) ActionFinish()
- func (slf *Round[Data]) ActionRefresh()
- func (slf *Round[Data]) AllowAction(camp, entity int) bool
- func (slf *Round[Data]) CampAllowAction(camp int) bool
- func (slf *Round[Data]) GetActionTimeoutTime() int64
- func (slf *Round[Data]) GetCurrent() (camp, entity int)
- func (slf *Round[Data]) GetCurrentCamp() int
- func (slf *Round[Data]) GetCurrentRoundProgressRate() float64
- func (slf *Round[Data]) GetData() Data
- func (slf *Round[Data]) GetRound() int
- func (slf *Round[Data]) OnActionRefreshEvent()
- func (slf *Round[Data]) OnActionTimeoutEvent()
- func (slf *Round[Data]) OnChangeEvent()
- func (slf *Round[Data]) OnGameOverEvent()
- func (slf *Round[Data]) OnSwapCampEvent()
- func (slf *Round[Data]) OnSwapEntityEvent()
- func (slf *Round[Data]) Release()
- func (slf *Round[Data]) Reset()
- func (slf *Round[Data]) SetCurrent(campId int, entityId int)
- func (slf *Round[Data]) SkipCamp()
- func (slf *Round[Data]) Start()
- func (slf *Round[Data]) Stop()
- type RoundActionRefreshEvent
- type RoundActionTimeoutEvent
- type RoundCamp
- type RoundChangeEvent
- type RoundData
- type RoundGameOverEvent
- type RoundGameOverVerifyHandle
- type RoundOption
- func WithRoundActionRefreshEvent[Data RoundData](refreshEventHandle RoundActionRefreshEvent[Data]) RoundOption[Data]
- func WithRoundActionTimeout[Data RoundData](timeout time.Duration) RoundOption[Data]
- func WithRoundActionTimeoutEvent[Data RoundData](timeoutEventHandle RoundActionTimeoutEvent[Data]) RoundOption[Data]
- func WithRoundCampCounterclockwise[Data RoundData]() RoundOption[Data]
- func WithRoundChangeEvent[Data RoundData](changeEventHandle RoundChangeEvent[Data]) RoundOption[Data]
- func WithRoundEntityCounterclockwise[Data RoundData]() RoundOption[Data]
- func WithRoundGameOverEvent[Data RoundData](gameOverEventHandle RoundGameOverEvent[Data]) RoundOption[Data]
- func WithRoundShareAction[Data RoundData](share bool) RoundOption[Data]
- func WithRoundSwapCampEvent[Data RoundData](swapCampEventHandle RoundSwapCampEvent[Data]) RoundOption[Data]
- func WithRoundSwapEntityEvent[Data RoundData](swapEntityEventHandle RoundSwapEntityEvent[Data]) RoundOption[Data]
- func WithRoundTicker[Data RoundData](ticker *timer.Ticker) RoundOption[Data]
- type RoundSwapCampEvent
- type RoundSwapEntityEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Round ¶
type Round[Data RoundData] struct { // contains filtered or unexported fields }
Round 回合制游戏结构
func NewRound ¶
func NewRound[Data RoundData](data Data, camps []*RoundCamp, roundGameOverVerifyHandle RoundGameOverVerifyHandle[Data], options ...RoundOption[Data]) *Round[Data]
NewRound 创建一个新的回合制游戏
- data 游戏数据
- camps 阵营
- roundGameOverVerifyHandle 游戏结束验证函数
- options 选项
func (*Round[Data]) AllowAction ¶
AllowAction 是否允许行动
func (*Round[Data]) CampAllowAction ¶
CampAllowAction 阵容是否允许行动
func (*Round[Data]) GetActionTimeoutTime ¶ added in v0.0.24
GetActionTimeoutTime 获取行动超时时间
func (*Round[Data]) GetCurrent ¶
GetCurrent 获取当前行动的阵营和对象
func (*Round[Data]) GetCurrentCamp ¶
GetCurrentCamp 获取当前行动的阵营
func (*Round[Data]) GetCurrentRoundProgressRate ¶
GetCurrentRoundProgressRate 获取当前回合进度
func (*Round[Data]) OnActionRefreshEvent ¶ added in v0.0.24
func (slf *Round[Data]) OnActionRefreshEvent()
OnActionRefreshEvent 触发行动刷新事件
func (*Round[Data]) OnActionTimeoutEvent ¶
func (slf *Round[Data]) OnActionTimeoutEvent()
OnActionTimeoutEvent 触发行动超时事件
func (*Round[Data]) OnGameOverEvent ¶
func (slf *Round[Data]) OnGameOverEvent()
OnGameOverEvent 触发游戏结束事件
func (*Round[Data]) OnSwapCampEvent ¶
func (slf *Round[Data]) OnSwapCampEvent()
OnSwapCampEvent 触发阵营交换事件
func (*Round[Data]) OnSwapEntityEvent ¶
func (slf *Round[Data]) OnSwapEntityEvent()
OnSwapEntityEvent 触发实体交换事件
func (*Round[Data]) SetCurrent ¶
SetCurrent 设置当前行动对象
type RoundActionRefreshEvent ¶ added in v0.0.24
type RoundActionTimeoutEvent ¶
type RoundCamp ¶
type RoundCamp struct {
// contains filtered or unexported fields
}
RoundCamp 回合制游戏阵营
func NewRoundCamp ¶
NewRoundCamp 创建一个新的回合制游戏阵营
type RoundChangeEvent ¶
type RoundGameOverEvent ¶
type RoundGameOverVerifyHandle ¶
RoundGameOverVerifyHandle 回合制游戏结束验证函数
type RoundOption ¶
RoundOption 回合制游戏选项
func WithRoundActionRefreshEvent ¶ added in v0.0.24
func WithRoundActionRefreshEvent[Data RoundData](refreshEventHandle RoundActionRefreshEvent[Data]) RoundOption[Data]
WithRoundActionRefreshEvent 设置游戏的行动刷新事件
func WithRoundActionTimeout ¶
func WithRoundActionTimeout[Data RoundData](timeout time.Duration) RoundOption[Data]
WithRoundActionTimeout 设置游戏的行动超时时间
func WithRoundActionTimeoutEvent ¶
func WithRoundActionTimeoutEvent[Data RoundData](timeoutEventHandle RoundActionTimeoutEvent[Data]) RoundOption[Data]
WithRoundActionTimeoutEvent 设置游戏的超时事件
func WithRoundCampCounterclockwise ¶
func WithRoundCampCounterclockwise[Data RoundData]() RoundOption[Data]
WithRoundCampCounterclockwise 设置游戏阵营逆序执行
func WithRoundChangeEvent ¶
func WithRoundChangeEvent[Data RoundData](changeEventHandle RoundChangeEvent[Data]) RoundOption[Data]
WithRoundChangeEvent 设置游戏的回合变更事件
- 该事件在触发时已经完成了回合的变更
func WithRoundEntityCounterclockwise ¶
func WithRoundEntityCounterclockwise[Data RoundData]() RoundOption[Data]
WithRoundEntityCounterclockwise 设置游戏实体逆序执行
func WithRoundGameOverEvent ¶
func WithRoundGameOverEvent[Data RoundData](gameOverEventHandle RoundGameOverEvent[Data]) RoundOption[Data]
WithRoundGameOverEvent 设置游戏的结束事件
func WithRoundShareAction ¶
func WithRoundShareAction[Data RoundData](share bool) RoundOption[Data]
WithRoundShareAction 设置游戏的行动是否共享
func WithRoundSwapCampEvent ¶
func WithRoundSwapCampEvent[Data RoundData](swapCampEventHandle RoundSwapCampEvent[Data]) RoundOption[Data]
WithRoundSwapCampEvent 设置游戏的阵营交换事件
- 该事件在触发时已经完成了阵营的交换
func WithRoundSwapEntityEvent ¶
func WithRoundSwapEntityEvent[Data RoundData](swapEntityEventHandle RoundSwapEntityEvent[Data]) RoundOption[Data]
WithRoundSwapEntityEvent 设置游戏的实体交换事件
- 该事件在触发时已经完成了实体的交换
func WithRoundTicker ¶
func WithRoundTicker[Data RoundData](ticker *timer.Ticker) RoundOption[Data]
WithRoundTicker 设置游戏的计时器