using System; using System.Collections; using System.Collections.Generic; using I2.Loc; using UnityEngine; using wf; public class YotogiParamScroll : MonoBehaviour { private void Awake() { this.panel_ = UTY.GetChildObject(base.gameObject, "Mask", false).GetComponent(); this.parent_obj_ = UTY.GetChildObject(base.gameObject, "Parent", false); UIGrid component = this.parent_obj_.GetComponent(); if (GameUty.supportMultiLanguage) { component.cellWidth = 150f; Utility.ResetNGUI(component); } Transform transform = this.parent_obj_.transform; this.label_array = new YotogiParamScroll.LabelAndLocalize[transform.childCount]; for (int i = 0; i < this.label_array.Length; i++) { this.label_array[i] = new YotogiParamScroll.LabelAndLocalize(transform.GetChild(i).GetComponent(), transform.GetChild(i).GetComponent()); } this.base_pos = transform.localPosition; this.hide_pos = this.base_pos; this.hide_pos.x = this.hide_pos.x - this.panel_.baseClipRegion.z; this.end_pos = this.base_pos; this.end_pos.y = this.end_pos.y + this.panel_.baseClipRegion.w; transform.localPosition = this.hide_pos; } public void Init() { for (int i = 0; i < this.label_array.Length; i++) { this.label_array[i].label.alpha = 0f; } if (this.state_ == YotogiParamScroll.State.FadeIn || this.state_ == YotogiParamScroll.State.FadeOut) { iTween.Stop(this.parent_obj_); } if (this.state_ == YotogiParamScroll.State.FadeOut) { this.parent_obj_.transform.SetParent(base.transform, false); for (int j = 0; j < this.label_array.Length; j++) { this.label_array[j].label.ParentHasChanged(); } } this.parent_obj_.transform.localPosition = this.hide_pos; } public void CallFadeIn(List> draw_param) { draw_param.RemoveAll((KeyValuePair key_val) => key_val.Value == 0); int num = (this.label_array.Length >= draw_param.Count) ? draw_param.Count : this.label_array.Length; for (int i = 0; i < this.label_array.Length; i++) { this.label_array[i].label.alpha = 0f; } for (int j = 0; j < num; j++) { this.label_array[j].label.alpha = 1f; KeyValuePair keyValuePair = draw_param[j]; YotogiParamScroll.SetLabelText(this.label_array[j], keyValuePair.Key, keyValuePair.Value); } if (this.state_ == YotogiParamScroll.State.FadeIn || this.state_ == YotogiParamScroll.State.FadeOut) { iTween.Stop(this.parent_obj_); } if (this.state_ == YotogiParamScroll.State.FadeOut) { this.parent_obj_.transform.SetParent(base.transform, false); for (int k = 0; k < this.label_array.Length; k++) { this.label_array[k].label.ParentHasChanged(); } } this.parent_obj_.transform.localPosition = this.hide_pos; this.state_ = YotogiParamScroll.State.CallIn; } private void Update() { if (this.state_ == YotogiParamScroll.State.Wait && this.fade_out_tick_count <= GameMain.tick_count) { this.parent_obj_.transform.SetParent(this.panel_.transform, false); for (int i = 0; i < this.label_array.Length; i++) { this.label_array[i].label.ParentHasChanged(); } Hashtable hashtable = TweenHash.EaseOutSine(TweenHash.Type.Position, this.end_pos, this.MoveSpeedTime); hashtable.Add("oncomplete", "OnEndFadeOut"); hashtable.Add("oncompletetarget", base.gameObject); iTween.MoveTo(this.parent_obj_, hashtable); this.state_ = YotogiParamScroll.State.FadeOut; } } private void LateUpdate() { if (this.state_ == YotogiParamScroll.State.CallIn && this.parent_obj_.GetComponent() == null) { Hashtable hashtable = TweenHash.EaseOutSine(TweenHash.Type.Position, this.base_pos, this.MoveSpeedTime); hashtable.Add("oncomplete", "OnEndFadeIn"); hashtable.Add("oncompletetarget", base.gameObject); iTween.MoveTo(this.parent_obj_, hashtable); this.state_ = YotogiParamScroll.State.FadeIn; } } private void OnEndFadeIn() { iTween.Stop(this.parent_obj_); this.fade_out_tick_count = GameMain.tick_count + this.WaitTime; this.state_ = YotogiParamScroll.State.Wait; } private void OnEndFadeOut() { iTween.Stop(this.parent_obj_); this.parent_obj_.transform.SetParent(base.transform, false); for (int i = 0; i < this.label_array.Length; i++) { this.label_array[i].label.ParentHasChanged(); } this.parent_obj_.transform.localPosition = this.hide_pos; this.state_ = YotogiParamScroll.State.Null; } private static void SetLabelText(YotogiParamScroll.LabelAndLocalize labelAndLocalize, string text, int num) { labelAndLocalize.label.text = text; if (labelAndLocalize.localize != null) { labelAndLocalize.localize.SetTerm("MaidStatus/" + text); } UILabel label = labelAndLocalize.label; label.text = label.text + " " + num.ToString(); } public int WaitTime = 2500; public float MoveSpeedTime = 0.7f; private UIPanel panel_; private GameObject parent_obj_; private YotogiParamScroll.LabelAndLocalize[] label_array; private Vector3 base_pos; private Vector3 hide_pos; private Vector3 end_pos; private int fade_out_tick_count; private YotogiParamScroll.State state_; private enum State { Null, CallIn, FadeIn, Wait, FadeOut } private struct LabelAndLocalize { public LabelAndLocalize(UILabel label, Localize localize) { this.label = label; this.localize = localize; } public UILabel label; public Localize localize; } }