Пример #1
0
        public void HandWindowEx(BasePlane bp)
        {
            RectTransform rectTransform = (bp.transform as RectTransform);

            rectTransform.offsetMin = new Vector2(0, isExtraHight);
            rectTransform.offsetMax = new Vector2(0, -isExtraHight);
        }
Пример #2
0
 public override void Begin(params object[] obj)
 {
     if (!string.IsNullOrEmpty(mPlaneName))
     {
         mBasePlane = UIManager.instance.ShowWindos(mPlaneName);
     }
 }
Пример #3
0
 public static void CloseWindos(BasePlane p)
 {
     if (p != null)
     {
         _CloseWindos(p.HandleID);
     }
 }
Пример #4
0
 public static void HierarchyEffect(this BasePlane plane)
 {
     if (plane != null)
     {
         var canv = SceneManager.instance.AddComponent <Canvas>(plane.gameObject);
         canv.overrideSorting = true;
         canv.sortingOrder    = 1;
         SceneManager.instance.AddComponent <GraphicRaycaster>(plane.gameObject);
     }
 }
Пример #5
0
        public void HandWindos(BasePlane bp)
        {
            if (isExtraHight > 0)
            {
                if (bp != null)
                {
                    if (bp.nUiType == UIWIND_TYPE.UI_NORMAL || bp.nUiType == UIWIND_TYPE.UI_SOLID)
                    {
                        HandWindowEx(bp);
                    }
                    else if (bp.nUiType == UIWIND_TYPE.UI_SOLF)
                    {
                        if (bp.PoolName == ResConfig.FNOVICEPLANE)
                        {
                            HandWindowEx(bp);
                        }
                    }
                }
            }

            if (bp != null)
            {
                if (bp.nUiType == UIWIND_TYPE.UI_TEMP)
                {
                    var t = bp.transform.localPosition;
                    t.z = -15;
                    bp.transform.localPosition = t;
                }
            }

            /*
             * if(FEngine.instance.IsPad)
             * {
             *  if (bp != null)
             *  {
             *      if (bp.Ipad)
             *      {
             *          float s = 1.7778f * Screen.width / Screen.height;
             *          RectTransform rectTransform = (bp.transform as RectTransform);
             *          float w = rectTransform.rect.width * (1.0f/s-1);
             *          float h = rectTransform.rect.height * (1.0f/s-1);
             *          bp.transform.localScale = new Vector3(s, s,1);
             *          rectTransform.sizeDelta = new Vector2(w,h);
             *      }
             *  }
             * }
             */
        }
Пример #6
0
        private static BasePlane CreatePoolUI(string key)
        {
            BasePlane bp = null;

            if (mPoolWindos.TryGetValue(key, out bp))
            {
                if (bp != null)
                {
                    if (bp.PoolName == key)
                    {
                        bp.gameObject.SetActive(true);
                        mPoolWindos.Remove(key);
                        return(bp);
                    }
                }
            }
            return(null);
        }
Пример #7
0
 public static BasePlane ShowWait(int lay, bool mask = true)
 {
     mMaskWait = FUniversalFunction.SetMaskCode(mMaskWait, 1 << lay, mask);
     if (mask)
     {
         if (mMaskWait != 0 && mWaitPlane == null)
         {
             mWaitPlane = FEngineManager.ShowWindos(ResConfig.CC_WAITPLANE);
         }
     }
     else
     {
         if (mMaskWait == 0 && mWaitPlane != null)
         {
             FEngineManager.CloseWindos(mWaitPlane);
         }
     }
     return(mWaitPlane);
 }
Пример #8
0
 public static void ResetWindos(string keyName)
 {
     if (mBackWindos.Count != 0)
     {
         WindosUIData wud = mBackWindos[mBackWindos.Count - 1];
         if (wud.keyWindosName == keyName)
         {
             for (int i = wud.nextUIData.Count - 1; i >= 0; i--)
             {
                 ShowWindos(wud.nextUIData[i].windosName, wud.nextUIData[i].showType, wud.nextUIData[i].arg);
             }
             ShowWindos(wud.windosName, wud.showType, wud.arg);
             mBackWindos.Remove(wud);
         }
         else
         {
             BasePlane bp = GetActiveWindos(keyName);
             if (bp != null && !GetIsCloseOther(bp.nUiType))
             {
                 ClearBackWindos();
             }
         }
     }
 }
Пример #9
0
 public void CloseWindos(BasePlane p)
 {
     FEngineManager.CloseWindos(p);
 }
Пример #10
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 != "");
                    }
                }
            }
        }
Пример #11
0
        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);
        }
Пример #12
0
 private static void PushUIPool(BasePlane ui)
 {
     ui.BackPoolClear();
     ui.gameObject.SetActive(false);
     mPoolWindos[ui.PoolName] = ui;
 }
Пример #13
0
 public static void ChangeHigLay(this BasePlane plane)
 {
     plane.transform.SetParent(MainCanvas.instance.GetLayer(LayerType.LT_Hig));
 }