From 060fb05fb8cdeff4008706527806193f808d48f4 Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Tue, 1 Aug 2023 16:30:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20fight.Round=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E6=93=8D=E4=BD=9C=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E6=97=B6=E9=97=B4=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/fight/round.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game/fight/round.go b/game/fight/round.go index 4a17661..0b6e9e9 100644 --- a/game/fight/round.go +++ b/game/fight/round.go @@ -47,6 +47,7 @@ type Round[Data RoundData] struct { campOrder []int // 阵营顺序 actionTimeout time.Duration // 行动超时时间 actionTimeoutTickerName string // 行动超时计时器名称 + actionTimeoutTime int64 // 行动超时时间 round int // 回合数 roundCount int // 回合计数 currentCamp int // 当前行动阵营 @@ -137,6 +138,7 @@ func (slf *Round[Data]) SkipCamp() { // ActionRefresh 刷新行动超时时间 func (slf *Round[Data]) ActionRefresh() { slf.currentEndTime = time.Now().Unix() + slf.actionTimeoutTime = time.Now().Add(slf.actionTimeout).Unix() slf.ticker.After(slf.actionTimeoutTickerName, slf.actionTimeout, slf.loop, true) } @@ -154,6 +156,11 @@ func (slf *Round[Data]) GetRound() int { return slf.round } +// GetActionTimeoutTime 获取行动超时时间 +func (slf *Round[Data]) GetActionTimeoutTime() int64 { + return slf.actionTimeoutTime +} + // AllowAction 是否允许行动 func (slf *Round[Data]) AllowAction(camp, entity int) bool { return (slf.currentCamp == camp && slf.currentEntity == entity) || slf.shareAction && camp == slf.currentCamp