Exemple #1
0
        /// <summary>
        /// 初始化RankWindow界面管理类
        /// 1.查找子界面
        /// 2.初始化子界面
        /// </summary>
        public override void InitWindowManager()
        {
            base.InitWindowManager();
            InitWindowControl();
            isNeedWaitHideOver = true;

            // UIRankDetail子界面
            GameObject   objRankDetail    = GameUtility.FindDeepChild(this.gameObject, "DetailWindowContainer").gameObject;
            UIRankDetail rankDetailScript = objRankDetail.GetComponent <UIRankDetail>();

            if (rankDetailScript == null)
            {
                rankDetailScript = objRankDetail.AddComponent <UIRankDetail>();
            }

            allWindows[WindowID.WindowID_Rank_Detail] = rankDetailScript;

            // UIRankOwnDetail子界面
            GameObject      objRankOwnDetail    = GameUtility.FindDeepChild(this.gameObject, "OwnDetailWindow").gameObject;
            UIRankOwnDetail rankOwnDetailScript = objRankOwnDetail.GetComponent <UIRankOwnDetail>();

            if (rankOwnDetailScript == null)
            {
                rankOwnDetailScript = objRankOwnDetail.AddComponent <UIRankOwnDetail>();
            }

            allWindows[WindowID.WindowID_Rank_OwnDetail] = rankOwnDetailScript;
        }
Exemple #2
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_MatchResult;
            base.InitWindowOnAwake();
            InitWindowData();

            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
            {
                //ShowWindowData windowData = new ShowWindowData();
                //windowData.needClearBackSequence = true;
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_TopBar);
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Skill);
            };

            UIEventListener.Get(btnRank).onClick = delegate
            {
                //UIManager.GetInstance().ShowWindow(WindowID.WindowID_TopBar);
                //UIManager.GetInstance().ShowWindow(WindowID.WindowID_Rank);
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_TopBar);
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level);
            };
        }
Exemple #3
0
        public override void InitWindowOnAwake()
        {
            this.windowID    = WindowID.WindowID_Rank;
            this.preWindowID = WindowID.WindowID_MainMenu;
            InitWindowData();
            base.InitWindowOnAwake();

            // this.RegisterReturnLogic(RetrunPreLogic);

            objEffect    = GameUtility.FindDeepChild(this.gameObject, "EffectParent");
            itemsGrid    = GameUtility.FindDeepChild(this.gameObject, "LeftAnchor/LeftMain/Scroll View/Grid");
            trsAnimation = GameUtility.FindDeepChild(this.gameObject, "LeftAnchor/LeftMain");
            scrollView   = GameUtility.FindDeepChild <UIScrollView>(this.gameObject, "LeftAnchor/LeftMain/Scroll View");
            btnGoToMatch = GameUtility.FindDeepChild(this.gameObject, "Btn_GotoMatch").gameObject;

            rankWindowManager = this.gameObject.GetComponent <UIRankManager>();
            if (rankWindowManager == null)
            {
                rankWindowManager = this.gameObject.AddComponent <UIRankManager>();
                rankWindowManager.InitWindowManager();
            }

            UIEventListener.Get(btnGoToMatch).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("AnimationCurve",
                                                           delegate
                {
                    UIManager.GetInstance().ShowWindow(WindowID.WindowID_Matching);
                    UIManager.GetInstance().GetGameWindowScript <UIMatching>(WindowID.WindowID_Matching).SetMatchingData(this.windowID);
                });
            };
        }
Exemple #4
0
        /// <summary>
        /// Item需要编写通用类
        /// </summary>
        void Awake()
        {
            lbItemName = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Label");
            spIcon     = GameUtility.FindDeepChild <UISprite>(this.gameObject, "Sprite");
            btnBg      = GameUtility.FindDeepChild(this.gameObject, "Bgbtn").gameObject;

            UIEventListener.Get(btnBg).onClick = OnBtnClick;
        }
Exemple #5
0
 public override void InitWindowOnAwake()
 {
     this.windowID = WindowID.WindowID_Level;
     InitWindowData();
     base.InitWindowOnAwake();
     // this.RegisterReturnLogic(RetrunPreLogic);
     trsLevelItemsParent = GameUtility.FindDeepChild(this.gameObject, "LevelItems/Items");
     twAlpha             = gameObject.GetComponent <TweenAlpha>();
 }
Exemple #6
0
        /// <summary>
        /// 查找子节点脚本
        /// </summary>
        public static T FindDeepChild <T>(GameObject _target, string _childName) where T : Component
        {
            Transform resultTrs = GameUtility.FindDeepChild(_target, _childName);

            if (resultTrs != null)
            {
                return(resultTrs.gameObject.GetComponent <T>());
            }
            return((T)((object)null));
        }
Exemple #7
0
        void Awake()
        {
            lbLevelName  = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Label");
            btnLevelItem = GameUtility.FindDeepChild(this.gameObject, "Icon").gameObject;

            UIEventListener.Get(btnLevelItem).onClick = delegate
            {
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_LevelDetail);
                // UIManager.GetInstance().ShowWindowDelay(2.0f, WindowID.WindowID_LevelDetail);
            };
        }
Exemple #8
0
        /// <summary>
        /// 给目标添加Collider背景
        /// </summary>
        public static void AddColliderBgToTarget(GameObject target, string maskName, UIAtlas altas, bool isTransparent)
        {
            // 添加UIPaneldepth最小上面
            // 保证添加的Collider放置在屏幕中间
            Transform windowBg = GameUtility.FindDeepChild(target, "WindowBg");

            if (windowBg == null)
            {
                GameObject targetParent = GetPanelDepthMaxMin(target, false, true);
                if (targetParent == null)
                {
                    targetParent = target;
                }

                windowBg = (new GameObject("WindowBg")).transform;
                AddChildToTarget(targetParent.transform, windowBg);
            }

            Transform bg = GameUtility.FindDeepChild(target, "WindowColliderBg(Cool)");

            if (bg == null)
            {
                // add sprite or widget to ColliderBg gameobject
                UIWidget widget = null;
                if (!isTransparent)
                {
                    widget = NGUITools.AddSprite(windowBg.gameObject, altas, maskName);
                }
                else
                {
                    widget = NGUITools.AddWidget <UIWidget>(windowBg.gameObject);
                }

                widget.name = "WindowColliderBg(Cool)";
                bg          = widget.transform;

                // fill the screen
                UIStretch stretch = bg.gameObject.AddComponent <UIStretch>();
                stretch.style = UIStretch.Style.Both;
                // set relative size bigger
                stretch.relativeSize = new Vector2(1.5f, 1.5f);

                // set a lower depth
                widget.depth = -5;

                // set alpha
                widget.alpha = 0.6f;

                // add collider
                NGUITools.AddWidgetCollider(bg.gameObject);
            }
        }
Exemple #9
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_Rank_OwnDetail;
            InitWindowData();
            base.InitWindowOnAwake();

            lbName       = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Name");
            spHeadIcon   = GameUtility.FindDeepChild <UISprite>(this.gameObject, "Sprite");
            btnClose     = GameUtility.FindDeepChild(this.gameObject, "Close").gameObject;
            objAnimation = this.gameObject;

            UIEventListener.Get(btnClose).onClick = OnBtnSwitch;
        }
Exemple #10
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);
            };
        }
Exemple #11
0
        public override void InitWindowOnAwake()
        {
            this.windowID    = WindowID.WindowID_Skill;
            this.preWindowID = WindowID.WindowID_MainMenu;

            base.InitWindowOnAwake();
            InitWindowData();

            gbAnimation  = GameUtility.FindDeepChild(this.gameObject, "Center/Sprite").gameObject;
            btnGoToLevel = GameUtility.FindDeepChild(this.gameObject, "RightAnchor/BtnLevel").gameObject;

            twPosition = gbAnimation.GetComponent <TweenPosition>();

            UIEventListener.Get(btnGoToLevel).onClick = delegate
            {
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level);
            };
        }
Exemple #12
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_Rank_Detail;
            InitWindowData();
            base.InitWindowOnAwake();

            lbDetail     = GameUtility.FindDeepChild(this.gameObject, "Move/Label").GetComponent <UILabel>();
            spHeadIcon   = GameUtility.FindDeepChild <UISprite>(this.gameObject, "Move/Sprite");
            objAnimation = GameUtility.FindDeepChild(this.gameObject, "Move").gameObject;
            btnClose     = GameUtility.FindDeepChild(this.gameObject, "Move/Close").gameObject;
            btnGoToLevel = GameUtility.FindDeepChild(this.gameObject, "Move/BtnGotoLevel").gameObject;
            UIEventListener.Get(btnClose).onClick = OnBtnClose;

            UIEventListener.Get(btnGoToLevel).onClick = delegate
            {
                UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level);
            };
        }
Exemple #13
0
        /// <summary>
        /// 查找子节点
        /// </summary>
        public static Transform FindDeepChild(GameObject _target, string _childName)
        {
            Transform resultTrs = null;

            resultTrs = _target.transform.Find(_childName);
            if (resultTrs == null)
            {
                foreach (Transform trs in _target.transform)
                {
                    resultTrs = GameUtility.FindDeepChild(trs.gameObject, _childName);
                    if (resultTrs != null)
                    {
                        return(resultTrs);
                    }
                }
            }
            return(resultTrs);
        }
Exemple #14
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_TopBar;
            this.windowData.windowType = UIWindowType.Fixed;

            base.InitWindowOnAwake();
            btnReturn  = GameUtility.FindDeepChild(this.gameObject, "TopLeft/Btn_Rtn").gameObject;
            btnShowMsg = GameUtility.FindDeepChild(this.gameObject, "TopRight/Meg/Sprite").gameObject;

            UIEventListener.Get(btnReturn).onClick = delegate
            {
                UIManager.GetInstance().ReturnWindow();
            };

            // message box Test.
            UIEventListener.Get(btnShowMsg).onClick = delegate
            {
                // UIManager.GetInstance().ShowMessageBox("Hello World!");

                //UIManager.GetInstance().ShowMessageBox(
                //    "Do you want to quit this game?",
                //    "Yes",
                //    delegate
                //    {
                //        Debug.Log("Message Box click YES.");
                //        UIManager.GetInstance().CloseMessageBox();
                //    },
                //    "No",
                //    delegate
                //    {
                //        Debug.Log("Message Box click NO.");
                //        UIManager.GetInstance().CloseMessageBox();
                //    });

                UIManager.GetInstance().ShowMessageBox(
                    "You are yourself, please don't lose confidence.",
                    "Sure!",
                    delegate
                {
                    UIManager.GetInstance().CloseMessageBox();
                });
            };
        }
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_LevelDetail;
            base.InitWindowOnAwake();
            InitWindowData();

            btnStart = GameUtility.FindDeepChild(this.gameObject, "LevelDetailRight/BtnEnter").gameObject;
            twAlpha  = this.gameObject.GetComponent <TweenAlpha>();

            UIEventListener.Get(btnStart).onClick = delegate
            {
                // Application.LoadLevel("AnimationCurve");
                GameMonoHelper.GetInstance().LoadGameScene("AnimationCurve",
                                                           delegate
                {
                    UIManager.GetInstance().ShowWindow(WindowID.WindowID_Matching);
                    UIManager.GetInstance().GetGameWindowScript <UIMatching>(WindowID.WindowID_Matching).SetMatchingData(this.windowID);
                });
            };
        }
Exemple #16
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_MessageBox;
            InitWindowData();
            base.InitWindowOnAwake();

            lbMsg        = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Message");
            btnCenter    = GameUtility.FindDeepChild(this.gameObject, "Btns/CenterBtn").gameObject;
            btnRight     = GameUtility.FindDeepChild(this.gameObject, "Btns/RightBtn").gameObject;
            btnLeft      = GameUtility.FindDeepChild(this.gameObject, "Btns/LeftBtn").gameObject;
            btnClose     = GameUtility.FindDeepChild(this.gameObject, "Btns/Close").gameObject;
            objAnimation = GameUtility.FindDeepChild(this.gameObject, "Center").gameObject;
            lbCenter     = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Btns/CenterBtn/Label");
            lbLeft       = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Btns/LeftBtn/Label");
            lbRight      = GameUtility.FindDeepChild <UILabel>(this.gameObject, "Btns/RightBtn/Label");

            UIEventListener.Get(btnClose).onClick = delegate
            {
                UIManager.GetInstance().CloseMessageBox();
            };
        }
Exemple #17
0
        public override void InitWindowOnAwake()
        {
            this.windowID = WindowID.WindowID_Matching;
            base.InitWindowOnAwake();

            InitWindowData();

            btnWin  = GameUtility.FindDeepChild(this.gameObject, "BtnWin").gameObject;
            btnLose = GameUtility.FindDeepChild(this.gameObject, "BtnLose").gameObject;

            // win the game
            UIEventListener.Get(btnWin).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("TestEmptyScene", delegate
                {
                    // 是否需要一个退出比赛单独接口?
                    // UIManager.GetInstance().ShowWindow(WindowID.WindowID_TopBar);
                    // UIManager.GetInstance().ShowWindow(WindowID.WindowID_LevelDetail);

                    UIManager.GetInstance().ShowWindow(WindowID.WindowID_MatchResult);
                    UIBaseWindow baseWindow = UIManager.GetInstance().GetGameWindow(WindowID.WindowID_MatchResult);
                    ((UIMatchResult)baseWindow).SetMatchResult(true, targetBackWindowId);
                });
            };

            // lose the game
            UIEventListener.Get(btnLose).onClick = delegate
            {
                GameMonoHelper.GetInstance().LoadGameScene("TestEmptyScene", delegate
                {
                    UIManager.GetInstance().ShowWindow(WindowID.WindowID_MatchResult);
                    UIBaseWindow baseWindow = UIManager.GetInstance().GetGameWindow(WindowID.WindowID_MatchResult);
                    ((UIMatchResult)baseWindow).SetMatchResult(false, targetBackWindowId);
                });
            };
        }