public string GetMenuScreen(CampaignMenu campaignMenu) { MenuItem returnedMenu = new MenuItem(); string menuData = Menu.ShowMenu(0, Convert.ToInt32(campaignMenu), ref returnedMenu); Session.LastMenuAccessed = returnedMenu; CurrentMenu = returnedMenu; return(menuData); }
private void Awake() { if (menu == null) { menu = GetComponent <CampaignMenu>(); } Assert.IsTrue(menu != null); Assert.IsTrue(deckConfirmButton != null); FindNodes(); FindArmies(); LoadFile(); if (GameSettings.INSTANCE.IsBattle()) { ConfirmBattleResult(); } }
public void HandlePanels(Panel currentPanel) { switch (currentPanel) { case Panel.MainMenu: LobbyMainMenu.Show(); break; case Panel.CampaignMenu: CampaignMenu.Show(); break; case Panel.InGame: ShowTopMenu(false); ShowBottomMenu(false); BattleHUD.Show(); return; case Panel.LeaderBoards: Leaderboard.Show(); break; case Panel.ArmyPanel: CardCollectionMenu.Show(); break; case Panel.TasksPanel: TasksMenu.Show(); break; case Panel.ShopPanel: IAPPanel.Show(); break; case Panel.SocialPanel: SocialPanel.Show(); break; default: LobbyMainMenu.Show(); break; } }
private string ShowPreviousMenu(CampaignMenu modelSelection, int length, string selection) { string results = string.Empty; string message = "Aucune Mutuelle presente\n\n"; switch (modelSelection) { case CampaignMenu.MutuelSelection: modelSelection = CampaignMenu.CommuneSelection; Session["SelectedCommune"] = null; Session["CurrentTerritorySelection"] = null; break; case CampaignMenu.CommuneSelection: modelSelection = CampaignMenu.CitySelection; Session["SelectedCity"] = null; Session["CurrentCitySelection"] = null; break; case CampaignMenu.CitySelection: modelSelection = CampaignMenu.ProvinceSelection; Session["SelectedProvince"] = null; Session["CurrentProvinceSelection"] = null; break; } MenuItem currentMenu = new MenuItem(); results = Menu.ShowMenu((int)modelSelection, (int)modelSelection, ref currentMenu, false); Session.LastMenuAccessed = currentMenu; results += message + GetMenuSubScreen(modelSelection, length, selection); return(results); }
private string GetMenuSubScreen(CampaignMenu modelSelection, int length, string selection) { try { string returnValue = string.Empty; string backValue = "\n0)Retour\n10)Pg suivante\n00.Accueil"; //tricky stuff. you need to build a string less the length so that it will fit on the returned string and keep track of where you // at the the collection for navigation. switch (modelSelection) { case CampaignMenu.ProvinceSelection: #region Province Session["MenuSection"] = 1; DisplayListOfProvinces(); Dictionary <int, string> provinceMenuItems = Session["ProvinceMenuItems"] as Dictionary <int, string>; int index = Session["CurrentProvinceSelection"] != null ? (int)Session["CurrentProvinceSelection"] : 0; int displayIndex = index >= 10 ? index + 2 : index + 1; if (selection == "10" || index == 0) { Session["PreviousProvinceSelection"] = index; while (index >= 0 && (index < provinceMenuItems.Count) && (length + provinceMenuItems[index + 1].Length + backValue.Length) < 180) { if (index == 0) { backValue = "\n10)Pg suivante\n00.Accueil"; } if (displayIndex == 10) { displayIndex++; } returnValue += $"\n{displayIndex}){provinceMenuItems[index + 1]}"; index++; displayIndex++; length += returnValue.Length; Session["CurrentProvinceSelection"] = index; if (index >= provinceMenuItems.Count) { backValue = "\n0)Retour\n00.Acceuil"; } } } else if (selection == "0") { index = Convert.ToInt32(Session["PreviousProvinceSelection"]); displayIndex = index >= 10 ? index + 1 : index; Session["CurrentProvinceSelection"] = index; while (index > 0 && (index <= provinceMenuItems.Count) && (length + provinceMenuItems[index].Length + backValue.Length) < 180) { if (index >= provinceMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } returnValue += $"\n{displayIndex }){provinceMenuItems[index]}"; index--; displayIndex--; if (displayIndex == 10) { displayIndex--; } length += returnValue.Length; Session["PreviousProvinceSelection"] = index; if (index == 1) { backValue = "\n10)Pg suivante\n00.Acceuil"; } } } break; #endregion case CampaignMenu.CitySelection: #region Cities List <City> cityMenuItems = TestData.ListOfCities().cities.Where(n => n.province_id == Convert.ToInt32(Session["SelectedProvince"])).ToList(); Session["MenuSection"] = 2; // Dictionary<int, string> cityMenuItems = Session["CityMenuItems"] as Dictionary<int, string>; index = Session["CurrentCitySelection"] != null ? (int)Session["CurrentCitySelection"] : 0; displayIndex = index >= 10 ? index + 2 : index + 1; if (selection == "10" || index == 0) { if (selection == "0" && cityMenuItems.Count == 0) { return(GetHomeScreen()); } Session["PreviousCitySelection"] = index; while (index >= 0 && (index < cityMenuItems.Count) && (length + cityMenuItems[index].city_name.Length + backValue.Length) < 180) { if (index == 0) { backValue = "\n10)Pg Suivante\n00.Acceuil"; } if (displayIndex == 10) { displayIndex++; } returnValue += $"\n{displayIndex}){cityMenuItems[index].city_name}"; index++; displayIndex++; length += returnValue.Length; Session["CurrentCitySelection"] = index; if (index >= cityMenuItems.Count) { backValue = "\n0)Retour\n00.Acceuil"; } } } else if (selection == "0") { index = Convert.ToInt32(Session["PreviousCitySelection"]); displayIndex = index >= 10 ? index + 1 : index; Session["CurrenCitySelection"] = index; if (index == 0) { Session["CurrentProvinceSelection"] = 0; //returnValue = GetMenuScreen(CampaignMenu.ProvinceSelection); //returnValue += GetMenuSubScreen(CampaignMenu.ProvinceSelection, length, selection); GoToMainMenu(); } while (index > 0 && (index <= cityMenuItems.Count) && (length + cityMenuItems[index].city_name.Length + backValue.Length) < 180) { if (index >= cityMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } returnValue += $"\n{displayIndex }){cityMenuItems[index].city_name}"; index--; displayIndex--; if (displayIndex == 10) { displayIndex--; } length += returnValue.Length; Session["PreviousCitySelection"] = index; if (index == 1) { backValue = "\n10)Pg Suivante\n00.Accueil"; } } } break; #endregion case CampaignMenu.CommuneSelection: #region Commune Session["MenuSection"] = 3; List <Commune> communeMenuItems = TestData.ListOfCommunes().communes.Where(n => n.city_id == Convert.ToInt32(Session["SelectedCity"])).ToList(); //Dictionary<int, string> territoryMenuItems = Session["TerritoryMenuItems"] as Dictionary<int, string>; index = Session["CurrentTerritorySelection"] != null ? (int)Session["CurrentTerritorySelection"] : 0; displayIndex = index >= 10 ? index + 2 : index + 1; if (selection == "10" || index == 0) { if (selection == "0" && communeMenuItems.Count == 0) { return(GetHomeScreen()); } Session["PreviousTerritorySelection"] = index; while (index >= 0 && (index < communeMenuItems.Count) && (length + communeMenuItems[index].commune_name.Length + backValue.Length) < 180) { if (index == 0) { backValue = "\n10)Pg Suivante\n00.Accueil"; } if (displayIndex == 10) { displayIndex++; } returnValue += $"\n{displayIndex}){communeMenuItems[index].commune_name}"; index++; displayIndex++; length += returnValue.Length; Session["CurrentTerritorySelection"] = index; if (index >= communeMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } } } else if (selection == "0") { index = Convert.ToInt32(Session["PreviousTerritorySelection"]); displayIndex = index >= 10 ? index + 1 : index; Session["CurrentTerritorySelection"] = index; if (index == 0) { Session["CurrenCitySelection"] = 0; Session.LastMenuAccessed.MenuId = (int)CampaignMenu.CitySelection; return(GetMenuSubScreen(CampaignMenu.CitySelection, length, selection)); } while (index > 0 && (index <= communeMenuItems.Count) && (length + communeMenuItems[index].commune_name.Length + backValue.Length) < 180) { if (index >= communeMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } returnValue += $"\n{displayIndex }){communeMenuItems[index].commune_name}"; index--; displayIndex--; if (displayIndex == 10) { displayIndex--; } length += returnValue.Length; Session["PreviousTerritorySelection"] = index; if (index == 1) { backValue = "\n10)Pg Suivante\n00.Accueil"; } } } break; #endregion case CampaignMenu.MutuelSelection: #region Mutuel List <Mutuel> mutuelMenuItems = TestData.ListOfMutuels().mutuels.Where(n => n.commune_id == Convert.ToInt32(Session["SelectedCommune"])).ToList(); Session["MenuSection"] = 4; //Dictionary<int, string> territoryMenuItems = Session["TerritoryMenuItems"] as Dictionary<int, string>; index = Session["CurrentMutuelSelection"] != null ? (int)Session["CurrentMutuelSelection"] : 0; displayIndex = index >= 10 ? index + 2 : index + 1; if (selection == "10" || index == 0) { if (selection == "0" && mutuelMenuItems.Count == 0) { return(GetHomeScreen()); } Session["PreviousMutuelSelection"] = index; while (index >= 0 && (index < mutuelMenuItems.Count) && (length + mutuelMenuItems[index].mutuel_name.Length + backValue.Length) < 180) { if (index == 0) { backValue = "\n10)Pg Suivante\n00.Accueil"; } if (displayIndex == 10) { displayIndex++; } returnValue += $"\n{displayIndex}){mutuelMenuItems[index].mutuel_name} - ${mutuelMenuItems[index].price}"; index++; displayIndex++; length += returnValue.Length; Session["CurrentMutuelSelection"] = index; if (index >= mutuelMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } } } else if (selection == "0") { index = Convert.ToInt32(Session["PreviousMutuelSelection"]); displayIndex = index >= 10 ? index + 1 : index; Session["CurrentMutuelSelection"] = index; while (index > 0 && (index <= mutuelMenuItems.Count) && (length + mutuelMenuItems[index].mutuel_name.Length + backValue.Length) < 180) { if (index >= mutuelMenuItems.Count) { backValue = "\n0)Retour\n00.Accueil"; } returnValue += $"\n{displayIndex }){mutuelMenuItems[index].mutuel_name} - ${mutuelMenuItems[index].price}"; index--; displayIndex--; if (displayIndex == 10) { displayIndex--; } length += returnValue.Length; Session["PreviousMutuelSelection"] = index; if (index == 1) { backValue = "\n10)Pg Suivante\n00.Accueil"; } } } break; #endregion } return(string.Format("{0}", returnValue + backValue)); } catch (Exception exp) { return("notfify# Pas d'info\n\n00.Accueil"); } }
private UniRx.IObservable <Unit> HidePreviousPanel() { return(Observable.Create <Unit>(observer => { if (PreviousPanel.Value == CurrentPanel.Value) { observer.OnCompleted(); return null; } switch (PreviousPanel.Value) { case Panel.MainMenu: LobbyMainMenu.Hide(); break; case Panel.CampaignMenu: CampaignMenu.Hide(); break; case Panel.Lobby: this.lobbyPanel.SetActive(false); break; case Panel.InGame: BattleHUD.Hide(); BattleResultsPanel.Hide(); break; case Panel.LeaderBoards: Leaderboard.Hide(); break; case Panel.ArmyPanel: CardCollectionMenu.Hide(); break; case Panel.ShopPanel: IAPPanel.Hide(); break; case Panel.TasksPanel: TasksMenu.Hide(); break; case Panel.ServerPanel: this.serverPanel.SetActive(false); break; case Panel.SocialPanel: SocialPanel.Hide(); break; case Panel.BattleResultsPanel: BattleResultsPanel.Hide(); break; default: Debug.LogError("Unsupported panel: " + PreviousPanel); break; } observer.OnCompleted(); return null; })); }