using System.Collections; using System.Collections.Generic; using UnityEngine; namespace LoyalSoftSDK { public enum UIType { Normal, Float, Loading } public class BaseUIForm : MonoBehaviour { //从哪个窗口打开的,无操作返回时使用打开上一级的 private BaseUIForm parent; public UIType curUIType; // Use this for initialization public virtual void Hiding() { this.gameObject.SetActive(false); } public virtual void Display(BaseUIForm _parent,Dictionary data) { if (this.gameObject.transform.parent.transform.parent && !this.gameObject.transform.parent.transform.parent.gameObject.activeInHierarchy) { this.gameObject.transform.parent.transform.parent.gameObject.SetActive(true); } // Debug.Log(this.gameObject.transform.parent + " zhege "+this.gameObject.transform.parent.gameObject.activeInHierarchy); // Debug.Log(this.gameObject.transform.parent.transform.parent + " zhege " + this.gameObject.transform.parent.transform.parent.gameObject.activeInHierarchy); parent = _parent; this.gameObject.SetActive(true); } public virtual void ReDisplay() { this.gameObject.SetActive(true); } public virtual void GoBackParent() { this.Hiding(); if(parent!=null) { parent.ReDisplay(); } } public virtual void Init() { } public virtual bool OnEscape() { if(curUIType==UIType.Normal) { if(this.gameObject.activeSelf) { GoBackParent(); return true; } } return false; } } }