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); foreach (Transform transform in componentsInChildren) { if (transform != this.m_troopHeartContainerEmpty.transform) { Object.Destroy(transform.gameObject); } } Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true); foreach (Transform transform2 in componentsInChildren2) { if (transform2 != this.m_troopHeartContainerFull.transform) { Object.Destroy(transform2.gameObject); } } float num = 0.15f; WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID]; for (int k = 0; k < wrapperGarrisonFollower.Durability; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false); if (k >= follower.Durability) { float num2 = initialEntranceDelay + (float)(wrapperGarrisonFollower.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.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>(); float num4 = initialEntranceDelay + (float)(wrapperGarrisonFollower.Durability - follower.Durability) * num + 1f; delayedUIAnim.Init(num4, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.transform, 1.5f, 0.3f); DelayedObjectEnable delayedObjectEnable = base.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.sprite = sprite; } if (isTroop) { this.m_qualityBorder_TitleQuality.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); this.m_followerNameText.color = Color.white; this.m_iLevelText.gameObject.SetActive(false); } else { if (follower.Quality == 6) { this.m_qualityBorder_TitleQuality.gameObject.SetActive(true); this.m_levelBorder_TitleQuality.gameObject.SetActive(true); this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); } else { this.m_qualityBorder_TitleQuality.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); this.m_qualityBorder.gameObject.SetActive(true); this.m_levelBorder.gameObject.SetActive(true); } Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.color = qualityColor; this.m_levelBorder.color = qualityColor; this.m_followerNameText.color = qualityColor; } CreatureRec record2 = 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 = record2.Name; } if (follower.FollowerLevel < 110) { this.m_iLevelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), follower.FollowerLevel.ToString()); } else { this.m_iLevelText.text = StaticDB.GetString("ILVL", null) + " " + ((follower.ItemLevelArmor + follower.ItemLevelWeapon) / 2).ToString(); } GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID)); this.m_classText.text = record3.ClassSpec; Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_classIcon.sprite = atlasSprite; } 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_UPGRADE", string.Empty); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty); } } }
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); } } }