public void ResetUI(ChooserMode mode) { chooserMode = mode; if (mode == ChooserMode.Ally) //reset ally to none { DataStore.sessionData.selectedAlly = null; } selectedHero = null; enemyNameText.text = ""; //reset to show Core expansion transform.parent.parent.parent.parent.Find("expansion selector container").Find("Core").GetComponent <Toggle>().isOn = true; OnChangeExpansion("Core"); }
public void Show(ChooserMode mode, List <CardDescriptor> cards, Action <CardDescriptor> callback) { gameObject.SetActive(true); fader.color = new Color(0, 0, 0, 0); fader.DOFade(.95f, 1); cg.alpha = 0; cg.DOFade(1, .5f); closeText.text = DataStore.uiLanguage.uiMainApp.close; //hide expansion buttons not owned, skipping Core and Other Transform exp = transform.Find("Panel/expansion selector container"); //toggle Core button ON exp.GetChild(0).GetComponent <Toggle>().isOn = true; for (int i = 1; i < exp.childCount - 1; i++) { if (DataStore.ownedExpansions.Contains((Expansion)Enum.Parse(typeof(Expansion), exp.GetChild(i).name))) { exp.GetChild(i).gameObject.SetActive(true); } else { exp.GetChild(i).gameObject.SetActive(false); } } callBack = callback; chooserMode = mode; //add custom group IF mode != ally/hero CardDescriptor custom = new CardDescriptor() { cost = 0, expansion = "Other", name = "Custom Group", faction = "None", id = "DG070", ignored = "", priority = 2, rcost = 0, size = 1, tier = 1 }; cardDescriptors = new List <CardDescriptor>(cards); if (mode == ChooserMode.DeploymentGroups && !cardDescriptors.Any(x => x.id == "DG070")) { cardDescriptors.Add(custom); } OnChangeExpansion("Core"); }
//0=starting, 1=reserved, 2=villains, 3=ignored, 4=heroes public void ActivateScreen(ChooserMode mode, int dataGroupIndex = 0) { gameObject.SetActive(true); cg.alpha = 0; cg.DOFade(1, .5f); fader.DOFade(.95f, .5f); this.mode = mode; //reset expansion buttons except Core Transform[] expButtons = (from Transform x in transform.Find("expansion selector container") select x).ToArray(); for (int i = 1; i < expButtons.Length; i++) { if (!DataStore.ownedExpansions.Contains((Expansion)Enum.Parse(typeof(Expansion), expButtons[i].name))) { expButtons[i].gameObject.SetActive(false); } else { expButtons[i].gameObject.SetActive(true); } } expButtons[7].gameObject.SetActive(true); //Other is always active //reset UI expansionController.ResetText(); previewButton.gameObject.SetActive(false); if (mode == ChooserMode.DeploymentGroups) { switch (dataGroupIndex) { case 0: enemyGroupTitle.text = DataStore.uiLanguage.uiSetup.initialHeading; break; case 1: enemyGroupTitle.text = DataStore.uiLanguage.uiSetup.reservedHeading; break; case 2: enemyGroupTitle.text = DataStore.uiLanguage.uiSetup.villainsHeading; break; case 3: enemyGroupTitle.text = DataStore.uiLanguage.uiSetup.ignoredHeading; break; } //update the expansion tabs so they display their card counts for (int i = 0; i < 8; i++) { expansionController.UpdateText(i, DataStore.sessionData.selectedDeploymentCards[dataGroupIndex].cards.Count(x => x.expansion.ToLower() == ((Expansion)i).ToString().ToLower())); } enemyChooserPanel.SetActive(true); groupToggleContainer.ResetUI(dataGroupIndex); } else if (mode == ChooserMode.Missions) { missionChooserPanel.SetActive(true); missionToggleContainer.ResetUI(); } else if (mode == ChooserMode.Hero || mode == ChooserMode.Ally) { //ChooserMode.Hero is DEPRECATED, not used //The Hero Chooser has its own panel and code (HeroChooser) allyChooserPanel.SetActive(true); heroAllyToggleContainer.ResetUI(mode); } }