コード例 #1
0
    public GameObject GetMaskByType(UIWindowType type)
    {
        GameObject mask = null;

        if (type == UIWindowType.ePopup)
        {
            mask = GameObject.Instantiate(popupMask.gameObject);
        }
        else if (type == UIWindowType.ePopup_Black)
        {
            mask = GameObject.Instantiate(blackMask.gameObject);
        }
        else if (type == UIWindowType.ePopup_Blue)
        {
            mask = GameObject.Instantiate(blurMask.gameObject);
            var rawImages = mask.GetComponentsInChildren <RawImage>();

            var rawImage = rawImages[rawImages.Length - 1];

            rawImage.texture = null;

            rawImage.gameObject.SetActive(true);
        }
        if (mask != null)
        {
            mask.SetActive(true);
        }
        return(mask);
    }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: Anzs666/Slime
        //打开窗体
        //从uiWindowDic中查找,若没有则创建缓存
        public UIWindow OpenWindow(UIWindowType windowType)
        {
            if (uiWindowDic == null)
            {
                uiWindowDic = new Dictionary <UIWindowType, UIWindow>();
            }
            UIWindow uIWindow;

            uiWindowDic.TryGetValue(windowType, out uIWindow);
            if (uIWindow == null)
            {
                //初始化窗口
                string path;
                uiWindowPathDic.TryGetValue(windowType, out path);
                GameObject instWindow = GameObject.Instantiate(Resources.Load(path)) as GameObject;
                uIWindow = instWindow.GetComponent <UIWindow>();
                //设置根节点
                UIRoot.SetParent(instWindow.transform, true, uIWindow.currentUIType.UIForm_Type);
                //加入缓存集合
                uiWindowDic.Add(windowType, uIWindow);
                return(uIWindow);
            }
            else
            {
                UIRoot.SetParent(uIWindow.transform, true, uIWindow.currentUIType.UIForm_Type);
                uIWindow.OnEnter();
                return(uIWindow);
            }
        }
コード例 #3
0
        private void SetInstantiatedWindow(UIWindowType windowType, RectTransform window)
        {
            switch (windowType)
            {
            case UIWindowType.LoginMode:
                _loginModeWindow = window;
                break;

            case UIWindowType.Portal:
                _portalWindow = window;
                break;

            case UIWindowType.Room:
                _roomWindow = window;
                break;

            case UIWindowType.Seat:
                _seatWindow = window;
                break;

            case UIWindowType.Game:
                _gameWindow = window;
                break;
            }
        }
コード例 #4
0
    public void OpenView(UIWindowType type)
    {
        switch (type)
        {
        case UIWindowType.Match:
            UIViewUtil.Instance.LoadWindowAsync(UIWindowType.Match, (GameObject go) =>
            {
                m_UIBattleView = go.GetComponent <UIMatchView>();
                m_UIBattleView.OnEnterClick     = OnEnterClick;
                m_UIBattleView.OnSeeDetailClick = OnSeeDetailClick;
                m_UIBattleView.SetCards(AccountProxy.Instance.CurrentAccountEntity.cards);
                AudioBackGroundManager.Instance.Play("bgm_match");
                RequestBattleList(0, 0);
            });
            break;

        case UIWindowType.MatchWait:
            OpenMatchWaitView();
            break;

        case UIWindowType.MatchRankList:
            OpenMatchRankListView();
            break;
        }
    }
コード例 #5
0
        /// <summary>
        /// Calculate right depth with windowType
        /// </summary>
        /// <param name="baseWindow"></param>
        private void AdjustBaseWindowDepth(UIWindowBase baseWindow)
        {
            UIWindowType windowType = baseWindow.windowData.windowType;
            int          needDepth  = 1;

            if (windowType == UIWindowType.NormalLayer)
            {
                needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UINormalLayerRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue);
                Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.Normal] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.ForegroundLayer)
            {
                needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UIForegroundLayerRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue);
                Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.PopUp] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.BackgroundLayer)
            {
                needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UIBackgroundLayerRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue);
                Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.Fixed] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            if (baseWindow.MinDepth != needDepth)
            {
                UGUITools.SetTargetMinPanelDepth(baseWindow.gameObject, needDepth);
            }

            // send window added message to game client
            if (baseWindow.windowData.windowType == UIWindowType.ForegroundLayer)
            {
                // trigger the window PopRoot added window event
                // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventId.PopRootWindowAdded);
                //暂时不需要事件系统
            }
            baseWindow.MinDepth = needDepth;
        }
コード例 #6
0
ファイル: UIRoot.cs プロジェクト: ouyangwenyuan/OhMyFramework
    /// <summary>
    /// Creates the window.
    /// </summary>
    /// <returns>The window.</returns>
    /// <param name="windowName">UI预设名</param>
    /// <param name="type">UI类型</param>
    /// <param name="layer">UI层级</param>
    public UIWindow CreateWindow(string windowName, UIWindowType type, UIWindowLayer layer = UIWindowLayer.Normal)
    {
        GameObject uiPrefab = LoadPrefab(windowName);

        if (uiPrefab == null)
        {
            Debug.LogError($"{GetType()}.CreateWindow, cannot find window resource : {windowName}");
            return(null);
        }

        UIWindow   window = null;
        GameObject obj    = Instantiate(uiPrefab, mRoot.transform, false) as GameObject;

        string[] dirs      = windowName.Split('/');
        string   className = dirs[dirs.Length - 1] + "Controller";

        window = obj.AddComponent(Type.GetType(className)) as UIWindow;
        if (window == null)
        {
            Debug.LogError($"Cant find UIWindow: {className}, check the name or remove any outter namespace.");
            return(null);
        }

        return(window);
    }
コード例 #7
0
        private void AdjustBaseWindowDepth(UIBaseWindow baseWindow)
        {
            UIWindowType windowType = baseWindow.windowData.windowType;
            int          needDepth  = 1;

            if (windowType == UIWindowType.Normal)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UINormalWindowRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue);
                Debug.Log("[UIWindowType.Normal] maxDepth is " + needDepth + baseWindow.GetID);
            }
            else if (windowType == UIWindowType.PopUp)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIPopUpWindowRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue);
                Debug.Log("[UIWindowType.PopUp] maxDepth is " + needDepth);
            }
            else if (windowType == UIWindowType.Fixed)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIFixedWidowRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue);
                Debug.Log("[UIWindowType.Fixed] max depth is " + needDepth);
            }
            if (baseWindow.MinDepth != needDepth)
            {
                GameUtility.SetTargetMinPanel(baseWindow.gameObject, needDepth);
            }
            baseWindow.MinDepth = needDepth;
        }
コード例 #8
0
        /// <summary>
        /// 清除指定root下所有窗口
        /// </summary>
        /// <param name="type"></param>
        public virtual void HideAllWindowByWindowType(UIWindowType type)
        {
            switch (type)
            {
            case UIWindowType.BackgroundLayer:
            {
                for (int i = 0; i < UIBackgroundLayerRoot.transform.childCount; i++)
                {
                    UIWindowBase chidWindow = UIBackgroundLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>();
                    HideWindow(chidWindow.ID);
                }
            }
            break;

            case UIWindowType.ForegroundLayer:
            {
                for (int i = 0; i < UIForegroundLayerRoot.transform.childCount; i++)
                {
                    UIWindowBase chidWindow = UIForegroundLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>();
                    HideWindow(chidWindow.ID);
                }
            }
            break;

            case UIWindowType.NormalLayer:
            {
                for (int i = 0; i < UINormalLayerRoot.transform.childCount; i++)
                {
                    UIWindowBase chidWindow = UINormalLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>();
                    HideWindow(chidWindow.ID);
                }
            }
            break;
            }
        }
コード例 #9
0
        /// <summary>
        /// Calculate right depth with windowType
        /// </summary>
        /// <param name="baseWindow"></param>
        private void AdjustBaseWindowDepth(UIBaseWindow baseWindow)
        {
            UIWindowType windowType = baseWindow.windowData.windowType;
            int          needDepth  = 1;

            if (windowType == UIWindowType.Normal)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UINormalWindowRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.Normal] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.PopUp)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIPopUpWindowRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.PopUp] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.Fixed)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIFixedWidowRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.Fixed] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            if (baseWindow.MinDepth != needDepth)
            {
                GameUtility.SetTargetMinPanelDepth(baseWindow.gameObject, needDepth);
            }

            // send window added message to game client
            if (baseWindow.windowData.windowType == UIWindowType.PopUp)
            {
                // trigger the window PopRoot added window event
                EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventSystemDefine.EventUIFrameWorkPopRootWindowAdded);
            }
            baseWindow.MinDepth = needDepth;
        }
コード例 #10
0
 //OpenViewPaiJiu  以观察者模式提供加载窗口
 private void OpenViewPaiJiu(object[] obj)
 {
     for (int i = 0; i < obj.Length; i++)
     {
         UIWindowType type = (UIWindowType)obj[i];
         OpenView(type);
     }
 }
コード例 #11
0
ファイル: UIWindowInfo.cs プロジェクト: YESshowMeCode/MyGame
    public UIWindowInfo(UIWindowEnum name, UIWindowType type, string path)
    {
        this.windowEnum = name;
        this.windowType = type;
        this.assetPath  = path;

        windowName = assetPath.Substring(path.LastIndexOf('/') + 1);
    }
コード例 #12
0
 public bool isPopup(UIWindowType type)
 {
     if (type != UIWindowType.oNormal)
     {
         return(true);
     }
     return(false);
 }
コード例 #13
0
 /// <summary>
 /// 窗口信息
 /// </summary>
 /// <param name="key">标识</param>
 /// <param name="t">宿主脚本</param>
 /// <param name="resName">资源名称,如果resName为null取key.tostring()</param>
 /// <param name="wType">窗口类型</param>
 /// <param name="wEffect">窗口效果</param>
 public UIWindowInfo(UIType key, System.Type t, string resName = "", UIWindowType wType = UIWindowType.ModelType, UIWindowEffect wEffect = UIWindowEffect.Default)
 {
     Key           = key;
     Owner         = t;
     WinType       = wType;
     WinEffect     = wEffect;
     mResourceName = resName;
 }
コード例 #14
0
 public void WindowHasFocus(UIWindowType type)
 {
     if (!mTaskbarButtons.ContainsKey(type))
     {
         return;
     }
     mWindows[type].transform.SetAsLastSibling();
 }
コード例 #15
0
 public PSI_UIWindow GetWindow(UIWindowType type)
 {
     if (!mWindows.ContainsKey(type))
     {
         return(null);
     }
     return(mWindows[type]);
 }
コード例 #16
0
ファイル: UIWindowType.cs プロジェクト: tsuixl/Frame
 /// <summary>
 /// 窗口信息
 /// </summary>
 /// <param name="key">标识</param>
 /// <param name="t">宿主脚本</param>
 /// <param name="resName">资源名称,如果resName为null取key.tostring()</param>
 /// <param name="wType">窗口类型</param>
 /// <param name="wEffect">窗口效果</param>
 public UIWindowInfo(UIType key, System.Type t, string resName = "", UIWindowType wType = UIWindowType.ModelType, UIWindowEffect wEffect = UIWindowEffect.Default)
 {
     Key = key;
     Owner = t;
     WinType = wType;
     WinEffect = wEffect;
     mResourceName = resName;
 }
コード例 #17
0
 /// <summary>
 /// 异步加载窗口
 /// </summary>
 /// <param name="type">窗口类型</param>
 /// <param name="onComplete">加载完毕回调</param>
 public void LoadWindowAsync(UIWindowType type, Action <GameObject> onComplete)
 {
     if (type == UIWindowType.None)
     {
         return;
     }
     LoadWindowAsync(type.ToString(), onComplete);
 }
コード例 #18
0
 /// <summary>
 /// 同步加载窗口
 /// </summary>
 /// <returns>窗口类型</returns>
 public GameObject LoadWindow(UIWindowType type)
 {
     if (type == UIWindowType.None)
     {
         return(null);
     }
     return(LoadWindow(type.ToString()));
 }
コード例 #19
0
ファイル: RankingCtrl.cs プロジェクト: guochaolinDLKF/LaiJu
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.Ranking:
         OpenRankingView();
         break;
     }
 }
コード例 #20
0
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.Shop:
         OpenShopView();
         break;
     }
 }
コード例 #21
0
 /// <summary>
 /// 关闭并且打开下一个窗口
 /// </summary>
 /// <param name="nextType"></param>
 public virtual void CloseOpenNext(UIWindowType nextType)
 {
     this.Close();
     if (nextType == UIWindowType.None)
     {
         return;
     }
     UIViewUtil.Instance.NextOpenViewName = nextType.ToString();
 }
コード例 #22
0
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.Retroaction:
         OpenRetroactionView();
         break;
     }
 }
コード例 #23
0
ファイル: RecordCtrl.cs プロジェクト: guochaolinDLKF/LaiJu
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.Record:
         OpenRecordView();
         break;
     }
 }
コード例 #24
0
 /// <summary>
 /// 打开视图
 /// </summary>
 /// <param name="type"></param>
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.UIZJHTotalSettlement:
         //OpenUnitSettlement_ZJH();
         break;
     }
 }
コード例 #25
0
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.Rule:
         OpenRuleView();
         break;
     }
 }
コード例 #26
0
ファイル: AgreeMentCtrl.cs プロジェクト: guochaolinDLKF/LaiJu
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.AgreeMent:
         OpenAgreeMentView();
         break;
     }
 }
コード例 #27
0
 public void OpenView(UIWindowType type)
 {
     switch (type)
     {
     case UIWindowType.AgentService:
         OpenAgentServiceView();
         break;
     }
 }
コード例 #28
0
        private void DestroyWindow(UIWindowType type)
        {
            MyLog.DebugWithFrame(name, string.Format("Destroy window: {0}", type));
            switch (type)
            {
            case UIWindowType.LoginMode:
                if (_loginModeWindow)
                {
                    Destroy(_loginModeWindow.gameObject);
                    _loginModeWindow = null;
                    NeedUnloadAsset();
                }

                break;

            case UIWindowType.Portal:
                if (_portalWindow)
                {
                    Destroy(_portalWindow.gameObject);
                    _portalWindow = null;
                    NeedUnloadAsset();
                }

                break;

            case UIWindowType.Room:
                if (_roomWindow)
                {
                    Destroy(_roomWindow.gameObject);
                    _roomWindow = null;
                    NeedUnloadAsset();
                }

                break;

            case UIWindowType.Seat:
                if (_seatWindow)
                {
                    Destroy(_seatWindow.gameObject);
                    _seatWindow = null;
                    NeedUnloadAsset();
                }

                break;

            case UIWindowType.Game:
                if (_gameWindow)
                {
                    Destroy(_gameWindow.gameObject);
                    _gameWindow = null;
                    NeedUnloadAsset();
                }

                break;
            }
        }
コード例 #29
0
        private static IUserInterfaceWindow GetInstance(UIWindowType windowType, object[] args)
        {
            Type windowClassType;

            if (uiWindowImplementations.TryGetValue(windowType, out windowClassType))
            {
                return((IUserInterfaceWindow)Activator.CreateInstance(windowClassType, args));
            }
            return(null);
        }
コード例 #30
0
        public StackData GetTopStackByWinType(UIWindowType type)
        {
            StackChunk chunk;

            if (mChunkWindow.TryGetValue(type, out chunk))
            {
                return(chunk.TopStack);
            }
            return(null);
        }
コード例 #31
0
 /// <summary>
 /// Closes the user interface window.
 /// </summary>
 /// <param name="windowType">Window type.</param>
 public void CloseUIWindow(UIWindowType windowType)
 {
     if (uiWindowDic.ContainsKey(windowType))
     {
         GameObject                uiWindow                = uiWindowDic[windowType];
         UIWindowControllerBase    uiWindownController     = uiWindow.GetOrAddComponent <UIWindowControllerBase>();
         UIWindowShowAnimationType windowShowAnimationType = uiWindownController.windowShowAnimationType;
         StartActiveUIWindow(uiWindow, windowShowAnimationType, state: false);
     }
 }
コード例 #32
0
ファイル: CSWindowEditor.cs プロジェクト: tsuixl/Frame
        void DrawStack()
        {
            if (CSCommonEditor.DrawHeader("Chunk Info", "CSUI-Stack"))
            {
                var stackMng = CSCommonEditor.GetField<StackManager>(UIManager.Instance, "mStackInstance");
                var listWnd = CSCommonEditor.GetField<List<StackData>>(stackMng, "mListWindow");
                var chunkWnd = CSCommonEditor.GetField<Dictionary<UIWindowType, StackChunk>>(stackMng, "mChunkWindow");

                GUILayout.Label(string.Format(" Stack Window Count {0} ", listWnd.Count.ToString()), GUILayout.Width(120));

                GUILayout.BeginHorizontal();
                foreach (var iter in chunkWnd)
                {
                    if (GUILayout.Toggle(chunkSelectType == iter.Key, iter.Key.ToString(), "ButtonLeft"))
                    {
                        chunkSelectType = iter.Key;
                    }
                }
                GUILayout.EndHorizontal();

                DrawStackChunkInfo(chunkWnd[chunkSelectType]);
            }
        }
コード例 #33
0
ファイル: UIStack.cs プロジェクト: tsuixl/Frame
 public StackChunk(UIWindowType t)
 {
     mChunkType = t;
     mChunkList = new List<StackData>();
     mStartDepth = (int)t;
 }
コード例 #34
0
ファイル: UIStack.cs プロジェクト: tsuixl/Frame
 public StackData GetTopStackByWinType(UIWindowType type)
 {
     StackChunk chunk;
     if (mChunkWindow.TryGetValue(type, out chunk))
     {
         return chunk.TopStack;
     }
     return null;
 }
コード例 #35
0
 private Transform GetTargetRoot(UIWindowType type)
 {
     if (type == UIWindowType.Fixed)
         return UIFixedWidowRoot;
     if (type == UIWindowType.Normal)
         return UINormalWindowRoot;
     if (type == UIWindowType.PopUp)
         return UIPopUpWindowRoot;
     return UIRoot;
 }