//[nc]表示不关闭任何窗口,[pool]使用池存储界面,[back]界面关闭时回退,[reset]重刷界面 public BasePlane ShowWindos(string name, params object[] arg) { List <string> keys = FUniversalFunction.GetChunk(name, "[", "]"); name = keys[0]; WinShowType type = WinShowType.WT_Normal; if (keys.Contains("nc")) { type |= WinShowType.WT_NoClose; } if (keys.Contains("pool")) { type |= WinShowType.WT_Pool; } if (keys.Contains("back")) { type |= WinShowType.WT_Back; } if (keys.Contains("reset")) { type |= WinShowType.WT_Reset; } return(ShowWindos(name, type, arg)); }
public BasePlane ShowWindos(string name, WinShowType type = WinShowType.WT_Normal, params object[] arg) { var bp = FEngineManager.ShowWindos(name, type, arg); EventListenManager.Send(ShowWindowEvent); //HandWindos(bp); /* * if (bp != null) * { * bp.transform.localEulerAngles = new Vector3(0, 180, 0); * var texts = bp.GetComponentsInChildren<Text>(true); * for (int i = 0; i < texts.Length; i++) * { * texts[i].MirrorText(); * } * } */ return(bp); }
public static bool IsHaveSameWinType(WinShowType main, WinShowType use) { return(((int)(main & use)) != 0); }
internal static void _CloseWindos(string name = "", string curOpenName = "", WinShowType type = WinShowType.WT_Normal) { if (name == "" && curOpenName == "") { ClearBackWindos(); } bool isFirst = true; for (int i = mActivePlane.Count - 1; i >= 0; i--) { if (name == "" || mActivePlane[i].HandleID == name) { BasePlane up = mActivePlane[i]; if (GetAutoIsByClose(up.nUiType) || name != "") { //卸载代码 if (IsHaveSameWinType(type, WinShowType.WT_Back)) { WindosUIData w = new WindosUIData(); w.keyWindosName = curOpenName; w.windosName = up.PoolName; w.showType = up.mWinShowType; w.arg = up.mArgs; if (isFirst) { mBackWindos.Add(w); isFirst = false; } else { if (mBackWindos.Count > 0) { WindosUIData widn = mBackWindos[mBackWindos.Count - 1]; widn.nextUIData.Add(w); } } } mActivePlane.RemoveAt(i); up.SetDelayEvent(() => { if (IsHaveSameWinType(type, WinShowType.WT_Pool)) { PushUIPool(up); } else { up.CloseClear(); FEngineManager.DeletObject(up); } if (IsHaveSameWinType(type, WinShowType.WT_Reset)) { if (mActivePlane.Count > 0) { BasePlane rplane = null; for (int p = mActivePlane.Count - 1; p >= 0; p--) { var plane = mActivePlane[p]; if (plane.nUiType == UIWIND_TYPE.UI_NORMAL) { rplane = plane; break; } } if (rplane != null) { _CloseWindos(rplane.HandleID); var lastWinShow = rplane.mWinShowType; var newPlane = ShowWindos(rplane.PoolName, WinShowType.WT_NoClose, rplane.mArgs); if (newPlane != null) { newPlane.mWinShowType = lastWinShow; } } } } }, name != ""); } } } }
public static BasePlane ShowWindos(string name, WinShowType type = WinShowType.WT_Normal, params object[] arg) { if (string.IsNullOrEmpty(name) || name == "null") { return(null); } mOpenTimes++; BasePlane up = GetActiveWindos(name); BasePlane.OpenType ot = BasePlane.OpenType.OT_Normal; if (up != null) { if (up.RefreshType == UIRefresh_Type.None) { return(up); } else if (up.RefreshType == UIRefresh_Type.Refresh) { ot = BasePlane.OpenType.OT_Active; } else if (up.RefreshType == UIRefresh_Type.Reset) { up.CloseMySelf(); return(ShowWindos(name, type, arg)); } } else { //先用池加载 up = CreatePoolUI(name); if (up == null) { GameObject go = PoolObject(name, null).gameObject; up = go.GetComponent <BasePlane>(); if (up == null) { up = go.AddComponent <BasePlane>(); Debug.LogError(name + "界面没有继承BasePlane"); } FCMainCanvas.instance.SetLayer(up.LayerType, go); up.IsPool = up.UsePool; ot = BasePlane.OpenType.OT_Normal; } else { ot = BasePlane.OpenType.OT_BackPool; } up.SetHandle(name, mOpenTimes); if (GetIsCloseOther(up.nUiType) && !IsHaveSameWinType(type, WinShowType.WT_NoClose)) { _CloseWindos("", up.HandleID, type); } mActivePlane.Add(up); } if (up == null) { Debug.LogError("未找到窗口: " + name); return(null); } up.mWinShowType = type; if (ShowWindosCall != null) { ShowWindosCall(up); } up.openInit(ot, arg); return(up.mIsClose ? null : up); }