Beispiel #1
0
 private void SortUILayer(GameObject aLayerNode)
 {
     TUIBasePage[] pages = aLayerNode.GetComponentsInChildren <TUIBasePage>();
     for (int i = 0; i < pages.Length - 1; i++)
     {
         for (int j = i + 1; j < pages.Length; j++)
         {
             if (pages[i].UIOrder > pages[j].UIOrder)
             {
                 TUIBasePage temp = pages[i];
                 pages[i] = pages[j];
                 pages[j] = temp;
             }
         }
     }
     for (int i = 0; i < pages.Length; i++)
     {
         pages[i].transform.SetSiblingIndex(i);
     }
 }
Beispiel #2
0
    public void OpenUI(string aUIName, params object[] parms)
    {
        if (this.mUIDic.ContainsKey(aUIName) == false)
        {
            Debug.LogError("UI is not existed!");
            return;
        }
        GameObject  prefab    = this.mUIDic[aUIName];
        GameObject  UIObj     = GameObject.Instantiate(prefab);
        TUIBasePage uiPage    = UIObj.GetComponent <TUIBasePage>();
        EUILayer    layerType = uiPage.UILayer;

        switch (layerType)
        {
        case EUILayer.GLOBLE:
            UIObj.transform.SetParent(TUIRoot.GetSingleton().GlobalUIRoot.transform, false);
            this.SortUILayer(TUIRoot.GetSingleton().GlobalUIRoot);
            break;

        case EUILayer.NORMAL:
            UIObj.transform.SetParent(TUIRoot.GetSingleton().NormalUIRoot.transform, false);
            this.SortUILayer(TUIRoot.GetSingleton().NormalUIRoot);
            break;

        case EUILayer.POPUP:
            UIObj.transform.SetParent(TUIRoot.GetSingleton().PopUIRoot.transform, false);
            this.SortUILayer(TUIRoot.GetSingleton().PopUIRoot);
            break;

        default:
            return;
        }
        uiPage.UIName = aUIName;
        uiPage.OnInitialize(parms);
        uiPage.OnShow();
        this.mReadyToAddList.Add(uiPage);
    }
Beispiel #3
0
 public void CloseUI(TUIBasePage aUIObj)
 {
     this.mReadyToDelList.Add(aUIObj);
 }