コード例 #1
0
        public bool LoadFrame()
        {
            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/MainForm.nui");

            myHP = GUISystem.Instance.RootWindow.FindChild("MyHP", true) as UIProgressBar;
            myMP = GUISystem.Instance.RootWindow.FindChild("MyMP", true) as UIProgressBar;
            //myEnergy = GUISystem.Instance.RootWindow.FindChild("MyEnergy", true) as UIProgressBar;

            myMessageTips1 = GUISystem.Instance.RootWindow.FindChild("MessageTips1", true) as UIStaticText;
            myMessageTips1.TextRenderComp.Text = String.Empty;
            myMessageTips1.Hide();
            myMessageTips2 = GUISystem.Instance.RootWindow.FindChild("MessageTips2", true) as UIStaticText;
            myMessageTips2.TextRenderComp.Text = String.Empty;
            myMessageTips2.Hide();
            myMessageTips3 = GUISystem.Instance.RootWindow.FindChild("MessageTips3", true) as UIStaticText;
            myMessageTips3.TextRenderComp.Text = String.Empty;
            myMessageTips3.Hide();

            GameEngine.EngineInstance.LocalPlayer.StatInited  += new EventHandler <StatEventArgs>(LocalPlayerController_StatInited);
            GameEngine.EngineInstance.LocalPlayer.StatUpdated += new EventHandler <StatEventArgs>(LocalPlayerController_StatUpdated);

            UpdateStatInfo(GameEngine.EngineInstance.LocalPlayer.StatData);

            return(true);
        }
コード例 #2
0
        public bool LoadFrame()
        {
            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/SpellPrepareForm.nui");

            prepareProgressBar = GUISystem.Instance.RootWindow.FindChild("PBSpellPrep", true) as UIProgressBar;
            prepareProgressBar.Hide();

            return(true);
        }
コード例 #3
0
        public bool LoadFrame()
        {
            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/LoginForm.nui");

            uiID       = GUISystem.Instance.RootWindow.FindChild("ID", true) as UIEditBox;
            uiPassword = GUISystem.Instance.RootWindow.FindChild("Password", true) as UIEditBox;
            uiPassword.MaxTextLength = (int)LoginConst.MaxPasswordLen;

            btnOK = GUISystem.Instance.RootWindow.FindChild("LoginOK", true) as UIButton;
            UIButton btnCancel = GUISystem.Instance.RootWindow.FindChild("LoginCancel", true) as UIButton;

            btnOK.Disable();
            btnOK.Clicked     += new EventHandler <GUIEventArgs>(btnOK_Clicked);
            btnCancel.Clicked += new EventHandler <GUIEventArgs>(btnCancel_Clicked);
            return(true);
        }
コード例 #4
0
        public bool LoadFrame()
        {
            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/CreateRoleForm.nui");

            uiRoleName = GUISystem.Instance.RootWindow.FindChild("CreateRoleNameEditBox", true) as UIEditBox;
            btnBoy     = GUISystem.Instance.RootWindow.FindChild("CreateBoy", true) as UIRadioButton;
            btnGirl    = GUISystem.Instance.RootWindow.FindChild("CreateGirl", true) as UIRadioButton;
            btnOK      = GUISystem.Instance.RootWindow.FindChild("LoginOK", true) as UIButton;
            UIButton btnCancel = GUISystem.Instance.RootWindow.FindChild("CreateCancel", true) as UIButton;

            uiRoleName.ClearText();
            uiRoleName.TextChange += new EventHandler <WindowEventArgs>(uiRoleName_TextChange);

            btnOK.Clicked += new EventHandler <GUIEventArgs>(btnOK_Clicked);
            btnOK.Disable();

            btnCancel.Clicked += new EventHandler <GUIEventArgs>(btnCancel_Clicked);

            return(true);
        }
コード例 #5
0
        public bool LoadFrame()
        {
            // 发送请求角色列表消息
            C2S_CharEnum msg;

            msg.messageId = C2S_CharEnum.Id;
            GameFrameManager.SendNetMessage <C2S_CharEnum>(msg);

            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/SelectRoleForm.nui");

            UIButton btnCreateRole = GUISystem.Instance.RootWindow.FindChild("CreateRole", true) as UIButton;

            btnEnterGame = GUISystem.Instance.RootWindow.FindChild("EnterGame", true) as UIButton;
            UIButton btnExitGame = GUISystem.Instance.RootWindow.FindChild("ExitGame", true) as UIButton;

            btnEnterGame.Disable();
            btnCreateRole.Clicked += new EventHandler <GUIEventArgs>(btnCreateRole_Clicked);
            btnEnterGame.Clicked  += new EventHandler <GUIEventArgs>(btnEnterGame_Clicked);
            btnExitGame.Clicked   += new EventHandler <GUIEventArgs>(btnExitGame_Clicked);

            return(true);
        }
コード例 #6
0
        public bool LoadFrame()
        {
            WindowCollection windowCollection = GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/MiniMap.nui");

            if (windowCollection != null)
            {
                miniMap    = (Nexus.GUI.Widgets.UIShapedImageBox)GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UIShapedImageBox1", true);
                coordLabel = (Nexus.GUI.Widgets.UILabel)GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UILabel1", true);
                if (miniMap != null)
                {
                    miniMap.BackgroundRenderComp.ImageLocation = new NResourceLoc("content", "/minimap/minimap.dds");
                    miniMapSize = miniMap.BackgroundRenderComp.Texture.GetOriginalSize();
                    Vector2 center = new Vector2(miniMapSize.x * 0.5f, miniMapSize.y * 0.5f);
                    miniMap.BackgroundRenderComp.TextureRect = new Rect(center.x - minimapRange.x, center.y - minimapRange.y,
                                                                        center.x + minimapRange.x, center.y + minimapRange.y);
                    Vector3 scale = GameEngine.EngineInstance.CurrentLevel.NavigationMapScale;
                    sceneSize.x    = GameEngine.EngineInstance.CurrentLevel.NavigationMapWidth * scale.x;
                    sceneSize.y    = GameEngine.EngineInstance.CurrentLevel.NavigationMapHeight * scale.z;
                    minimapRatio.x = minimapRange.x * 2 / miniMap.Width.offest;
                    minimapRatio.y = minimapRange.y * 2 / miniMap.Height.offest;

                    Icons = NResourceManager.Instance.LoadTextureAtlas(new NResourceLoc("content", "/ui/texAtlas/content1.txa"), EResourceIOMode.Auto, EResourceIOPriority.Normal);
                    if (Icons == null)
                    {
                        return(false);
                    }

                    {
                        NTexAtlasItem item = Icons.GetItem("minimap_6");
                        playerIcon = new Rect(item.UVStart.x, item.UVStart.y, item.UVEnd.x, item.UVEnd.y);
                    }

                    {
                        NTexAtlasItem item = Icons.GetItem("minimap-5");
                        northIcon = new Rect(item.UVStart.x, item.UVStart.y, item.UVEnd.x, item.UVEnd.y);
                    }

                    {
                        NTexAtlasItem item = Icons.GetItem("minimap-5");
                        aroundRoleIcon = new Rect(item.UVStart.x, item.UVStart.y, item.UVEnd.x, item.UVEnd.y);
                    }
                    //------------------------------------------------------
                    miniMap.BackgroundRenderComp.OnRendering += this.OnDraw;

                    Window win = GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UIButton2", true);
                    if (win != null)
                    {
                        win.MouseClicked += this.ZoomIn;
                    }

                    win = GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UIButton3", true);
                    if (win != null)
                    {
                        win.MouseClicked += this.ZoomOut;
                    }

                    win = GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UIButton4", true);
                    if (win != null)
                    {
                        win.MouseClicked += this.OnMinsize;
                    }

                    win = GUISystem.Instance.RootWindow.FindChild("root/UIStaticImage1/UIButton5", true);
                    if (win != null)
                    {
                        win.MouseClicked += this.OnShowWorldMap;
                    }


                    // 添加测试用角色
                    RoleAround a = new RoleAround(1, RoleStandpoint.RoleFriendly); roleAround.Add(a);
                    RoleAround b = new RoleAround(2, RoleStandpoint.RoleNeutrally); roleAround.Add(b);
                    RoleAround c = new RoleAround(3, RoleStandpoint.RoleHostile); roleAround.Add(c);
                    a.Position = new Vector2(500, 400);
                    b.Position = new Vector2(450, 500);
                    c.Position = new Vector2(550, 450);
                }
            }

            return(windowCollection != null);
        }