using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Wizard; public class NotificatonAnimation : MonoBehaviour { public class Param { public enum Type { Result, MaintenanceOnHome, MaintenanceOnResult, GatheringMatching, GachaResult, TemporaryDeckResult, MissionCleared } public readonly Type _type; public readonly string _text; public Param(Type type, string text) { _type = type; _text = text; } } [SerializeField] private GameObject _root; [SerializeField] private UILabel[] _labels; private Vector3 _rootInitialPos; private Vector3 _labelInitialPos; private const float ROOT_MOVE_DIST = 100f; private const float ROOT_MOVE_TIME = 1f; private const float BREAK_TIME_1 = 0.5f; private const float LABEL_MOVE_DIST = 2000f; private const float LABEL_MOVE_TIME = 0.5f; private const float BREAK_TIME_2 = 0.3f; private const float LABEL_WAIT_TIME_RESULT = 1.4f; private const float LABEL_WAIT_TIME_MAINTENANCE_ON_HOME = 4f; private const float LABEL_WAIT_TIME_MAINTENANCE_ON_RESULT = 4f; private const float LABEL_WAIT_TIME_GATHERING_MATCHING = 2f; private const float LABEL_WAIT_TIME_GACHA_RESULT = 1.4f; private const float LABEL_WAIT_TIME_TEMPORARY_DECK_RESULT = 1.4f; private const float LABEL_WAIT_TIME_MISSION_CLEARED = 1.4f; private void Awake() { _rootInitialPos = _root.transform.localPosition; _labelInitialPos = _labels[0].transform.localPosition; _root.SetActive(value: false); } public IEnumerator Exec(List paramList) { if (paramList.Count <= 0) { yield break; } _root.SetActive(value: true); _root.transform.localPosition = _rootInitialPos + Vector3.up * 100f; for (int i = 0; i < _labels.Length; i++) { _labels[i].transform.localPosition = _labelInitialPos + Vector3.right * 2000f; } iTween.MoveTo(_root, iTween.Hash("position", _rootInitialPos, "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); yield return new WaitForSeconds(0.5f); int labelIndex = 0; int i2 = 0; while (i2 < paramList.Count) { Param param = paramList[i2]; UILabel usingLabel = _labels[labelIndex]; usingLabel.text = param._text; usingLabel.transform.localPosition = _labelInitialPos + Vector3.right * 2000f; iTween.MoveTo(usingLabel.gameObject, iTween.Hash("position", _labelInitialPos, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); float seconds = 0f; switch (param._type) { case Param.Type.Result: seconds = 1.4f; break; case Param.Type.MaintenanceOnHome: seconds = 4f; break; case Param.Type.MaintenanceOnResult: seconds = 4f; break; case Param.Type.GatheringMatching: seconds = 2f; break; case Param.Type.GachaResult: seconds = 1.4f; break; case Param.Type.TemporaryDeckResult: seconds = 1.4f; break; case Param.Type.MissionCleared: seconds = 1.4f; break; } yield return new WaitForSeconds(seconds); iTween.MoveTo(usingLabel.gameObject, iTween.Hash("position", _labelInitialPos + Vector3.left * 2000f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); yield return new WaitForSeconds(0.3f); int num = labelIndex + 1; labelIndex = num % _labels.Length; num = i2 + 1; i2 = num; } iTween.MoveTo(_root, iTween.Hash("position", _rootInitialPos + Vector3.up * 100f, "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); yield return new WaitForSeconds(1f); } }