public void OnMagePrefabUpdated(Mage mage) { var mageButton = MageButtonsList[mage.Data.ProfileButtonIndex - 1]; mageButton.GetComponentInChildren <Text>().text = mage.Data.GetName(); SetButtonElement(mageButton, mage.Data.GetElement()); var profilePage = mageButton.gameObject.transform.GetChild(1); var buttons = profilePage.GetComponentsInChildren <Button>(); mage.AssignActions(); foreach (var t in mage.upgradeActions) { UIManager.SetButtonEvent(buttons[0], t); } var uiAccordionElement = mageButton.GetComponent <UIAccordionElement>(); if (uiAccordionElement.isOn) { Player.TelevoleManager.SetMage(mage.Data); } uiAccordionElement.onValueChanged.AddListener(delegate { Player._audioManager.PlayButtonClickSound(); SetPerson(profilePage.gameObject, mage.Data); if (mage.GetBuilding()) { if (uiAccordionElement.isOn) { // mage.GetBuilding().StartHighlighting(ElementController.Instance.GetColor(mage.Data.GetElement())); mage.GetBuilding().StartHighlighting(); mage.GetBuilding().DisplayRangeObject(); } else { mage.GetBuilding().StopHighlighting(); mage.GetBuilding().HideRangeObject(); } if (mage.GetBuilding().MenuOpen) { mage.GetBuilding().MenuOpen = uiAccordionElement.isOn; if (MageMenuOpen) { Player.UIManager.DestroyTowerMenuCloser(); } } else if (uiAccordionElement.isOn) { Player.BuildingMenuSpawner.SpawnMenu(mage.GetBuilding()); } } else { mage.SetHightlighActive(uiAccordionElement.isOn); } SetScroll(mage.Data.ProfileButtonIndex); }); }