Esempio n. 1
0
        private void RefreshBackSequenceData(UIBaseWindow targetWindow, ShowWindowData showData)
        {
            WindowCoreData coreData         = targetWindow.windowData;
            bool           dealBackSequence = true;

            if (dicShownWindows.Count > 0 && dealBackSequence)
            {
                List <WindowID>     removedKey          = null;
                List <UIBaseWindow> sortedHiddenWindows = new List <UIBaseWindow>();

                BackWindowSequenceData backData = new BackWindowSequenceData();
                foreach (KeyValuePair <int, UIBaseWindow> window in dicShownWindows)
                {
                    if (coreData.showMode != UIWindowShowMode.DoNothing)
                    {
                        if (window.Value.windowData.windowType == UIWindowType.Fixed)
                        {
                            continue;
                        }
                        if (removedKey == null)
                        {
                            removedKey = new List <WindowID>();
                        }
                        removedKey.Add((WindowID)window.Key);
                        window.Value.HideWindowDirectly();
                    }

                    if (window.Value.windowData.windowType != UIWindowType.Fixed)
                    {
                        sortedHiddenWindows.Add(window.Value);
                    }
                }

                if (removedKey != null)
                {
                    for (int i = 0; i < removedKey.Count; i++)
                    {
                        dicShownWindows.Remove((int)removedKey[i]);
                    }
                }

                // Push new navigation data
                if (coreData.navigationMode == UIWindowNavigationMode.NormalNavigation &&
                    (showData == null || (!showData.ignoreAddNavData)))
                {
                    // Add to return show target list
                    sortedHiddenWindows.Sort(this.compareWindowFun);
                    List <WindowID> navHiddenWindows = new List <WindowID>();
                    for (int i = 0; i < sortedHiddenWindows.Count; i++)
                    {
                        WindowID pushWindowId = sortedHiddenWindows[i].ID;
                        navHiddenWindows.Add(pushWindowId);
                    }
                    backData.hideTargetWindow = targetWindow;
                    backData.backShowTargets  = navHiddenWindows;
                    backSequence.Push(backData);
                    Debuger.Log("<color=cyan>### !!!Push new Navigation data!!! ###</color>");
                }
            }
        }
Esempio n. 2
0
 public override void ShowWindow(WindowID id, ShowWindowData showData)
 {
     if (!IsWindowInControl(id))
     {
         Debuger.Log("UIRankManager has no control power of " + id.ToString());
         return;
     }
     if (dicShownWindows.ContainsKey((int)id))
     {
         return;
     }
     if (dicAllWindows.ContainsKey((int)id))
     {
         UIBaseWindow baseWindow = dicAllWindows[(int)id];
         if (baseWindow.ID != id)
         {
             Debuger.LogError(string.Format("[UIRankManager BaseWindowId :{0} != shownWindowId :{1}]", baseWindow.ID, id));
             return;
         }
         if (baseWindow.windowData.navigationMode == UIWindowNavigationMode.NormalNavigation)
         {
             BackWindowSequenceData backData = new BackWindowSequenceData();
             backData.hideTargetWindow = baseWindow;
             backSequence.Push(backData);
         }
         this.RealShowWindow(baseWindow, baseWindow.ID, showData);
     }
 }
Esempio n. 3
0
        private void ExecuteNavigationLogic(UIBaseWindow baseWindow, ShowWindowData showData)
        {
            WindowCoreData windowData = baseWindow.windowData;

            if (baseWindow.RefreshBackSeqData)
            {
                this.RefreshBackSequenceData(baseWindow, showData);
            }
            else if (windowData.showMode == UIWindowShowMode.HideOtherWindow)
            {
                HideAllShownWindow();
            }

            // If target window is mark as force clear all the navigation sequence data
            // Show data need force clear the back seq data
            if (baseWindow.windowData.forceClearNavigation || (showData != null && showData.forceClearBackSeqData))
            {
                Debuger.Log("<color=cyan>## [Enter the start window, reset the backSequenceData for the navigation system.]##</color>");
                ClearBackSequence();
            }
            else
            {
                if ((showData != null && showData.checkNavigation))
                {
                    CheckBackSequenceData(baseWindow);
                }
            }
        }
Esempio n. 4
0
        public override void ShowWindow(WindowID id, ShowWindowData data)
        {
            if (!IsWindowInControl(id))
            {
                Debug.Log("UIRankManager has no control power of " + id.ToString());
                return;
            }
            if (shownWindows.ContainsKey(id))
            {
                return;
            }
            if (allWindows.ContainsKey(id))
            {
                UIBaseWindow baseWindow = allWindows[id];
                if (baseWindow.windowData.showMode == UIWindowShowMode.NeedBack)
                {
                    BackWindowSequenceData backData = new BackWindowSequenceData();
                    backData.hideTargetWindow = baseWindow;
                    backSequence.Push(backData);
                }
                allWindows[id].ShowWindow();
                shownWindows[id] = allWindows[id];

                this.lastShownNormalWindow = this.curShownNormalWindow;
                curShownNormalWindow       = baseWindow;
            }
        }
Esempio n. 5
0
 public override void ShowWindow(WindowID id, ShowWindowData showData)
 {
     if (!IsWindowInControl(id))
     {
         Debuger.Log("UIRankManager has no control power of " + id.ToString());
         return;
     }
     if (dicShownWindows.ContainsKey((int)id))
         return;
     if (dicAllWindows.ContainsKey((int)id))
     {
         UIBaseWindow baseWindow = dicAllWindows[(int)id];
         if (baseWindow.ID != id)
         {
             Debuger.LogError(string.Format("[UIRankManager BaseWindowId :{0} != shownWindowId :{1}]", baseWindow.ID, id));
             return;
         }
         if (baseWindow.windowData.navigationMode == UIWindowNavigationMode.NormalNavigation)
         {
             BackWindowSequenceData backData = new BackWindowSequenceData();
             backData.hideTargetWindow = baseWindow;
             backSequence.Push(backData);
         }
         this.RealShowWindow(baseWindow, baseWindow.ID, showData);
     }
 }
        public override void ShowWindow(WindowID id, ShowWindowData data)
        {
            if (!IsWindowInControl(id))
            {
                Debug.Log("UIRankManager has no control power of " + id.ToString());
                return;
            }
            if (shownWindows.ContainsKey(id))
                return;
            if (allWindows.ContainsKey(id))
            {
                UIBaseWindow baseWindow = allWindows[id];
                if (baseWindow.windowData.showMode == UIWindowShowMode.NeedBack)
                {
                    BackWindowSequenceData backData = new BackWindowSequenceData();
                    backData.hideTargetWindow = baseWindow;
                    backSequence.Push(backData);
                }
                allWindows[id].ShowWindow();
                shownWindows[id] = allWindows[id];

                this.lastShownNormalWindow = this.curShownNormalWindow;
                curShownNormalWindow = baseWindow;
            }
        }
Esempio n. 7
0
        protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
        {
            // 检测控制权限
            if (!this.IsWindowInControl(id))
            {
                Debug.Log("UIManager has no control power of " + id.ToString());
                return(null);
            }
            if (shownWindows.ContainsKey(id))
            {
                return(null);
            }

            UIBaseWindow baseWindow = GetGameWindow(id);
            bool         newAdded   = false;

            if (!baseWindow)
            {
                newAdded = true;
                // 窗口不存在从内存进行加载
                if (UIResourceDefine.windowPrefabPath.ContainsKey(id))
                {
                    string     prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[id];
                    GameObject prefab     = Resources.Load <GameObject>(prefabPath);
                    if (prefab != null)
                    {
                        GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                        NGUITools.SetActive(uiObject, true);
                        baseWindow = uiObject.GetComponent <UIBaseWindow>();
                        // 需要动态添加对应的控制界面,prefab不用添加脚本
                        Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType);
                        GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform);
                        allWindows[id] = baseWindow;
                    }
                }
            }

            if (baseWindow == null)
            {
                Debug.LogError("[window instance is null.]" + id.ToString());
            }

            // 重置界面(第一次添加,强制Reset)
            if (newAdded || (showData != null && showData.forceResetWindow))
            {
                baseWindow.ResetWindow();
            }

            // 显示界面固定内容


            // 导航系统数据更新
            RefreshBackSequenceData(baseWindow);
            // 调整层级depth
            AdjustBaseWindowDepth(baseWindow);
            // 添加背景Collider
            AddColliderBgForWindow(baseWindow);
            return(baseWindow);
        }
 public override void ShowWindow(WindowID id, ShowWindowData showData = null)
 {
     UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, showData);
     if (baseWindow != null)
     {
         RealShowWindow(baseWindow, id, showData);
     }
 }
Esempio n. 9
0
        public override void ShowWindow(WindowID id, ShowWindowData showData = null)
        {
            UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, showData);

            if (baseWindow != null)
            {
                RealShowWindow(baseWindow, id, showData);
            }
        }
Esempio n. 10
0
 private void OnContineBtn(GameObject obj)
 {
     GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
     {
         UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
         ShowWindowData showData   = new ShowWindowData();
         showData.checkNavigation  = true;
         showData.ignoreAddNavData = true;
         UICenterMasterManager.Instance.ShowWindow(targetBackWindowId, showData);
     });
 }
Esempio n. 11
0
        protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
        {
            // 检测控制权限
            if (!this.IsWindowInControl(id))
            {
                Debug.Log("UIManager has no control power of " + id.ToString());
                return null;
            }
            if (shownWindows.ContainsKey(id))
                return null;

            UIBaseWindow baseWindow = GetGameWindow(id);
            bool newAdded = false;
            if (!baseWindow)
            {
                newAdded = true;
                // 窗口不存在从内存进行加载
                if (UIResourceDefine.windowPrefabPath.ContainsKey(id))
                {
                    string prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[id];
                    GameObject prefab = Resources.Load<GameObject>(prefabPath);
                    if (prefab != null)
                    {
                        GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                        NGUITools.SetActive(uiObject, true);
                        baseWindow = uiObject.GetComponent<UIBaseWindow>();
                        // 需要动态添加对应的控制界面,prefab不用添加脚本
                        Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType);
                        GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform);
                        allWindows[id] = baseWindow;
                    }
                }
            }

            if (baseWindow == null)
                Debug.LogError("[window instance is null.]" + id.ToString());

            // 重置界面(第一次添加,强制Reset)
            if (newAdded || (showData != null && showData.forceResetWindow))
                baseWindow.ResetWindow();

            // 显示界面固定内容


            // 导航系统数据更新
            RefreshBackSequenceData(baseWindow);
            // 调整层级depth
            AdjustBaseWindowDepth(baseWindow);
            // 添加背景Collider
            AddColliderBgForWindow(baseWindow);
            return baseWindow;
        }
Esempio n. 12
0
        protected virtual void RealShowWindow(UIBaseWindow baseWindow, WindowID id, ShowWindowData showData = null)
        {
            BaseWindowContextData contextData = showData == null ? null : showData.contextData;

            baseWindow.ShowWindow(contextData);
            dicShownWindows[(int)id] = baseWindow;
            if (baseWindow.windowData.navigationMode == UIWindowNavigationMode.NormalNavigation)
            {
                lastNavigationWindow = curNavigationWindow;
                curNavigationWindow  = baseWindow;
                Debuger.Log("<color=magenta>### current Navigation window </color>" + baseWindow.ID.ToString());
            }
        }
Esempio n. 13
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_MainMenu;
            base.InitWindowOnAwake();
            InitWindowData();

            twPositions = new TweenPosition[4];
            btnInfor    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject;
            btnRank     = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject;
            btnLevel    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject;
            btnSwitch   = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject;
            btnSkill    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject;
            lbSwitch    = GameUtility.FindDeepChild <UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label");

            twPositions[0] = btnInfor.GetComponent <TweenPosition>();
            twPositions[1] = btnRank.GetComponent <TweenPosition>();
            twPositions[2] = btnLevel.GetComponent <TweenPosition>();
            twPositions[3] = btnSkill.GetComponent <TweenPosition>();

            UIEventListener.Get(btnRank).onClick = delegate
            {
                ShowWindowData showData = new ShowWindowData();
                showData.forceResetWindow = true;
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Rank, showData);
            };

            UIEventListener.Get(btnSwitch).onClick = delegate
            {
                switchFlag = !switchFlag;
                if (switchFlag)
                {
                    ShowBtns();
                }
                else
                {
                    HideBtns();
                }
            };

            UIEventListener.Get(btnLevel).onClick = delegate
            {
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level);
            };

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Skill);
            };
        }
Esempio n. 14
0
        void Awake()
        {
            lbLevelName = GameUtility.FindDeepChild<UILabel>(this.gameObject, "Label");
            btnLevelItem = GameUtility.FindDeepChild(this.gameObject, "Icon").gameObject;

            UIEventListener.Get(btnLevelItem).onClick = delegate
            {
                ShowWindowData showData = new ShowWindowData();
                ContextDataLevelDetail context = new ContextDataLevelDetail();
                context.levelDescription = "Hi Man cool things will be happen.Be busy living or be busy dying. - Fighting for the game world";
                context.levelId = 10001;
                context.levelName = lbLevelName.text;
                context.starCount = starCount;
                showData.contextData = context;
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_LevelDetail, showData);
            };
        }
Esempio n. 15
0
        void Awake()
        {
            lbLevelName  = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Label");
            btnLevelItem = GameUtility.FindDeepChild(this.gameObject, "Icon").gameObject;

            UIEventListener.Get(btnLevelItem).onClick = delegate
            {
                ShowWindowData         showData = new ShowWindowData();
                ContextDataLevelDetail context  = new ContextDataLevelDetail();
                context.levelDescription = "Hi Man cool things will be happen.Be busy living or be busy dying. - Fighting for the game world";
                context.levelId          = 10001;
                context.levelName        = lbLevelName.text;
                context.starCount        = starCount;
                showData.contextData     = context;
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_LevelDetail, showData);
            };
        }
Esempio n. 16
0
        public override void ShowWindow(WindowID id, ShowWindowData data = null)
        {
            UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, data);
            if (baseWindow != null)
            {
                RealShowWindow(baseWindow, id);
                
                // 是否清空当前导航信息(回到主菜单)
                if (baseWindow.windowData.isStartWindow)
                {
                    Debuger.Log("[Enter the start window, reset the backSequenceData for the navigation system.]");
                    ClearBackSequence();
                }

                if (data != null && data.forceClearBackSeqData)
                    ClearBackSequence();
            }
        }
Esempio n. 17
0
        public override void InitWindowOnAwake()
        {
            base.InitWindowOnAwake();
            InitWindowCoreData();

            gbWinContent  = GameUtility.FindDeepChild(this.gameObject, "WinContent").gameObject;
            gbLoseContent = GameUtility.FindDeepChild(this.gameObject, "LoseContent").gameObject;

            btnRank        = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Rank").gameObject;
            btnSkill       = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Skill").gameObject;
            btnLoseContine = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Continue").gameObject;
            btnWinContine  = GameUtility.FindDeepChild(this.gameObject, "WinContent/Btn_Continue").gameObject;
            lbResult       = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Msg/Sprite/Label");
            lbResultMsg    = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Msg/Label");

            UIEventListener.Get(btnLoseContine).onClick = OnContineBtn;
            UIEventListener.Get(btnWinContine).onClick  = OnContineBtn;

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
                {
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
                    ShowWindowData showData   = new ShowWindowData();
                    showData.checkNavigation  = true;
                    showData.ignoreAddNavData = true;
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill, showData);
                });
            };

            UIEventListener.Get(btnRank).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
                {
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
                    ShowWindowData showData   = new ShowWindowData();
                    showData.checkNavigation  = true;
                    showData.ignoreAddNavData = true;
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_LevelDetail, showData);
                });
            };
        }
Esempio n. 18
0
        public override void InitWindowOnAwake()
        {
            base.InitWindowOnAwake();
            InitWindowCoreData();

            gbWinContent = GameUtility.FindDeepChild(this.gameObject, "WinContent").gameObject;
            gbLoseContent = GameUtility.FindDeepChild(this.gameObject, "LoseContent").gameObject;

            btnRank = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Rank").gameObject;
            btnSkill = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Skill").gameObject;
            btnLoseContine = GameUtility.FindDeepChild(this.gameObject, "LoseContent/Btns/Btn_Continue").gameObject;
            btnWinContine = GameUtility.FindDeepChild(this.gameObject, "WinContent/Btn_Continue").gameObject;
            lbResult = GameUtility.FindDeepChild<UILabel>(this.gameObject, "Msg/Sprite/Label");
            lbResultMsg = GameUtility.FindDeepChild<UILabel>(this.gameObject, "Msg/Label");

            UIEventListener.Get(btnLoseContine).onClick = OnContineBtn;
            UIEventListener.Get(btnWinContine).onClick = OnContineBtn;

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
                {
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
                    ShowWindowData showData = new ShowWindowData();
                    showData.checkNavigation = true;
                    showData.ignoreAddNavData = true;
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill, showData);
                });
            };

            UIEventListener.Get(btnRank).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
                {
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
                    ShowWindowData showData = new ShowWindowData();
                    showData.checkNavigation = true;
                    showData.ignoreAddNavData = true;
                    UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_LevelDetail, showData);
                });
            };
        }
Esempio n. 19
0
        public override void ShowWindow(WindowID id, ShowWindowData data = null)
        {
            UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, data);

            if (baseWindow != null)
            {
                RealShowWindow(baseWindow, id);

                // 是否清空当前导航信息(回到主菜单)
                if (baseWindow.windowData.isStartWindow)
                {
                    Debuger.Log("[Enter the start window, reset the backSequenceData for the navigation system.]");
                    ClearBackSequence();
                }

                if (data != null && data.forceClearBackSeqData)
                {
                    ClearBackSequence();
                }
            }
        }
Esempio n. 20
0
 protected void ShowWindowForOtherWindowManager(WindowID id, ShowWindowData showData)
 {
     if (!IsWindowInControl(id))
     {
         Debuger.Log("UIRankManager has no control power of " + id.ToString());
         return;
     }
     if (dicShownWindows.ContainsKey((int)id))
     {
         return;
     }
     if (dicAllWindows.ContainsKey((int)id))
     {
         UIWindowBase baseWindow = dicAllWindows[(int)id];
         if (baseWindow.ID != id)
         {
             Debuger.LogError(string.Format("[UIRankManager BaseWindowId :{0} != shownWindowId :{1}]", baseWindow.ID, id));
             return;
         }
         this.RealShowWindow(baseWindow, baseWindow.ID, showData);
     }
 }
Esempio n. 21
0
 /// <summary>
 /// Show target Window
 /// </summary>
 public virtual void ShowWindow(WindowID id, ShowWindowData data = null)
 {
 }
Esempio n. 22
0
        public override void InitWindowOnAwake()
        {
            base.InitWindowOnAwake();
            InitWindowCoreData();

            twPositions = new TweenPosition[4];
            btnInfor    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject;
            btnRank     = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject;
            btnLevel    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject;
            btnSwitch   = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject;
            btnSkill    = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject;
            lbSwitch    = GameUtility.FindDeepChild <UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label");

            twPositions[0] = btnInfor.GetComponent <TweenPosition>();
            twPositions[1] = btnRank.GetComponent <TweenPosition>();
            twPositions[2] = btnLevel.GetComponent <TweenPosition>();
            twPositions[3] = btnSkill.GetComponent <TweenPosition>();

            UIEventListener.Get(btnRank).onClick = delegate
            {
                ShowWindowData showData = new ShowWindowData();
                showData.forceResetWindow = true;

                string[] headIcons = new string[] { "Rambo", "Angry", "Smile", "Laugh", "Dead", "Frown", "Annoyed" };

                // fill the rank data
                ContextDataRank contextData = new ContextDataRank();
                contextData.listRankItemDatas = new List <RankItemData>();

                // rank list
                for (int i = 0; i < 10; i++)
                {
                    RankItemData newData = new RankItemData();
                    newData.playerName        = headIcons[UnityEngine.Random.Range(0, headIcons.Length)];
                    newData.headIcon          = "Emoticon - " + newData.playerName;
                    newData.playerName        = "Mr." + newData.playerName;
                    newData.playerDescription = string.Format("I'm {0}", newData.playerName);
                    contextData.listRankItemDatas.Add(newData);
                }
                showData.contextData = contextData;
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Rank, showData);
            };

            UIEventListener.Get(btnSwitch).onClick = delegate
            {
                switchFlag = !switchFlag;
                if (switchFlag)
                {
                    ShowBtns();
                }
                else
                {
                    HideBtns();
                }
            };

            UIEventListener.Get(btnLevel).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Level);
            };

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill);
            };
        }
        private void ExecuteNavigationLogic(UIBaseWindow baseWindow, ShowWindowData showData)
        {
            WindowCoreData windowData = baseWindow.windowData;
            if (baseWindow.RefreshBackSeqData)
            {
                this.RefreshBackSequenceData(baseWindow, showData);
            }
            else if (windowData.showMode == UIWindowShowMode.HideOtherWindow)
            {
                HideAllShownWindow();
            }

            // If target window is mark as force clear all the navigation sequence data
            // Show data need force clear the back seq data
            if (baseWindow.windowData.forceClearNavigation || (showData != null && showData.forceClearBackSeqData))
            {
                Debuger.Log("<color=cyan>## [Enter the start window, reset the backSequenceData for the navigation system.]##</color>");
                ClearBackSequence();
            }
            else
            {
                if ((showData != null && showData.checkNavigation))
                    CheckBackSequenceData(baseWindow);
            }
        }
Esempio n. 24
0
        protected bool RealPopNavigationWindow()
        {
            if (backSequence.Count == 0)
            {
                if (curNavigationWindow == null)
                {
                    return(false);
                }
                if (PopUpWindowManager(curNavigationWindow))
                {
                    return(true);
                }

                // if curNavigationWindow BackSequenceData is null
                // Check window's preWindowId
                // if preWindowId defined just move to target Window(preWindowId)
                WindowID preWindowId = curNavigationWindow.PreWindowID;
                if (preWindowId != WindowID.WindowID_Invaild)
                {
                    Debuger.LogWarning(string.Format(string.Format("## Current nav window {0} need show pre window {1}.", curNavigationWindow.ID.ToString(), preWindowId.ToString())));
                    HideWindow(curNavigationWindow.ID, delegate
                    {
                        ShowWindowData showData  = new ShowWindowData();
                        showData.executeNavLogic = false;
                        ShowWindow(preWindowId, showData);
                    });
                }
                else
                {
                    Debuger.LogWarning("## CurrentShownWindow " + curNavigationWindow.ID + " preWindowId is " + WindowID.WindowID_Invaild);
                }
                return(false);
            }
            BackWindowSequenceData backData = backSequence.Peek();

            if (backData != null)
            {
                // check the current back data

                int curId = this.GetCurrenShownWindow();
                if (curId != (int)backData.hideTargetWindow.ID)
                {
                    Debuger.Log("<color=red>Can't PopUp seq data [backData.hideTargetWindow.ID != this.curShownWindowId]</color>");
                    return(false);
                }

                if (PopUpWindowManager(backData.hideTargetWindow))
                {
                    return(true);
                }

                WindowID hideId = backData.hideTargetWindow.ID;
                if (!dicShownWindows.ContainsKey((int)hideId))
                {
                    ExectuteBackSeqData(backData);
                }
                else
                {
                    HideWindow(hideId, delegate
                    {
                        ExectuteBackSeqData(backData);
                    });
                }
            }
            return(true);
        }
Esempio n. 25
0
        public override void InitWindowOnAwake()
        {
            base.InitWindowOnAwake();
            InitWindowCoreData();

            twPositions = new TweenPosition[4];
            btnInfor = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject;
            btnRank = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject;
            btnLevel = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject;
            btnSwitch = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject;
            btnSkill = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject;
            lbSwitch = GameUtility.FindDeepChild<UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label");

            twPositions[0] = btnInfor.GetComponent<TweenPosition>();
            twPositions[1] = btnRank.GetComponent<TweenPosition>();
            twPositions[2] = btnLevel.GetComponent<TweenPosition>();
            twPositions[3] = btnSkill.GetComponent<TweenPosition>();

            UIEventListener.Get(btnRank).onClick = delegate
            {
                ShowWindowData showData = new ShowWindowData();
                showData.forceResetWindow = true;

                string[] headIcons = new string[] { "Rambo", "Angry", "Smile", "Laugh", "Dead", "Frown", "Annoyed" };

                // fill the rank data
                ContextDataRank contextData = new ContextDataRank();
                contextData.listRankItemDatas = new List<RankItemData>();

                // rank list
                for (int i = 0; i < 10; i++)
                {
                    RankItemData newData = new RankItemData();
                    newData.playerName = headIcons[UnityEngine.Random.Range(0, headIcons.Length)];
                    newData.headIcon = "Emoticon - " + newData.playerName;
                    newData.playerName = "Mr." + newData.playerName;
                    newData.playerDescription = string.Format("I'm {0}", newData.playerName);
                    contextData.listRankItemDatas.Add(newData);
                }
                showData.contextData = contextData;
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Rank, showData);
            };

            UIEventListener.Get(btnSwitch).onClick = delegate
            {
                switchFlag = !switchFlag;
                if (switchFlag)
                    ShowBtns();
                else
                    HideBtns();
            };

            UIEventListener.Get(btnLevel).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Level);
            };

            UIEventListener.Get(btnSkill).onClick = delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill);
            };
        }
Esempio n. 26
0
 protected virtual UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
 {
     return(null);
 }
Esempio n. 27
0
        private IEnumerator _ShowWindowDelay(float delayTime, WindowID id, ShowWindowData showData = null)
        {
            yield return(new WaitForSeconds(delayTime));

            ShowWindow(id, showData);
        }
Esempio n. 28
0
        private void OnContineBtn(GameObject obj)
        {
            GameMonoHelper.GetInstance().LoadGameScene("RealGame-EmptyScene", true, delegate
            {
                UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_TopBar);
                ShowWindowData showData = new ShowWindowData();
                showData.checkNavigation = true;
                showData.ignoreAddNavData = true;
                UICenterMasterManager.Instance.ShowWindow(targetBackWindowId, showData);
            });

        }
Esempio n. 29
0
        protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
        {
            // Check the window control state
            if (!this.IsWindowInControl(id))
            {
                Debuger.Log("## UIManager has no control power of " + id.ToString());
                return(null);
            }

            // If the window in shown list just return
            if (dicShownWindows.ContainsKey((int)id))
            {
                return(null);
            }

            UIBaseWindow baseWindow = GetGameWindow(id);

            // If window not in scene start Instantiate new window to scene
            bool newAdded = false;

            if (!baseWindow)
            {
                newAdded = true;
                if (UIResourceDefine.windowPrefabPath.ContainsKey((int)id))
                {
                    string     prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[(int)id];
                    GameObject prefab     = Resources.Load <GameObject>(prefabPath);
                    if (prefab != null)
                    {
                        GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                        NGUITools.SetActive(uiObject, true);
                        // NOTE: You can add component to the window in the inspector
                        // Or just AddComponent<UIxxxxWindow>() to the target
                        baseWindow = uiObject.GetComponent <UIBaseWindow>();
                        if (baseWindow.ID != id)
                        {
                            Debuger.LogError(string.Format("<color=cyan>[BaseWindowId :{0} != shownWindowId :{1}]</color>", baseWindow.ID, id));
                            return(null);
                        }
                        // Get the window target root parent
                        Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType);
                        GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform);
                        dicAllWindows[(int)id] = baseWindow;
                    }
                }
            }

            if (baseWindow == null)
            {
                Debuger.LogError("[window instance is null.]" + id.ToString());
            }

            // Call reset window when first load new window
            // Or get forceResetWindow param
            if (newAdded || (showData != null && showData.forceResetWindow))
            {
                baseWindow.ResetWindow();
            }

            if (showData == null || (showData != null && showData.executeNavLogic))
            {
                // refresh the navigation data
                ExecuteNavigationLogic(baseWindow, showData);
            }

            // Adjust the window depth
            AdjustBaseWindowDepth(baseWindow);

            // Add common background collider to window
            AddColliderBgForWindow(baseWindow);
            return(baseWindow);
        }
Esempio n. 30
0
 public override void ShowWindow(WindowID id, ShowWindowData showData)
 {
     ShowWindowForOtherWindowManager(id, showData);
 }
Esempio n. 31
0
 /// <summary>
 /// Delay 显示界面
 /// </summary>
 /// <param name="delayTime"> 延迟时间</param>
 /// <param name="id"> 界面ID</param>
 /// <param name="data">显示数据</param>
 public virtual void ShowWindowDelay(float delayTime, WindowID id, ShowWindowData data = null)
 {
     StartCoroutine(_ShowWindowDelay(delayTime, id, data));
 }
        protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
        {
            // Check the window control state
            if (!this.IsWindowInControl(id))
            {
                Debuger.Log("## UIManager has no control power of " + id.ToString());
                return null;
            }

            // If the window in shown list just return
            if (dicShownWindows.ContainsKey((int)id))
                return null;

            UIBaseWindow baseWindow = GetGameWindow(id);

            // If window not in scene start Instantiate new window to scene
            bool newAdded = false;
            if (!baseWindow)
            {
                newAdded = true;
                if (UIResourceDefine.windowPrefabPath.ContainsKey((int)id))
                {
                    string prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[(int)id];
                    GameObject prefab = Resources.Load<GameObject>(prefabPath);
                    if (prefab != null)
                    {
                        GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                        NGUITools.SetActive(uiObject, true);
                        // NOTE: You can add component to the window in the inspector
                        // Or just AddComponent<UIxxxxWindow>() to the target
                        baseWindow = uiObject.GetComponent<UIBaseWindow>();
                        if (baseWindow.ID != id)
                        {
                            Debuger.LogError(string.Format("<color=cyan>[BaseWindowId :{0} != shownWindowId :{1}]</color>", baseWindow.ID, id));
                            return null;
                        }
                        // Get the window target root parent
                        Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType);
                        GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform);
                        dicAllWindows[(int)id] = baseWindow;
                    }
                }
            }

            if (baseWindow == null)
                Debuger.LogError("[window instance is null.]" + id.ToString());

            // Call reset window when first load new window
            // Or get forceResetWindow param
            if (newAdded || (showData != null && showData.forceResetWindow))
                baseWindow.ResetWindow();

            if (showData == null || (showData != null && showData.executeNavLogic))
            {
                // refresh the navigation data
                ExecuteNavigationLogic(baseWindow, showData);
            }

            // Adjust the window depth
            AdjustBaseWindowDepth(baseWindow);

            // Add common background collider to window
            AddColliderBgForWindow(baseWindow);
            return baseWindow;
        }
        private void RefreshBackSequenceData(UIBaseWindow targetWindow, ShowWindowData showData)
        {
            WindowCoreData coreData = targetWindow.windowData;
            bool dealBackSequence = true;
            if (dicShownWindows.Count > 0 && dealBackSequence)
            {
                List<WindowID> removedKey = null;
                List<UIBaseWindow> sortedHiddenWindows = new List<UIBaseWindow>();

                BackWindowSequenceData backData = new BackWindowSequenceData();
                foreach (KeyValuePair<int, UIBaseWindow> window in dicShownWindows)
                {
                    if (coreData.showMode != UIWindowShowMode.DoNothing)
                    {
                        if (window.Value.windowData.windowType == UIWindowType.Fixed)
                            continue;
                        if (removedKey == null)
                            removedKey = new List<WindowID>();
                        removedKey.Add((WindowID)window.Key);
                        window.Value.HideWindowDirectly();
                    }

                    if (window.Value.windowData.windowType != UIWindowType.Fixed)
                        sortedHiddenWindows.Add(window.Value);
                }

                if (removedKey != null)
                {
                    for (int i = 0; i < removedKey.Count; i++)
                        dicShownWindows.Remove((int)removedKey[i]);
                }

                // Push new navigation data
                if (coreData.navigationMode == UIWindowNavigationMode.NormalNavigation &&
                    (showData == null || (!showData.ignoreAddNavData)))
                {
                    // Add to return show target list
                    sortedHiddenWindows.Sort(this.compareWindowFun);
                    List<WindowID> navHiddenWindows = new List<WindowID>();
                    for (int i = 0; i < sortedHiddenWindows.Count; i++)
                    {
                        WindowID pushWindowId = sortedHiddenWindows[i].ID;
                        navHiddenWindows.Add(pushWindowId);
                    }
                    backData.hideTargetWindow = targetWindow;
                    backData.backShowTargets = navHiddenWindows;
                    backSequence.Push(backData);
                    Debuger.Log("<color=cyan>### !!!Push new Navigation data!!! ###</color>");
                }
            }
        }
Esempio n. 34
0
 /// <summary>
 /// Delay to show target window
 /// </summary>
 /// <param name="delayTime"> delayTime</param>
 /// <param name="id"> WindowId</param>
 /// <param name="showData">show window data</param>
 public virtual void ShowWindowDelay(float delayTime, WindowID id, ShowWindowData showData = null)
 {
     StopAllCoroutines();
     StartCoroutine(_ShowWindowDelay(delayTime, id, showData));
 }