public void OpenApp(App app) { if (_currentApp.Type == app) { return; } if (!_apps.ContainsKey(app)) { _apps[app] = MakeApp(app); } _branch.Remove(_currentApp.Branch); _currentApp = _apps[app]; _branch.Add(_currentApp.Branch); }
public RoomUI() { _gameState = CurrentGameState.State; Branch = new ClickUIBranch("Room", (int)ClickUIPriorities.Room); _map = ApartmentMapFactory.Create(); Branch.Add(_map.Branch); _sleep = new NewSelectSleepDurationUI(() => { _preparingForBed = false; Branch.Remove(_sleep.Branch); }); _gameState.PlayerCharacter = new PlayerCharacter(_gameState.CharacterSex, _map, new Transform2(new Vector2(TileSize.Size.Width * 2, TileSize.Size.Height * 3))); World.Subscribe(EventSubscription.Create <PreparingForBed>(PrepareForBed, this)); World.Subscribe(EventSubscription.Create <WentToBed>((e) => WentToBed(), this)); World.Subscribe(EventSubscription.Create <Awaken>(Awaken, this)); World.Subscribe(EventSubscription.Create <CollapsedWithExhaustion>((e) => WentToBed(), this)); }