From 327481014428b2d5d894b79ae61e82072d6e0b5f Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Thu, 27 Apr 2023 15:18:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=8E=A9=E6=B3=95=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E9=87=8A=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/builtin/gameplay.go | 5 +++++ game/gameplay.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/game/builtin/gameplay.go b/game/builtin/gameplay.go index 3329467..14aabdc 100644 --- a/game/builtin/gameplay.go +++ b/game/builtin/gameplay.go @@ -65,3 +65,8 @@ func (slf *Gameplay) OnGameplayTimeChangeEvent() { handle(current) } } + +func (slf *Gameplay) Release() { + slf.gameplayStartEventHandles = nil + slf.gameplayTimeChangeEventHandles = nil +} diff --git a/game/gameplay.go b/game/gameplay.go index 7d04559..8adcdea 100644 --- a/game/gameplay.go +++ b/game/gameplay.go @@ -15,6 +15,8 @@ type Gameplay interface { GetCurrentTime() time.Time // SetTimeOffset 设置玩法时间偏移 SetTimeOffset(offset time.Duration) + // Release 释放游戏玩法资源 + Release() // RegGameplayStartEvent 在游戏玩法开始时将立即执行被注册的事件处理函数 RegGameplayStartEvent(handle GameplayStartEventHandle)