Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public GameSession(CoordHelper.EProfile pt, HUD h)
            : base(App.Game)
        {
            hud = h;
            playerType = pt;
            board = new Board(playerType, new Vector2(Constants.Measures.boardBlockWidth, Constants.Measures.boardBlockHeight));
            climby = new Climby(playerType);
            //
            aroundRect = new Dictionary<Climby.EAroundSquare, Point>();
            #region Set Around Rect
            aroundRect.Add(Climby.EAroundSquare.FRONT, Point.Zero);
            aroundRect.Add(Climby.EAroundSquare.FRONT_TOP, Point.Zero);
            aroundRect.Add(Climby.EAroundSquare.FRONT_UNDER, Point.Zero);
            aroundRect.Add(Climby.EAroundSquare.FRONT_UNDER_UNDER, Point.Zero);
            aroundRect.Add(Climby.EAroundSquare.TOP, Point.Zero);
            aroundRect.Add(Climby.EAroundSquare.UNDER, Point.Zero);
            #endregion
            lastDir = climby.Direction;
            //

            tetriminoFactory = TetriminoFactory.Instance;
            var tmp = tetriminoFactory.getTetrimino(playerType);
            currTetrimino = tmp.Item1;
            shadowTetrimino = tmp.Item2;
            hud.setNext(TetriminoFactory.Instance.getNextTetrimino(playerType), playerType);
            cur = TimeSpan.Zero;
            //lat = new TimeSpan(10000000/3); // 3
            score = new Score();
            level = new Level();
            //lat = new TimeSpan(10000000 / (level.level + 1));
            lat = new TimeSpan((10 - level.level) * 1000000);
            //lat = new TimeSpan(2 / (level.level + 1) * 10000000);
            tSpinLimit = new TimeSpan(1000000 * 3); // TSPIN TIME
            tSpinCur = TimeSpan.Zero;
            state = new Dictionary<Climby.EState, Action>();

            #region Climby State
            state.Add(Climby.EState.FALL, climbyFall);
            state.Add(Climby.EState.FREE_FALL, climbyFreeFall);
            state.Add(Climby.EState.CLIMB, climbyClimb);
            state.Add(Climby.EState.END_CLIMB, climbyClimb);
            state.Add(Climby.EState.MOVE, climbyMove);
            state.Add(Climby.EState.STOP, climbyStop);
            #endregion
            updateAroundRects();
        }
Ejemplo n.º 3
0
 public void addScore(Score s)
 {
     scores.Add(s);
     saveScoreBoard();
 }