123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public abstract class WfScreenManager : MonoBehaviour
- {
- public virtual void Start()
- {
- this.SettingChildrenList(this.children_dic_);
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- }
- public virtual void Update()
- {
- if (!this.init_)
- {
- bool flag = true;
- foreach (KeyValuePair<string, WfScreenChildren> keyValuePair in this.children_dic_)
- {
- if (!keyValuePair.Value.init_finishied)
- {
- flag = false;
- break;
- }
- }
- if (flag)
- {
- this.init_ = true;
- if (!string.IsNullOrEmpty(this.next_screen_))
- {
- string screen_name = this.next_screen_;
- this.next_screen_ = string.Empty;
- this.RunScreen(screen_name);
- }
- }
- }
- else if (!string.IsNullOrEmpty(this.next_screen_) && this.cur_call_screen_mgr.fade_status == WfScreenChildren.FadeStatus.FadeEnd)
- {
- this.cur_call_screen_mgr.Reset();
- string screen_name2 = this.next_screen_;
- this.next_screen_ = string.Empty;
- this.RunScreen(screen_name2);
- }
- }
- public virtual void CallScreen(string call_screen_name)
- {
- if (this.cur_call_screen_mgr == null)
- {
- this.next_screen_ = string.Empty;
- if (this.init_)
- {
- this.RunScreen(call_screen_name);
- }
- else
- {
- this.next_screen_ = call_screen_name;
- }
- }
- else if (this.cur_call_screen_mgr.fade_status == WfScreenChildren.FadeStatus.FadeEnd || this.cur_call_screen_mgr.fade_status == WfScreenChildren.FadeStatus.Null)
- {
- this.next_screen_ = call_screen_name;
- }
- else if (this.cur_call_screen_mgr.Finish())
- {
- this.next_screen_ = call_screen_name;
- }
- }
- private void RunScreen(string screen_name)
- {
- this.OnPrevRunScreen(screen_name);
- foreach (KeyValuePair<string, WfScreenChildren> keyValuePair in this.children_dic_)
- {
- keyValuePair.Value.root_obj.SetActive(false);
- }
- if (this.children_dic_[screen_name].Call())
- {
- this.call_screen_ = screen_name;
- }
- }
- protected virtual void OnPrevRunScreen(string screen_name)
- {
- }
- protected abstract void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic);
- public string cur_call_screen_name
- {
- get
- {
- return this.call_screen_;
- }
- }
- public WfScreenChildren cur_call_screen_mgr
- {
- get
- {
- if (this.call_screen_ == string.Empty)
- {
- return null;
- }
- return this.children_dic_[this.call_screen_];
- }
- }
- public Dictionary<string, WfScreenChildren> children_dic
- {
- get
- {
- return this.children_dic_;
- }
- }
- private Dictionary<string, WfScreenChildren> children_dic_ = new Dictionary<string, WfScreenChildren>();
- private bool init_;
- private string call_screen_ = string.Empty;
- private string next_screen_ = string.Empty;
- }
|