예제 #1
0
        protected void OnJoinGame()
        {
            myMsgBox.Hide();

            if (!myMapRendererSetUp)
            {
                MapRenderer.CameraX = 20;
                MapRenderer.CameraY = 16;

                MapRenderer.CameraScale = 1.0f;

                MapRenderer.SetUp(Width, Height);
                myMapRendererSetUp = true;
            }

            mySinglePlayerButton.Disable();
            myMultiPlayerButton.Disable();

            myMainMenu.InsertButton(0, "Continue", delegate(object sender, MouseButtonEventArgs e)
            {
                myMainMenu.Hide();
            });
            myMainMenu.InsertButton(1, "Leave Map", delegate(object sender, MouseButtonEventArgs e)
            {
                GameClient.SendPlayerLeaveMap();
                myMainMenu.Hide();

                RemoveChild(myManaBar);
                RemoveChild(myHPBar);

                MapRenderer.CameraScale = 1.0f;

                AddChild(myWorldMap);

                myInGame           = false;
                myViewingOverworld = true;
            });
            myMainMenu.InsertButton(2, "Leave Game", delegate(object sender, MouseButtonEventArgs e)
            {
                myMainMenu.RemoveButton(0);
                myMainMenu.RemoveButton(0);
                myMainMenu.RemoveButton(0);
                myMainMenu.RemoveButton(0);
                myMainMenu.AutoSize();
                myMainMenu.Centre();

                mySinglePlayerButton.Enable();
                myMultiPlayerButton.Enable();

                RemoveChild(myHPBar);
                RemoveChild(myManaBar);

                myInGame            = false;
                myJoinedLocalServer = false;

                GameClient.Disconnect();

                if (GameServer.Running)
                {
                    GameServer.Stop();
                }
            });
            myMainMenu.InsertButton(3, "View Stats", delegate(object sender, MouseButtonEventArgs e)
            {
                myMainMenu.Disable();

                CharAttribDisplay popup = new CharAttribDisplay(GameClient.PlayerEntity);
                AddChild(popup);
                popup.Centre();

                popup.Closed += delegate(object sender2, EventArgs e2)
                {
                    myMainMenu.Enable();
                };
            }).Disable();

            myMainMenu.AutoSize();
            myMainMenu.Centre();

            myWorldMap = new WorldMap(new Vector2(Width, Height), GameClient.Overworld);
            myWorldMap.DungeonSelected += delegate(object sender, DungeonSelectedEventArgs e)
            {
                GameClient.SendMapRequest(e.Dungeon.ID);

                // GameClient.SendMapRequest( 0xFFFF );

                RemoveChild(myWorldMap);
            };
            AddChild(myWorldMap);

            myViewingOverworld = true;
        }