private void HandleCollectTroopResult(SHIPMENT_RESULT result, ulong shipmentDBID) { if (result == SHIPMENT_RESULT.SUCCESS && shipmentDBID == this.m_shipmentDBID) { if (this.m_glowLoopHandle != null) { UiAnimation anim = this.m_glowLoopHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } this.m_glowLoopHandle = null; } UiAnimMgr.instance.PlayAnim("GreenCheckRound", this.m_greenCheckEffectRoot, Vector3.zero, 1.8f, 0f); Main.instance.m_UISound.Play_GreenCheck(); this.m_training = false; this.m_troopOwnedCheckmark.gameObject.SetActive(true); this.m_troopPortraitImage.gameObject.SetActive(true); this.m_timeRemainingText.gameObject.SetActive(false); this.m_troopPortraitImage.material = null; PersistentShipmentData.shipmentDictionary.Remove(shipmentDBID); LegionCompanionWrapper.RequestShipmentTypes((int)GarrisonStatus.GarrisonType); LegionCompanionWrapper.RequestShipments((int)GarrisonStatus.GarrisonType); LegionCompanionWrapper.RequestGarrisonData((int)GarrisonStatus.GarrisonType); } }
public void AnimComplete(UiAnimation script) { GameObject gameObject = script.gameObject; UiAnimMgr.AnimData animData; this.m_animData.TryGetValue(gameObject.name, out animData); if (animData == null) { Debug.Log("Error! UiAnimMgr could not find completed anim " + gameObject.name); return; } if (!animData.m_activeObjects.Remove(gameObject)) { Debug.Log("Error! anim obj " + gameObject.name + "not in UiAnimMgr active list"); } animData.m_availableObjects.Push(gameObject); gameObject.SetActive(false); if (this.m_parentObj == null) { gameObject.transform.SetParent(null); } else { gameObject.transform.SetParent(this.m_parentObj.transform); } UiAnimation component = gameObject.GetComponent <UiAnimation>(); component.m_ID = 0; }
private void ClearEffects() { iTween.StopByName(this.m_theActualButton, "RecruitWobble"); iTween.StopByName(this.m_theActualButton, "RecruitWobbleL"); iTween.StopByName(this.m_theActualButton, "RecruitButtonSwing"); this.m_theActualButton.transform.localScale = Vector3.one; this.m_theActualButton.transform.localRotation = Quaternion.identity; iTween.StopByName(this.m_numReadyTroopsTextBG, "RecruitNumSwing"); this.m_numReadyTroopsTextBG.transform.localRotation = Quaternion.identity; if (this.m_glowHandle != null) { UiAnimation anim = this.m_glowHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } } if (this.m_glowLoopHandle != null) { UiAnimation anim2 = this.m_glowLoopHandle.GetAnim(); if (anim2 != null) { anim2.Stop(0.5f); } } }
public void AnimComplete(UiAnimation script) { UiAnimMgr.AnimData animDatum; GameObject gameObject = script.gameObject; this.m_animData.TryGetValue(gameObject.name, out animDatum); if (animDatum == null) { Debug.Log(string.Concat("Error! UiAnimMgr could not find completed anim ", gameObject.name)); return; } if (!animDatum.m_activeObjects.Remove(gameObject)) { Debug.Log(string.Concat("Error! anim obj ", gameObject.name, "not in UiAnimMgr active list")); } animDatum.m_availableObjects.Push(gameObject); gameObject.SetActive(false); if (this.m_parentObj != null) { gameObject.transform.SetParent(this.m_parentObj.transform); } else { gameObject.transform.SetParent(null); } gameObject.GetComponent <UiAnimation>().m_ID = 0; }
public void StopAKReadyToUseAnim() { if (this.m_akReadyToConsumeEffectHandle != null) { UiAnimation anim = this.m_akReadyToConsumeEffectHandle.GetAnim(); if (anim != null) { anim.Stop(0f); } this.m_akReadyToConsumeEffectHandle = null; } }
public UiAnimMgr.UiAnimHandle PlayAnim(string animName, Transform parent, Vector3 localPos, float localScale, float fadeTime = 0f) { GameObject gameObject = this.CreateAnimObj(animName, false); if (gameObject == null) { return(null); } gameObject.transform.SetParent(parent, false); gameObject.transform.localPosition = localPos; gameObject.transform.localScale = new Vector3(localScale, localScale, localScale); UiAnimation component = gameObject.GetComponent <UiAnimation>(); component.Play(fadeTime); return(new UiAnimMgr.UiAnimHandle(component)); }
private void StopGlowEffect() { if (this.m_glowSpinHandle != null) { UiAnimation anim = this.m_glowSpinHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } this.m_glowSpinHandle = null; } if (this.m_glowPulseHandle != null) { UiAnimation uiAnimation = this.m_glowPulseHandle.GetAnim(); if (uiAnimation != null) { uiAnimation.Stop(0.5f); } this.m_glowPulseHandle = null; } }
private void StopGlowEffect() { if (this.m_glowSpinHandle != null) { UiAnimation anim = this.m_glowSpinHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } this.m_glowSpinHandle = null; } if (this.m_glowPulseHandle != null) { UiAnimation anim2 = this.m_glowPulseHandle.GetAnim(); if (anim2 != null) { anim2.Stop(0.5f); } this.m_glowPulseHandle = null; } this.m_greenSelectionGlow.gameObject.SetActive(false); }
public void HandleMissionChanged(int newMissionID) { if (this.m_isStackablePreview || this.m_garrMissionID == 0) { return; } if (this.m_selectedEffectAnimHandle != null) { UiAnimation anim = this.m_selectedEffectAnimHandle.GetAnim(); if (anim != null) { anim.Stop(0.5f); } } if (newMissionID == this.m_garrMissionID) { this.m_selectedEffectAnimHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_selectedEffectRoot, Vector3.zero, 2.5f, 0f); } if (this.m_selectionRing != null) { this.m_selectionRing.gameObject.SetActive(newMissionID == this.m_garrMissionID); } }
public void ClearResults() { this.m_enableLootEffect_success = false; this.m_enableLootEffect_fail = false; if (this.m_greenCheck != null) { this.m_greenCheck.gameObject.SetActive(false); } if (this.m_redX != null) { this.m_redX.gameObject.SetActive(false); } if (this.m_effectHandle != null) { UiAnimation anim = this.m_effectHandle.GetAnim(); if (anim != null) { anim.Stop(0f); } } if (this.m_glowEffectHandle != null) { UiAnimation anim2 = this.m_glowEffectHandle.GetAnim(); if (anim2 != null) { anim2.Stop(0f); } } if (this.m_akReadyToConsumeEffectHandle != null) { UiAnimation anim3 = this.m_akReadyToConsumeEffectHandle.GetAnim(); if (anim3 != null) { anim3.Stop(0f); } } }
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 GameObject CreateAnimObj(string animName, bool createForInit = false) { UiAnimMgr.AnimData animData; this.m_animData.TryGetValue(animName, out animData); if (animData == null) { return(null); } GameObject gameObject = null; if (!createForInit && animData.m_availableObjects.Count > 0) { gameObject = animData.m_availableObjects.Pop(); } if (gameObject != null) { if (animData.m_activeObjects.Contains(gameObject)) { Debug.Log("Error! new anim object already in active object list."); } else { animData.m_activeObjects.Add(gameObject); } gameObject.SetActive(true); UiAnimation component = gameObject.GetComponent <UiAnimation>(); component.Reset(); component.m_ID = this.GetNextID(); return(gameObject); } gameObject = new GameObject(); if (createForInit) { animData.m_availableObjects.Push(gameObject); } else if (animData.m_activeObjects.Contains(gameObject)) { Debug.Log("Error! new anim object already in active object list."); } else { animData.m_activeObjects.Add(gameObject); } CanvasGroup canvasGroup = gameObject.AddComponent <CanvasGroup>(); canvasGroup.blocksRaycasts = false; canvasGroup.interactable = false; gameObject.name = animName; UiAnimation uiAnimation = gameObject.AddComponent <UiAnimation>(); uiAnimation.m_ID = this.GetNextID(); uiAnimation.Deserialize(animName); RectTransform rectTransform = gameObject.AddComponent <RectTransform>(); rectTransform.SetSizeWithCurrentAnchors(0, uiAnimation.GetFrameWidth()); rectTransform.SetSizeWithCurrentAnchors(1, uiAnimation.GetFrameHeight()); foreach (UiAnimation.UiTexture uiTexture in uiAnimation.m_textures.Values) { GameObject gameObject2 = new GameObject(); gameObject2.name = uiTexture.m_parentKey + "_Texture"; gameObject2.transform.SetParent(gameObject.transform, false); uiTexture.m_image = gameObject2.AddComponent <Image>(); uiTexture.m_image.sprite = uiTexture.m_sprite; uiTexture.m_image.canvasRenderer.SetAlpha(uiTexture.m_alpha); if (uiTexture.m_alphaMode == "ADD") { uiTexture.m_image.material = new Material(UiAnimMgr.instance.m_additiveMaterial); } else { uiTexture.m_image.material = new Material(UiAnimMgr.instance.m_blendMaterial); } uiTexture.m_image.material.mainTexture = uiTexture.m_sprite.texture; RectTransform component2 = gameObject2.GetComponent <RectTransform>(); if (uiTexture.m_anchor != null && uiTexture.m_anchor.relativePoint != null) { string relativePoint = uiTexture.m_anchor.relativePoint; switch (relativePoint) { case "TOP": component2.anchorMin = new Vector2(0.5f, 1f); component2.anchorMax = component2.anchorMin; break; case "BOTTOM": component2.anchorMin = new Vector2(0.5f, 0f); component2.anchorMax = component2.anchorMin; break; case "LEFT": component2.anchorMin = new Vector2(0f, 0.5f); component2.anchorMax = component2.anchorMin; break; case "RIGHT": component2.anchorMin = new Vector2(1f, 0.5f); component2.anchorMax = component2.anchorMin; break; case "CENTER": component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = component2.anchorMin; break; case "TOPLEFT": component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = component2.anchorMin; break; case "TOPRIGHT": component2.anchorMin = new Vector2(1f, 1f); component2.anchorMax = component2.anchorMin; break; case "BOTTOMLEFT": component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = component2.anchorMin; break; case "BOTTOMRIGHT": component2.anchorMin = new Vector2(1f, 0f); component2.anchorMax = component2.anchorMin; break; } } Vector2 vector = default(Vector2); if (uiTexture.m_anchor != null && uiTexture.m_anchor.point != null) { string point = uiTexture.m_anchor.point; switch (point) { case "TOP": vector.Set(0f, -0.5f * uiTexture.m_image.sprite.rect.height); break; case "BOTTOM": vector.Set(0f, 0.5f * uiTexture.m_image.sprite.rect.height); break; case "LEFT": vector.Set(0.5f * uiTexture.m_image.sprite.rect.width, 0f); break; case "RIGHT": vector.Set(-0.5f * uiTexture.m_image.sprite.rect.width, 0f); break; case "TOPLEFT": vector.Set(0.5f * uiTexture.m_image.sprite.rect.width, -0.5f * uiTexture.m_image.sprite.rect.height); break; case "TOPRIGHT": vector.Set(-0.5f * uiTexture.m_image.sprite.rect.width, -0.5f * uiTexture.m_image.sprite.rect.height); break; case "BOTTOMLEFT": vector.Set(0.5f * uiTexture.m_image.sprite.rect.width, 0.5f * uiTexture.m_image.sprite.rect.height); break; case "BOTTOMRIGHT": vector.Set(-0.5f * uiTexture.m_image.sprite.rect.width, 0.5f * uiTexture.m_image.sprite.rect.height); break; } } component2.anchoredPosition = new Vector2(vector.x + uiTexture.m_anchor.x, vector.y + uiTexture.m_anchor.y); int num2 = 0; int num3 = 0; int.TryParse(uiTexture.m_width, out num2); int.TryParse(uiTexture.m_height, out num3); component2.SetSizeWithCurrentAnchors(0, (num2 <= 0) ? uiTexture.m_image.sprite.rect.width : ((float)num2)); component2.SetSizeWithCurrentAnchors(1, (num3 <= 0) ? uiTexture.m_image.sprite.rect.height : ((float)num3)); } foreach (UiAnimation.UiTexture uiTexture2 in uiAnimation.m_textures.Values) { RectTransform rectTransform2 = uiTexture2.m_image.rectTransform; uiTexture2.m_localPosition = rectTransform2.localPosition; } return(gameObject); }
public UiAnimHandle(UiAnimation anim) { this.m_anim = anim; this.m_ID = anim.m_ID; }
private GameObject CreateAnimObj(string animName, bool createForInit = false) { UiAnimMgr.AnimData animDatum; Dictionary <string, int> strs; int num; this.m_animData.TryGetValue(animName, out animDatum); if (animDatum == null) { return(null); } GameObject gameObject = null; if (!createForInit && animDatum.m_availableObjects.Count > 0) { gameObject = animDatum.m_availableObjects.Pop(); } if (gameObject != null) { if (!animDatum.m_activeObjects.Contains(gameObject)) { animDatum.m_activeObjects.Add(gameObject); } else { Debug.Log("Error! new anim object already in active object list."); } gameObject.SetActive(true); UiAnimation component = gameObject.GetComponent <UiAnimation>(); component.Reset(); component.m_ID = this.GetNextID(); return(gameObject); } gameObject = new GameObject(); if (createForInit) { animDatum.m_availableObjects.Push(gameObject); } else if (!animDatum.m_activeObjects.Contains(gameObject)) { animDatum.m_activeObjects.Add(gameObject); } else { Debug.Log("Error! new anim object already in active object list."); } CanvasGroup canvasGroup = gameObject.AddComponent <CanvasGroup>(); canvasGroup.blocksRaycasts = false; canvasGroup.interactable = false; gameObject.name = animName; UiAnimation nextID = gameObject.AddComponent <UiAnimation>(); nextID.m_ID = this.GetNextID(); nextID.Deserialize(animName); RectTransform rectTransform = gameObject.AddComponent <RectTransform>(); rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, nextID.GetFrameWidth()); rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, nextID.GetFrameHeight()); foreach (UiAnimation.UiTexture value in nextID.m_textures.Values) { GameObject gameObject1 = new GameObject() { name = string.Concat(value.m_parentKey, "_Texture") }; gameObject1.transform.SetParent(gameObject.transform, false); value.m_image = gameObject1.AddComponent <Image>(); value.m_image.sprite = value.m_sprite; value.m_image.canvasRenderer.SetAlpha(value.m_alpha); if (value.m_alphaMode != "ADD") { value.m_image.material = new Material(UiAnimMgr.instance.m_blendMaterial); } else { value.m_image.material = new Material(UiAnimMgr.instance.m_additiveMaterial); } value.m_image.material.mainTexture = value.m_sprite.texture; RectTransform vector2 = gameObject1.GetComponent <RectTransform>(); if (value.m_anchor != null && value.m_anchor.relativePoint != null) { string mAnchor = value.m_anchor.relativePoint; if (mAnchor != null) { if (UiAnimMgr.< > f__switch$map9 == null) { strs = new Dictionary <string, int>(9) { { "TOP", 0 }, { "BOTTOM", 1 }, { "LEFT", 2 }, { "RIGHT", 3 }, { "CENTER", 4 }, { "TOPLEFT", 5 }, { "TOPRIGHT", 6 }, { "BOTTOMLEFT", 7 }, { "BOTTOMRIGHT", 8 } }; UiAnimMgr.< > f__switch$map9 = strs; } if (UiAnimMgr.< > f__switch$map9.TryGetValue(mAnchor, out num)) { switch (num) { case 0: { vector2.anchorMin = new Vector2(0.5f, 1f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 1: { vector2.anchorMin = new Vector2(0.5f, 0f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 2: { vector2.anchorMin = new Vector2(0f, 0.5f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 3: { vector2.anchorMin = new Vector2(1f, 0.5f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 4: { vector2.anchorMin = new Vector2(0.5f, 0.5f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 5: { vector2.anchorMin = new Vector2(0f, 1f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 6: { vector2.anchorMin = new Vector2(1f, 1f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 7: { vector2.anchorMin = new Vector2(0f, 0f); vector2.anchorMax = vector2.anchorMin; goto Label0; } case 8: { vector2.anchorMin = new Vector2(1f, 0f); vector2.anchorMax = vector2.anchorMin; goto Label0; } } } } } Label0: Vector2 vector21 = new Vector2(); if (value.m_anchor != null && value.m_anchor.point != null) { string str = value.m_anchor.point; if (str != null) { if (UiAnimMgr.< > f__switch$mapA == null) { strs = new Dictionary <string, int>(9) { { "TOP", 0 }, { "BOTTOM", 1 }, { "LEFT", 2 }, { "RIGHT", 3 }, { "CENTER", 4 }, { "TOPLEFT", 5 }, { "TOPRIGHT", 6 }, { "BOTTOMLEFT", 7 }, { "BOTTOMRIGHT", 8 } }; UiAnimMgr.< > f__switch$mapA = strs; } if (UiAnimMgr.< > f__switch$mapA.TryGetValue(str, out num)) { switch (num) { case 0: { Rect mImage = value.m_image.sprite.rect; vector21.Set(0f, -0.5f * mImage.height); goto Label1; } case 1: { Rect rect = value.m_image.sprite.rect; vector21.Set(0f, 0.5f * rect.height); goto Label1; } case 2: { Rect mImage1 = value.m_image.sprite.rect; vector21.Set(0.5f * mImage1.width, 0f); goto Label1; } case 3: { Rect rect1 = value.m_image.sprite.rect; vector21.Set(-0.5f * rect1.width, 0f); goto Label1; } case 4: { goto Label1; } case 5: { float single = 0.5f * value.m_image.sprite.rect.width; Rect mImage2 = value.m_image.sprite.rect; vector21.Set(single, -0.5f * mImage2.height); goto Label1; } case 6: { float single1 = -0.5f * value.m_image.sprite.rect.width; Rect rect2 = value.m_image.sprite.rect; vector21.Set(single1, -0.5f * rect2.height); goto Label1; } case 7: { float single2 = 0.5f * value.m_image.sprite.rect.width; Rect mImage3 = value.m_image.sprite.rect; vector21.Set(single2, 0.5f * mImage3.height); goto Label1; } case 8: { float single3 = -0.5f * value.m_image.sprite.rect.width; Rect rect3 = value.m_image.sprite.rect; vector21.Set(single3, 0.5f * rect3.height); goto Label1; } } } } } Label1: vector2.anchoredPosition = new Vector2(vector21.x + value.m_anchor.x, vector21.y + value.m_anchor.y); int num1 = 0; int num2 = 0; int.TryParse(value.m_width, out num1); int.TryParse(value.m_height, out num2); vector2.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, (num1 <= 0 ? value.m_image.sprite.rect.width : (float)num1)); vector2.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (num2 <= 0 ? value.m_image.sprite.rect.height : (float)num2)); } foreach (UiAnimation.UiTexture uiTexture in nextID.m_textures.Values) { uiTexture.m_localPosition = uiTexture.m_image.rectTransform.localPosition; } return(gameObject); }