public EquipmentList() : base(equipmentList) { if (UmbraMenu.characterCollected) { int buttonPlacement = 1; List <Button> buttons = new List <Button>(); for (int i = 0; i < UmbraMenu.equipment.Count; i++) { var equipmentIndex = UmbraMenu.equipment[i]; if (equipmentIndex != EquipmentIndex.None && equipmentIndex != EquipmentCatalog.FindEquipmentIndex("AffixYellow")) { void ButtonAction() => GiveEquipment(equipmentIndex); Color32 equipColor = ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex); string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex)); Button button = new Button(new NormalButton(this, buttonPlacement, equipmentName, ButtonAction)); buttons.Add(button); buttonPlacement++; } else { void ButtonAction() => GiveEquipment(equipmentIndex); string equipmentName = Util.GenerateColoredString(equipmentIndex.ToString(), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Equipment)); Button button = new Button(new NormalButton(this, buttonPlacement, equipmentName, ButtonAction)); buttons.Add(button); buttonPlacement++; } } AddButtons(buttons); SetActivatingButton(Utility.FindButtonById(3, 4)); SetPrevMenuId(3); } }
public static void DrawItemMenu(float x, float y, float widthSize, int mulY, GUIStyle BGstyle, GUIStyle buttonStyle, GUIStyle LabelStyle) { int heightMul = 15; if (Main.lowResolutionMonitor) { heightMul = 10; } GUI.Box(new Rect(x + 0f, y + 0f, widthSize + 20, 50f + 45 * heightMul), "", BGstyle); GUI.Label(new Rect(x + 5f, y + 5f, widthSize + 10, 85f), "I T E M S L I S T", LabelStyle); itemSpawnerScrollPosition = GUI.BeginScrollView(new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * heightMul), itemSpawnerScrollPosition, new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * mulY), false, true); int buttonPlacement = 1; foreach (var itemIndex in Main.items) { Color32 itemColor = ColorCatalog.GetColor(ItemCatalog.GetItemDef(itemIndex).colorIndex); if (itemColor.r <= 105 && itemColor.g <= 105 && itemColor.b <= 105) { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), new Color32(255, 255, 255, 255)); DrawButton(buttonPlacement, "itemSpawner", itemName, buttonStyle); buttonPlacement++; } else { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), itemColor); DrawButton(buttonPlacement, "itemSpawner", itemName, buttonStyle); buttonPlacement++; } } GUI.EndScrollView(); }
public ItemList() : base(itemsList) { if (UmbraMenu.characterCollected) { int buttonPlacement = 1; List <Button> buttons = new List <Button>(); for (int i = 0; i < UmbraMenu.items.Count; i++) { ItemIndex itemIndex = UmbraMenu.items[i]; void ButtonAction() => GiveItem(itemIndex); Color32 itemColor = ColorCatalog.GetColor(ItemCatalog.GetItemDef(itemIndex).colorIndex); if (itemColor.r <= 105 && itemColor.g <= 105 && itemColor.b <= 105) { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), new Color32(255, 255, 255, 255)); Button button = new Button(new NormalButton(this, buttonPlacement, itemName, ButtonAction)); buttons.Add(button); buttonPlacement++; } else { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), itemColor); Button button = new Button(new NormalButton(this, buttonPlacement, itemName, ButtonAction)); buttons.Add(button); buttonPlacement++; } } AddButtons(buttons); SetActivatingButton(Utility.FindButtonById(3, 3)); SetPrevMenuId(3); } }
public static List <EquipmentIndex> GetEquipment() { List <EquipmentIndex> equipment = new List <EquipmentIndex>(); List <EquipmentIndex> equip = new List <EquipmentIndex>(); List <EquipmentIndex> lunar = new List <EquipmentIndex>(); List <EquipmentIndex> other = new List <EquipmentIndex>(); Color32 equipColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Equipment); Color32 lunarColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem); foreach (EquipmentIndex equipmentIndex in EquipmentCatalog.allEquipment) { Color32 currentEquipColor = ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex); if (currentEquipColor.Equals(equipColor)) // equipment { equip.Add(equipmentIndex); } else if (currentEquipColor.Equals(lunarColor)) // lunar equipment { lunar.Add(equipmentIndex); } else // other { other.Add(equipmentIndex); } } UmbraMenu.unreleasedEquipment = other; var result = equipment.Concat(lunar).Concat(equip).Concat(other).ToList(); return(result); }
private void MaybeAwardLoot(On.RoR2.CharacterBody.orig_OnInventoryChanged orig, CharacterBody self) { orig(self); var amount = self.inventory.GetItemCount(Definition.itemIndex); if (amount > 0 && amount % 3 == 0) { self.inventory.RemoveItem(Definition.itemIndex, 3); PickupIndex loot; if (Util.CheckRoll(5, self.master)) { loot = Run.instance.treasureRng.NextElementUniform(Run.instance.availableTier3DropList); } else { loot = Run.instance.treasureRng.NextElementUniform(Run.instance.availableTier2DropList); } if (self.isPlayerControlled) { PickupDropletController.CreatePickupDroplet(loot, self.corePosition, Vector3.up * 5); } else { PickupDef def = PickupCatalog.GetPickupDef(loot); self.inventory.GiveItem(def.itemIndex); var lootCount = self.inventory.GetItemCount(def.itemIndex); Chat.AddPickupMessage(self, def.nameToken, ColorCatalog.GetColor(ItemCatalog.GetItemDef(def.itemIndex).colorIndex), (uint)lootCount); } } }
public void UpdateTextMeshPros() { Vector4 percents = Vector4.zero; float max = (self.equipmentWeight + self.failureWeight + self.tier1Weight + self.tier2Weight + self.tier3Weight) / 100; for (int i = 0; i < 5; i++) { string outputText; Color outputColor = Color.black; float tierWeight = 0f; switch (i) { case 0: outputColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3Item); tierWeight = self.tier3Weight; break; case 1: outputColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2Item); tierWeight = self.tier2Weight; break; case 2: outputColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item); tierWeight = self.tier1Weight; break; case 3: outputColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Equipment); tierWeight = self.equipmentWeight; break; case 4: outputColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItemDark); tierWeight = self.failureWeight; break; } GameObject canvas = textMeshPros[i].gameObject; outputText = (int)(tierWeight / max) + "%"; textMeshPros[i].color = outputColor; textMeshPros[i].text = outputText; textMeshPros[i].overflowMode = TextOverflowModes.Overflow; if (i != 4) { percents[i] = (tierWeight / max); } else { SendUpdateShrineCanvas(self.netId, percents); } } }
// Token: 0x060021C1 RID: 8641 RVA: 0x0009F738 File Offset: 0x0009D938 public static Color GetCriticallyHurtColor() { if (Mathf.FloorToInt(Time.fixedTime * 10f) % 2 != 0) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.Teleporter)); } return(Color.white); }
public static void DrawChestItemMenu(float x, float y, float widthSize, int mulY, GUIStyle BGstyle, GUIStyle buttonStyle, GUIStyle LabelStyle) { int heightMul = 15; if (Main.lowResolutionMonitor) { heightMul = 10; } GUI.Box(new Rect(x + 0f, y + 0f, widthSize + 20, 50f + 45 * heightMul), "", BGstyle); GUI.Label(new Rect(x + 5f, y + 5f, widthSize + 10, 85f), "C H A N G E C H E S T L I S T", LabelStyle); chestItemChangerScrollPosition = GUI.BeginScrollView(new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * heightMul), chestItemChangerScrollPosition, new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * mulY), false, true); int buttonPlacement = 1; if (Chests.IsClosestChestEquip()) { foreach (var equipmentIndex in Main.equipment) { if (equipmentIndex != EquipmentIndex.None) { Color32 equipColor = ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex); if (equipColor.r <= 105 && equipColor.g <= 105 && equipColor.b <= 105) { string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), new Color32(255, 255, 255, 255)); DrawButton(buttonPlacement, "chestItemChanger", equipmentName, buttonStyle); buttonPlacement++; } else { string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex)); DrawButton(buttonPlacement, "chestItemChanger", equipmentName, buttonStyle); buttonPlacement++; } } } } else { foreach (var itemIndex in Main.items) { Color32 itemColor = ColorCatalog.GetColor(ItemCatalog.GetItemDef(itemIndex).colorIndex); if (itemColor.r <= 105 && itemColor.g <= 105 && itemColor.b <= 105) { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), new Color32(255, 255, 255, 255)); DrawButton(buttonPlacement, "chestItemChanger", itemName, buttonStyle); buttonPlacement++; } else { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), itemColor); DrawButton(buttonPlacement, "chestItemChanger", itemName, buttonStyle); buttonPlacement++; } } } GUI.EndScrollView(); }
/// <summary> /// Method to get the interactable tier color from a ping target /// </summary> /// <param name="gameObject">The ping target</param> /// <returns>An Color instance of the tier color</returns> private Color GetTargetTierColor(GameObject gameObject) { Color color = Color.black; ShopTerminalBehavior shopTerminal = gameObject.GetComponent <ShopTerminalBehavior>(); if (shopTerminal) { PickupIndex pickupIndex = shopTerminal.CurrentPickupIndex(); PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndex); if (pickup != null) { color = pickup.baseColor; } } GenericPickupController pickupController = gameObject.GetComponent <GenericPickupController>(); if (pickupController) { PickupDef pickup = PickupCatalog.GetPickupDef(pickupController.pickupIndex); if (pickup != null) { color = pickup.baseColor; } } PurchaseInteraction purchaseInteraction = gameObject.GetComponent <PurchaseInteraction>(); if (purchaseInteraction) { CostTypeDef costType = CostTypeCatalog.GetCostTypeDef(purchaseInteraction.costType); color = ColorCatalog.GetColor(costType.colorIndex); } PickupIndexNetworker pickupIndexNetworker = gameObject.GetComponent <PickupIndexNetworker>(); if (pickupIndexNetworker) { PickupDef pickup = PickupCatalog.GetPickupDef(pickupIndexNetworker.NetworkpickupIndex); if (pickup != null) { color = pickup.baseColor; } } if (color == Color.black) { color = _colors["InteractablePingColor"]; } return(color); }
public static void UpdateChestListMenu() { List <Button> buttons = new List <Button>(); if (isClosestChestEquip) { for (int i = 0; i < UmbraMenu.equipment.Count; i++) { var equipmentIndex = UmbraMenu.equipment[i]; if (equipmentIndex != EquipmentIndex.None) { void ButtonAction() => SetChestEquipment(equipmentIndex); if (equipmentIndex != EquipmentCatalog.FindEquipmentIndex("AffixYellow")) { Color32 equipColor = ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex); string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex)); Button button = new Button(new NormalButton(UmbraMenu.chestItemListMenu, i + 1, equipmentName, ButtonAction)); buttons.Add(button); } else { string equipmentName = Util.GenerateColoredString(equipmentIndex.ToString(), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Equipment)); Button button = new Button(new NormalButton(UmbraMenu.chestItemListMenu, i + 1, equipmentName, ButtonAction)); buttons.Add(button); } } } } else { for (int i = 0; i < UmbraMenu.items.Count; i++) { var itemIndex = UmbraMenu.items[i]; void ButtonAction() => SetChestItem(itemIndex); Color32 itemColor = ColorCatalog.GetColor(ItemCatalog.GetItemDef(itemIndex).colorIndex); if (itemColor.r <= 105 && itemColor.g <= 105 && itemColor.b <= 105) { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), new Color32(0, 0, 0, 255)); Button button = new Button(new NormalButton(UmbraMenu.chestItemListMenu, i + 1, itemName, ButtonAction)); buttons.Add(button); } else { string itemName = Util.GenerateColoredString(Language.GetString(ItemCatalog.GetItemDef(itemIndex).nameToken), itemColor); Button button = new Button(new NormalButton(UmbraMenu.chestItemListMenu, i + 1, itemName, ButtonAction)); buttons.Add(button); } } } UmbraMenu.chestItemListMenu.AddButtons(buttons); }
// Token: 0x060021B4 RID: 8628 RVA: 0x0009EE88 File Offset: 0x0009D088 public void SetEquipment(EquipmentIndex equipmentIndex) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); this.titleText.token = equipmentDef.nameToken; this.descriptionText.token = equipmentDef.pickupToken; if (equipmentDef.pickupIconPath != null) { this.iconImage.texture = Resources.Load <Texture>(equipmentDef.pickupIconPath); } this.titleTMP.color = ColorCatalog.GetColor(equipmentDef.colorIndex); }
// Token: 0x060021B3 RID: 8627 RVA: 0x0009EE18 File Offset: 0x0009D018 public void SetItem(ItemIndex itemIndex) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); this.titleText.token = itemDef.nameToken; this.descriptionText.token = itemDef.pickupToken; if (itemDef.pickupIconPath != null) { this.iconImage.texture = Resources.Load <Texture>(itemDef.pickupIconPath); } this.titleTMP.color = ColorCatalog.GetColor(itemDef.colorIndex); }
public static List <ItemIndex> GetItems() { List <ItemIndex> items = new List <ItemIndex>(); List <ItemIndex> boss = new List <ItemIndex>(); List <ItemIndex> tier3 = new List <ItemIndex>(); List <ItemIndex> tier2 = new List <ItemIndex>(); List <ItemIndex> tier1 = new List <ItemIndex>(); List <ItemIndex> lunar = new List <ItemIndex>(); List <ItemIndex> other = new List <ItemIndex>(); Color32 bossColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItem); Color32 tier3Color = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3Item); Color32 tier2Color = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2Item); Color32 tier1Color = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item); Color32 lunarColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem); foreach (ItemIndex itemIndex in ItemCatalog.allItems) { Color32 itemColor = ColorCatalog.GetColor(ItemCatalog.GetItemDef(itemIndex).colorIndex); if (itemColor.Equals(bossColor)) // boss { boss.Add(itemIndex); } else if (itemColor.Equals(tier3Color)) // tier 3 { tier3.Add(itemIndex); } else if (itemColor.Equals(tier2Color)) // tier 2 { tier2.Add(itemIndex); } else if (itemColor.Equals(tier1Color)) // tier 1 { tier1.Add(itemIndex); } else if (itemColor.Equals(lunarColor)) // lunar { lunar.Add(itemIndex); } else // Other { other.Add(itemIndex); } } UmbraMenu.bossItems = boss; UmbraMenu.unreleasedItems = other; var result = items.Concat(boss).Concat(tier3).Concat(tier2).Concat(tier1).Concat(lunar).Concat(other).ToList(); return(result); }
// Token: 0x06001D49 RID: 7497 RVA: 0x00088840 File Offset: 0x00086A40 private void Start() { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)(base.GetComponent <EffectComponent>().effectData.genericUInt - 1u)); ColorCatalog.ColorIndex colorIndex = ColorCatalog.ColorIndex.Error; Sprite sprite = null; if (itemDef != null) { colorIndex = itemDef.colorIndex; sprite = itemDef.pickupIconSprite; } this.trailToColor.endColor = (this.trailToColor.startColor = ColorCatalog.GetColor(colorIndex)); this.iconSpriteRenderer.sprite = sprite; }
private static TooltipContent LogBookControllerOnGetPickupTooltipContent(On.RoR2.UI.LogBook.LogBookController.orig_GetPickupTooltipContent orig, UserProfile userProfile, Entry entry, EntryStatus status) { if (IsCustomItemOrEquipment((PickupIndex)entry.extraData)) { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(((PickupIndex)entry.extraData).GetUnlockableName()); TooltipContent result = default; result.titleToken = entry.nameToken; result.titleColor = entry.color; if (unlockableDef != null) { result.overrideBodyText = unlockableDef.getUnlockedString(); } result.bodyToken = "LOGBOOK_CATEGORY_ITEM"; result.bodyColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable); return(result); } return(orig(userProfile, entry, status)); }
// Token: 0x0600220F RID: 8719 RVA: 0x000A1038 File Offset: 0x0009F238 public void SetItemIndex(ItemIndex newItemIndex, int newItemCount) { if (this.itemIndex == newItemIndex && this.itemCount == newItemCount) { return; } this.itemIndex = newItemIndex; this.itemCount = newItemCount; string titleToken = ""; string bodyToken = ""; Color color = Color.white; Color bodyColor = new Color(0.6f, 0.6f, 0.6f, 1f); ItemDef itemDef = ItemCatalog.GetItemDef(this.itemIndex); if (itemDef != null) { this.image.texture = Resources.Load <Texture>(itemDef.pickupIconPath); if (this.itemCount > 1) { this.stackText.enabled = true; this.stackText.text = string.Format("x{0}", this.itemCount); } else { this.stackText.enabled = false; } titleToken = itemDef.nameToken; bodyToken = itemDef.pickupToken; color = ColorCatalog.GetColor(itemDef.darkColorIndex); } if (this.glowImage) { this.glowImage.color = new Color(color.r, color.g, color.b, 0.75f); } if (this.tooltipProvider) { this.tooltipProvider.titleToken = titleToken; this.tooltipProvider.bodyToken = bodyToken; this.tooltipProvider.titleColor = color; this.tooltipProvider.bodyColor = bodyColor; } }
public static void DrawEquipmentMenu(float x, float y, float widthSize, int mulY, GUIStyle BGstyle, GUIStyle buttonStyle, GUIStyle LabelStyle, GUIStyle offStyle) { int heightMul = 15; if (Main.lowResolutionMonitor) { heightMul = 10; } GUI.Box(new Rect(x + 0f, y + 0f, widthSize + 20, 50f + 45 * heightMul), "", BGstyle); GUI.Label(new Rect(x + 5f, y + 5f, widthSize + 10, 85f), "E Q U I P M E N T L I S T", LabelStyle); equipmentSpawnerScrollPosition = GUI.BeginScrollView(new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * heightMul), equipmentSpawnerScrollPosition, new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * mulY), false, true); int buttonPlacement = 1; foreach (var equipmentIndex in Main.equipment) { if (equipmentIndex != EquipmentIndex.None) { Color32 equipColor = ColorCatalog.GetColor(EquipmentCatalog.GetEquipmentDef(equipmentIndex).colorIndex); if (equipColor.r <= 105 && equipColor.g <= 105 && equipColor.b <= 105) { string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), new Color32(255, 255, 255, 255)); DrawButton(buttonPlacement, "equipmentSpawner", equipmentName, buttonStyle); buttonPlacement++; } else { string equipmentName = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(equipmentIndex).nameToken), equipColor); DrawButton(buttonPlacement, "equipmentSpawner", equipmentName, buttonStyle); buttonPlacement++; } } else { string equipmentName = "Remove Equipment"; DrawButton(buttonPlacement, "equipmentSpawner", equipmentName, buttonStyle); buttonPlacement++; } } GUI.EndScrollView(); }
private void GiveRandomRed(On.RoR2.CharacterBody.orig_OnInventoryChanged orig, CharacterBody self) //ripped from harbcrate, i did credit though. { orig(self); var amount = GetCount(self); if (amount > 1) { self.inventory.RemoveItem(catalogIndex); PickupIndex loot = Run.instance.treasureRng.NextElementUniform(Run.instance.availableTier3DropList); if (self.isPlayerControlled) { PickupDropletController.CreatePickupDroplet(loot, self.corePosition, Vector3.up * 5); } else { PickupDef def = PickupCatalog.GetPickupDef(loot); self.inventory.GiveItem(def.itemIndex); var lootCount = self.inventory.GetItemCount(def.itemIndex); Chat.AddPickupMessage(self, def.nameToken, ColorCatalog.GetColor(ItemCatalog.GetItemDef(def.itemIndex).colorIndex), (uint)lootCount); } } }
private void GenericNotification_SetItem(On.RoR2.UI.GenericNotification.orig_SetItem orig, GenericNotification self, ItemDef itemDef) { if (itemDef.itemIndex != catalogIndex) { orig(self, itemDef); return; } var clearCount = Run.instance.stageClearCount; var StageCount = Mathf.Max(clearCount + 1, 1); string numberString = HelperUtil.NumbertoOrdinal(StageCount); string numberCapitalized = char.ToUpper(numberString[0]) + numberString.Substring(1); string descString = adjustedDesc[Mathf.Clamp(StageCount, 0, adjustedDesc.Length - 1)]; //https://www.dotnetperls.com/uppercase-first-letter //string output2 = numberCapitalized + " Chamber" + //"\nThis " + descString + " artifact indicates mastery of the " + numberString + " chamber."; TODO: REMOVE WHEN KNOW IT WORKS string output = string.Format(itemPickupDescToken, numberCapitalized, descString, numberString); if (bannedStages.Contains(SceneCatalog.mostRecentSceneDef.baseSceneName)) { output = itemPickupDescBannedToken; } self.titleText.token = itemDef.nameToken; self.titleTMP.color = ColorCatalog.GetColor(itemDef.colorIndex); self.descriptionText.token = output; if (itemDef.pickupIconSprite != null) { self.iconImage.texture = itemDef.pickupIconTexture; //var index = Mathf.Max(clearCount, textures.Count-1); //self.iconImage.texture = Resources.Load<Texture>(filePaths[index]); //self.iconImage.texture = textures[index]; } }
public static Color32 GetItemColor(ItemIndex index) { if (IsWhiteItem(index)) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item)); } if (IsGreenItem(index)) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2Item)); } if (IsRedItem(index)) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3Item)); } if (IsLunarItem(index)) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem)); } if (IsBossItem(index)) { return(ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItem)); } return(Color.white); }
// Token: 0x060022C1 RID: 8897 RVA: 0x00096C7C File Offset: 0x00094E7C private void SetDisplayData(EquipmentIcon.DisplayData newDisplayData) { if (!this.currentDisplayData.isReady && newDisplayData.isReady) { this.DoStockFlash(); } if (this.displayRoot) { this.displayRoot.SetActive(!newDisplayData.hideEntireDisplay); } if (newDisplayData.stock > this.currentDisplayData.stock) { Util.PlaySound("Play_item_proc_equipMag", RoR2Application.instance.gameObject); this.DoStockFlash(); } if (this.isReadyPanelObject) { this.isReadyPanelObject.SetActive(newDisplayData.isReady); } if (this.isAutoCastPanelObject) { if (this.targetInventory) { this.isAutoCastPanelObject.SetActive(this.targetInventory.GetItemCount(ItemIndex.AutoCastEquipment) > 0); } else { this.isAutoCastPanelObject.SetActive(false); } } if (this.iconImage) { Texture texture = null; Color color = Color.clear; if (newDisplayData.equipmentDef != null) { color = ((newDisplayData.stock > 0) ? Color.white : Color.gray); texture = Resources.Load <Texture>(newDisplayData.equipmentDef.pickupIconPath); } this.iconImage.texture = texture; this.iconImage.color = color; } if (this.cooldownText) { this.cooldownText.gameObject.SetActive(newDisplayData.showCooldown); if (newDisplayData.cooldownValue != this.currentDisplayData.cooldownValue) { this.cooldownText.text = newDisplayData.cooldownValue.ToString(); } } if (this.stockText) { if (newDisplayData.hasEquipment && (newDisplayData.maxStock > 1 || newDisplayData.stock > 1)) { this.stockText.gameObject.SetActive(true); this.stockText.text = newDisplayData.stock.ToString(); } else { this.stockText.gameObject.SetActive(false); } } string titleToken = null; string bodyToken = null; Color titleColor = Color.white; Color gray = Color.gray; if (newDisplayData.equipmentDef != null) { titleToken = newDisplayData.equipmentDef.nameToken; bodyToken = newDisplayData.equipmentDef.pickupToken; titleColor = ColorCatalog.GetColor(newDisplayData.equipmentDef.colorIndex); } if (this.tooltipProvider) { this.tooltipProvider.titleToken = titleToken; this.tooltipProvider.titleColor = titleColor; this.tooltipProvider.bodyToken = bodyToken; this.tooltipProvider.bodyColor = gray; } this.currentDisplayData = newDisplayData; }
public void Awake() { // lets not ruin peoples save files On.RoR2.UserProfile.Save += (orig, self, blocking) => { return(true); }; // just incase they do add the artifacts we dont want duplicates in the unlockableDefTable and // since they dont check for those we will do that for them On.RoR2.UnlockableCatalog.RegisterUnlockable += (orig, name, unlockableDef) => { if (UnlockableCatalog.GetUnlockableDef(name) != null) { return; } orig(name, unlockableDef); }; // add artifacts to unlocks On.RoR2.UnlockableCatalog.Init += (orig) => { for (var artifactIdx = ArtifactIndex.Command; artifactIdx < ArtifactIndex.Count; artifactIdx++) { var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx); if (artifactDef?.unlockableName.Length < 0) { continue; } Reflection.InvokeMethod(typeof(UnlockableCatalog), "RegisterUnlockable", artifactDef.unlockableName, new UnlockableDef { hidden = true, }); } orig(); }; // set neat colors and tooltips for artifacts that have none On.RoR2.RuleDef.FromArtifact += (orig, artifactIdx) => { var tooltipClr = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3ItemDark); var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx); var ruleDef = new RuleDef("Artifacts." + artifactIdx.ToString(), artifactDef.nameToken); { var ruleChoiceDef1 = ruleDef.AddChoice("On", null, false); ruleChoiceDef1.spritePath = artifactDef.smallIconSelectedPath; ruleChoiceDef1.tooltipNameColor = tooltipClr; ruleChoiceDef1.unlockableName = artifactDef.unlockableName; ruleChoiceDef1.artifactIndex = artifactIdx; var ruleChoiceDef2 = ruleDef.AddChoice("Off", null, false); ruleChoiceDef2.spritePath = artifactDef.smallIconDeselectedPath; ruleChoiceDef2.tooltipNameColor = tooltipClr; ruleChoiceDef2.materialPath = "Materials/UI/matRuleChoiceOff"; ruleChoiceDef2.tooltipBodyToken = null; switch (artifactIdx) { case ArtifactIndex.Bomb: ruleChoiceDef1.tooltipNameToken = "Spite"; ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken; ruleChoiceDef1.tooltipBodyToken = "Makes monsters explode on death"; ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken; break; case ArtifactIndex.Spirit: ruleChoiceDef1.tooltipNameToken = "Spirit"; ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken; ruleChoiceDef1.tooltipBodyToken = "Makes you and monsters move faster at low health"; ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken; break; case ArtifactIndex.Enigma: ruleChoiceDef1.tooltipNameToken = "Enigma"; ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken; ruleChoiceDef1.tooltipBodyToken = "Give you a special use item that triggers a random effect on use"; ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken; break; default: ruleChoiceDef1.tooltipNameToken = "Work in Progress"; ruleChoiceDef2.tooltipNameToken = ruleChoiceDef1.tooltipNameToken; ruleChoiceDef1.tooltipBodyToken = "This artifact does not do anything yet"; ruleChoiceDef2.tooltipBodyToken = ruleChoiceDef1.tooltipBodyToken; break; } } ruleDef.MakeNewestChoiceDefault(); return(ruleDef); }; // unlock artifacts for the current user LocalUserManager.onUserSignIn += (user) => { for (var artifactIdx = ArtifactIndex.Command; artifactIdx < ArtifactIndex.Count; artifactIdx++) { var artifactDef = ArtifactCatalog.GetArtifactDef(artifactIdx); if (artifactDef?.unlockableName.Length < 0) { continue; } var unlockableDef = UnlockableCatalog.GetUnlockableDef(artifactDef.unlockableName); if (unlockableDef is null) { Logger.LogError($"Could not unlock artifact {artifactDef.nameToken}, " + "UnlockableDef does not exist"); continue; } user.userProfile.GrantUnlockable(unlockableDef); } }; }
public void PickupPickerPanel_OnCreateButton(On.RoR2.UI.PickupPickerPanel.orig_OnCreateButton orig, RoR2.UI.PickupPickerPanel self, int index, MPButton button) { orig(self, optionMap[0] >= 0 ? optionMap[index] : index, button); if (mod.config.CommandTooltipsShow.Value || mod.config.CommandCountersShow.Value) { CharacterMaster master = LocalUserManager.GetFirstLocalUser().cachedMasterController.master; PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickerController.options[optionMap[0] >= 0 ? optionMap[index] : index].pickupIndex); if (pickupDef.itemIndex != ItemIndex.None && mod.config.CommandCountersShow.Value) { int count = master.inventory.itemStacks[(int)pickupDef.itemIndex]; if (!mod.config.CommandCountersHideOnZero.Value || count > 0) { GameObject textGameObject = new GameObject("StackText"); textGameObject.transform.SetParent(button.transform); textGameObject.layer = 5; RectTransform counterRect = textGameObject.AddComponent <RectTransform>(); HGTextMeshProUGUI counterText = textGameObject.AddComponent <HGTextMeshProUGUI>(); counterText.enableWordWrapping = false; counterText.alignment = mod.config.CommandCountersTextAlignmentOption; counterText.fontSize = mod.config.CommandCountersFontSize.Value; counterText.faceColor = Color.white; counterText.outlineWidth = 0.2f; counterText.text = mod.config.CommandCountersPrefix.Value + count; counterRect.localPosition = Vector3.zero; counterRect.anchorMin = Vector2.zero; counterRect.anchorMax = Vector2.one; counterRect.localScale = Vector3.one; counterRect.sizeDelta = new Vector2(-10, -4); counterRect.anchoredPosition = Vector2.zero; } } if (mod.config.CommandTooltipsShow.Value) { TooltipProvider tooltipProvider = button.gameObject.AddComponent <TooltipProvider>(); if (pickupDef.itemIndex != ItemIndex.None) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (mod.ItemStatsModIntegration) { int count = master.inventory.itemStacks[(int)pickupDef.itemIndex]; string bodyText = Language.GetString(itemDef.descriptionToken); if (self.pickerController.contextString == "ARTIFACT_COMMAND_CUBE_INTERACTION_PROMPT" && mod.config.CommandTooltipsItemStatsBeforeAfter.Value && count > 0) { bodyText += String.Format("\n\n<align=left>Before ({0} Stack" + (count > 1 ? "s" : "") + "):", count); String[] descLines = ModCompat.statsFromItemStats(itemDef.itemIndex, count, master).Split(new String[] { "\n", "<br>" }, StringSplitOptions.None); bodyText += String.Join("\n", descLines.Take(descLines.Length - 1).Skip(1)); bodyText += String.Format("\n\n<align=left>After ({0} Stacks):", count + 1); descLines = ModCompat.statsFromItemStats(itemDef.itemIndex, count + 1, master).Split(new String[] { "\n", "<br>" }, StringSplitOptions.None); bodyText += String.Join("\n", descLines.Take(descLines.Length - 1).Skip(1)); } else { if (self.pickerController.contextString == "ARTIFACT_COMMAND_CUBE_INTERACTION_PROMPT") { count += 1; } bodyText += ModCompat.statsFromItemStats(itemDef.itemIndex, count, master); } tooltipProvider.overrideBodyText = bodyText; } else { tooltipProvider.bodyToken = itemDef.descriptionToken; } tooltipProvider.titleToken = itemDef.nameToken; tooltipProvider.titleColor = ColorCatalog.GetColor(itemDef.darkColorIndex);; tooltipProvider.bodyColor = new Color(0.6f, 0.6f, 0.6f, 1f); } else if (pickupDef.equipmentIndex != EquipmentIndex.None) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); tooltipProvider.titleToken = equipmentDef.nameToken; tooltipProvider.bodyToken = equipmentDef.descriptionToken; tooltipProvider.titleColor = ColorCatalog.GetColor(equipmentDef.colorIndex); tooltipProvider.bodyColor = Color.gray; } } } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); } else { _instance = this; } lobbyRule.AddChoice(0, "None", "Enemies aggregate no items", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1ItemDark)); lobbyRule.AddChoice(1, "White", "Enemies aggregate white items every level", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier1ItemDark)); lobbyRule.AddChoice(2, "Green", "Enemies also aggregate green items, every 3 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier2ItemDark)); lobbyRule.AddChoice(3, "Red", "Enemies also aggregate red items, every 5 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3Item), ColorCatalog.GetColor(ColorCatalog.ColorIndex.Tier3ItemDark)); lobbyRule.AddChoice(4, "Lunar", "Enemies also aggregate lunar items, every 8 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem), ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItemDark)); lobbyRule.AddChoice(5, "Boss", "Enemies also aggregate boss items, every 10 levels", ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItem), ColorCatalog.GetColor(ColorCatalog.ColorIndex.BossItemDark)); lobbyRule.MakeValueDefault(0); lobbyCategory.PushRule <int>(lobbyRule); On.RoR2.UI.HUD.Awake += (orig, self) => { orig(self); itemInventoryDisplay = Instantiate(self.itemInventoryDisplay, self.transform); itemInventoryDisplay.SetFieldValue <int[]>("itemStacks", ItemCatalog.RequestItemStackArray()); itemInventoryDisplay.SetFieldValue <ItemIndex[]>("itemOrder", ItemCatalog.RequestItemOrderBuffer()); if (!inventory) { inventory = itemInventoryDisplay.gameObject.AddComponent <Inventory>(); } itemInventoryDisplay.SetSubscribedInventory(inventory); }; RoR2.Run.onRunStartGlobal += (RoR2.Run run) => { if (NetworkServer.active && lobbyRule.Value != null) { levelWave = 1; Debug.Log(lobbyRule.Value); if (lobbyRule.Value == 1) { Debug.Log("Added white"); On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart += CopyItemsMaster; On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp; } if (lobbyRule.Value == 2) { Debug.Log("Added green"); On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart += CopyItemsMaster; On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp; } if (lobbyRule.Value == 3) { Debug.Log("Added red"); On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart += CopyItemsMaster; On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp; } if (lobbyRule.Value == 4) { Debug.Log("Added lunar"); On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart += CopyItemsMaster; On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += LunarOnLevelUp; } if (lobbyRule.Value == 5) { Debug.Log("Added boss"); On.RoR2.GlobalEventManager.OnTeamLevelUp += UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart += CopyItemsMaster; On.RoR2.GlobalEventManager.OnTeamLevelUp += WhiteOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += GreenOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += RedOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += LunarOnLevelUp; On.RoR2.GlobalEventManager.OnTeamLevelUp += BossOnLevelUp; } } }; RoR2.Run.onRunDestroyGlobal += (RoR2.Run run) => { if (NetworkServer.active && lobbyRule.Value != null) { levelWave = 1; if (lobbyRule.Value <= 0) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= UpdateLevelWave; On.RoR2.CharacterMaster.OnBodyStart -= CopyItemsMaster; } if (lobbyRule.Value <= 1) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= WhiteOnLevelUp; } if (lobbyRule.Value <= 2) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= GreenOnLevelUp; } if (lobbyRule.Value <= 3) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= RedOnLevelUp; } if (lobbyRule.Value <= 4) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= LunarOnLevelUp; } if (lobbyRule.Value <= 5) { On.RoR2.GlobalEventManager.OnTeamLevelUp -= BossOnLevelUp; } } }; }
// Token: 0x060021C0 RID: 8640 RVA: 0x0009F160 File Offset: 0x0009D360 private void UpdateHealthbar(float deltaTime) { float num = 0f; float num2 = 1f; float num3 = 1f; if (this.source) { CharacterBody component = this.source.GetComponent <CharacterBody>(); if (component) { float num4 = component.CalcLunarDaggerPower(); num3 /= num4; } float fullHealth = this.source.fullHealth; float f = this.source.health + this.source.shield; float num5 = this.source.fullHealth + this.source.fullShield; num = Mathf.Clamp01(this.source.health / num5 * num3); float num6 = Mathf.Clamp01(this.source.shield / num5 * num3); if (!this.hasCachedInitialValue) { this.cachedFractionalValue = num; this.hasCachedInitialValue = true; } if (this.eliteBackdropRectTransform) { if (component.equipmentSlot && EliteCatalog.IsEquipmentElite(component.equipmentSlot.equipmentIndex) != EliteIndex.None) { num2 += 1f; this.eliteBackdropRectTransform.gameObject.SetActive(true); } else { this.eliteBackdropRectTransform.gameObject.SetActive(false); } } if (this.frozenCullThresholdRectTransform) { this.frozenCullThresholdRectTransform.gameObject.SetActive(this.source.isFrozen); } bool active = false; if (this.source.fullShield > 0f) { active = true; } this.shieldFillRectTransform.gameObject.SetActive(active); if (this.scaleHealthbarWidth && component) { float num7 = Util.Remap(Mathf.Clamp((component.baseMaxHealth + component.baseMaxShield) * num2, 0f, this.maxHealthbarHealth), this.minHealthbarHealth, this.maxHealthbarHealth, this.minHealthbarWidth, this.maxHealthbarWidth); this.healthbarScale = num7 / this.minHealthbarWidth; this.rectTransform.sizeDelta = new Vector2(num7, this.rectTransform.sizeDelta.y); } Color color = this.originalFillColor; CharacterMaster master = component.master; if (master && (master.isBoss || master.inventory.GetItemCount(ItemIndex.Infusion) > 0)) { color = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Teleporter); } this.fillImage.color = color; if (this.fillRectTransform) { this.fillRectTransform.anchorMin = new Vector2(0f, 0f); this.fillRectTransform.anchorMax = new Vector2(num, 1f); this.fillRectTransform.anchoredPosition = Vector2.zero; this.fillRectTransform.sizeDelta = new Vector2(1f, 1f); } if (this.shieldFillRectTransform) { this.shieldFillRectTransform.anchorMin = new Vector2(num, 0f); this.shieldFillRectTransform.anchorMax = new Vector2(num + num6, 1f); this.shieldFillRectTransform.anchoredPosition = Vector2.zero; this.shieldFillRectTransform.sizeDelta = new Vector2(1f, 1f); } if (this.delayfillRectTransform) { this.delayfillRectTransform.anchorMin = new Vector2(0f, 0f); this.delayfillRectTransform.anchorMax = new Vector2(this.cachedFractionalValue, 1f); this.delayfillRectTransform.anchoredPosition = Vector2.zero; this.delayfillRectTransform.sizeDelta = new Vector2(1f, 1f); } if (this.flashRectTransform) { this.flashRectTransform.anchorMin = new Vector2(0f, 0f); this.flashRectTransform.anchorMax = new Vector2(num, 1f); float num8 = 1f - num; float num9 = 2f * num8; this.theta += deltaTime * num9; if (this.theta > 1f) { this.theta -= this.theta - this.theta % 1f; } float num10 = 1f - Mathf.Cos(this.theta * 3.1415927f * 0.5f); this.flashRectTransform.sizeDelta = new Vector2(num10 * 20f * num8, num10 * 20f * num8); Image component2 = this.flashRectTransform.GetComponent <Image>(); if (component2) { Color color2 = component2.color; color2.a = (1f - num10) * num8 * 0.7f; component2.color = color2; } } if (this.currentHealthText) { float num11 = Mathf.Ceil(f); if (num11 != this.displayStringCurrentHealth) { this.displayStringCurrentHealth = num11; this.currentHealthText.text = num11.ToString(); } } if (this.fullHealthText) { float num12 = Mathf.Ceil(fullHealth); if (num12 != this.displayStringFullHealth) { this.displayStringFullHealth = num12; this.fullHealthText.text = num12.ToString(); } } if (this.criticallyHurtImage) { if (num + num6 < HealthBar.criticallyHurtThreshold && this.source.alive) { this.criticallyHurtImage.enabled = true; this.criticallyHurtImage.color = HealthBar.GetCriticallyHurtColor(); this.fillImage.color = HealthBar.GetCriticallyHurtColor(); } else { this.criticallyHurtImage.enabled = false; } } if (this.deadImage) { this.deadImage.enabled = !this.source.alive; } } this.cachedFractionalValue = Mathf.SmoothDamp(this.cachedFractionalValue, num, ref this.healthFractionVelocity, 0.05f, float.PositiveInfinity, deltaTime); }
void Start() { float splitY = 0; //Items category RectTransform itemCategory = Instantiate(CategoryTemplate, Content.transform); itemCategory.gameObject.SetActive(true); itemCategory.anchoredPosition = new Vector2(0, -offsetY * Mathf.FloorToInt(splitY / 2)); ItemBannerCategorySlot itemCategorySlot = itemCategory.gameObject.AddComponent <ItemBannerCategorySlot>(); itemCategorySlot.CategoryName = "Items"; itemCategorySlot.CategoryColor = new Color(0.4481132f, 1.0f, 0.9442427f, 1.0f); Slots.Add(itemCategory); splitY += 2; //Load items List <ItemIndex> items = ItemCatalog.allItems.ToList(); items.Sort(new ItemSorter()); for (int i = 0; i < items.Count; i++) { float splitX = offsetX; if (i % 2 == 0) { splitX = 0; } ItemDef itemDef = ItemCatalog.GetItemDef(items[i]); RectTransform item = Instantiate(ItemTemplate, Content.transform); item.gameObject.SetActive(true); item.anchoredPosition = new Vector2(splitX, -offsetY * Mathf.FloorToInt(splitY / 2)); ItemBannerItemSlot itemSlot = item.gameObject.AddComponent <ItemBannerItemSlot>(); itemSlot.ItemSlot = items[i]; itemSlot.Banner = this; itemSlot.ItemNameToken = itemDef.nameToken; itemSlot.ItemColor = ColorCatalog.GetColor(itemDef.colorIndex); itemSlot.ItemSprite = itemDef.pickupIconSprite; Slots.Add(item); splitY++; if (i >= items.Count - 1) { if (splitY % 2 != 0) { splitY++; } } } //Equipments category RectTransform equipmentCategory = Instantiate(CategoryTemplate, Content.transform); equipmentCategory.gameObject.SetActive(true); equipmentCategory.anchoredPosition = new Vector2(0, -offsetY * Mathf.FloorToInt(splitY / 2)); ItemBannerCategorySlot equipmentCategorySlot = equipmentCategory.gameObject.AddComponent <ItemBannerCategorySlot>(); equipmentCategorySlot.CategoryName = "Equipment"; equipmentCategorySlot.CategoryColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Equipment); Slots.Add(equipmentCategory); splitY += 2; //Load equipments List <EquipmentIndex> equipments = EquipmentCatalog.allEquipment.ToList(); equipments.Sort(new EquipmentSorter()); for (int i = 0; i < equipments.Count; i++) { float splitX = offsetX; if (i % 2 == 0) { splitX = 0; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipments[i]); RectTransform item = Instantiate(ItemTemplate, Content.transform); item.gameObject.SetActive(true); item.anchoredPosition = new Vector2(splitX, -offsetY * Mathf.FloorToInt(splitY / 2)); ItemBannerItemSlot itemSlot = item.gameObject.AddComponent <ItemBannerItemSlot>(); itemSlot.EquipmentSlot = equipments[i]; itemSlot.Banner = this; itemSlot.ItemNameToken = equipmentDef.nameToken; itemSlot.ItemColor = ColorCatalog.GetColor(equipmentDef.colorIndex); itemSlot.ItemSprite = equipmentDef.pickupIconSprite; Slots.Add(item); splitY++; if (i >= equipments.Count - 1) { if (splitY % 2 != 0) { splitY++; } } } Content.sizeDelta = new Vector2(Content.sizeDelta.x, offsetY * Mathf.FloorToInt(splitY / 2)); }