コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            if (OnlineGameClient != null)
            {
                OnlineGameClient.ExecuteDelayedScripts();
            }

            if (OnlineCommunicationClient != null)
            {
                OnlineCommunicationClient.ExecuteDelayedScripts();
            }

            if (FMODSystem.sndActiveBGM != sndBGM)
            {
                sndBGM.PlayAsBGM();
            }

            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Update(gameTime);
            }

            if (OnlineCommunicationClient != null)
            {
                ChatHelper.UpdateChat(gameTime, OnlineCommunicationClient.Chat, ChatInput);
            }

            if (SelectingTeam == -1 && Room.UseTeams && ListMapTeam.Count > 0 && MouseHelper.InputLeftButtonPressed())
            {
                int DrawX       = 10;
                int DrawY       = 45;
                int PlayerIndex = (MouseHelper.MouseStateCurrent.Y - DrawY) / 45;
                if (PlayerIndex >= 0 && PlayerIndex < Room.ListRoomPlayer.Count)
                {
                    Rectangle TeamCollisionBox = new Rectangle(DrawX + 280, DrawY + PlayerIndex * 45, 80, 25);
                    if (PlayerManager.ListLocalPlayer.Contains(Room.ListRoomPlayer[PlayerIndex]) && TeamCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y))
                    {
                        SelectingTeam = PlayerIndex;
                    }
                }
            }
            else if (SelectingTeam != -1 && MouseHelper.InputLeftButtonPressed())
            {
                int DrawX     = 10;
                int DrawY     = 45 + 30 + SelectingTeam * 45;
                int TeamIndex = (MouseHelper.MouseStateCurrent.Y - DrawY) / 25;
                if (TeamIndex >= 0 && TeamIndex < ListMapTeam.Count)
                {
                    Rectangle TeamCollisionBox = new Rectangle(DrawX + 285, DrawY + TeamIndex * 25, 85, 25);
                    if (TeamCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y))
                    {
                        Room.ListRoomPlayer[SelectingTeam].Team = TeamIndex;
                    }
                }
                SelectingTeam = -1;
            }
        }
コード例 #2
0
ファイル: Lobby.cs プロジェクト: Wargamer3/Project-Eternity
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin();
            g.Draw(sprBackground, Vector2.Zero, Color.White);

            int LeftSideWidth = (int)(Constants.Width * 0.7);
            int TopSectionHeight = (int)(Constants.Height * 0.1);
            int MiddleSectionY = TopSectionHeight;
            int MiddleSectionHeight = (int)(Constants.Height * 0.6);
            int RoomSectionY = (int)(MiddleSectionY + MiddleSectionHeight * 0.2);
            int RoomSectionHeight = MiddleSectionHeight - (RoomSectionY - MiddleSectionY);
            int BottomSectionY = MiddleSectionY + MiddleSectionHeight;

            //Left side
            DrawBox(g, new Vector2(0, 0), LeftSideWidth, TopSectionHeight, Color.White);
            g.DrawString(fntArial12, "Player 1", new Vector2(10, 15), Color.White);
            g.DrawString(fntArial12, "Player 2", new Vector2(110, 15), Color.White);
            g.DrawString(fntArial12, "Player 3", new Vector2(210, 15), Color.White);
            g.DrawString(fntArial12, "Player 4", new Vector2(310, 15), Color.White);
            DrawBox(g, new Vector2(0, MiddleSectionY), LeftSideWidth, MiddleSectionHeight - RoomSectionHeight, Color.White);
            DrawBox(g, new Vector2(0, RoomSectionY), LeftSideWidth, RoomSectionHeight, Color.White);
            DrawBox(g, new Vector2(0, BottomSectionY), LeftSideWidth, Constants.Height - BottomSectionY, Color.White);

            int RightSideWidth = Constants.Width - LeftSideWidth;
            int PlayerInfoHeight = (int)(Constants.Height * 0.2);
            int PlayerListY = PlayerInfoHeight;
            int PlayerListHeight = (int)(Constants.Height * 0.6);
            int InventoryShopListY = PlayerListY + PlayerListHeight;
            int InventoryShopListHeight = Constants.Height - InventoryShopListY;

            //Right side
            DrawBox(g, new Vector2(LeftSideWidth, 0), RightSideWidth, PlayerListY, Color.White);
            DrawBox(g, new Vector2(LeftSideWidth, PlayerListY), RightSideWidth, PlayerListHeight, Color.White);
            DrawBox(g, new Vector2(LeftSideWidth, InventoryShopListY), RightSideWidth, InventoryShopListHeight, Color.White);
            g.DrawString(fntArial12, "Inventory*Shop", new Vector2(LeftSideWidth + 5, InventoryShopListY + 5), Color.White);


            g.DrawString(fntArial12, "Lv." + PlayerManager.OnlinePlayerLevel, new Vector2(610, 17), Color.White);
            g.DrawString(fntArial12, PlayerManager.OnlinePlayerName, new Vector2(670, 15), Color.White);

            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            DrawRooms(g);
            if (OnlineCommunicationClient != null)
            {
                ChatHelper.DrawChat(g, fntArial12, OnlineCommunicationClient.Chat, ChatInput);
            }
            DrawPlayers(g);

            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Draw(g);
            }
        }
コード例 #3
0
ファイル: Lobby.cs プロジェクト: Wargamer3/Project-Eternity
        public override void Update(GameTime gameTime)
        {
            if (OnlineGameClient != null)
            {
                OnlineGameClient.ExecuteDelayedScripts();
                OnlineCommunicationClient.ExecuteDelayedScripts();

                ChatHelper.UpdateChat(gameTime, OnlineCommunicationClient.Chat, ChatInput);
            }

            if (FMODSystem.sndActiveBGM != sndBGM)
            {
                sndBGM.PlayAsBGM();
            }

            UpdateRooms();
            UpdatePlayers();

            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Update(gameTime);
            }
        }
コード例 #4
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            int LeftSideWidth    = (int)(Constants.Width * 0.7);
            int RoomNameHeight   = (int)(Constants.Height * 0.05);
            int PlayerZoneY      = RoomNameHeight;
            int PlayerZoneHeight = (int)(Constants.Height * 0.65);
            int ChatZoneY        = PlayerZoneY + PlayerZoneHeight;
            int ChatZoneHeight   = Constants.Height - ChatZoneY;

            DrawBox(g, new Vector2(0, 0), LeftSideWidth, RoomNameHeight, Color.White);
            g.DrawString(fntText, "Room Name:", new Vector2(5, 7), Color.White);
            g.DrawString(fntText, Room.RoomName, new Vector2(95, 7), Color.White);
            DrawBox(g, new Vector2(0, PlayerZoneY), LeftSideWidth, PlayerZoneHeight, Color.White);
            DrawBox(g, new Vector2(0, ChatZoneY), LeftSideWidth, ChatZoneHeight, Color.White);
            g.DrawString(fntText, "Chat", new Vector2(10, ChatZoneY + 10), Color.White);


            int RightSideWidth      = Constants.Width - LeftSideWidth;
            int MapDetailTextY      = (int)(Constants.Height * 0.3);
            int MapDetailTextHeight = (int)(Constants.Height * 0.3);
            int RoomOptionHeight    = (int)(Constants.Height * 0.08);

            DrawBox(g, new Vector2(LeftSideWidth, 0), RightSideWidth, Constants.Height, Color.White);
            g.DrawString(fntText, "Player Info", new Vector2(LeftSideWidth + 10, 7), Color.White);
            DrawBox(g, new Vector2(LeftSideWidth, MapDetailTextY), RightSideWidth, MapDetailTextHeight, Color.White);

            int GameModeY = MapDetailTextY + RoomOptionHeight;

            g.DrawString(fntText, "Game Mode:", new Vector2(LeftSideWidth + 10, GameModeY + 10), Color.White);
            g.DrawStringMiddleAligned(fntText, "Campaign", new Vector2(LeftSideWidth + RightSideWidth - 45, GameModeY + 10), Color.White);
            GameModeY += 15;
            g.DrawString(fntText, "Players:", new Vector2(LeftSideWidth + 10, GameModeY + 10), Color.White);
            if (Room.MinNumberOfPlayer != Room.MaxNumberOfPlayer)
            {
                g.DrawStringMiddleAligned(fntText, Room.MinNumberOfPlayer + " - " + Room.MaxNumberOfPlayer, new Vector2(LeftSideWidth + RightSideWidth - 45, GameModeY + 10), Color.White);
            }
            else
            {
                g.DrawStringMiddleAligned(fntText, Room.MinNumberOfPlayer.ToString(), new Vector2(LeftSideWidth + RightSideWidth - 45, GameModeY + 10), Color.White);
            }
            GameModeY += 15;
            g.DrawString(fntText, "Map Size:", new Vector2(LeftSideWidth + 10, GameModeY + 10), Color.White);
            g.DrawStringMiddleAligned(fntText, MapSize.X + " x " + MapSize.Y, new Vector2(LeftSideWidth + RightSideWidth - 45, GameModeY + 10), Color.White);
            GameModeY += 110;
            g.Draw(sprMapImage, new Vector2(LeftSideWidth + (RightSideWidth - sprMapImage.Width) / 2, GameModeY), Color.White);
            GameModeY += 85;
            g.DrawString(fntText, "Map:", new Vector2(LeftSideWidth + 10, GameModeY + 10), Color.White);
            if (Room.MapPath != null)
            {
                g.DrawStringMiddleAligned(fntText, Room.MapName, new Vector2(LeftSideWidth + RightSideWidth - 45, GameModeY + 10), Color.White);
            }
            GameModeY += 15;
            g.DrawString(fntText, "Details:", new Vector2(LeftSideWidth + 10, GameModeY + 10), Color.White);
            GameModeY += 15;
            g.DrawString(fntText, "Tutorial map aimed to introduce the basics of the\r\ncampaign mode", new Vector2(LeftSideWidth + 15, GameModeY + 10), Color.White);


            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Draw(g);
            }

            if (OnlineCommunicationClient != null)
            {
                ChatHelper.DrawChat(g, fntText, OnlineCommunicationClient.Chat, ChatInput);
            }

            for (int P = 0; P < Room.ListRoomPlayer.Count; ++P)
            {
                int DrawX = 10;
                int DrawY = 45 + P * 45;

                DrawBox(g, new Vector2(DrawX - 5, DrawY - 10), LeftSideWidth - 10, 45, Color.White);
                DrawPlayerBox(g, DrawX, DrawY, P);
            }
            if (SelectingTeam >= 0)
            {
                int DrawX = 10;
                int DrawY = 45 + SelectingTeam * 45;
                DrawBox(g, new Vector2(DrawX + 280, DrawY + 25), 85, 5 + 25 * ListMapTeam.Count, Color.White);
                for (int T = 0; T < ListMapTeam.Count; T++)
                {
                    Rectangle TeamCollisionBox = new Rectangle(DrawX + 285, DrawY + 30 + T * 25, 85, 25);
                    if (TeamCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y))
                    {
                        g.Draw(sprPixel, new Rectangle(DrawX + 285, DrawY + 28 + T * 25, 75, 22), Color.FromNonPremultiplied(255, 255, 255, 127));
                    }
                    g.DrawString(fntText, ListAllTeamInfo[T].TeamName, new Vector2(DrawX + 285, DrawY + 30 + T * 25), Color.White);
                }
            }
        }