public void Reset(SyncState state) { Game gamestate = new Game(); gamestate.Sync(state); this.EnqueueCallback(delegate { Game.State = gamestate; }); }
public void Sync(SyncState state) { ServiceManager.Execute(delegate(IClientService x) { x.SyncReceived(); }); ((Client)ThreadHelper.MainThread).SetLoadingStatus("Syncing..."); Game game = new Game(); game.Sync(state); Game.State = game; ConnectedTradersManager.Initialize(); ChatManager.Initialize(); lock (this.SyncRoot) { this.IsSynced = true; this.EnqueueOrderedUpdate(null); while (this.PresyncQueue.Count > 0) { Action a = this.PresyncQueue.Dequeue(); ThreadHelper.MainThread.BeginInvokeIfRequired(a); } } ((Client)ThreadHelper.MainThread).SetLoadingStatus("UI..."); ThreadHelper.MainThread.BeginInvokeIfRequired(delegate { GameManager.UpdateStatus(Game.State.Current); ((Client)ThreadHelper.MainThread).SetUIState(Client.UIState.ACTIVE); }); }