123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- 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<UIPanel>();
- this.title_label_ = UTY.GetChildObject(base.gameObject, "TitleLabel", false).GetComponent<UILabel>();
- this.item_label_ = UTY.GetChildObject(base.gameObject, "LineupItemLabel", false).GetComponent<UILabel>();
- this.item_fix_label_obj_ = UTY.GetChildObject(base.gameObject, "ItemFixText", false);
- this.trophy_image_ = UTY.GetChildObject(base.gameObject, "TrophyImage/Image", false).GetComponent<UISprite>();
- 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<Localize>();
- 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> trophy_data_list_ = new List<Trophy.Data>();
- private enum State
- {
- Null,
- InMove,
- Wait,
- OutMove
- }
- }
|