private void createItems() { bool flag = true; for (int i = 0; i < EventItems.Length; i++) { MarketplaceEventItem item = new MarketplaceEventItem(); item.EventItemDefinition = EventItems[i]; if (ExistingRowItem == null) { Content.LoadAsync(delegate(string path, GameObject prefab) { onEventItemButtonPrefabLoaded(prefab, item); }, eventItemButtonContentKey); } else { ExistingRowItem.SetItem(item, ItemIconImageMaterial, ItemIconBgColor, ItemIconPenguinColor, EventNameForBI); } if (flag && !item.IsAvailable()) { flag = false; } } if (ItemsBlocker != null) { ItemsBlocker.SetActive(!flag); } }
public void SetItem(MarketplaceEventItem item, Material itemIconImageMaterial, Color itemIconBackgroundColor, Color itemIconPenguinColor, string eventNameForBI) { this.item = item; this.itemIconBackgroundColor = itemIconBackgroundColor; this.itemIconPenguinColor = itemIconPenguinColor; IconImage.material = itemIconImageMaterial; loadCoinsAndXP(item); loadItemIcon(item); showItemStatus(); showMemberStatus(); }
private void loadItemIcon(MarketplaceEventItem item) { List <DReward> rewards = item.GetRewards(); for (int i = 0; i < rewards.Count; i++) { TemplateDefinition value; switch (rewards[i].Category) { case RewardCategory.equipmentTemplates: { Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >(); if (dictionary.TryGetValue((int)rewards[0].UnlockID, out value)) { Texture2DContentKey equipmentIconPath = EquipmentPathUtil.GetEquipmentIconPath(value.AssetName); Content.LoadAsync(delegate(string key, Texture2D texture) { onIconReady(texture); }, equipmentIconPath); TitleText.text = Service.Get <Localizer>().GetTokenTranslation(value.Name); itemNameForBI = value.AssetName; isMemberOnly = value.IsMemberOnly; } return; } case RewardCategory.equipmentInstances: { Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >(); if (dictionary.TryGetValue(rewards[0].EquipmentRequest.definitionId, out value)) { TitleText.text = Service.Get <Localizer>().GetTokenTranslation(value.Name); itemNameForBI = value.AssetName; isMemberOnly = value.IsMemberOnly; } renderRewardItem(rewards[0].EquipmentRequest.definitionId, CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(rewards[0].EquipmentRequest)); return; } } } }
private void loadCoinsAndXP(MarketplaceEventItem item) { if (CoinsText != null) { int coinReward = item.GetCoinReward(); if (coinReward != 0) { CoinsText.text = coinReward.ToString(); } } if (!(XpText != null)) { return; } Dictionary <string, int> xpReward = item.GetXpReward(); if (xpReward == null || xpReward.Count == 0) { return; } using (Dictionary <string, int> .Enumerator enumerator = xpReward.GetEnumerator()) { if (enumerator.MoveNext()) { KeyValuePair <string, int> current = enumerator.Current; if (Service.Get <ProgressionService>().IsMascotMaxLevel(current.Key)) { XpText.gameObject.SetActive(value: false); MaxXpText.SetActive(value: true); } else { XpText.text = current.Value.ToString(); } } } }
private void onEventItemButtonPrefabLoaded(GameObject prefab, MarketplaceEventItem item) { GameObject gameObject = Object.Instantiate(prefab, ItemPanelContainer.transform, worldPositionStays: false); gameObject.GetComponent <MarketplaceEventRowItem>().SetItem(item, ItemIconImageMaterial, ItemIconBgColor, ItemIconPenguinColor, EventNameForBI); }