//入栈+显示 public void PushPanel(UIBaseType type, RuneEntity runeEntity = null) { if (panelStack == null) { panelStack = new Stack <BasePanel>(); } if (panelStack.Count > 0) { BasePanel top = panelStack.Peek(); top.OnPause(); } BasePanel panel = GetPanel(type); if (!panel) { Debug.Log("SSS"); } if (type == UIBaseType.ExchangePanel) { ExchangePanel temp = (ExchangePanel)panel; temp.PickedRune = runeEntity.rune; } if (type == UIBaseType.IntroducePanel) { IntroducePanel temp = (IntroducePanel)panel; temp.IntroducedRune = runeEntity.rune; } panel.OnEnter(); panelStack.Push(panel); }
public static void Recycle(GameObject obj, UIBaseType baseType = UIBaseType.Page) { string name = obj.name; RectTransform parent = baseType == UIBaseType.Page ? PageBuffer : WindowBuffer; obj.transform.SetParent(parent); pool[name] = obj; }
public BasePanel GetPanel(UIBaseType type) { if (Panels == null) { Panels = new Dictionary <UIBaseType, BasePanel>(); } BasePanel panel; Panels.TryGetValue(type, out panel); if (panel == null) { string path; panelPathPairs.TryGetValue(type, out path); GameObject temp = (GameObject)GameObject.Instantiate(Resources.Load(path)); temp.transform.SetParent(CanvasTransform, false); panel = temp.GetComponent <BasePanel>(); Panels.Add(type, panel); } return(panel); }
public void OnAfterDeserialize() { UIBaseType temp = (UIBaseType)System.Enum.Parse(typeof(UIBaseType), panelType); PanelType = temp; }