public void initialize(GameLogic.ChestType chestType) { this.ChestType = chestType; ChestBlueprint blueprint = ConfigUi.CHEST_BLUEPRINTS[chestType]; LootTable table = GameLogic.Binder.ItemResources.getDynamicChestLootTable(chestType); List <Item> list = new List <Item>(table.Items.Count); for (int i = 0; i < table.Items.Count; i++) { LootTableItem item = table.Items[i]; if (!GameLogic.Binder.ItemResources.itemExists(item.Id)) { Debug.LogError("Only fixed item visualization supported for chests: " + item.Id); } else { Item item2 = GameLogic.Binder.ItemResources.getItemForLootTableRollId(item.Id, ItemType.UNSPECIFIED); list.Add(item2); } } list.Sort(this.m_chestContentComparer); for (int j = 0; j < list.Count; j++) { Item item3 = list[j]; SpriteAtlasEntry sprite = new SpriteAtlasEntry("Menu", item3.SpriteId); this.addItemToGrid(item3, item3.Rarity, sprite); } this.Title.text = _.L(blueprint.Name, null, false); this.setupChest(chestType); }
private void setupChest(GameLogic.ChestType chestType) { ChestBlueprint blueprint = ConfigUi.CHEST_BLUEPRINTS[chestType]; RewardGalleryCell.Content content2 = new RewardGalleryCell.Content(); content2.Sprite = blueprint.Icon; RewardGalleryCell.Content content = content2; RewardGalleryCell item = PlayerView.Binder.RewardGalleryCellPool.getObject(RewardGalleryCellType.RewardGalleryCellFazer); RectTransformExtensions.SetSize(item.RectTm, new Vector2(300f, 300f)); item.transform.SetParent(this.ChestRoot, false); item.initialize(content, null); this.m_rewardGalleryCells.Add(item); item.gameObject.SetActive(true); }