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; }
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); } } }
public void Hide() { if (State == UIFormState.Hide) { return; } state = UIFormState.Hide; OnHide(); gameObject.SetActive(false); }
public void Show() { if (State == UIFormState.Show) { return; } state = UIFormState.Show; gameObject.SetActive(true); OnShow(); }
/// <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) => { }); } }