using System; using System.Collections; using System.Collections.Generic; using I2.Loc; using UnityEngine; public class TrophyAchieveEffect : MonoBehaviour { public void Awake() { this.main_panel_ = base.gameObject.GetComponent(); this.title_label_ = UTY.GetChildObject(base.gameObject, "TitleLabel", false).GetComponent(); this.item_label_ = UTY.GetChildObject(base.gameObject, "LineupItemLabel", false).GetComponent(); this.item_fix_label_obj_ = UTY.GetChildObject(base.gameObject, "ItemFixText", false); this.trophy_image_ = UTY.GetChildObject(base.gameObject, "TrophyImage/Image", false).GetComponent(); this.main_panel_.alpha = 0f; this.init_local_pos_ = base.transform.localPosition; } public void EffectStart(Trophy.Data trophy_data) { if (trophy_data == null) { return; } this.trophy_data_list_.Add(trophy_data); } public void EffectStackClear() { this.Clear(); this.trophy_data_list_.Clear(); } public void Clear() { if (this.state_ == TrophyAchieveEffect.State.InMove || this.state_ == TrophyAchieveEffect.State.OutMove) { iTween.Stop(base.gameObject); } this.state_ = TrophyAchieveEffect.State.Null; this.main_panel_.alpha = 0f; base.transform.localPosition = this.init_local_pos_; } public void Update() { if (0 < this.trophy_data_list_.Count && this.state_ == TrophyAchieveEffect.State.Null && GameMain.Instance.MainCamera.IsFadeStateNon()) { Trophy.Data trophy_data = this.trophy_data_list_[0]; this.trophy_data_list_.RemoveAt(0); this.Clear(); this.WriteUITrophyData(trophy_data); this.state_ = TrophyAchieveEffect.State.InMove; GameMain.Instance.SoundMgr.PlaySystem("SE015.ogg"); iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", iTween.EaseType.easeOutCubic, "from", 0, "to", 1, "time", this.MoveSpeedTime, "onupdate", "UpdateFadeIn", "oncomplete", "OnEndFadeIn" })); return; } if (this.state_ == TrophyAchieveEffect.State.Wait && this.fade_out_tick_count_ <= GameMain.tick_count) { this.state_ = TrophyAchieveEffect.State.OutMove; iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "easetype", iTween.EaseType.easeOutCubic, "from", 1, "to", 0, "time", this.MoveSpeedTime, "onupdate", "UpdateFadeOut", "oncomplete", "OnEndFadeOut" })); } } private void UpdateFadeIn(float value) { if (this.state_ != TrophyAchieveEffect.State.InMove) { return; } this.main_panel_.alpha = value; base.transform.localPosition = new Vector3(this.init_local_pos_.x + (float)this.MoveXPos * value, this.init_local_pos_.y, this.init_local_pos_.z); } private void OnEndFadeIn() { if (this.state_ != TrophyAchieveEffect.State.InMove) { return; } base.StartCoroutine(this.CoLoadWaitMove()); } private IEnumerator CoLoadWaitMove() { while (GameMain.Instance.MainCamera.IsFadeProc()) { yield return null; } if (this.state_ == TrophyAchieveEffect.State.InMove) { this.fade_out_tick_count_ = GameMain.tick_count + this.WaitTime; this.state_ = TrophyAchieveEffect.State.Wait; } yield break; } private void UpdateFadeOut(float value) { if (this.state_ != TrophyAchieveEffect.State.OutMove) { return; } this.main_panel_.alpha = value; } private void OnEndFadeOut() { if (this.state_ != TrophyAchieveEffect.State.OutMove) { return; } this.state_ = TrophyAchieveEffect.State.Null; this.Clear(); } private void WriteUITrophyData(Trophy.Data trophy_data) { this.trophy_image_.spriteName = trophy_data.trophySpriteName; this.title_label_.text = "『" + trophy_data.name + "』"; if (Product.SPP) { Localize component = this.title_label_.GetComponent(); if (component != null) { component.TermPrefix = "『"; component.TermSuffix = "』"; component.SetTerm(trophy_data.nameTerm); } } if (!string.IsNullOrEmpty(trophy_data.effectDrawItemName) && GameMain.Instance.CharacterMgr.status.isAvailableShop) { this.item_label_.text = "『" + trophy_data.effectDrawItemName + "』"; this.item_fix_label_obj_.SetActive(true); } else { this.item_label_.text = string.Empty; this.item_fix_label_obj_.SetActive(false); } } public float MoveSpeedTime; public int MoveXPos = 1000; public int WaitTime = 2500; private TrophyAchieveEffect.State state_; private UISprite trophy_image_; private UIPanel main_panel_; private UILabel title_label_; private UILabel item_label_; private GameObject item_fix_label_obj_; private Vector3 init_local_pos_; private int fade_out_tick_count_; private List trophy_data_list_ = new List(); private enum State { Null, InMove, Wait, OutMove } }