Ejemplo n.º 1
0
        private void ChangeUIFormState(string uiFormName, UIFormState state)
        {
            UIConfigData uiInfo = uIConfig.GetDataByKey(uiFormName);

            UIFormShowMode uIFormShowMode = (UIFormShowMode)uiInfo.UIFormShowMode;

            if (uIFormShowMode == UIFormShowMode.HideOther)
            {
                if (state == UIFormState.Open)
                {
                    HideOpenUIForms();
                }
                if (state == UIFormState.Close)
                {
                    DisplayOpenUIForms();
                }
            }
            else if (uIFormShowMode == UIFormShowMode.ReverseChange)
            {
                if (state == UIFormState.Open)
                {
                    PushUIFormToStack(uiFormName);
                }
                if (state == UIFormState.Close)
                {
                    ExitUIFormToStack();
                }
            }

            dicUIFormState[uiFormName] = state;
        }
Ejemplo n.º 2
0
        public void CloseUIForms(params string[] uiFormNames)
        {
            for (int i = 0; i < uiFormNames.Length; i++)
            {
                string uiFormName = uiFormNames[i];

                if (dicOpenUIForms.ContainsKey(uiFormName))
                {
                    if (dicOpenUIForms[uiFormName] != null)
                    {
                        dicOpenUIForms[uiFormName].gameObject.SetActive(false);
                    }
                    dicOpenUIForms.Remove(uiFormName);
                    ChangeUIFormState(uiFormName, UIFormState.Close);
                }
                else
                {
                    string msg = string.Empty;
                    if (!dicUIFormState.ContainsKey(uiFormName))
                    {
                        msg = GetType() + "/CloseUIForms()/ Close ui error! ui is null! uiFormName:" + uiFormName;
                    }
                    else
                    {
                        ChangeUIFormState(uiFormName, UIFormState.Close);
                        UIFormState uIFormState = dicUIFormState[uiFormName];
                        msg = string.Format(GetType() + "/CloseUIForms()/ Close ui error! currentState:{0} uiFormName:{1}", uIFormState, uiFormName);
                    }
                    Debug.LogWarning(msg);
                }
            }
        }
Ejemplo n.º 3
0
 public void Hide()
 {
     if (State == UIFormState.Hide)
     {
         return;
     }
     state = UIFormState.Hide;
     OnHide();
     gameObject.SetActive(false);
 }
Ejemplo n.º 4
0
 public void Show()
 {
     if (State == UIFormState.Show)
     {
         return;
     }
     state = UIFormState.Show;
     gameObject.SetActive(true);
     OnShow();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 这个方法不允许调用,uimodule专用
 /// </summary>
 public void Init(UIFormTableSetting table, object userdata)
 {
     Table = table;
     state = UIFormState.Hide;
     OnInit(userdata);
     isOpen = false;
     if (table.Title != 0)
     {
         UIItemTableSetting uiItem = UIItemTableSettings.Get(2);
         ResourceManager.LoadGameObject(uiItem.Path,
                                        (p, data, go) =>
         {
             go.transform.parent               = transform;
             go.transform.localPosition        = Vector3.zero;
             go.transform.localScale           = Vector3.one;
             go.GetComponent <UIPanel>().depth = StartDepth + 1;
             UIEventListener.Get(go.transform.Find("btnClose").gameObject).onClick = (btn) => { UIModule.Instance.CloseForm(this); };
             go.transform.Find("btnClose").GetComponent <UILabel>().text           = I18N.Get(table.Title);
         },
                                        (p, data) => { });
     }
 }