public static void RefreshSpecificEquipmentPanelTabOnCurrentPage(Type itemType) { try { dynamic p = GameAssets.CurrentPage; EquipmentPage equipmentPage = p.EquipmentFrame.Content; equipmentPage.RefreshSpecificEquipmentTab(itemType); } catch (RuntimeBinderException) { // No stats frame on this page! // Best solution according to: // https://stackoverflow.com/a/5768449/14770235 } catch (NullReferenceException) { // This might be necessary instead of the above with the new approach. } }
private void PopulatePages() { foreach (EquipmentLayout equip in equipments.equipments) { EquipmentPageBinding binding = pages.First(x => x.equipmentType == equip.type); if (binding.Equals(default(EquipmentPageBinding))) { Debug.LogError("No equipment page found for type " + equip.type); } else { EquipmentPage page = binding.page; bool saveActive = page.gameObject.activeInHierarchy; page.gameObject.SetActive(true); page.AddEquipment(equip); page.gameObject.SetActive(saveActive); } } EquipmentButton.OnEquipmentSelected += OnEquipmentSelected; }
public static void RefreshStatsAndEquipmentPanelsOnCurrentPage() { try { dynamic p = GameAssets.CurrentPage; HeroStatsPage statsPage = p.StatsFrame.Content; statsPage.RefreshAllDynamicStatsAndToolTips(); EquipmentPage equipmentPage = p.EquipmentFrame.Content; equipmentPage.ChangeActiveTab(); equipmentPage.RefreshCurrentEquipmentTab(); } catch (RuntimeBinderException) { // No stats frame on this page! // Best solution according to: // https://stackoverflow.com/a/5768449/14770235 } catch (NullReferenceException) { // This might be necessary instead of the above with the new approach. } }