Esempio n. 1
0
        //Конструктор
        public TileInfo(Vector2 Position, Texture2D Texture, SpriteFont Font, Color TextColor, string NeedMovePoints, string Defense, float Layer = DefaultLayer) : base(Position, Texture, Layer)
        {
            CellWidth = Texture.Width / 4 + 1;
            var VectTmp = Font.MeasureString(NeedMovePoints);

            _NeedMovePointsInfo = new BasicText(new Vector2(Position.X + CellWidth + CellWidth / 2 - VectTmp.X / 2 + 3, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), NeedMovePoints, Font, TextColor, Layer - 0.0001f);
            VectTmp             = Font.MeasureString(Defense);
            _DefenseInfo        = new BasicText(new Vector2(Position.X + CellWidth * 3 + CellWidth / 2 - VectTmp.X / 2 + 6, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), Defense, Font, TextColor, Layer - 0.0001f);
            iteration           = 0;
        }
Esempio n. 2
0
        public CapturePointInfo(Vector2 Position, Texture2D Allied_Texture, Texture2D Enemy_Texture, Texture2D Neutral_Texture, SpriteFont Font, string Text, float Layer = BasicSprite.DefaultLayer)
        {
            this.Allied_Texture  = Allied_Texture;
            this.Enemy_Texture   = Enemy_Texture;
            this.Neutral_Texture = Neutral_Texture;

            Sprite  = new BasicSprite(Position, Neutral_Texture, Layer);
            TextObj = new BasicText(Position + (new Vector2(Neutral_Texture.Width, Neutral_Texture.Height) - Font.MeasureString(Text)) / 2, Text, Font, Color.Black, Layer - 0.001f);
            Visible = true;
        }
Esempio n. 3
0
 /// <summary>
 /// Создает кнопку без текста
 /// </summary>
 /// <param name="Position">Координаты кнопки</param>
 /// <param name="Texture">Текстура кнопки</param>
 /// <param name="FrameSizeX">Размер кадра по X</param>
 /// <param name="FPS">Кол-во кадров в секунду в анимациях</param>
 /// <param name="NotSelectedFrame">Кадр, когда кнопка не выбрана</param>
 /// <param name="Selected">Анимация, когда кнопка выбрана</param>
 /// <param name="ClickedFrame">Кадр, когда кнопка нажата</param>
 /// <param name="Layer">Слой, на котором расположена кнопка</param>
 public Button(Vector2 Position, Texture2D Texture, int FrameSizeX, int FPS, int NotSelectedFrame, Animation Selected, int ClickedFrame, int DisabledFrame, float Layer = DefaultLayer) : base(Position, Texture, FrameSizeX, FPS, Layer + 0.0001f)
 {
     AddAnimation("Selected", Selected);
     this.NotSelectedFrame = NotSelectedFrame;
     this.ClickedFrame     = ClickedFrame;
     this.DisabledFrame    = DisabledFrame;
     Intersector           = new Intersector(Position, new Vector2(Position.X + FrameSize.X, Position.Y), new Vector2(Position.X + FrameSize.X, Position.Y + FrameSize.Y), new Vector2(Position.X, Position.Y + FrameSize.Y));
     _Text   = null;
     Enabled = true;
 }
Esempio n. 4
0
 /// <summary>
 /// Создает кнопку
 /// </summary>
 /// <param name="Position">Координаты кнопки</param>
 /// <param name="Texture">Текстура кнопки</param>
 /// <param name="Text">Текст кнопки</param>
 /// <param name="Font">Шрифт</param>
 /// <param name="color">Цвет шрифта</param>
 /// <param name="FrameSizeX">Размер кадра по X</param>
 /// <param name="FPS">Кол-во кадров в секунду в анимациях</param>
 /// <param name="NotSelectedFrame">Кадр, когда кнопка не выбрана</param>
 /// <param name="Selected">Анимация, когда кнопка выбрана</param>
 /// <param name="ClickedFrame">Кадр, когда кнопка нажата</param>
 /// <param name="Layer">Слой, на котором расположена кнопка</param>
 public Button(Vector2 Position, Texture2D Texture, string Text, SpriteFont Font, Color color, int FrameSizeX, int FPS, int NotSelectedFrame, Animation Selected, int ClickedFrame, int DisabledFrame, float Layer = DefaultLayer) : base(Position, Texture, FrameSizeX, FPS, Layer + 0.0001f)
 {
     AddAnimation("Selected", Selected);
     this.NotSelectedFrame = NotSelectedFrame;
     this.ClickedFrame     = ClickedFrame;
     this.DisabledFrame    = DisabledFrame;
     Intersector           = new Intersector(Position, new Vector2(Position.X + FrameSize.X, Position.Y), new Vector2(Position.X + FrameSize.X, Position.Y + FrameSize.Y), new Vector2(Position.X, Position.Y + FrameSize.Y));
     _Text   = new BasicText(new Vector2(Position.X + (FrameSize.X - Font.MeasureString(Text).X) / 2, Position.Y + (FrameSize.Y - Font.MeasureString(Text).Y) / 2), Text, Font, color, Layer);
     Enabled = true;
 }
Esempio n. 5
0
        public InfoBox(Vector2 Position, Color LineColor, Color RectColor, SpriteFont Font, Color TextColor, string InfoText, GraphicsDevice GrDevice, float Layer = BasicSprite.DefaultLayer)
        {
            _Text = new BasicText(new Vector2(Position.X + 5, Position.Y + 2), InfoText, Font, TextColor, Layer - 0.0001f);
            var textwidth = _Text.Font.MeasureString(_Text.Text) * _Text.Scale;

            _Rect         = new SimpleRectangle(Position, textwidth + new Vector2(9, 3), LineColor, RectColor, GrDevice, Layer);
            this.Position = Position;
            Scale         = new Vector2(1);
            this.Layer    = Layer;
            iteration     = 0;
        }
Esempio n. 6
0
        public Card(Card card) : base(card.Position, card.Texture, (int)Math.Truncate(card.FrameSize.X), card.FPS, card.NotSelectedFrame, card.GetAnimation("Selected"), card.ClickedFrame, card.DisabledFrame, card.Layer)
        {
            Art      = new BasicSprite(card.Art.Position, card.Art.Texture, card.Art.Layer);
            CardName = new BasicText(card.CardName.Position, card.CardName.Text, card.CardName.Font, card.CardName.color, card.CardName.Layer);
            ;
            DamageInfo         = new BasicText(card.DamageInfo.Position, card.DamageInfo.Text, card.DamageInfo.Font, card.DamageInfo.color, card.DamageInfo.Layer);
            DefenseInfo        = new BasicText(card.DefenseInfo.Position, card.DefenseInfo.Text, card.DefenseInfo.Font, card.DefenseInfo.color, card.DefenseInfo.Layer);
            AttackDistanceInfo = new BasicText(card.AttackDistanceInfo.Position, card.AttackDistanceInfo.Text, card.AttackDistanceInfo.Font, card.AttackDistanceInfo.color, card.AttackDistanceInfo.Layer);
            MovePointsInfo     = new BasicText(card.MovePointsInfo.Position, card.MovePointsInfo.Text, card.MovePointsInfo.Font, card.MovePointsInfo.color, card.MovePointsInfo.Layer);
            HPInfo             = new BasicText(card.HPInfo.Position, card.HPInfo.Text, card.HPInfo.Font, card.HPInfo.color, card.HPInfo.Layer);

            MoneyInfo = new BasicText(card.MoneyInfo.Position, card.MoneyInfo.Text, card.MoneyInfo.Font, card.MoneyInfo.color, card.MoneyInfo.Layer);

            _UpPosition   = card._UpPosition;
            _DownPosition = card._DownPosition;
            _MoveVector   = card._MoveVector;
            AddAnimation("Disappear", card.GetAnimation("Disappear"));
            AddAnimation("Appear", card.GetAnimation("Appear"));
            AddAnimation("Choosed", card.GetAnimation("Choosed"));
            LastLayer       = card.LastLayer;
            IsDown          = card.IsDown;
            LockClicking    = card.LockClicking;
            IsPressed       = card.IsPressed;
            LockClicking    = card.LockClicking;
            IsMoving        = card.IsMoving;
            IsTargeted      = card.IsTargeted;
            IsDisappearing  = card.IsDisappearing;
            Position        = card.Position;
            Scale           = card.Scale;
            Stats_OffsY     = card.Stats_OffsY;
            FirstStat_OffsX = card.FirstStat_OffsX;
            MidStat_OffsX   = card.MidStat_OffsX;
            StatCellWidth   = card.StatCellWidth;
            MoveSpeed       = card.MoveSpeed;
            UpdBtnAnims     = card.UpdBtnAnims;
            if (card.IsDisappearing)
            {
                Art.Visible                = false;
                CardName.Visible           = false;
                DamageInfo.Visible         = false;
                DefenseInfo.Visible        = false;
                AttackDistanceInfo.Visible = false;
                MovePointsInfo.Visible     = false;
                HPInfo.Visible             = false;
                MoneyInfo.Visible          = false;
            }

            AllowedTiles = card.AllowedTiles;
            AllowedZones = card.AllowedZones;
        }
Esempio n. 7
0
        public UI_Resource_Info(Vector2 Position, Color LineColor, Color RectColor, SpriteFont Font, Texture2D Icon, Color TextColor, Color AddTextColor, string MainText, string AddText, GraphicsDevice GrDevice, float Layer = BasicSprite.DefaultLayer)
        {
            _Icon     = new BasicSprite(new Vector2(Position.X + 5, Position.Y + 2), Icon, Layer - 0.0001f);
            _MainText = new BasicText(new Vector2(Position.X + 5 + Icon.Width, Position.Y + 2), MainText, Font, TextColor, Layer - 0.0001f);
            var textwidth = _MainText.Font.MeasureString(MainText) * _MainText.Scale + new Vector2(Icon.Width, 0);

            _AdditionalText = new BasicText(new Vector2(Position.X + 5 + textwidth.X, Position.Y + 2), AddText, Font, AddTextColor, Layer - 0.0001f);
            textwidth       = new Vector2(textwidth.X + _AdditionalText.Font.MeasureString(AddText).X *_AdditionalText.Scale.X, textwidth.Y);
            _Rect           = new SimpleRectangle(Position, textwidth + new Vector2(9, 3), LineColor, RectColor, GrDevice, Layer);
            intersect       = new Intersector(new Rectangle(_Rect.Position.ToPoint(), _Rect.WidthHeight.ToPoint()));
            this.Position   = Position;
            Scale           = new Vector2(1);
            this.Layer      = Layer;
            Visible         = true;
        }
Esempio n. 8
0
        //Конструктор
        public UnitInfo(Vector2 Position, Texture2D Texture, SpriteFont Font, Color TextColor, string MovePoints, string Defense, string Damage, string HP, float Layer = DefaultLayer) : base(Position, Texture, Layer)
        {
            CellWidth = Texture.Width / 4 + 1;

            var VectTmp = Font.MeasureString(Damage);

            _DamageInfo = new BasicText(new Vector2(Position.X + CellWidth / 2 - VectTmp.X / 2, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), Damage, Font, TextColor, Layer - 0.0001f);

            VectTmp      = Font.MeasureString(Defense);
            _DefenseInfo = new BasicText(new Vector2(Position.X + CellWidth + CellWidth / 2 - VectTmp.X / 2, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), Defense, Font, TextColor, Layer - 0.0001f);

            VectTmp         = Font.MeasureString(MovePoints);
            _MovePointsInfo = new BasicText(new Vector2(Position.X + CellWidth * 2 + CellWidth / 2 - VectTmp.X / 2, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), MovePoints, Font, TextColor, Layer - 0.0001f);

            VectTmp = Font.MeasureString(HP);
            _HPInfo = new BasicText(new Vector2(Position.X + CellWidth * 3 + CellWidth / 2 - VectTmp.X / 2 - 1, Position.Y + Texture.Height / 2 - VectTmp.Y / 2 + 1), HP, Font, TextColor, Layer - 0.0001f);

            iteration = 0;
        }
Esempio n. 9
0
        public ListBox(Vector2 Position, Texture2D VariantTexture, Texture2D ChoosedVariantTexture, Texture2D ButtonTexture, SpriteFont Font, Color TextColor, string[] Variants, float Layer = BasicSprite.DefaultLayer)
        {
            OpenButton     = new Button(Position, ButtonTexture, ButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);
            ChoosedVariant = new BasicSprite(Position + new Vector2(OpenButton.FrameSize.X, 0), ChoosedVariantTexture, Layer);
            var TmpStr = "";

            if (Variants.Length > 0)
            {
                TmpStr = Variants[0];
            }
            Text = new BasicText(ChoosedVariant.Position + (new Vector2(ChoosedVariant.Texture.Width, ChoosedVariant.Texture.Height) - Font.MeasureString(TmpStr)) / 2, TmpStr, Font, TextColor, Layer - 0.0005f);

            this.Variants = new List <Button>();
            for (var i = 0; i < Variants.Length; i++)
            {
                this.Variants.Add(new Button(new Vector2(ChoosedVariant.Position.X, ChoosedVariant.Position.Y + ChoosedVariant.Texture.Height + VariantTexture.Height * i), VariantTexture, Variants[i], Font, TextColor, VariantTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer));
                this.Variants[i].Visible = false;
            }
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        public Collection(Vector2 ScreenRes, Color FontColor, bool[] IsSovietCardInCollection, bool[] IsGermanCardInCollection, int CardTextureWidth, float Layer = BasicSprite.DefaultLayer)
        {
            Cards      = new Card[3];
            DeckChange = new Button[8];

            this.CardTextureWidth = CardTextureWidth;
            CardTextureHeight     = GameContent.CardTexture.Height;
            this.Layer            = Layer;

            Pages        = (GameContent.UnitCards.Count - 1) / Cards.Length + 1;
            GermanyPages = (GameContent.GermanyUnitCards.Count - 1) / Cards.Length + 1;
            SovietPages  = (GameContent.SovietUnitCards.Count - 1) / Cards.Length + 1;
            Page         = 1;

            var TmpVect = new Vector2((ScreenRes.X - 300 - CardTextureWidth * Cards.Length) / (Cards.Length + 1), ScreenRes.Y - CardTextureHeight * 1.5f);

            for (var i = 0; i < Cards.Length; i++)
            {
                Cards[i] = new Card(new Vector2(TmpVect.X * (i + 1) + CardTextureWidth * i, TmpVect.Y), GameContent.CardTexture, GameContent.UnitCards[0].Card_Decoration, new Vector2(16, 9), 200, 10, 0, 13, new Animation(14, 16, true), new Animation(2, 6, false), new Animation(7, 12, false), new Animation(1, 1, true), 0, GameContent.UI_InfoFont, Color.White, GameContent.UnitCards[0].Name, GameContent.UnitCards[0].Damage.ToString(), GameContent.UnitCards[0].Armor.ToString(), GameContent.UnitCards[0].AttackRadius.ToString(), GameContent.UnitCards[0].Speed.ToString(), GameContent.UnitCards[0].HP.ToString(), GameContent.UnitCards[0].Cost.ToString(), 141, 315, 4, 4, 37, true, MapZones.ALL, Layer: Layer);
            }

            PageText = new BasicText(new Vector2((ScreenRes.X - 300 - GameContent.UI_MainMenu_Collection_PageTextFont.MeasureString("10").X) / 2, ScreenRes.Y - GameContent.UI_MainMenu_Collection_Prev.Height - 20), "10", GameContent.UI_MainMenu_Collection_PageTextFont, FontColor, Layer - 0.001f);
            Prev     = new Button(new Vector2(PageText.Position.X - GameContent.UI_MainMenu_Collection_Prev.Width / 4 - 10, PageText.Position.Y - (GameContent.UI_MainMenu_Collection_Prev.Height - GameContent.UI_MainMenu_Collection_PageTextFont.MeasureString("10").Y) / 2), GameContent.UI_MainMenu_Collection_Prev, GameContent.UI_MainMenu_Collection_Prev.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);
            Next     = new Button(new Vector2(PageText.Position.X + 10 + GameContent.UI_MainMenu_Collection_PageTextFont.MeasureString("10").X + 3, PageText.Position.Y - (GameContent.UI_MainMenu_Collection_Prev.Height - GameContent.UI_MainMenu_Collection_PageTextFont.MeasureString("10").Y) / 2), GameContent.UI_MainMenu_Collection_Next, GameContent.UI_MainMenu_Collection_Next.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);

            BackGround_Bottom = new BasicSprite(new Vector2(0, ScreenRes.Y - GameContent.UI_MainMenu_Collection_Bottom.Height), GameContent.UI_MainMenu_Collection_Bottom, Layer - 0.0002f);
            BackGround_Right  = new BasicSprite(new Vector2(ScreenRes.X - GameContent.UI_MainMenu_Collection_Right.Width, 102), GameContent.UI_MainMenu_Collection_Right, Layer - 0.0001f);
            for (var i = 0; i < DeckChange.Length / 2; i++)
            {
                DeckChange[i] = new Button(new Vector2(BackGround_Right.Position.X, BackGround_Right.Position.Y + i * GameContent.UI_MainMenu_SovietDeck.Height), GameContent.UI_MainMenu_SovietDeck, "Колода " + i, GameContent.UI_ButtonFont, Color.White, GameContent.UI_MainMenu_SovietDeck.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.002f);
            }
            for (var i = DeckChange.Length / 2; i < DeckChange.Length; i++)
            {
                DeckChange[i] = new Button(new Vector2(BackGround_Right.Position.X, BackGround_Right.Position.Y + i * GameContent.UI_MainMenu_GermanDeck.Height), GameContent.UI_MainMenu_GermanDeck, "Колода " + i, GameContent.UI_ButtonFont, Color.White, GameContent.UI_MainMenu_GermanDeck.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.002f);
            }

            Hide();

            State = CollectionState.ALL_CARDS;

            this.ScreenRes = ScreenRes;
        }
Esempio n. 12
0
        public Play(Vector2 ScreenRes, float RollbackY, MainMenu Parent, float Layer = BasicSprite.DefaultLayer)
        {
            this.Parent = Parent;
            DeckButtons = new Button[8];
            var TmpX = (ScreenRes.X - GameContent.UI_MainMenu_SovietDeck.Width / 4 * DeckButtons.Length / 2) / (DeckButtons.Length / 2 + 1f);
            var TmpY = 150f;

            for (var i = 0; i < DeckButtons.Length / 2; i++)
            {
                DeckButtons[i] = new Button(new Vector2(TmpX * (i + 1) + GameContent.UI_MainMenu_SovietDeck.Width / 4 * i, RollbackY + TmpY), GameContent.UI_MainMenu_SovietDeck, "Колода " + i, GameContent.UI_ButtonFont, Color.White, GameContent.UI_MainMenu_SovietDeck.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            }
            for (var i = DeckButtons.Length / 2; i < DeckButtons.Length; i++)
            {
                DeckButtons[i] = new Button(new Vector2(TmpX * (i - DeckButtons.Length / 2 + 1) + GameContent.UI_MainMenu_SovietDeck.Width / 4 * (i - DeckButtons.Length / 2), RollbackY + TmpY * 2), GameContent.UI_MainMenu_GermanDeck, "Колода " + i, GameContent.UI_ButtonFont, Color.White, GameContent.UI_MainMenu_GermanDeck.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            }

            StartEnemySearch  = new Button(new Vector2((ScreenRes.X - GameContent.UI_MainMenu_Play_StartButton.Width / 4) / 2, ScreenRes.Y - 20 - GameContent.UI_MainMenu_Play_StartButton.Height), GameContent.UI_MainMenu_Play_StartButton, GameContent.UI_MainMenu_Play_StartButton.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.002f);
            BackGround        = new BasicSprite(new Vector2((ScreenRes.X - GameContent.UI_MainMenu_LogIn_BackGround.Width) / 2, (ScreenRes.Y - GameContent.UI_MainMenu_LogIn_BackGround.Height) / 2), GameContent.UI_MainMenu_LogIn_BackGround, Layer - 0.0007f);
            Search_Icon       = new BasicSprite(BackGround.Position + new Vector2(BackGround.Texture.Width, BackGround.Texture.Height) / 2, GameContent.UI_MainMenu_LogIn_ConnIcon, new Vector2(GameContent.UI_MainMenu_LogIn_ConnIcon.Width, GameContent.UI_MainMenu_LogIn_ConnIcon.Height) / 2, 0f, Layer - 0.001f);
            CancelSearch      = new Button(new Vector2((ScreenRes.X - GameContent.UI_MainMenu_Button.Width / 4) / 2, ScreenRes.Y / 2 + 50), GameContent.UI_MainMenu_Button, "Отмена", GameContent.UI_ButtonFont, Color.Black, GameContent.UI_MainMenu_Button.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.001f);
            SearchDescription = new BasicText(new Vector2((ScreenRes.X - GameContent.UI_ButtonFont.MeasureString("Поиск противника").X) / 2, ScreenRes.Y / 2 - 70), "Поиск противника", GameContent.UI_ButtonFont, Color.Black, Layer - 0.001f);
            Hide();
        }
Esempio n. 13
0
        public MainMenu
            (Vector2 ScreenRes,
            Texture2D LogInBackGroundTexture, Texture2D LogInButtonTexture,
            Texture2D LogInEditTexture, Texture2D ConnectingIconTexture,
            Texture2D MenuBarTexture, Texture2D ButtonTexture, Texture2D HomeButtonTexture, Texture2D MoneyBackTexture,
            Texture2D RollingBackTexture, Texture2D NameBackTexture,
            SpriteFont Font, Color TextColor, GraphicsDevice Graphicsdevice, Game1 Parent, float Layer = BasicSprite.DefaultLayer
            )
        {
            this.Parent = Parent;

            LogIn = new LogInForm((ScreenRes - new Vector2(LogInBackGroundTexture.Width, LogInBackGroundTexture.Height)) / 2, LogInBackGroundTexture, LogInButtonTexture, LogInEditTexture, ConnectingIconTexture, Font, TextColor, Graphicsdevice, Layer - 0.001f);

            MenuBar      = new BasicSprite(new Vector2(0, 50), MenuBarTexture, Layer + 0.0005f);
            Home         = new Button(MenuBar.Position, HomeButtonTexture, HomeButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);
            Play         = new Button(new Vector2(Home.Position.X + Home.FrameSize.X, MenuBar.Position.Y), ButtonTexture, "Играть", Font, TextColor, HomeButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);
            Collection   = new Button(new Vector2(Play.Position.X + Play.FrameSize.X, MenuBar.Position.Y), ButtonTexture, "Коллекция", Font, TextColor, HomeButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);
            OpenCardPack = new Button(new Vector2(Collection.Position.X + Collection.FrameSize.X, MenuBar.Position.Y), ButtonTexture, "Наборы карт", Font, TextColor, HomeButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);
            Options      = new Button(new Vector2(OpenCardPack.Position.X + OpenCardPack.FrameSize.X, MenuBar.Position.Y), ButtonTexture, "Настройки/Выход", Font, TextColor, HomeButtonTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer);

            NameBack    = new BasicSprite(new Vector2(0), NameBackTexture, Layer);
            PlayerName  = new BasicText(new Vector2(NameBack.Position.X + 10, NameBack.Position.Y + 5), "", Font, TextColor, Layer - 0.0005f);
            MoneyBack   = new BasicSprite(new Vector2(ScreenRes.X - MoneyBackTexture.Width, 0), MoneyBackTexture, Layer);
            PlayerMoney = new BasicText(new Vector2(MoneyBack.Position.X + 50, MoneyBack.Position.Y + 5), "", Font, TextColor, Layer - 0.0005f);

            RollingBack = new RollBack(new Vector2(0, 100), new Vector2(0, ScreenRes.Y), 20, RollingBackTexture, Layer + 0.0005f);

            IsLoginState = true;

            MasterNI = new NetworkInterface();
            CommandParser.InitMasterServer(MasterNI);

            State = MenuState.HOME;

            collection = new Collection(ScreenRes, Color.Black, new bool[] { }, new bool[] { }, 200, Layer - 0.0005f);
            play       = new Play(ScreenRes, RollingBack.UpPosition.Y, this, Layer - 0.0005f);
        }
Esempio n. 14
0
        public GameMenu(Vector2 ScreenRes, Game1 Parent, Texture2D MainBackGround, Texture2D OptionsBackGround, Texture2D BtnTexture, Texture2D Variant, Texture2D ChoosedVariant, Texture2D OpenBtn, SpriteFont Font, Color TextColor, float Layer = BasicSprite.DefaultLayer)
        {
            this.Parent = Parent;

            MainBack = new BasicSprite((ScreenRes - new Vector2(MainBackGround.Width, MainBackGround.Height)) / 2, MainBackGround, Layer);

            var Offset  = new Vector2((ScreenRes.X - BtnTexture.Width / 4) / 2, ((float)MainBack.Texture.Height - BtnTexture.Height * 4) / 5);
            var OffsetY = new Vector2(0, Offset.Y + BtnTexture.Height);

            MenuCaption = new BasicText(new Vector2(MainBack.Position.X + (MainBack.Texture.Width - Font.MeasureString("Меню").X) / 2, MainBack.Position.Y + 10), "Меню", Font, Color.Black, Layer - 0.0005f);
            Continue    = new Button(new Vector2(Offset.X, MainBack.Position.Y + Offset.Y), BtnTexture, "Продолжить", Font, TextColor, BtnTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            Surrender   = new Button(Continue.Position + OffsetY, BtnTexture, "Сдаться", Font, TextColor, BtnTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            Options     = new Button(Surrender.Position + OffsetY, BtnTexture, "Настройки", Font, TextColor, BtnTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            Quit        = new Button(Options.Position + OffsetY, BtnTexture, "Выход", Font, TextColor, BtnTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);

            OptionsBack           = new BasicSprite((ScreenRes - new Vector2(MainBackGround.Width, MainBackGround.Height)) / 2, OptionsBackGround, Layer);
            ScreenOptions         = new BasicText(OptionsBack.Position + new Vector2(20, 20), "Настройки экрана:", Font, TextColor, Layer - 0.0005f);
            Resolutions           = new ListBox(ScreenOptions.Position + new Vector2(0, 30), Variant, ChoosedVariant, OpenBtn, Font, TextColor, Config.ResolutionTypes, Layer - 0.001f);
            ScreenMode            = new Button(Resolutions.Position + new Vector2(0, 30), BtnTexture, "Оконный", Font, TextColor, BtnTexture.Width / 4, 60, 0, new Animation(1, 1, true), 2, 3, Layer - 0.0005f);
            OptionsBack.Visible   = false;
            ScreenOptions.Visible = false;
            Resolutions.Visible   = false;
            ScreenMode.Visible    = false;

            if (Config.FullScreen)
            {
                ScreenMode.Text = "Полноэкранный";
            }
            else
            {
                ScreenMode.Text = "Оконный";
            }

            Resolutions.Choosed   = Config.CurrResolution;
            Resolutions.OnChange += ResolutionChanged;
        }
Esempio n. 15
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;
        }