游戏玩法资源释放

This commit is contained in:
kercylan98 2023-04-27 15:18:22 +08:00
parent 93d71c9a7e
commit 3274810144
2 changed files with 7 additions and 0 deletions

View File

@ -65,3 +65,8 @@ func (slf *Gameplay) OnGameplayTimeChangeEvent() {
handle(current)
}
}
func (slf *Gameplay) Release() {
slf.gameplayStartEventHandles = nil
slf.gameplayTimeChangeEventHandles = nil
}

View File

@ -15,6 +15,8 @@ type Gameplay interface {
GetCurrentTime() time.Time
// SetTimeOffset 设置玩法时间偏移
SetTimeOffset(offset time.Duration)
// Release 释放游戏玩法资源
Release()
// RegGameplayStartEvent 在游戏玩法开始时将立即执行被注册的事件处理函数
RegGameplayStartEvent(handle GameplayStartEventHandle)