private void ItemIcon_SetItemIndex(On.RoR2.UI.ItemIcon.orig_SetItemIndex orig, ItemIcon self, ItemIndex newItemIndex, int newItemCount) { orig(self, newItemIndex, newItemCount); var shouldDisplay = newItemIndex == itemDef.itemIndex && newItemCount > 0; var fillIcon = self.GetComponent <MysticsItemsSuperIdolHUDIcon>(); if (shouldDisplay != fillIcon) { if (shouldDisplay) { var itemInventoryDisplay = self.GetComponentInParent <ItemInventoryDisplay>(); if (itemInventoryDisplay && itemInventoryDisplay.inventory) { var master = itemInventoryDisplay.inventory.GetComponent <CharacterMaster>(); if (master) { fillIcon = self.gameObject.AddComponent <MysticsItemsSuperIdolHUDIcon>(); fillIcon.master = master; fillIcon.fillAmount = CalculateIdolBonus(master, newItemCount); } } } else { UnityEngine.Object.Destroy(fillIcon); fillIcon = null; } } if (shouldDisplay && fillIcon) { fillIcon.itemCount = newItemCount; fillIcon.UpdateTransform(); } }
private static void AttachZetDropHandler(ItemIcon icon) { if (icon.GetComponent <ZetDropHandler>() != null) { return; } var dropItemHandler = icon.transform.gameObject.AddComponent <ZetDropHandler>(); dropItemHandler.GetItemIndex = () => icon.GetFieldValue <ItemIndex>("itemIndex"); dropItemHandler.GetInventory = () => icon.rectTransform.parent.GetComponent <ItemInventoryDisplay>().GetFieldValue <Inventory>("inventory"); }
public override void UpdateUI() { base.UpdateUI(); SetActive((Enum)UI.SPR_COUNT_0_ON, exceedCount > 0); SetActive((Enum)UI.SPR_COUNT_1_ON, exceedCount > 1); SetActive((Enum)UI.SPR_COUNT_2_ON, exceedCount > 2); SetActive((Enum)UI.SPR_COUNT_3_ON, exceedCount > 3); SetLabelText((Enum)UI.LBL_SELECT_NOW, (selectPageIndex + 1).ToString()); UpdateBonusDetail(true); bool is_only_lapis = true; int item_num = exceedData.exceed.Length; SetGrid(UI.GRD_LAPIS, "SmithExceedItem", item_num, false, delegate(int i, Transform t, bool is_recycle) { //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) if (exceedCount >= 4) { SetActive(t, false); } else if (i < selectPageIndex * 3 || i >= (selectPageIndex + 1) * 3) { SetActive(t, false); } else { EquipItemExceedTable.EquipItemExceedData.ExceedNeedItem exceedNeedItem = exceedData.exceed[i]; if (exceedNeedItem == null || exceedNeedItem.itemId == 0 || exceedNeedItem.num[exceedCount] == 0) { SetActive(t, false); } else { ItemTable.ItemData itemData = Singleton <ItemTable> .I.GetItemData(exceedNeedItem.itemId); if (itemData == null) { SetActive(t, false); } else { if (itemData.type != ITEM_TYPE.LAPIS) { is_only_lapis = false; } SetActive(t, true); int haveingItemNum = MonoBehaviourSingleton <InventoryManager> .I.GetHaveingItemNum(exceedNeedItem.itemId); int num = (int)exceedNeedItem.num[exceedCount]; ItemIcon.GetIconShowData(REWARD_TYPE.ITEM, exceedNeedItem.itemId, out int _, out ITEM_ICON_TYPE icon_type, out RARITY_TYPE? _, out ELEMENT_TYPE _, out EQUIPMENT_TYPE? _, out int _, out int _, out GET_TYPE _, 0); Transform val = FindCtrl(t, UI.OBJ_MATERIAL_ICON_ROOT); bool flag2 = haveingItemNum >= num; ItemIcon itemIcon = ItemIconMaterial.CreateMaterialIcon(icon_type, itemData, val, haveingItemNum, num, (!flag2) ? "NEED" : "NEXT", i, false); SetMaterialInfo(itemIcon._transform, REWARD_TYPE.ITEM, exceedNeedItem.itemId, GetCtrl(UI.SCR_LAPIS_ROOT)); ItemIconMaterial itemIconMaterial = itemIcon as ItemIconMaterial; if (itemIconMaterial != null) { itemIconMaterial.SetVisibleBG(false); } FindCtrl(val, UI.SPR_EXCEED_BTN_BG).set_parent(itemIcon._transform); SetActive(t, UI.SPR_EXCEED_GRAYOUT, !flag2); if (itemData.endDate != default(DateTime)) { string format = StringTable.Get(STRING_CATEGORY.SHOP, 15u); SetLabelText(t, UI.LBL_LIMITED, string.Format(format, itemData.endDate.ToString("yyyy/MM/dd HH:mm"))); } else { SetActive(t, UI.OBJ_EXCEED_LIMITED, false); } if (!IsValidExceedSection()) { if (itemIcon.GetComponent <UINoAuto>() == null) { itemIcon.get_gameObject().AddComponent <UINoAuto>(); } if (itemIcon.GetComponent <UIButtonScale>() == null) { UIButtonScale uIButtonScale = itemIcon.get_gameObject().AddComponent <UIButtonScale>(); uIButtonScale.hover = Vector3.get_one(); uIButtonScale.pressed = UIButtonEffect.buttonScale_pressed; uIButtonScale.duration = UIButtonEffect.buttonScale_duration; } } } } } }); bool flag = exceedCount < 4; SetActive((Enum)UI.OBJ_VALID_EXCEED_ROOT, flag); SetActive((Enum)UI.OBJ_INVALID_EXCEED_ROOT, !flag); int id = (!is_only_lapis) ? 6 : 5; string text = StringTable.Get(STRING_CATEGORY.ITEM_DETAIL, (uint)id); SetLabelText((Enum)UI.LBL_USE_MATERIAL_NAME, text); }