private ItemData[] MergeDropItems(RaidResult raidResult) { if (raidResult == null) { return(new ItemData[0]); } PlayerData player = MonoSingleton <GameManager> .Instance.Player; List <ItemData> itemDataList = new List <ItemData>(); using (List <RaidQuestResult> .Enumerator enumerator = raidResult.results.GetEnumerator()) { while (enumerator.MoveNext()) { RaidQuestResult current = enumerator.Current; if (current != null) { foreach (ItemData drop in current.drops) { if (drop != null) { bool flag = false; for (int index = 0; index < itemDataList.Count; ++index) { if (itemDataList[index].Param == drop.Param) { itemDataList[index].Gain(drop.Num); flag = true; break; } } if (!flag) { ItemData itemData = new ItemData(); itemData.Setup(drop.UniqueID, drop.Param, drop.Num); ItemData itemDataByItemParam = player.FindItemDataByItemParam(itemData.Param); itemData.IsNew = !player.ItemEntryExists(itemData.Param.iname) || (itemDataByItemParam == null || itemDataByItemParam.IsNew); itemDataList.Add(itemData); } } } } } } return(itemDataList.ToArray()); }
protected override void Start() { base.Start(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ResultTemplate, (UnityEngine.Object)null)) { this.ResultTemplate.SetActive(false); } if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.UnitListItem)) { this.UnitListItem.SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnUp, (UnityEngine.Object)null)) { ((Selectable)this.BtnUp).set_interactable(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnDown, (UnityEngine.Object)null)) { ((Selectable)this.BtnUp).set_interactable(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnOutSide, (UnityEngine.Object)null)) { ((Selectable)this.BtnOutSide).set_interactable(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnGainExpOutSide, (UnityEngine.Object)null)) { ((Selectable)this.BtnGainExpOutSide).set_interactable(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ResultLayout, (UnityEngine.Object)null)) { ((Behaviour)this.ResultLayout).set_enabled(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.GainExpWindow, (UnityEngine.Object)null)) { this.GainExpWindow.SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListItem, (UnityEngine.Object)null)) { this.TreasureListItem.SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.NewItemBadge, (UnityEngine.Object)null)) { this.NewItemBadge.SetActive(false); } this.mRaidResult = GlobalVars.RaidResult; if (this.mRaidResult != null) { this.ApplyQuestCampaignParams(this.mRaidResult.campaignIds); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ResultTemplate, (UnityEngine.Object)null)) { for (int index = 0; index < this.mRaidResult.results.Count; ++index) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ResultTemplate); gameObject.get_transform().SetParent(this.ResultParent, false); DataSource.Bind <RaidQuestResult>(gameObject, this.mRaidResult.results[index]); ListItemEvents component = (ListItemEvents)gameObject.GetComponent <ListItemEvents>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { this.AddItem(component); } this.mResults.Add(gameObject); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitListItem, (UnityEngine.Object)null)) { Transform transform = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitList, (UnityEngine.Object)null) ? this.UnitListItem.get_transform().get_parent() : this.UnitList.get_transform(); for (int index = 0; index < this.mRaidResult.members.Count; ++index) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.UnitListItem); gameObject.get_transform().SetParent(transform, false); this.mUnitListItems.Add(gameObject); DataSource.Bind <UnitData>(gameObject, this.mRaidResult.members[index]); gameObject.SetActive(true); } } this.CreateDropItemObjects(this.MergeDropItems(this.mRaidResult)); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtGainGoldVal, (UnityEngine.Object)null)) { this.TxtGainGoldVal.set_text(this.mRaidResult.gold.ToString()); } } GlobalVars.RaidResult = (RaidResult)null; GlobalVars.RaidNum = 0; if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SkipButton, (UnityEngine.Object)null)) { ((Component)this.SkipButton).get_gameObject().SetActive(false); } if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ExpSkipButton, (UnityEngine.Object)null)) { return; } ((Component)this.ExpSkipButton).get_gameObject().SetActive(false); }
private QuestResult.DropItemData[] MergeDropItems(RaidResult raidResult) { if (raidResult == null) { return(new QuestResult.DropItemData[0]); } PlayerData player = MonoSingleton <GameManager> .Instance.Player; List <QuestResult.DropItemData> dropItemDataList = new List <QuestResult.DropItemData>(); using (List <RaidQuestResult> .Enumerator enumerator = raidResult.results.GetEnumerator()) { while (enumerator.MoveNext()) { RaidQuestResult current = enumerator.Current; if (current != null) { foreach (QuestResult.DropItemData drop in current.drops) { if (drop != null) { bool flag = false; for (int index = 0; index < dropItemDataList.Count; ++index) { if (dropItemDataList[index].IsItem && drop.IsItem && dropItemDataList[index].itemParam == drop.itemParam) { dropItemDataList[index].Gain(drop.Num); flag = true; break; } if (dropItemDataList[index].IsConceptCard && drop.IsConceptCard && dropItemDataList[index].conceptCardParam == drop.conceptCardParam) { dropItemDataList[index].Gain(drop.Num); flag = true; break; } } if (!flag) { QuestResult.DropItemData dropItemData = new QuestResult.DropItemData(); if (drop.IsItem) { dropItemData.SetupDropItemData(EBattleRewardType.Item, 0L, drop.itemParam.iname, drop.Num); if (drop.itemParam.type != EItemType.Unit) { ItemData itemDataByItemParam = player.FindItemDataByItemParam(drop.itemParam); dropItemData.IsNew = !player.ItemEntryExists(drop.itemParam.iname) || (itemDataByItemParam == null || itemDataByItemParam.IsNew); } else { string iid = drop.itemParam.iname; if (player.Units.Find((Predicate <UnitData>)(p => p.UnitParam.iname == iid)) == null) { dropItemData.IsNew = true; } } } else if (drop.IsConceptCard) { dropItemData.SetupDropItemData(EBattleRewardType.ConceptCard, 0L, drop.conceptCardParam.iname, drop.Num); } dropItemDataList.Add(dropItemData); } } } } } } return(dropItemDataList.ToArray()); }