protected ProgressData() { Levels = new Dictionary <string, bool>(); Tasks = new Dictionary <string, bool>(); foreach (var p in LevelContainer.GetInstance().Levels) { Levels.Add(p.Key, false); if (p.Value.Tasks == null) { continue; } foreach (var t in p.Value.Tasks) { Tasks.Add(t.Name, false); } } Skins = new Dictionary <string, bool>(); foreach (var skin in SkinsContainer.GetInstance().Skins) { Skins.Add(skin.Skin.name, false); } //todo Data = new Dictionary <DataType, Dictionary <string, bool> > { { DataType.Level, Levels }, { DataType.Task, Tasks }, { DataType.Skin, Skins }, }; //special Levels["main"] = true; }
public void HandleTimedEvent(string msg, string par1, string par2) { switch (msg) { case "SPAWN_CUSTOMER": LevelContainer.GetInstance().ActiveLevel.SpawnCustomer(); break; case "DESPAWN_CUSTOMER": LevelContainer.GetInstance().ActiveLevel.DespawnCustomer(); break; case "DELETE_OLD_CUSTOMER": LevelContainer.GetInstance().ActiveLevel.DeleteOldCustomer(); break; } }
public void HandleKeyEvent(string keyValue, string keyAction) { if (keyAction == "KEY_PRESS") { switch (keyValue) { case "KEY_UP": if (activeMenuButton > 0) { menuButtons[activeMenuButton].SetColor(new Vec3F(1.0f, 1.0f, 1.0f)); activeMenuButton--; menuButtons[activeMenuButton].SetColor(new Vec3F(0.0f, 1.0f, 0.0f)); } break; case "KEY_DOWN": if (activeMenuButton < maxMenuButtons) { menuButtons[activeMenuButton].SetColor(new Vec3F(1.0f, 1.0f, 1.0f)); activeMenuButton++; menuButtons[activeMenuButton].SetColor(new Vec3F(0.0f, 1.0f, 0.0f)); } break; case "KEY_ENTER": switch (activeMenuButton) { case 2: SpaceTaxiBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.GameStateEvent, this, "CHANGE_STATE", "MAIN_MENU", "")); break; default: LevelContainer.GetInstance().GetLevel(maxMenuButtons - activeMenuButton - 1); SpaceTaxiBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.GameStateEvent, this, "CHANGE_STATE", "GAME_RUNNING", "")); break; } break; } } }
private void Start() { if (_instance != null) { throw new Exception("Second singleton"); } _instance = this; _lvlContainer = LevelContainer.GetInstance(); _casualStyle.CommonAssets = _commonAssets; _avaCtrl = AvatarController.GetInstance(); _buildCtrl = BuildController.GetInstance(); _buildCtrl.SetStyle(_casualStyle); _taskCtrl = TaskController.GetInstance(); _taskCtrl.Initialize(); GameplayController.InitializeInstance(); _gameplayCtrl = GameplayController.GetInstance(); LocalizationController.Instance.ChangeLocale(LocalizationController.Locale.EN); var a = AppSettings.GetInstance(); }
public bool this[DataType type, string name] { get { return(Data[type][name]); } set { Data[type][name] = value; DataChanged?.Invoke(type, name, value); if (type == DataType.Task && value) { var res = true; var tsks = LevelContainer.GetInstance().Levels[name.Substring(0, 3)].Tasks; foreach (var t in tsks) { res &= this[DataType.Task, t.Name]; } if (res) { this[DataType.Level, name.Substring(0, 3)] = true; } } } }
public void UpdateGameLogic() { SpaceTaxiEventContainer.GetContainer().ProcessTimedEvents(); LevelContainer.GetInstance().ActiveLevel.UpdateLevel(); }