public void SetMission(int garrMissionID) { base.gameObject.name = "AdvMapMissionSite " + garrMissionID; if (!PersistentMissionData.missionDictionary.ContainsKey(garrMissionID)) { return; } this.m_garrMissionID = garrMissionID; GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID); if (record == null || !PersistentMissionData.missionDictionary.ContainsKey(garrMissionID)) { return; } this.m_areaID = record.AreaID; this.m_isSupportMission = false; if ((record.Flags & 16u) != 0u) { this.m_isSupportMission = true; this.m_missionTimeRemainingText.text = "Fortified"; } GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID); if (record2.UiTextureAtlasMemberID > 0u) { Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_availableMissionTypeIcon.sprite = atlasSprite; this.m_inProgressMissionTypeIcon.sprite = atlasSprite; } } WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID]; if (wrapperGarrisonMission.MissionState == 1 || wrapperGarrisonMission.MissionState == 2) { this.m_missionDuration = wrapperGarrisonMission.MissionDuration; } else { this.m_missionDuration = TimeSpan.FromSeconds((double)record.MissionDuration); } this.m_missionStartedTime = wrapperGarrisonMission.StartTime; this.m_availableMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 0); this.m_inProgressMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 1); this.m_completeMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 3); if (wrapperGarrisonMission.MissionState == 1) { foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in PersistentFollowerData.followerDictionary) { if (keyValuePair.Value.CurrentMissionID == garrMissionID) { GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(keyValuePair.Value.GarrFollowerID); if (record3 != null) { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceIconFileDataID : record3.HordeIconFileDataID); if (sprite != null) { this.m_followerPortraitImage.sprite = sprite; } this.m_followerPortraitRingImage.GetComponent <Image>().enabled = true; break; } } } } this.m_missionLevelText.text = string.Empty + record.TargetLevel + ((record.TargetLevel != 110) ? string.Empty : (" (" + record.TargetItemLevel + ")")); this.UpdateMissionRemainingTimeDisplay(); }
private void SetFollowerAppearance(WrapperGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); this.m_troopHeartContainerEmpty.SetActive(isTroop); this.m_troopHeartContainerFull.SetActive(isTroop); this.m_expiredPortraitX.SetActive(false); if (isTroop) { this.m_levelBorder.gameObject.SetActive(false); this.m_progressBarObj.SetActive(false); this.m_portraitBG.gameObject.SetActive(false); this.m_troopHeartContainerEmpty.SetActive(true); this.m_troopHeartContainerFull.SetActive(true); Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { Transform transforms = componentsInChildren[i]; if (transforms != this.m_troopHeartContainerEmpty.transform) { UnityEngine.Object.Destroy(transforms.gameObject); } } Transform[] transformArrays = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true); for (int j = 0; j < (int)transformArrays.Length; j++) { Transform transforms1 = transformArrays[j]; if (transforms1 != this.m_troopHeartContainerFull.transform) { UnityEngine.Object.Destroy(transforms1.gameObject); } } float single = 0.15f; WrapperGarrisonFollower item = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID]; for (int k = 0; k < item.Durability; k++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false); if (k >= follower.Durability) { float single1 = initialEntranceDelay + (float)(item.Durability - (k - follower.Durability)) * single; float single2 = 2f; iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", single2, "easetype", iTween.EaseType.easeOutCubic, "delay", single1, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" })); } } for (int l = 0; l < record.Vitality; l++) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject1.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>(); float single3 = initialEntranceDelay + (float)(item.Durability - follower.Durability) * single + 1f; delayedUIAnim.Init(single3, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.transform, 1.5f, 0.3f); DelayedObjectEnable delayedObjectEnable = base.gameObject.AddComponent <DelayedObjectEnable>(); delayedObjectEnable.Init(single3 + 0.25f, this.m_expiredPortraitX); } } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID)); if (sprite != null) { this.m_followerPortrait.sprite = sprite; } if (!isTroop) { if (follower.Quality != 6) { this.m_qualityBorder.gameObject.SetActive(true); this.m_levelBorder.gameObject.SetActive(true); } else { this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); } Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.color = qualityColor; this.m_troopBackground.SetActive(false); this.m_followerBackground.SetActive(true); } else { this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); this.m_troopBackground.SetActive(true); this.m_followerBackground.SetActive(false); this.m_iLevelText.gameObject.SetActive(false); } CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID)); if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.m_followerNameText.text = record.TitleName; } else if (record != null) { this.m_followerNameText.text = creatureRec.Name; } this.m_iLevelText.text = follower.FollowerLevel.ToString(); GarrClassSpecRec garrClassSpecRec = StaticDB.garrClassSpecDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)record.AllianceGarrClassSpecID : (int)record.HordeGarrClassSpecID)); this.m_classText.text = garrClassSpecRec.ClassSpec; if (!isTroop) { if (isMaxLevelAndMaxQuality) { this.m_progressBarObj.SetActive(false); this.m_toNextLevelOrUpgradeText.text = string.Empty; } else if (!nextCapIsForQuality) { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty); } } }
private void SetFollowerAppearance(JamGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); this.m_troopHeartContainerEmpty.SetActive(isTroop); this.m_troopHeartContainerFull.SetActive(isTroop); this.m_expiredPortraitX.SetActive(false); if (isTroop) { this.m_levelBorder.get_gameObject().SetActive(false); this.m_progressBarObj.SetActive(false); this.m_portraitBG.get_gameObject().SetActive(false); this.m_troopHeartContainerEmpty.SetActive(true); this.m_troopHeartContainerFull.SetActive(true); Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(); Transform[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Transform transform = array[i]; if (transform != this.m_troopHeartContainerEmpty.get_transform()) { Object.DestroyImmediate(transform.get_gameObject()); } } Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(); Transform[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { Transform transform2 = array2[j]; if (transform2 != this.m_troopHeartContainerFull.get_transform()) { Object.DestroyImmediate(transform2.get_gameObject()); } } float num = 0.15f; JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary.get_Item(follower.GarrFollowerID); for (int k = 0; k < jamGarrisonFollower.Durability; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.get_transform().SetParent(this.m_troopHeartContainerFull.get_transform(), false); if (k >= follower.Durability) { float num2 = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - (k - follower.Durability)) * num; float num3 = 2f; iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", num3, "easetype", iTween.EaseType.easeOutCubic, "delay", num2, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" })); } } for (int l = 0; l < record.Vitality; l++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject2.get_transform().SetParent(this.m_troopHeartContainerEmpty.get_transform(), false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.get_gameObject().AddComponent <DelayedUIAnim>(); float num4 = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - follower.Durability) * num + 1f; delayedUIAnim.Init(num4, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.get_transform(), 1.5f); DelayedObjectEnable delayedObjectEnable = base.get_gameObject().AddComponent <DelayedObjectEnable>(); delayedObjectEnable.Init(num4 + 0.25f, this.m_expiredPortraitX); } } int iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID); if (sprite != null) { this.m_followerPortrait.set_sprite(sprite); } if (isTroop) { this.m_qualityBorder.get_gameObject().SetActive(false); this.m_levelBorder.get_gameObject().SetActive(false); this.m_followerNameText.set_color(Color.get_white()); } else { Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.set_color(qualityColor); this.m_levelBorder.set_color(qualityColor); this.m_followerNameText.set_color(qualityColor); } CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); this.m_followerNameText.set_text(record2.Name); int num5 = (follower.ItemLevelWeapon + follower.ItemLevelArmor) / 2; if (this.m_iLvlString == null) { this.m_iLvlString = StaticDB.GetString("ITEM_LEVEL_ABBREVIATION", null); } this.m_iLevelText.set_text(this.m_iLvlString + " " + num5); GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID)); this.m_classText.set_text(record3.ClassSpec); Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_classIcon.set_sprite(atlasSprite); } if (!isTroop) { if (isMaxLevelAndMaxQuality) { this.m_progressBarObj.SetActive(false); this.m_toNextLevelOrUpgradeText.set_text(string.Empty); } else if (nextCapIsForQuality) { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty)); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_LEVEL", string.Empty)); } } }
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" })); } }