public void Dispose() { Disposing = true; if (OrderGenerator != null) { OrderGenerator.Deactivate(); } frameEndActions.Clear(); Game.Sound.StopAudio(); Game.Sound.StopVideo(); if (IsLoadingGameSave) { Game.Sound.DisableAllSounds = false; } ModelCache.Dispose(); // Dispose newer actors first, and the world actor last foreach (var a in actors.Values.Reverse()) { a.Dispose(); } // Actor disposals are done in a FrameEndTask while (frameEndActions.Count != 0) { frameEndActions.Dequeue()(this); } Game.FinishBenchmark(); }
public void Dispose() { Disposing = true; frameEndActions.Clear(); WarGame.Sound.StopAudio(); ModelCache.Dispose(); //Dispose newer actors first,and the world actor last foreach (var a in actors.Values.Reverse()) { a.Dispose(); } //Actor disposals are done in a FrameEndTask while (frameEndActions.Count != 0) { frameEndActions.Dequeue()(this); //移除并返回位于Queue开始处的对象 } }