Пример #1
0
        public EndGame(Score s, CoordHelper.EProfile player)
            : base()
        {
            Color ph;
            Color tbcolor;
            score = s;
            if (player == CoordHelper.EProfile.TWOPLAYER)
            {
                tbcolor = Constants.Color.p2Dark;
                who = new GameString("RED", TextManager.EFont.AHARONI, tbcolor, 0.8f);
                ph = Constants.Color.p2Light;
            }
            else if (CoordHelper.Instance.Profile == CoordHelper.EProfile.TWOPLAYER)
            {
                tbcolor = Constants.Color.p1Dark;
                who = new GameString("BLUE", TextManager.EFont.AHARONI, tbcolor, 0.8f);
                ph = Constants.Color.p1Light;
            }
            else
            {
                tbcolor = Constants.Color.p1Dark;
                who = new GameString("YOU", TextManager.EFont.AHARONI, tbcolor, 0.8f);
                ph = Constants.Color.p1Light;
            }

            scored = new GameString(" SCORED", TextManager.EFont.AHARONI, Color.White, 0.8f);
            who.Pos = new Vector2((Constants.Measures.landscapeWidth - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, who.Value+scored.Value).X * who.Scale) / 2,
                            Constants.Measures.upBoardMargin + 130);
            scored.Pos = new Vector2(who.Pos.X + TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, who.Value).X * who.Scale,
                                        Constants.Measures.upBoardMargin + 130);
            scoredBox = new Rectangle((int)(who.Pos.X - 50),
                                          (int)(scored.Pos.Y - 40),
                                          (int)(TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, who.Value + scored.Value).X * scored.Scale + 100),
                                          (int)(TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, who.Value + scored.Value).Y * scored.Scale + 40));

            scoreStr = new GameString(score.TotalScore.ToString(), TextManager.EFont.AHARONI, who.Color);
            scoreStr.Pos = new Vector2((Constants.Measures.landscapeWidth - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI,scoreStr.Value).X) / 2,
                                        scoredBox.Bottom + 5);

            scoreBox = new Rectangle((int)(Constants.Measures.landscapeWidth - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, scoreStr.Value).X) / 2 - 30,
                                        scoredBox.Y + scoredBox.Height,
                                        (int)TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, scoreStr.Value).X + 60,
                                        (int)TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, scoreStr.Value).Y);
            name = new GameString("ENTER YOUR NAME", TextManager.EFont.AHARONI, Color.White, 0.8f);
            name.Pos = new Vector2((Constants.Measures.landscapeWidth - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, name.Value).X * name.Scale) / 2,
                                        scoreBox.Bottom + 200);
            nameBox = new Rectangle((int)name.Pos.X - 50, (int)name.Pos.Y - 40,
                (int)(TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, name.Value).X * name.Scale + 100),
                (int)(TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, name.Value).Y * name.Scale + 40));
            tb = new TextBox(saveScore, tbcolor, ph, new Rectangle((int)(Constants.Measures.landscapeWidth - 400) / 2, (int)nameBox.Bottom, 400, 150));

            SurfaceKeyboard.CenterX = (float)InteractiveSurface.PrimarySurfaceDevice.Width - (SurfaceKeyboard.Width / 2);
            SurfaceKeyboard.CenterY = (float)InteractiveSurface.PrimarySurfaceDevice.Height - (SurfaceKeyboard.Height / 2);
            SurfaceKeyboard.Layout = Microsoft.Surface.KeyboardLayout.Alphanumeric;
            SurfaceKeyboard.ShowsFeedback = false;
        }
Пример #2
0
 public TextBox(HandlerAction h, Color textColor, Color placeHolderColor, Rectangle l = new Rectangle(), String val = "")
     : base(App.Game)
 {
     location = l;
     gs = new GameString(val, TextManager.EFont.AHARONI, textColor, 0.5f, new Vector2((float)l.X + 10, (float)(l.Y + 45)));
     Active = true;
     handler = h;
     placeHolder = new GameString("TAP HERE", TextManager.EFont.AHARONI, placeHolderColor, 0.5f);
     placeHolder.Pos = new Vector2((float)(l.Center.X - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, placeHolder.Value).X * placeHolder.Scale / 2),
         (float)(l.Y + 45));
 }
Пример #3
0
 public AButton(AMenu cnt, String text, Vector2 p, MenuManager.HandlerAction h, Object data = null, float s = 0.6f)
     : base(App.Game)
 {
     Container = cnt;
     scale = s;
     arg = data;
     execute = h;
     DefaultColor = Constants.Color.border;
     OverColor = Constants.Color.p1Light;
     Content = new GameString(text, TextManager.EFont.AHARONI, Constants.Color.border, scale);
     size = TextManager.Instance.getSizeString(Content.Font, Content.Value);
     int middle = 10;
     TotalSize = new Vector2((35 + (53 * middle) + 35) * scale, 115 * scale);
     LeftPos = p;
     rightPos = new Vector2(p.X + (35 + middle * 53) * scale, p.Y);
     Content.Pos = new Vector2(LeftPos.X + (35 * 2 + 53 *10 - size.X) / 2 * scale,
                   LeftPos.Y + (115 - size.Y + size.Y * 0.3f) / 2 * scale);
 }
Пример #4
0
 public override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     SpriteManager.Instance.drawRectangleAbsPos(new Rectangle(
         (int)Constants.Measures.upBoardMargin,
         (int)Constants.Measures.upBoardMargin,
         1920 - (int)Constants.Measures.upBoardMargin * 2,
         1080 - (int)Constants.Measures.upBoardMargin * 2), Constants.Color.background * 0.8f);
     TextManager.Instance.Draw(new GameString("LEADER BOARD", TextManager.EFont.AHARONI, Constants.Color.p1Dark, 0.8f, new Vector2(600f, Constants.Measures.upBoardMargin)));
     for (int i = 0; i < 10 && i < ScoreBoard.Instance.getScores().Count; i++)
     {
         TextManager.Instance.Draw(new GameString((i + 1).ToString() + ". " + ScoreBoard.Instance.getScores()[i].pseudo,
                                     TextManager.EFont.AHARONI, Constants.Color.border, 0.8f,
                                     new Vector2(Constants.Measures.upBoardMargin + 10, 150 + i * 85)));
         var tmp = new GameString(ScoreBoard.Instance.getScores()[i].TotalScore.ToString(), TextManager.EFont.AHARONI, Constants.Color.border, 0.8f);
         tmp.Pos = new Vector2(1920 - TextManager.Instance.getSizeString(TextManager.EFont.AHARONI, tmp.Value).X - Constants.Measures.upBoardMargin * 2, 150 + i * 85);
         TextManager.Instance.Draw(tmp);
     }
 }
Пример #5
0
        public HUD()
            : base(App.Game)
        {
            nextStr = new GameString("NEXT", TextManager.EFont.AHARONI, Constants.Color.background, 0.46f);
            nextStr.Pos = CoordHelper.Instance.getNextText(nextStr);

            scoreStr = new GameString("SCORE", TextManager.EFont.AHARONI, Constants.Color.background, 0.46f);
            scoreStr.Pos = CoordHelper.Instance.getScoreText(scoreStr);

            levelStr = new GameString("LEVEL", TextManager.EFont.AHARONI, Constants.Color.background, 0.46f);
            levelStr.Pos = CoordHelper.Instance.getLevelText(levelStr);

            nextBox = CoordHelper.Instance.getNextTextBox(nextStr);
            scoreBox = CoordHelper.Instance.getScoreTextBox(scoreStr);
            levelBox = CoordHelper.Instance.getLevelTextBox(levelStr);

            var tmp = new GameString("0", TextManager.EFont.AHARONI, Constants.Color.p1Dark, 0.8f);
            tmp.Pos = CoordHelper.Instance.getScoreValue(tmp, CoordHelper.EProfile.ONEPLAYER);
            scoreValue.Add(CoordHelper.EProfile.ONEPLAYER, tmp);
            tmp = new GameString("0", TextManager.EFont.AHARONI, Constants.Color.p1Dark, 0.8f);
            tmp.Pos = CoordHelper.Instance.getLevelValue(tmp, CoordHelper.EProfile.ONEPLAYER);
            levelValue.Add(CoordHelper.EProfile.ONEPLAYER, tmp);
            scoreValBox.Add(CoordHelper.EProfile.ONEPLAYER, CoordHelper.Instance.getScoreValueBox(scoreValue[CoordHelper.EProfile.ONEPLAYER], CoordHelper.EProfile.ONEPLAYER));
            levelValBox.Add(CoordHelper.EProfile.ONEPLAYER, CoordHelper.Instance.getLevelValueBox(levelValue[CoordHelper.EProfile.ONEPLAYER], CoordHelper.EProfile.ONEPLAYER));
            nextValBox.Add(CoordHelper.EProfile.ONEPLAYER, CoordHelper.Instance.getNextValueBox(CoordHelper.EProfile.ONEPLAYER));
            nextBoardColor[CoordHelper.EProfile.ONEPLAYER] = Color.White;
            if (CoordHelper.Instance.Profile == CoordHelper.EProfile.TWOPLAYER)
            {
                tmp = new GameString("0", TextManager.EFont.AHARONI, Constants.Color.p2Dark, 0.8f);
                tmp.Pos = CoordHelper.Instance.getScoreValue(tmp, CoordHelper.EProfile.TWOPLAYER);
                scoreValue.Add(CoordHelper.EProfile.TWOPLAYER, tmp);
                tmp = new GameString("0", TextManager.EFont.AHARONI, Constants.Color.p2Dark, 0.8f);
                tmp.Pos = CoordHelper.Instance.getLevelValue(tmp, CoordHelper.EProfile.TWOPLAYER);
                levelValue.Add(CoordHelper.EProfile.TWOPLAYER, tmp);
                scoreValBox.Add(CoordHelper.EProfile.TWOPLAYER, CoordHelper.Instance.getScoreValueBox(scoreValue[CoordHelper.EProfile.TWOPLAYER], CoordHelper.EProfile.TWOPLAYER));
                levelValBox.Add(CoordHelper.EProfile.TWOPLAYER, CoordHelper.Instance.getLevelValueBox(levelValue[CoordHelper.EProfile.TWOPLAYER], CoordHelper.EProfile.TWOPLAYER));
                nextValBox.Add(CoordHelper.EProfile.TWOPLAYER, CoordHelper.Instance.getNextValueBox(CoordHelper.EProfile.TWOPLAYER));
                nextBoardColor[CoordHelper.EProfile.TWOPLAYER] = Color.White;
            }
        }
Пример #6
0
        public Rectangle getScoreValueBox(GameString text, EProfile board)
        {
            if (board == EProfile.ONEPLAYER)
                return new Rectangle((int)(getRightBoard(EProfile.ONEPLAYER)), (int)(scorePosY + textBoxH),
                                     (int)(TextManager.Instance.getSizeString(text.Font, text.Value).X * text.Scale + Constants.Measures.paddingTextX * 2),
                                     (int)(TextManager.Instance.getSizeString(text.Font, text.Value).Y * 0.70 * text.Scale));

            return new Rectangle((int)(leftMargin[EProfile.TWOPLAYER] - TextManager.Instance.getSizeString(text.Font, text.Value).X * text.Scale - Constants.Measures.paddingTextX * 2 - Constants.Measures.borderSize), (int)(scorePosY + textBoxH),
                              (int)(TextManager.Instance.getSizeString(text.Font, text.Value).X * text.Scale + Constants.Measures.paddingTextX * 2),
                              (int)(TextManager.Instance.getSizeString(text.Font, text.Value).Y * 0.70 * text.Scale));
        }
Пример #7
0
        public Vector2 getScoreValue(GameString text, EProfile board)
        {
            if (board == EProfile.ONEPLAYER)
                return new Vector2(getRightBoard(EProfile.ONEPLAYER) + paddingTextX , scorePosY - paddingTextY/2 + textBoxH);

            return new Vector2(leftMargin[EProfile.TWOPLAYER] - TextManager.Instance.getSizeString(text.Font, text.Value).X * text.Scale - paddingTextX,
                                scorePosY - paddingTextY / 2 + textBoxH);
        }
Пример #8
0
        public Rectangle getScoreTextBox(GameString text)
        {
            if (Profile == EProfile.ONEPLAYER)
                return new Rectangle((int)(getRightBoard(EProfile.ONEPLAYER)), (int)scorePosY,
                                     (int)(TextManager.Instance.getSizeString(text.Font, text.Value).X * text.Scale + Constants.Measures.paddingTextX * 2),
                                     (int)textBoxH);

            return new Rectangle((int)(getRightBoard(EProfile.ONEPLAYER)), (int)scorePosY,
                              (int)textBoxW,
                              (int)textBoxH);
        }
Пример #9
0
        public Vector2 getScoreText(GameString text)
        {
            if (Profile == EProfile.ONEPLAYER)
                return new Vector2(getRightBoard(EProfile.ONEPLAYER) + paddingTextX, scorePosY + paddingTextY);

            return new Vector2(getRightBoard(EProfile.ONEPLAYER) + (textBoxW - TextManager.Instance.getSizeString(text.Font, text.Value).X* text.Scale) / 2,
                                scorePosY + paddingTextY);
        }
Пример #10
0
 public void Draw(GameString gs)
 {
     App.SpriteBatch.DrawString(fonts[gs.Font], gs.Value, gs.Pos, gs.Color, 0f, gs.Origin, gs.Scale, SpriteEffects.None, 0f);
 }