private static List <DRewardPopupScreen> buildCustomEquipmentScreens(DRewardPopup popupData, bool checkForNonMemberScreens) { List <DRewardPopupScreen> list = new List <DRewardPopupScreen>(); if (popupData.RewardData.TryGetValue <EquipmentInstanceReward>(out var rewardable) && !rewardable.IsEmpty()) { DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems(); DReward[] array = new DReward[rewardable.EquipmentInstances.Count]; bool isRewardsAllNonMember = false; for (int i = 0; i < rewardable.EquipmentInstances.Count; i++) { DReward dReward = new DReward(); dReward.EquipmentRequest = rewardable.EquipmentInstances[i]; array[i] = dReward; } if (checkForNonMemberScreens) { for (int j = 0; j < array.Length; j++) { if (RewardUtils.IsRewardMemberOnly(RewardCategory.equipmentInstances, array[j].EquipmentRequest.definitionId)) { isRewardsAllNonMember = false; break; } isRewardsAllNonMember = true; } } dRewardPopupScreenItems.ItemCategory = RewardCategory.equipmentInstances; dRewardPopupScreenItems.Rewards = array; dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember; list.Add(dRewardPopupScreenItems); } return(list); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; int tubeId = ((!(reward.UnlockID is string)) ? ((int)reward.UnlockID) : int.Parse((string)reward.UnlockID)); loadTubeIcon(getIconPath(tubeId)); }
private void onPrefabLoaded(string path, GameObject prefab) { DItemRewardPopup dItemRewardPopup = new DItemRewardPopup(); dItemRewardPopup.HeaderText = Service.Get <Localizer>().GetTokenTranslation(i18nHeaderText); dItemRewardPopup.ItemName = Service.Get <Localizer>().GetTokenTranslation(i18nItemName); dItemRewardPopup.RewardCategory = RewardCategory; dItemRewardPopup.CoinReward = CoinReward.Value; dItemRewardPopup.XpReward = XpReward.Value; dItemRewardPopup.MascotDefinition = MascotDefinition; DReward dReward = new DReward(); if (RewardCategory == RewardCategory.equipmentInstances) { dReward.EquipmentRequest.definitionId = Convert.ToInt32(RewardID); } dReward.UnlockID = RewardID; dItemRewardPopup.RewardData = dReward; popup = UnityEngine.Object.Instantiate(prefab); itemRewardPopup = popup.GetComponent <ItemRewardPopup>(); if (itemRewardPopup != null) { itemRewardPopup.SetData(dItemRewardPopup); itemRewardPopup.OpenDelay = OpenDelay; itemRewardPopup.DoneClose += onPopupClosed; } Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(popup, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.ItemReward")); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { int unlockID = ((!(reward.UnlockID is string)) ? ((int)reward.UnlockID) : int.Parse((string)reward.UnlockID)); this.callback = callback; CoroutineRunner.Start(renderDurable(unlockID), this, "RewardIconRenderer_Durable.renderDurable"); }
public void LoadItem(RewardCategory rewardCategory, DReward rewardData, bool allowMemberLockOverlay = false, bool showItemName = false) { this.rewardCategory = rewardCategory; this.rewardData = rewardData; if (rewardCategory == RewardCategory.fabrics) { loadItemIconContainer(fabricIconKey); } else if (rewardCategory == RewardCategory.partySupplies || rewardCategory == RewardCategory.consumables || rewardCategory == RewardCategory.musicTracks || rewardCategory == RewardCategory.iglooSlots || rewardCategory == RewardCategory.decorationInstances || rewardCategory == RewardCategory.decorationPurchaseRights || rewardCategory == RewardCategory.structureInstances || rewardCategory == RewardCategory.structurePurchaseRights) { loadItemIconContainer(prefabIconKey); } else { loadItemIconContainer(itemIconKey); } if (allowMemberLockOverlay) { object obj = rewardData.UnlockID; if (obj == null) { obj = rewardData.EquipmentRequest.definitionId; } bool flag = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember() || !RewardUtils.IsRewardMemberOnly(rewardCategory, obj); MemberLockOverlay.SetActive(!flag); } this.showItemName = showItemName; }
public void SetData(DItemRewardPopup itemRewardPopupData) { popupData = itemRewardPopupData; updateBackground(); ItemNameText.text = itemRewardPopupData.ItemName; rewardCategory = itemRewardPopupData.RewardCategory; rewardData = itemRewardPopupData.RewardData; CoroutineRunner.Start(loadItem(rewardCategory, rewardData), this, "RewardPopupScreenItems.loadItem"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; Dictionary <int, LightingDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, LightingDefinition> >(); if (dictionary.TryGetValue((int)reward.UnlockID, out lightingDefinition)) { CoroutineRunner.Start(renderLighting(), this, "renderLighting"); } }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; PropDefinition propByName = getPropByName((int)reward.UnlockID); if (propByName != null) { CoroutineRunner.Start(renderPartySupply(propByName), this, "LoadPropIcon"); } }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; PropDefinition propDefinition = Service.Get <PropService>().GetPropDefinition(reward.UnlockID.ToString()); if (propDefinition != null) { CoroutineRunner.Start(renderPropIcon(propDefinition, (int)reward.Data), this, "LoadPropIcon"); } }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.reward = reward; this.callback = callback; Dictionary <int, StructureDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, StructureDefinition> >(); if (dictionary.TryGetValue((int)reward.UnlockID, out structureDefinition)) { CoroutineRunner.Start(renderStructureInstance(), this, "renderStructureInstance"); } }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; EmoteDefinition emoteByName = getEmoteByName((string)reward.UnlockID); if (emoteByName != null) { CoroutineRunner.Start(renderEmote(emoteByName), this, ""); return; } Log.LogError(this, "Unable to find emote definition of name: " + reward.UnlockID); CoroutineRunner.Start(loadDefaultIcon(), this, ""); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; SizzleClipDefinition sizzleClipByName = getSizzleClipByName((int)reward.UnlockID); if (sizzleClipByName != null) { Content.LoadAsync(onLoadComplete, SizzleClipIconContentKey, sizzleClipByName.name); } else { Content.LoadAsync(onDefaultLoadComplete, RewardPopupConstants.DefaultIconContentKey); } }
private IEnumerator loadItem(RewardCategory rewardCategory, DReward reward) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(RewardPopupConstants.RewardPopupItemContentKey); yield return(assetRequest); GameObject itemGO = UnityEngine.Object.Instantiate(assetRequest.Asset); itemGO.transform.SetParent(ItemPanel, worldPositionStays: false); item = itemGO.GetComponent <RewardPopupRewardItem>(); RewardPopupRewardItem rewardPopupRewardItem = item; rewardPopupRewardItem.IconLoadCompleteAction = (Action <RewardPopupRewardItem>)Delegate.Combine(rewardPopupRewardItem.IconLoadCompleteAction, new Action <RewardPopupRewardItem>(OnItemLoadComplete)); item.LoadItem(rewardCategory, reward); }
private IEnumerator loadItem(RewardCategory rewardCategory, DReward reward) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(RewardPopupConstants.RewardPopupItemContentKey); yield return(assetRequest); GameObject itemGO = Object.Instantiate(assetRequest.Asset); itemGO.transform.SetParent(ItemParentTransform, worldPositionStays: false); itemGO.transform.SetSiblingIndex(0); RewardPopupRewardItem item = itemGO.GetComponent <RewardPopupRewardItem>(); items.Add(item); item.LoadItem(rewardCategory, reward); }
private static DRewardPopupScreenItems buildItemScreenFromIList(RewardCategory category, IList unlockedItems, DRewardPopup popupData) { DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems(); DReward[] array = new DReward[unlockedItems.Count]; for (int i = 0; i < unlockedItems.Count; i++) { DReward dReward = new DReward(); dReward.UnlockID = unlockedItems[i]; array[i] = dReward; dReward.Category = category; } dRewardPopupScreenItems.ItemCategory = category; dRewardPopupScreenItems.Rewards = array; dRewardPopupScreenItems.RewardPopupType = popupData.PopupType; return(dRewardPopupScreenItems); }
private static DRewardPopupScreenItems buildItemScreenFromDictionary(RewardCategory category, IDictionary unlockedItems, DRewardPopup popupData) { DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems(); DReward[] array = new DReward[unlockedItems.Count]; int num = 0; IDictionaryEnumerator enumerator = unlockedItems.GetEnumerator(); while (enumerator.MoveNext()) { DReward dReward = new DReward(); dReward.UnlockID = enumerator.Key; dReward.Data = enumerator.Value; dReward.Category = category; array[num] = dReward; num++; } dRewardPopupScreenItems.ItemCategory = category; dRewardPopupScreenItems.Rewards = array; dRewardPopupScreenItems.RewardPopupType = popupData.PopupType; return(dRewardPopupScreenItems); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CameraCullingMaskHelper.HideLayer(Camera.main, "IconRender"); CoroutineRunner.Start(renderSprite((string)reward.UnlockID), this, "RewardIconRenderer_Sprite.renderSprite"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.reward = reward; this.callback = callback; renderClothingInstance(); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderIglooSlot(), this, "renderIglooSlot"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderSprite((SpriteContentKey)reward.UnlockID), this, "RewardIconRenderer_Sprite.renderSprite"); }
public static List <DReward> GetDRewardFromReward(Reward reward) { Type typeFromHandle = typeof(IList); List <DReward> list = new List <DReward>(); foreach (IRewardable item in reward) { if (item.IsEmpty()) { continue; } if (item is ConsumableInstanceReward) { ConsumableInstanceReward consumableInstanceReward = (ConsumableInstanceReward)item; using (Dictionary <string, int> .Enumerator enumerator2 = consumableInstanceReward.Consumables.GetEnumerator()) { while (enumerator2.MoveNext()) { DReward dReward = new DReward(); dReward.Category = RewardCategory.consumables; dReward.UnlockID = GetConsumableIdByServerName(enumerator2.Current.Key); list.Add(dReward); } } } else if (item is EquipmentInstanceReward) { EquipmentInstanceReward equipmentInstanceReward = (EquipmentInstanceReward)item; for (int i = 0; i < equipmentInstanceReward.EquipmentInstances.Count; i++) { DReward dReward = new DReward(); dReward.Category = RewardCategory.equipmentInstances; dReward.EquipmentRequest = equipmentInstanceReward.EquipmentInstances[i]; list.Add(dReward); } } else if (item is DecorationInstanceReward) { DecorationInstanceReward decorationInstanceReward = (DecorationInstanceReward)item; using (Dictionary <int, int> .Enumerator enumerator3 = decorationInstanceReward.Decorations.GetEnumerator()) { while (enumerator3.MoveNext()) { DReward dReward = new DReward(); dReward.Category = RewardCategory.decorationInstances; dReward.UnlockID = enumerator3.Current.Key; list.Add(dReward); } } } else if (item is StructureInstanceReward) { StructureInstanceReward structureInstanceReward = (StructureInstanceReward)item; using (Dictionary <int, int> .Enumerator enumerator3 = structureInstanceReward.Decorations.GetEnumerator()) { while (enumerator3.MoveNext()) { DReward dReward = new DReward(); dReward.Category = RewardCategory.structureInstances; dReward.UnlockID = enumerator3.Current.Key; list.Add(dReward); } } } else { if (!Enum.IsDefined(typeof(RewardCategory), item.RewardType) || !typeFromHandle.IsAssignableFrom(item.Reward.GetType())) { continue; } IList list2 = item.Reward as IList; if (list2 != null) { for (int i = 0; i < list2.Count; i++) { DReward dReward = new DReward(); dReward.UnlockID = list2[i]; dReward.Category = (RewardCategory)Enum.Parse(typeof(RewardCategory), item.RewardType); list.Add(dReward); } } } } return(list); }
private static List <DRewardPopupScreen> buildItemScreens(DRewardPopup popupData, bool checkForNonMemberScreens) { List <DRewardPopupScreen> list = new List <DRewardPopupScreen>(); Type typeFromHandle = typeof(IList); Type typeFromHandle2 = typeof(int); Type typeFromHandle3 = typeof(IDictionary); foreach (IRewardable rewardDatum in popupData.RewardData) { if (rewardDatum is EquipmentInstanceReward || rewardDatum.IsEmpty() || !Enum.IsDefined(typeof(RewardCategory), rewardDatum.RewardType)) { continue; } RewardCategory rewardCategory = (RewardCategory)Enum.Parse(typeof(RewardCategory), rewardDatum.RewardType); Type type = rewardDatum.Reward.GetType(); if (rewardCategory == RewardCategory.iglooSlots) { int num = (int)rewardDatum.Reward; if (num > 0) { DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems(); DReward[] rewards = new DReward[num]; for (int i = 0; i < num; i++) { DReward dReward = new DReward(); dReward.Category = rewardCategory; } dRewardPopupScreenItems.ItemCategory = rewardCategory; dRewardPopupScreenItems.Rewards = rewards; dRewardPopupScreenItems.RewardPopupType = popupData.PopupType; list.Add(dRewardPopupScreenItems); } } else if (typeFromHandle.IsAssignableFrom(type)) { IList list2 = rewardDatum.Reward as IList; if (list2 == null || list2.Count <= 0) { continue; } bool isRewardsAllNonMember = false; DRewardPopupScreenItems dRewardPopupScreenItems = buildItemScreenFromIList(rewardCategory, list2, popupData); if (checkForNonMemberScreens) { for (int i = 0; i < dRewardPopupScreenItems.Rewards.Length; i++) { if (RewardUtils.IsRewardMemberOnly(rewardCategory, dRewardPopupScreenItems.Rewards[i].UnlockID)) { isRewardsAllNonMember = false; break; } isRewardsAllNonMember = true; } } dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember; list.Add(dRewardPopupScreenItems); } else if (typeFromHandle3.IsAssignableFrom(type)) { IDictionary dictionary = rewardDatum.Reward as IDictionary; if (dictionary == null || dictionary.Count <= 0) { continue; } bool isRewardsAllNonMember = false; DRewardPopupScreenItems dRewardPopupScreenItems = buildItemScreenFromDictionary(rewardCategory, dictionary, popupData); if (checkForNonMemberScreens) { for (int i = 0; i < dRewardPopupScreenItems.Rewards.Length; i++) { if (RewardUtils.IsRewardMemberOnly(rewardCategory, dRewardPopupScreenItems.Rewards[i].UnlockID)) { isRewardsAllNonMember = false; break; } isRewardsAllNonMember = true; } } dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember; list.Add(dRewardPopupScreenItems); } else if (type.Equals(typeFromHandle2)) { int num = (int)rewardDatum.Reward; if (num > 0) { list.Add(buildCountScreen(rewardCategory, num)); } } } list.Sort(delegate(DRewardPopupScreen p1, DRewardPopupScreen p2) { RewardCategory rewardCategory2 = ((!(p1 is DRewardPopupScreenItems)) ? ((DRewardPopupScreenCount)p1).CountCategory : ((DRewardPopupScreenItems)p1).ItemCategory); RewardCategory rewardCategory3 = ((!(p2 is DRewardPopupScreenItems)) ? ((DRewardPopupScreenCount)p2).CountCategory : ((DRewardPopupScreenItems)p2).ItemCategory); return(rewardCategory2.CompareTo(rewardCategory3)); }); return(list); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderDecal((int)reward.UnlockID), this, "RewardIconRenderer_Decal.renderDecal"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderFurnitureTemplate((string)reward.UnlockID), this, "RewardIconRenderer_Furniture.renderFurnitureTemplate"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderClothingTemplate((int)reward.UnlockID), this, "RewardIconRenderer_Equipment.renderClothingTemplate"); }
public void RenderReward(DReward reward, RewardIconRenderComplete callback) { this.callback = callback; CoroutineRunner.Start(renderColourPack((string)reward.UnlockID), this, "RewardIconRenderer_ColourPack.renderColourPack"); }