Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Log.EnableConsoleLog = true;
            Log.SendMessage("CLR: " + Environment.Version);
            Log.SendMessage("Machine Name: " + Environment.MachineName);
            Log.SendMessage("RAM for process (bytes): " + Environment.WorkingSet);
            Log.SendMessage("Number of processors: " + Environment.ProcessorCount);
            Log.SendMessage("OS x64: " + Environment.Is64BitOperatingSystem);
            Log.SendMessage("Process x64: " + Environment.Is64BitProcess);
            Log.SendMessage("OS: " + Environment.OSVersion.VersionString);
            //Log.EnableFileLog = true;

            Config.LoadConfigFile();

            ScreenWidth  = Window.ClientBounds.Width;
            ScreenHeight = Window.ClientBounds.Height;

            LoadingBr = new ScreenBr(new Vector2(ScreenWidth, ScreenHeight), 60, 255, GraphicsDevice, 0.001f);
            LoadingBr.CurrentFrame = 59;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameContent.LoadGameContent();
            _GlobalState = GlobalGameState.MainMenu;
            mainMenu     = new MainMenu(new Vector2(ScreenWidth, ScreenHeight), GameContent.UI_MainMenu_LogIn_BackGround, GameContent.UI_MainMenu_LogIn_Button, GameContent.UI_MainMenu_LogIn_EditBox, GameContent.UI_MainMenu_LogIn_ConnIcon, GameContent.UI_MainMenu_MenuBar, GameContent.UI_MainMenu_Button, GameContent.UI_MainMenu_HomeButton, GameContent.UI_MainMenu_MoneyBack, GameContent.UI_MainMenu_RollBack, GameContent.UI_MainMenu_NameBack, GameContent.UI_InfoFont, Color.Black, GraphicsDevice, this, 0.1f);
            //gameState = new GameState(ScreenWidth, ScreenHeight, GraphicsDevice);

            KeyBindings.RegisterKeyBind("KEY_MENU", Keys.Escape);
            Menu = new GameMenu(new Vector2(ScreenWidth, ScreenHeight), this, GameContent.UI_GameMenu_MainBack, GameContent.UI_GameMenu_OptionsBack, GameContent.UI_GameMenu_Button, GameContent.UI_GameMenu_ListBoxBtn, GameContent.UI_GameMenu_ListBoxChoosed, GameContent.UI_GameMenu_ListBoxOpenBtn, GameContent.UI_InfoFont, Color.Black, 0.1f);
            Menu.Hide(null, gameState, null);
        }
Пример #2
0
        public LogInForm(Vector2 Position, Texture2D BackGroundTexture, Texture2D ButtonTexture, Texture2D EditTexture, Texture2D ConnectingIconTexture, SpriteFont Font, Color TextColor, GraphicsDevice gr, float Layer = BasicSprite.DefaultLayer)
        {
            BackGround = new BasicSprite(Position, BackGroundTexture, Layer);
            Name       = new BasicText(Position + new Vector2(10), "Логин:", Font, TextColor, Layer - 0.0005f);
            NameEdit   = new EditBox(Name.Position + new Vector2(0, 30), EditTexture, "", Font, TextColor, 20, false, Layer - 0.0005f);
            Password   = new BasicText(NameEdit.Position + new Vector2(0, NameEdit.Texture.Height), "Пароль:", Font, TextColor, Layer - 0.0005f);
            PassEdit   = new EditBox(Password.Position + new Vector2(0, 30), EditTexture, "", Font, TextColor, 20, true, Layer - 0.0005f);

            Login    = new Button(PassEdit.Position + new Vector2(0, PassEdit.Texture.Height + 5), ButtonTexture, "Вход", Font, TextColor, ButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            Error    = new BasicText(Login.Position + new Vector2(0, PassEdit.Texture.Height + 10), "", Font, Color.Red, Layer - 0.0005f);
            Register = new Button(Login.Position + new Vector2(0, PassEdit.Texture.Height + 50), ButtonTexture, "Регистрация", Font, TextColor, ButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);

            Connecting_Icon         = new BasicSprite(Position + new Vector2(BackGround.Texture.Width, BackGround.Texture.Height) / 2, ConnectingIconTexture, new Vector2(ConnectingIconTexture.Width, ConnectingIconTexture.Height) / 2, 0f, Layer - 0.0005f);
            Connecting_Icon.Visible = false;
            Connecting_Text         = new BasicText(Connecting_Icon.Position - new Vector2(Font.MeasureString("Подключение к серверу...").X / 2, 64), "Подключение к серверу...", Font, TextColor, Layer - 0.0005f);
            Connecting_Text.Visible = false;

            Br = new ScreenBr(Config.Resolutions[Config.CurrResolution].ToVector2(), 3, 180, gr, Layer + 0.0005f);
        }
Пример #3
0
        public MainUI
        (
            Vector2 CurrentScreenRes,
            Texture2D UI_Bottom, Texture2D UI_BottomLeft, Texture2D UI_Up,
            Texture2D UI_UpLeft, Texture2D UI_UpRight, Texture2D ButtonEndTurn_Texture,
            Texture2D ButtonMove_Texture, Texture2D ButtonAttack_Texture, Texture2D ButtonGameMenu_Texture,
            Texture2D ButtonChat_Texture, Texture2D ButtonStats_Texture, Texture2D PlayerIcon,
            Texture2D OpponentIcon, Texture2D PlayerPointsIcon, Texture2D OpponentPointsIcon,
            Texture2D PlayerMoneyIcon, Texture2D RoundTimeIcon, Texture2D Vs,
            Texture2D CPAllied, Texture2D CPEnemy, Texture2D CPNeutral, Texture2D EnemyTurn,
            Texture2D WinTexture, Texture2D LoseTexture,
            SpriteFont Font,
            SpriteFont ResFont,
            SpriteFont NewTurn,
            GraphicsDevice Gr,
            GameState Parent,
            string PlayerName, string OpponentName, int PlayerPoints, int PlayerPoints_Inc,
            int OpponentPoints, int OpponentPoints_Inc, int Points_Needed,
            int PlayerMoney, int PlayerMoney_Inc,
            string RoundTime,
            string[] CPNames,
            int[] StartingCards,
            bool IsFirstTurn,
            float Layer = BasicSprite.DefaultLayer
        )
        {
            this.Parent = Parent;

            this.ShowingCards = StartingCards;

            this.WinTexture  = WinTexture;
            this.LoseTexture = LoseTexture;
            EndGame          = new BasicSprite(CurrentScreenRes / 2, WinTexture, new Vector2(WinTexture.Width / 2, WinTexture.Height / 2), 0f, 0.01f);
            EndGame.Visible  = false;

            Inf                = new InfoBox(Vector2.One, Color.Black, Color.LightBlue, Font, Color.Black, " ", Gr, 0.01f);
            Inf.Visible        = false;
            _CurrentScreenRes  = CurrentScreenRes;
            this.UI_Bottom     = new BasicSprite(new Vector2(UI_BottomLeft.Width, _CurrentScreenRes.Y - UI_Bottom.Height), UI_Bottom, Layer);
            this.UI_BottomLeft = new BasicSprite(new Vector2(0, _CurrentScreenRes.Y - UI_BottomLeft.Height), UI_BottomLeft, Layer - 0.0001f);
            this.UI_Up         = new BasicSprite(new Vector2(0, 0), UI_Up, Layer);
            this.UI_UpLeft     = new BasicSprite(new Vector2(0, 0), UI_UpLeft, Layer - 0.0001f);
            this.UI_UpRight    = new BasicSprite(new Vector2(_CurrentScreenRes.X - UI_UpRight.Width, 0), UI_UpRight, Layer - 0.0001f);

            //Верхний UI
            this.PlayerIcon         = new BasicSprite(new Vector2(0, 0), PlayerIcon, 0.09f);
            this.PlayerIcon.Scale   = new Vector2(0.4f);
            this.OpponentIcon       = new BasicSprite(new Vector2(_CurrentScreenRes.X - OpponentIcon.Width * 0.4f, 0), OpponentIcon, 0.09f);
            this.OpponentIcon.Scale = new Vector2(0.4f);
            this.PlayerName         = new BasicText(this.PlayerIcon.Position + new Vector2(PlayerIcon.Width * this.PlayerIcon.Scale.X + 10, 0), PlayerName, Font, Color.White, 0.09f);
            this.OpponentName       = new BasicText(this.OpponentIcon.Position - new Vector2(Font.MeasureString(OpponentName).X + 10, 0), OpponentName, Font, Color.White, 0.09f);

            this.PlayerPoints            = new UI_Resource_Info(new Vector2(this.PlayerName.Position.X, this.PlayerName.Position.Y + Font.MeasureString(PlayerName).Y), Color.Black, Color.FromNonPremultiplied(0, 0, 0, 130), ResFont, PlayerPointsIcon, Color.White, Color.LightGreen, "----------", "----------", Gr, Layer - 0.0005f);
            this.OpponentPoints          = new UI_Resource_Info(this.PlayerName.Position, Color.Black, Color.FromNonPremultiplied(0, 0, 0, 130), ResFont, OpponentPointsIcon, Color.White, Color.LightGreen, "----------", "----------", Gr, Layer - 0.0005f);
            this.OpponentPoints.Position = new Vector2(this.OpponentName.Position.X + Font.MeasureString(OpponentName).X - this.OpponentPoints.WidthHeight.X, this.OpponentName.Position.Y + Font.MeasureString(OpponentName).Y);

            this.PlayerMoney        = new UI_Resource_Info(new Vector2(this.PlayerName.Position.X, this.PlayerPoints.Position.Y + this.PlayerPoints.WidthHeight.Y + 5), Color.Black, Color.FromNonPremultiplied(0, 0, 0, 130), ResFont, PlayerMoneyIcon, Color.White, Color.LightGreen, "----------", "----------", Gr, Layer - 0.0005f);
            this.RoundTime          = new UI_Resource_Info(this.PlayerName.Position, Color.Black, Color.FromNonPremultiplied(0, 0, 0, 130), ResFont, RoundTimeIcon, Color.White, Color.Red, RoundTime, "", Gr, Layer - 0.0005f);
            this.RoundTime.Position = new Vector2(this.OpponentPoints.Position.X, this.OpponentPoints.Position.Y + this.OpponentPoints.WidthHeight.Y + 5);

            _Points_Needed      = Points_Needed;
            Player_Points       = PlayerPoints;
            Player_Points_Inc   = PlayerPoints_Inc;
            Opponent_Points     = OpponentPoints;
            Opponent_Points_Inc = OpponentPoints_Inc;
            Player_Money        = PlayerMoney;
            Player_Money_Inc    = PlayerMoney_Inc;

            //Нижний UI
            TileName = new BasicText(new Vector2(this.UI_BottomLeft.Position.X, this.UI_BottomLeft.Position.Y + 5), "", Font, Color.Black, Layer - 0.0005f);

            Btn_Move   = new Button(new Vector2(this.UI_BottomLeft.Position.X, this.UI_BottomLeft.Position.Y + 50), ButtonMove_Texture, ButtonMove_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);
            Btn_Attack = new Button(new Vector2(Btn_Move.Position.X + Btn_Move.FrameSize.X + 1, this.UI_BottomLeft.Position.Y + 50), ButtonAttack_Texture, ButtonAttack_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);

            Btn_EndTurn = new Button(new Vector2(this.UI_BottomLeft.Position.X, Btn_Move.Position.Y + Btn_Move.Texture.Height), ButtonEndTurn_Texture, "Закончить ход", Font, Color.Black, ButtonEndTurn_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);

            Btn_Stats    = new Button(new Vector2(this.UI_BottomLeft.Position.X, Btn_EndTurn.Position.Y + Btn_EndTurn.Texture.Height), ButtonStats_Texture, ButtonStats_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);
            Btn_Chat     = new Button(new Vector2(Btn_Stats.Position.X + Btn_Stats.FrameSize.X + 1, Btn_Stats.Position.Y), ButtonChat_Texture, ButtonChat_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);
            Btn_GameMenu = new Button(new Vector2(Btn_Chat.Position.X + Btn_Chat.FrameSize.X + 1, Btn_Stats.Position.Y), ButtonGameMenu_Texture, ButtonGameMenu_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);

            EnemyTurnSprite     = new BasicSprite(this.UI_BottomLeft.Position, EnemyTurn, this.UI_BottomLeft.Layer + 0.0005f);
            EnemyTurnText       = new BasicText(new Vector2(this.UI_BottomLeft.Position.X + (EnemyTurn.Width - Font.MeasureString("Ход противника").X) / 2, this.UI_BottomLeft.Position.Y + 5), "Ход противника", Font, Color.Black, this.UI_BottomLeft.Layer + 0.0003f);
            NewTurnText         = new ScalingText((CurrentScreenRes - NewTurn.MeasureString("")) / 2, "", NewTurn, Color.White, 20, 0f);
            NewTurnText.Visible = false;

            Br                    = new ScreenBr(CurrentScreenRes, 60, 220, Gr, 0.1f);
            this.Vs               = new BasicSprite(CurrentScreenRes / 2 - new Vector2(Vs.Width, Vs.Height) / 2, Vs, 0.09f);
            Cardchoose            = new CardChoose(CurrentScreenRes, GameContent.UI_CardReplace);
            ChooseText            = new BasicText(Vector2.Zero, "Выберите карты, которые хотите заменить", Font, Color.White, 0.001f);
            ChooseText.Visible    = false;
            ChooseText.Position   = new Vector2((CurrentScreenRes.X - Font.MeasureString(ChooseText.Text).X) / 2, CurrentScreenRes.Y / 2 - 250);
            ChooseConfirm         = new Button(new Vector2((CurrentScreenRes.X - ButtonEndTurn_Texture.Width / 4) / 2, CurrentScreenRes.Y / 2 + 250), ButtonEndTurn_Texture, "Заменить", Font, Color.Black, ButtonEndTurn_Texture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, 0.001f);
            ChooseConfirm.Visible = false;
            if (IsFirstTurn)
            {
                ChooseOrderText = new BasicText(Vector2.Zero, "Вы получили право первого хода", Font, Color.White, 0.001f);
            }
            else
            {
                ChooseOrderText = new BasicText(Vector2.Zero, "Противник получил право первого хода", Font, Color.White, 0.001f);
            }
            ChooseOrderText.Visible  = false;
            ChooseOrderText.Position = new Vector2((CurrentScreenRes.X - ChooseOrderText.Font.MeasureString(ChooseOrderText.Text).X) / 2, ChooseConfirm.Position.Y - 50);

            CPInfos = new CapturePointInfo[CPNames.Length];
            var StartPos = new Vector2((CurrentScreenRes.X - CPNames.Length * CPNeutral.Width) / 2, 0);

            for (var i = 0; i < CPNames.Length; i++)
            {
                CPInfos[i] = new CapturePointInfo(new Vector2(StartPos.X + i * CPNeutral.Width, 0), CPAllied, CPEnemy, CPNeutral, Font, CPNames[i], this.UI_Up.Layer - 0.001f);
            }

            StartVS();

            IsEnemyTurn = false;
            _IsEndGame  = false;
        }