public void TeamPanelOnClick(TeamSelectionPanel panel) { confirmButton.interactable = true; isTeamSelected = true; GameManager.Instance.selectedTeamNum = panel.teamNum; foreach (TeamSelectionPanel selectionPanel in teamSelectionPanels) { Image image = selectionPanel.GetComponent <Image>(); if (selectionPanel == panel) { image.color = Helpers.SELECTION_COLOR; selectionPanel.heroSlots.ForEach(x => x.GetComponent <Image>().color = Color.white); } else { image.color = Color.white; selectionPanel.heroSlots.ForEach(x => x.GetComponent <Image>().color = new Color(0.7f, 0.7f, 0.7f)); } } }
public void StageButtonOnClick(StageInfoBase stageInfo) { confirmButton.interactable = false; isTeamSelected = false; selectedStage = stageInfo; UIManager.Instance.OpenWindow(teamSelectParent, false); for (int i = 0; i < teamSelectionPanels.Count; i++) { TeamSelectionPanel selectionPanel = teamSelectionPanels[i]; Button button = selectionPanel.GetComponent <Button>(); button.onClick.RemoveAllListeners(); button.onClick.AddListener(delegate { TeamPanelOnClick(selectionPanel); }); selectionPanel.GetComponent <Image>().color = Color.white; int heroCount = 0; for (int j = 0; j < 5; j++) { HeroData hero = GameManager.Instance.PlayerStats.heroTeams[i][j]; TeamSelectionHeroSlot teamSelectionHeroSlot = teamSelectionPanels[i].heroSlots[j]; teamSelectionHeroSlot.GetComponent <Image>().color = new Color(0.7f, 0.7f, 0.7f); if (hero != null) { teamSelectionHeroSlot.nameText.text = hero.Name; teamSelectionHeroSlot.levelText.text = "Lv" + hero.Level.ToString("N0"); teamSelectionHeroSlot.sprite.sprite = ResourceManager.Instance.GetHeroSprite(hero.spriteName); teamSelectionHeroSlot.sprite.color = Color.white; heroCount++; } else { teamSelectionHeroSlot.nameText.text = ""; teamSelectionHeroSlot.levelText.text = ""; teamSelectionHeroSlot.sprite.color = new Color(1f, 1f, 1f, 0f); } } button.interactable = heroCount > 0; } }