Example #1
0
    public void ShowDialog(UIName dialogName, UIShowType showType = UIShowType.Normal)
    {
        AssignLayer(showType);
        GameObject dialogObject = null;

        if (m_rgCacheUIController != null)
        {
            if (m_rgCacheUIController.ContainsKey(dialogName))
            {
                dialogObject = m_rgCacheUIController[dialogName].gameObject;
            }
        }
        if (dialogObject == null)
        {
            string uiprefabpath = UIRegister.GetUIPath(dialogName);
            if (!string.IsNullOrEmpty(uiprefabpath))
            {
                GameObject uiprefab = Resources.Load <GameObject>(uiprefabpath);
                dialogObject = GameObject.Instantiate(uiprefab, Vector3.zero, Quaternion.identity, m_UILayers[m_iCurUILayer]);
                dialogObject.SetActive(false);
            }
        }
        UIController tmp = dialogObject.GetComponent <UIController>();

        if (tmp == null)
        {
            Debug.Log("UI Root Node Can Not Find UIController! UIName:  " + dialogName);
            return;
        }
        if (!m_rgCacheUIController.ContainsKey(dialogName))
        {
            m_rgCacheUIController.Add(dialogName, tmp);
        }
        OnShowDialog(tmp, showType);
    }
Example #2
0
 private void AssignLayer(UIShowType showType)
 {
     if (m_curUIController == null)
     {
         m_iCurUILayer = 0;
         return;
     }
     if (m_curUIController != null)
     {
         m_iCurUILayer = m_curUIController.m_iLayer;
     }
     else
     {
         m_iCurUILayer = 0;
     }
     switch (showType)
     {
     case UIShowType.Add:
         int count = GetCapacity(m_iCurUILayer);
         if (count > m_iLayerCapacity)
         {
             m_iCurUILayer = Mathf.Min(m_iCurUILayer + 1, m_UILayers.Length);
         }
         break;
     }
 }
Example #3
0
 private void OnShowDialog(UIController showUIController, UIShowType showtype)
 {
     switch (showtype)
     {
     case UIShowType.Normal:
         if (m_curUIController != null)
         {
             m_curUIController.UnRegisterEvent();
             m_curUIController.OnLeaveUI();
             m_curUIController.m_iLayer         = -1;
             m_curUIController.transform.parent = m_cacheLayer;
             m_curUIController.gameObject.SetActive(false);
             m_rgDialogStack.Pop();
         }
         break;
     }
     m_curUIController          = showUIController;
     m_curUIController.m_iLayer = m_iCurUILayer;
     m_curUIController.RegisterEvent();
     m_curUIController.OnEnterUI();
     m_curUIController.gameObject.SetActive(true);
     m_rgDialogStack.Push(showUIController);
 }
 public UIDragIntAttribute(int step, int min = int.MinValue, int max = int.MaxValue, UIShowType type = UIShowType.Global, string name = null) : base(type, name)
 {
     this.Min  = min;
     this.Max  = max;
     this.Step = step;
 }
Example #5
0
 public UIShowAttribute(UIShowType type = UIShowType.Global, string name = null)
 {
     this.Name = name;
     this.Type = type;
 }
Example #6
0
 public UIColorAttribute(UIShowType type = UIShowType.Global, string name = null) : base(type, name)
 {
 }
 public UISliderAttribute(float min, float max, UIShowType type = UIShowType.Global, string name = null) : base(type, name)
 {
     this.Min = min;
     this.Max = max;
 }
 public UIDragFloatAttribute(float step, float min = float.MinValue, float max = float.MaxValue, UIShowType type = UIShowType.Global, string name = null) : base(type, name)
 {
     this.Min  = min;
     this.Max  = max;
     this.Step = step;
 }