private void SetCharShipmentItem(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec, bool isSealOfFateHack = false) { this.m_isTroop = false; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(false); this.m_itemSpecificArea.SetActive(true); this.m_troopName.gameObject.SetActive(false); this.m_itemName.gameObject.SetActive(true); ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID); if (record == null) { Debug.LogError("Invalid Item ID: " + charShipmentRec.DummyItemID); this.m_troopName.text = "Invalid Item ID: " + charShipmentRec.DummyItemID; return; } this.m_itemDisplay.InitReward(MissionRewardDisplay.RewardType.item, charShipmentRec.DummyItemID, 1, 0, record.IconFileDataID); this.m_itemName.text = record.Display; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); this.m_itemResourceCostText.gameObject.SetActive(!isSealOfFateHack); this.m_itemResourceIcon.gameObject.SetActive(!isSealOfFateHack); if (!isSealOfFateHack) { this.m_itemResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_itemResourceIcon.sprite = sprite2; } } this.UpdateItemSlots(); this.UpdateRecruitButtonState(); }
private void SetCharShipmentItem(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = false; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(false); this.m_itemSpecificArea.SetActive(true); this.m_troopName.get_gameObject().SetActive(false); this.m_itemName.get_gameObject().SetActive(true); ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID); if (record == null) { Debug.LogError("Invalid Item ID: " + charShipmentRec.DummyItemID); this.m_troopName.set_text("Invalid Item ID: " + charShipmentRec.DummyItemID); return; } this.m_itemDisplay.InitReward(MissionRewardDisplay.RewardType.item, charShipmentRec.DummyItemID, 1, 0, record.IconFileDataID); this.m_itemName.set_text(record.Display); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_troopSnapshotImage.set_sprite(sprite); } this.m_itemResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost); Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_itemResourceIcon.set_sprite(sprite2); } this.UpdateItemSlots(); this.UpdateRecruitButtonState(); }
private void SetCharShipmentTroop(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = true; this.m_shipmentType = shipmentType; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.get_gameObject().SetActive(true); this.m_itemName.get_gameObject().SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { Debug.LogError("Invalid Follower ID: " + charShipmentRec.GarrFollowerID); this.m_troopName.set_text("Invalid Follower ID: " + charShipmentRec.GarrFollowerID); return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID; CreatureRec record2 = StaticDB.creatureDB.GetRecord(num); if (record2 == null) { Debug.LogError("Invalid Creature ID: " + num); this.m_troopName.set_text("Invalid Creature ID: " + num); return; } string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.m_troopSnapshotImage.set_sprite(sprite); } for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.get_transform().SetParent(this.m_troopHeartContainer.get_transform(), false); } this.m_troopName.set_text(record2.Name); StaticDB.garrFollowerXAbilityDB.EnumRecordsByParentID((int)charShipmentRec.GarrFollowerID, delegate(GarrFollowerXAbilityRec xAbilityRec) { if (xAbilityRec.FactionIndex == (int)GarrisonStatus.Faction()) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject2.get_transform().SetParent(this.m_traitsAndAbilitiesRootObject.get_transform(), false); AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>(); component.SetAbility(xAbilityRec.GarrAbilityID, true, true, null); } return(true); }); this.UpdateTroopSlots(); this.m_troopResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost); Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_troopResourceIcon.set_sprite(sprite2); } this.UpdateRecruitButtonState(); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_rightStackLayoutElement.minHeight = 170f; this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { this.m_troopName.text = "Invalid Follower ID: " + charShipmentRec.GarrFollowerID; return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID; CreatureRec record2 = StaticDB.creatureDB.GetRecord(num); if (record2 == null) { this.m_troopName.text = "Invalid Creature ID: " + num; return; } string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.m_troopSnapshotImage.sprite = sprite; } for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = record2.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject2.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_troopResourceIcon.sprite = sprite2; } this.UpdateRecruitButtonState(); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { Debug.LogError(string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID)); this.m_troopName.text = string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID); return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord(num); if (creatureRec == null) { Debug.LogError(string.Concat("Invalid Creature ID: ", num)); this.m_troopName.text = string.Concat("Invalid Creature ID: ", num); return; } int d = creatureRec.ID; string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png"); AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str); for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = creatureRec.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject1.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject1.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Concat(string.Empty, shipmentType.CurrencyCost); Sprite sprite = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite != null) { this.m_troopResourceIcon.sprite = sprite; } this.UpdateRecruitButtonState(); }
public void SetCharShipment(WrapperShipmentType?shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null) { this.m_akHintText.gameObject.SetActive(false); if (!isSealOfFateHack) { this.m_shipmentCost = shipmentType.Value.CurrencyCost; } else { this.m_shipmentCost = 0; } Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { Transform transforms = componentsInChildren[i]; if (transforms != this.m_troopHeartContainer.transform) { transforms.transform.SetParent(null); UnityEngine.Object.Destroy(transforms.gameObject); } } AbilityDisplay[] abilityDisplayArray = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int j = 0; j < (int)abilityDisplayArray.Length; j++) { AbilityDisplay abilityDisplay = abilityDisplayArray[j]; abilityDisplay.transform.SetParent(null); UnityEngine.Object.Destroy(abilityDisplay.gameObject); } TroopSlot[] troopSlotArray = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); for (int k = 0; k < (int)troopSlotArray.Length; k++) { TroopSlot troopSlot = troopSlotArray[k]; troopSlot.transform.SetParent(null); UnityEngine.Object.Destroy(troopSlot.gameObject); } CharShipmentRec charShipmentRec = (!isSealOfFateHack ? StaticDB.charShipmentDB.GetRecord(shipmentType.Value.CharShipmentID) : sealOfFateHackCharShipmentRec); if (charShipmentRec == null) { WrapperShipmentType value = shipmentType.Value; Debug.LogError(string.Concat("Invalid Shipment ID: ", value.CharShipmentID)); Text mTroopName = this.m_troopName; WrapperShipmentType wrapperShipmentType = shipmentType.Value; mTroopName.text = string.Concat("Invalid Shipment ID: ", wrapperShipmentType.CharShipmentID); return; } if (charShipmentRec.GarrFollowerID > 0) { this.SetCharShipmentTroop(shipmentType.Value, charShipmentRec); } else if (charShipmentRec.DummyItemID > 0) { this.SetCharShipmentItem(shipmentType.Value, (!isSealOfFateHack ? charShipmentRec : sealOfFateHackCharShipmentRec), isSealOfFateHack); } }
public void SetCharShipment(MobileClientShipmentType shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null) { if (isSealOfFateHack) { this.m_shipmentCost = 0; } else { this.m_shipmentCost = shipmentType.CurrencyCost; } Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true); Transform[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Transform transform = array[i]; if (transform != this.m_troopHeartContainer.get_transform()) { Object.DestroyImmediate(transform.get_gameObject()); } } AbilityDisplay[] componentsInChildren2 = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true); AbilityDisplay[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { AbilityDisplay abilityDisplay = array2[j]; Object.DestroyImmediate(abilityDisplay.get_gameObject()); } TroopSlot[] componentsInChildren3 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); TroopSlot[] array3 = componentsInChildren3; for (int k = 0; k < array3.Length; k++) { TroopSlot troopSlot = array3[k]; Object.DestroyImmediate(troopSlot.get_gameObject()); } CharShipmentRec charShipmentRec = (!isSealOfFateHack) ? StaticDB.charShipmentDB.GetRecord(shipmentType.CharShipmentID) : sealOfFateHackCharShipmentRec; if (charShipmentRec == null) { Debug.LogError("Invalid Shipment ID: " + shipmentType.CharShipmentID); this.m_troopName.set_text("Invalid Shipment ID: " + shipmentType.CharShipmentID); return; } if (charShipmentRec.GarrFollowerID > 0u) { this.SetCharShipmentTroop(shipmentType, charShipmentRec); } else if (charShipmentRec.DummyItemID > 0) { this.SetCharShipmentItem(shipmentType, (!isSealOfFateHack) ? charShipmentRec : sealOfFateHackCharShipmentRec, isSealOfFateHack); } }
public void SetCharShipment(WrapperShipmentType?shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null) { this.m_akHintText.gameObject.SetActive(false); if (isSealOfFateHack) { this.m_shipmentCost = 0; } else { this.m_shipmentCost = shipmentType.Value.CurrencyCost; } Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true); foreach (Transform transform in componentsInChildren) { if (transform != this.m_troopHeartContainer.transform) { transform.transform.SetParent(null); Object.Destroy(transform.gameObject); } } AbilityDisplay[] componentsInChildren2 = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true); foreach (AbilityDisplay abilityDisplay in componentsInChildren2) { abilityDisplay.transform.SetParent(null); Object.Destroy(abilityDisplay.gameObject); } TroopSlot[] componentsInChildren3 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); foreach (TroopSlot troopSlot in componentsInChildren3) { troopSlot.transform.SetParent(null); Object.Destroy(troopSlot.gameObject); } CharShipmentRec charShipmentRec = (!isSealOfFateHack) ? StaticDB.charShipmentDB.GetRecord(shipmentType.Value.CharShipmentID) : sealOfFateHackCharShipmentRec; if (charShipmentRec == null) { Debug.LogError("Invalid Shipment ID: " + shipmentType.Value.CharShipmentID); this.m_troopName.text = "Invalid Shipment ID: " + shipmentType.Value.CharShipmentID; return; } if (charShipmentRec.GarrFollowerID > 0) { this.SetCharShipmentTroop(shipmentType.Value, charShipmentRec); } else if (charShipmentRec.DummyItemID > 0) { this.SetCharShipmentItem(shipmentType.Value, (!isSealOfFateHack) ? charShipmentRec : sealOfFateHackCharShipmentRec, isSealOfFateHack); } }
private void SetCharShipmentItem(CharShipmentRec charShipmentRec) { ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID); if (record == null) { return; } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_troopPortraitImage.sprite = sprite; } }
public void SetCharShipmentTroop(CharShipmentRec charShipmentRec, int iconFileDataID = 0) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { return; } if (iconFileDataID <= 0) { iconFileDataID = ((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID); } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID); if (sprite != null) { this.m_troopPortraitImage.sprite = sprite; } }
private void SetCharShipmentItem(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec, bool isSealOfFateHack = false) { this.m_rightStackLayoutElement.minHeight = 120f; this.m_isTroop = false; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(false); this.m_itemSpecificArea.SetActive(true); this.m_troopName.gameObject.SetActive(false); this.m_itemName.gameObject.SetActive(true); ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID); if (record == null) { Debug.LogError("Invalid Item ID: " + charShipmentRec.DummyItemID); this.m_troopName.text = "Invalid Item ID: " + charShipmentRec.DummyItemID; return; } this.m_itemDisplay.InitReward(MissionRewardDisplay.RewardType.item, charShipmentRec.DummyItemID, 1, 0, record.IconFileDataID); this.m_isArtifactResearch = (record.ID == 139390 || record.ID == 146745); this.m_itemName.text = record.Display + ((!this.m_isArtifactResearch) ? string.Empty : this.GetCurrentArtifactPowerText()); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_troopSnapshotImage.sprite = sprite; } this.m_itemResourceCostText.gameObject.SetActive(!isSealOfFateHack); this.m_itemResourceIcon.gameObject.SetActive(!isSealOfFateHack); if (!isSealOfFateHack) { this.m_itemResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_itemResourceIcon.sprite = sprite2; } } this.UpdateAKStatus(); this.UpdateItemSlots(); this.UpdateRecruitButtonState(); }
private void InitList() { MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Length == 0) { this.m_noRecruitsYetMessage.gameObject.SetActive(true); } else { this.m_noRecruitsYetMessage.gameObject.SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); foreach (TroopsListItem troopsListItem in componentsInChildren) { bool flag = true; if (availableShipmentTypes != null) { foreach (MobileClientShipmentType mobileClientShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.DestroyImmediate(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int k = 0; k < availableShipmentTypes.Length; k++) { bool flag2 = false; foreach (TroopsListItem troopsListItem2 in componentsInChildren) { if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(availableShipmentTypes[k], false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k; component2.Activate(); } } IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj; if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID)) { bool flag3 = true; bool flag4 = false; if (jamCharacterShipment.ShipmentRecID < 372 || jamCharacterShipment.ShipmentRecID > 383) { flag3 = false; } if (jamCharacterShipment.ShipmentRecID == 178 || jamCharacterShipment.ShipmentRecID == 179 || jamCharacterShipment.ShipmentRecID == 180 || jamCharacterShipment.ShipmentRecID == 192 || jamCharacterShipment.ShipmentRecID == 194 || jamCharacterShipment.ShipmentRecID == 195) { flag4 = true; } if (flag3 || flag4) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject2.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>(); component3.SetCharShipment(null, true, record); } } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
private void UpdateTroopSlots() { int maxTroops = this.GetMaxTroops((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID)); TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); if (componentsInChildren.Length < maxTroops) { for (int i = componentsInChildren.Length; i < maxTroops; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab); gameObject.get_transform().SetParent(this.m_troopSlotsRootObject.get_transform(), false); TroopSlot component = gameObject.GetComponent <TroopSlot>(); component.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, 0, false, 0); } } if (componentsInChildren.Length > maxTroops) { for (int j = maxTroops; j < componentsInChildren.Length; j++) { Object.DestroyImmediate(componentsInChildren[j].get_gameObject()); } } componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); TroopSlot[] array = componentsInChildren; for (int k = 0; k < array.Length; k++) { TroopSlot troopSlot = array[k]; int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary.get_Item(ownedFollowerID).Durability == 0)) { troopSlot.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, 0, false, 0); } } uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID; using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator()) { while (enumerator.MoveNext()) { JamGarrisonFollower current = enumerator.get_Current(); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(current.GarrFollowerID); uint num2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID; if (num2 == num && current.Durability > 0) { this.SetTroopSlotForExistingFollower(componentsInChildren, current); } } } CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(this.m_shipmentType.CharShipmentID); IEnumerator enumerator2 = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator2.MoveNext()) { JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator2.get_Current(); if (jamCharacterShipment.ShipmentRecID == this.m_shipmentType.CharShipmentID) { this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID); } else { CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record3.ContainerID == record2.ContainerID) { this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID); } } } } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
private void InitList() { List <WrapperShipmentType> availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Count == 0) { this.m_noRecruitsYetMessage.gameObject.SetActive(true); } else { this.m_noRecruitsYetMessage.gameObject.SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); TroopsListItem[] troopsListItemArray = componentsInChildren; for (int i = 0; i < (int)troopsListItemArray.Length; i++) { TroopsListItem troopsListItem = troopsListItemArray[i]; bool flag = true; if (availableShipmentTypes != null) { foreach (WrapperShipmentType availableShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() != availableShipmentType.CharShipmentID) { continue; } flag = false; break; } } if (flag) { UnityEngine.Object.Destroy(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int j = 0; j < availableShipmentTypes.Count; j++) { bool flag1 = false; TroopsListItem[] troopsListItemArray1 = componentsInChildren; int num = 0; while (num < (int)troopsListItemArray1.Length) { if (troopsListItemArray1[num].GetCharShipmentTypeID() != availableShipmentTypes[j].CharShipmentID) { num++; } else { flag1 = true; break; } } if (!flag1) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(new WrapperShipmentType?(availableShipmentTypes[j]), false, null); FancyEntrance mListItemInitialEntranceDelay = component.GetComponent <FancyEntrance>(); mListItemInitialEntranceDelay.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)j; mListItemInitialEntranceDelay.Activate(); } } foreach (WrapperCharacterShipment value in PersistentShipmentData.shipmentDictionary.Values) { if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(value.ShipmentRecID)) { bool flag2 = true; bool flag3 = false; if (value.ShipmentRecID < 372 || value.ShipmentRecID > 383) { flag2 = false; } if (value.ShipmentRecID == 178 || value.ShipmentRecID == 179 || value.ShipmentRecID == 180 || value.ShipmentRecID == 192 || value.ShipmentRecID == 194 || value.ShipmentRecID == 195) { flag3 = true; } if (flag2 || flag3) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(value.ShipmentRecID); if (record != null) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject1.transform.SetParent(this.m_troopsListContents.transform, false); gameObject1.GetComponent <TroopsListItem>().SetCharShipment(null, true, record); } } } } }
private void UpdateTroopSlots() { if (this.m_followerRec == null || this.m_charShipmentRec == null) { return; } int maxTroops = this.GetMaxTroops((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID)); TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); if (componentsInChildren.Length < maxTroops) { for (int i = componentsInChildren.Length; i < maxTroops; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab); gameObject.transform.SetParent(this.m_troopSlotsRootObject.transform, false); TroopSlot component = gameObject.GetComponent <TroopSlot>(); component.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0); } } if (componentsInChildren.Length > maxTroops) { for (int j = maxTroops; j < componentsInChildren.Length; j++) { Object.DestroyImmediate(componentsInChildren[j].gameObject); } } componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); foreach (TroopSlot troopSlot in componentsInChildren) { int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary[ownedFollowerID].Durability == 0)) { troopSlot.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0); } } uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID; foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(jamGarrisonFollower.GarrFollowerID); uint num2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID; if (num2 == num && jamGarrisonFollower.Durability > 0) { this.SetTroopSlotForExistingFollower(componentsInChildren, jamGarrisonFollower); } } CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID); IEnumerator enumerator2 = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj = enumerator2.Current; JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj; if (jamCharacterShipment.ShipmentRecID == this.m_charShipmentRec.ID) { this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID); } else { CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record3.ContainerID == record2.ContainerID) { this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID); } } } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } }
private void InitList() { MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Length == 0) { this.m_noRecruitsYetMessage.get_gameObject().SetActive(true); } else { this.m_noRecruitsYetMessage.get_gameObject().SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); TroopsListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { TroopsListItem troopsListItem = array[i]; bool flag = true; if (availableShipmentTypes != null) { MobileClientShipmentType[] array2 = availableShipmentTypes; for (int j = 0; j < array2.Length; j++) { MobileClientShipmentType mobileClientShipmentType = array2[j]; if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.DestroyImmediate(troopsListItem.get_gameObject()); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int k = 0; k < availableShipmentTypes.Length; k++) { bool flag2 = false; TroopsListItem[] array3 = componentsInChildren; for (int l = 0; l < array3.Length; l++) { TroopsListItem troopsListItem2 = array3[l]; if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(availableShipmentTypes[k], false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k; component2.Activate(); } } IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator.MoveNext()) { JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator.get_Current(); if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID)) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject2.get_transform().SetParent(this.m_troopsListContents.get_transform(), false); TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>(); component3.SetCharShipment(null, true, record); } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public void SetCharShipment(int charShipmentID, ulong shipmentDBID, int ownedGarrFollowerID, bool training, int iconFileDataID = 0) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(charShipmentID); if (record == null) { Debug.LogError("Invalid Shipment ID: " + charShipmentID); return; } if (this.m_glowLoopHandle != null) { UiAnimation anim = this.m_glowLoopHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } this.m_glowLoopHandle = null; } this.m_collected = false; this.m_pendingCreate = false; this.m_collectingSpinner.SetActive(false); this.m_ownedGarrFollowerID = ownedGarrFollowerID; this.m_training = training; this.m_shipmentDBID = shipmentDBID; if (training) { if (!PersistentShipmentData.shipmentDictionary.ContainsKey(shipmentDBID)) { training = false; Debug.LogWarning("Shipment not found in Persistent: " + charShipmentID); } else { WrapperCharacterShipment wrapperCharacterShipment = PersistentShipmentData.shipmentDictionary[shipmentDBID]; this.m_shipmentCreationTime = wrapperCharacterShipment.CreationTime; this.m_shipmentDuration = wrapperCharacterShipment.ShipmentDuration; } } if (record.GarrFollowerID > 0) { this.SetCharShipmentTroop(record, iconFileDataID); } else if (record.DummyItemID > 0) { this.SetCharShipmentItem(record); } if (ownedGarrFollowerID != 0) { this.m_troopBuildEmptyRing.gameObject.SetActive(false); this.m_troopOwnedCheckmark.gameObject.SetActive(true); this.m_troopPortraitImage.gameObject.SetActive(true); this.m_timeRemainingText.gameObject.SetActive(false); return; } if (training) { this.m_troopBuildEmptyRing.gameObject.SetActive(true); this.m_troopOwnedCheckmark.gameObject.SetActive(false); this.m_troopPortraitImage.gameObject.SetActive(true); this.m_timeRemainingText.gameObject.SetActive(true); this.m_timeRemainingText.text = string.Empty; if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_troopPortraitImage.material = material; } } else { this.m_troopBuildEmptyRing.gameObject.SetActive(false); this.m_troopOwnedCheckmark.gameObject.SetActive(false); this.m_troopPortraitImage.gameObject.SetActive(false); this.m_timeRemainingText.gameObject.SetActive(false); } }
private void InitList() { List <WrapperShipmentType> availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Count == 0) { this.m_noRecruitsYetMessage.gameObject.SetActive(true); } else { this.m_noRecruitsYetMessage.gameObject.SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); foreach (TroopsListItem troopsListItem in componentsInChildren) { bool flag = true; if (availableShipmentTypes != null) { foreach (WrapperShipmentType wrapperShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() == wrapperShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.Destroy(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int j = 0; j < availableShipmentTypes.Count; j++) { bool flag2 = false; foreach (TroopsListItem troopsListItem2 in componentsInChildren) { if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[j].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(new WrapperShipmentType?(availableShipmentTypes[j]), false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)j; component2.Activate(); } } foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(wrapperCharacterShipment.ShipmentRecID)) { bool flag3 = true; bool flag4 = false; if (wrapperCharacterShipment.ShipmentRecID < 372 || wrapperCharacterShipment.ShipmentRecID > 383) { flag3 = false; } if (wrapperCharacterShipment.ShipmentRecID == 178 || wrapperCharacterShipment.ShipmentRecID == 179 || wrapperCharacterShipment.ShipmentRecID == 180 || wrapperCharacterShipment.ShipmentRecID == 192 || wrapperCharacterShipment.ShipmentRecID == 194 || wrapperCharacterShipment.ShipmentRecID == 195) { flag4 = true; } if (flag3 || flag4) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID); if (record != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject2.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>(); component3.SetCharShipment(null, true, record); } } } } }
private void UpdateTroopSlots() { if (this.m_followerRec == null || this.m_charShipmentRec == null) { return; } int maxTroops = this.GetMaxTroops((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID)); TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); if (componentsInChildren.Length < maxTroops) { for (int i = componentsInChildren.Length; i < maxTroops; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab); gameObject.transform.SetParent(this.m_troopSlotsRootObject.transform, false); TroopSlot component = gameObject.GetComponent <TroopSlot>(); component.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0); } } if (componentsInChildren.Length > maxTroops) { for (int j = maxTroops; j < componentsInChildren.Length; j++) { Object.Destroy(componentsInChildren[j].gameObject); } } componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); foreach (TroopSlot troopSlot in componentsInChildren) { int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary[ownedFollowerID].Durability == 0)) { troopSlot.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0); } } uint num = (uint)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID); foreach (WrapperGarrisonFollower follower in PersistentFollowerData.followerDictionary.Values) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); uint num2 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID); if (num2 == num && follower.Durability > 0) { this.SetTroopSlotForExistingFollower(componentsInChildren, follower); } } CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID); foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (wrapperCharacterShipment.ShipmentRecID == this.m_charShipmentRec.ID) { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } else { CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID); if (record3.ContainerID == record2.ContainerID) { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } } } }
private void UpdateTroopSlots() { if (this.m_followerRec == null || this.m_charShipmentRec == null) { return; } int maxTroops = this.GetMaxTroops((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)this.m_followerRec.AllianceGarrClassSpecID : (int)this.m_followerRec.HordeGarrClassSpecID)); TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); if ((int)componentsInChildren.Length < maxTroops) { for (int i = (int)componentsInChildren.Length; i < maxTroops; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopSlotPrefab); gameObject.transform.SetParent(this.m_troopSlotsRootObject.transform, false); TroopSlot component = gameObject.GetComponent <TroopSlot>(); component.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, 0, false, 0); } } if ((int)componentsInChildren.Length > maxTroops) { for (int j = maxTroops; j < (int)componentsInChildren.Length; j++) { UnityEngine.Object.Destroy(componentsInChildren[j].gameObject); } } componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); TroopSlot[] troopSlotArray = componentsInChildren; for (int k = 0; k < (int)troopSlotArray.Length; k++) { TroopSlot troopSlot = troopSlotArray[k]; int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary[ownedFollowerID].Durability == 0)) { troopSlot.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, 0, false, 0); } } uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID); foreach (WrapperGarrisonFollower value in PersistentFollowerData.followerDictionary.Values) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(value.GarrFollowerID); if ((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID) != num || value.Durability <= 0) { continue; } this.SetTroopSlotForExistingFollower(componentsInChildren, value); } CharShipmentRec charShipmentRec = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID); foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (wrapperCharacterShipment.ShipmentRecID != this.m_charShipmentRec.ID) { if (StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID).ContainerID != charShipmentRec.ContainerID) { continue; } this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } else { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } } }
public void SetCharShipment(int charShipmentID, ulong shipmentDBID, int ownedGarrFollowerID, bool training, int iconFileDataID = 0) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(charShipmentID); if (record == null) { Debug.LogError("Invalid Shipment ID: " + charShipmentID); return; } if (this.m_glowLoopHandle != null) { this.m_glowLoopHandle.GetAnim().Stop(0f); this.m_glowLoopHandle = null; } this.m_collected = false; this.m_ownedGarrFollowerID = ownedGarrFollowerID; this.m_training = training; this.m_shipmentDBID = shipmentDBID; if (training) { if (!PersistentShipmentData.shipmentDictionary.ContainsKey(shipmentDBID)) { training = false; Debug.LogWarning("Shipment not found in Persistent: " + charShipmentID); } else { JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)PersistentShipmentData.shipmentDictionary.get_Item(shipmentDBID); this.m_shipmentCreationTime = jamCharacterShipment.CreationTime; this.m_shipmentDuration = jamCharacterShipment.ShipmentDuration; } } if (record.GarrFollowerID > 0u) { this.SetCharShipmentTroop(record, iconFileDataID); } else if (record.DummyItemID > 0) { this.SetCharShipmentItem(record); } if (ownedGarrFollowerID != 0) { this.m_troopBuildProgressRing.get_gameObject().SetActive(false); this.m_troopBuildEmptyRing.get_gameObject().SetActive(false); this.m_troopBuildProgressFill.get_gameObject().SetActive(false); this.m_troopOwnedCheckmark.get_gameObject().SetActive(true); this.m_troopPortraitImage.get_gameObject().SetActive(true); this.m_timeRemainingText.get_gameObject().SetActive(false); return; } if (training) { this.m_troopBuildEmptyRing.get_gameObject().SetActive(true); this.m_troopBuildProgressRing.get_gameObject().SetActive(true); this.m_troopBuildProgressRing.set_fillAmount(0f); this.m_troopBuildProgressFill.get_gameObject().SetActive(true); this.m_troopBuildProgressFill.set_fillAmount(0f); this.m_troopOwnedCheckmark.get_gameObject().SetActive(false); this.m_troopPortraitImage.get_gameObject().SetActive(true); this.m_timeRemainingText.get_gameObject().SetActive(true); this.m_timeRemainingText.set_text(string.Empty); if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_troopPortraitImage.set_material(material); } } else { this.m_troopBuildEmptyRing.get_gameObject().SetActive(false); this.m_troopBuildProgressRing.get_gameObject().SetActive(false); this.m_troopBuildProgressFill.get_gameObject().SetActive(false); this.m_troopOwnedCheckmark.get_gameObject().SetActive(false); this.m_troopPortraitImage.get_gameObject().SetActive(false); this.m_timeRemainingText.get_gameObject().SetActive(false); } }
public void ScheduleNotifications() { this.ClearPendingNotifications(); if (!Main.instance.m_enableNotifications) { return; } List <NotificationData> list = new List <NotificationData>(); ICollection <WrapperGarrisonMission> values = PersistentMissionData.missionDictionary.Values; foreach (WrapperGarrisonMission wrapperGarrisonMission in values) { GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID); if (record != null && (GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID == GarrisonStatus.GarrisonFollowerType) { if (wrapperGarrisonMission.MissionState == 1) { if ((record.Flags & 16u) == 0u) { TimeSpan t = GarrisonStatus.CurrentTime() - wrapperGarrisonMission.StartTime; TimeSpan timeRemaining = wrapperGarrisonMission.MissionDuration - t; list.Add(new NotificationData { notificationText = record.Name, timeRemaining = timeRemaining, notificationType = NotificationType.missionCompete }); } } } } foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID); if (record2 == null) { Debug.LogError("Invalid Shipment ID: " + wrapperCharacterShipment.ShipmentRecID); } else { string notificationText = "Invalid"; if (record2.GarrFollowerID > 0) { GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord((int)record2.GarrFollowerID); if (record3 == null) { Debug.LogError("Invalid Follower ID: " + record2.GarrFollowerID); continue; } int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceCreatureID : record3.HordeCreatureID; CreatureRec record4 = StaticDB.creatureDB.GetRecord(num); if (record4 == null) { Debug.LogError("Invalid Creature ID: " + num); continue; } notificationText = record4.Name; } if (record2.DummyItemID > 0) { ItemRec record5 = StaticDB.itemDB.GetRecord(record2.DummyItemID); if (record5 == null) { Debug.LogError("Invalid Item ID: " + record2.DummyItemID); continue; } notificationText = record5.Display; } TimeSpan t2 = GarrisonStatus.CurrentTime() - wrapperCharacterShipment.CreationTime; TimeSpan timeRemaining2 = wrapperCharacterShipment.ShipmentDuration - t2; list.Add(new NotificationData { notificationText = notificationText, timeRemaining = timeRemaining2, notificationType = NotificationType.workOrderReady }); } } foreach (WrapperGarrisonTalent wrapperGarrisonTalent in PersistentTalentData.talentDictionary.Values) { if ((wrapperGarrisonTalent.Flags & 1) == 0) { if (!(wrapperGarrisonTalent.StartTime <= DateTime.UtcNow)) { GarrTalentRec record6 = StaticDB.garrTalentDB.GetRecord(wrapperGarrisonTalent.GarrTalentID); if (record6 != null) { TimeSpan timeRemaining3 = TimeSpan.Zero; if ((wrapperGarrisonTalent.Flags & 2) == 0) { timeRemaining3 = TimeSpan.FromSeconds((double)record6.ResearchDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime); } else { timeRemaining3 = TimeSpan.FromSeconds((double)record6.RespecDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime); } list.Add(new NotificationData { notificationText = record6.Name, timeRemaining = timeRemaining3, notificationType = NotificationType.talentReady }); } } } } int num2 = 0; foreach (NotificationData notificationData in from n in list orderby n.timeRemaining select n) { if (notificationData.notificationType == NotificationType.missionCompete) { LocalNotifications.ScheduleMissionCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds)); } if (notificationData.notificationType == NotificationType.workOrderReady) { LocalNotifications.ScheduleWorkOrderReadyNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds)); } if (notificationData.notificationType == NotificationType.talentReady) { LocalNotifications.ScheduleTalentResearchCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds)); } Debug.Log(string.Concat(new object[] { "Scheduling Notification for [", notificationData.notificationType, "] ", notificationData.notificationText, " (", num2, ") in ", notificationData.timeRemaining.TotalSeconds, " seconds" })); } }