예제 #1
0
        public override void Draw()
        {
            // may be the luck with drawing on two windows parallel-ly ran out...
            bool            isHost = _role == MultiplayerRole.Host;
            MultiplayerData data   = _connection.CurrentData;
            PlayerData      host   = isHost ? data.Host : data.Guest,
                            guest  = isHost ? data.Guest : data.Host;

            // draw player side
            InformationBar.Draw(
                TimeFormatter.GetTime(_connection.TimePlayed),
                (host.Board as MinesweeperBoard).Flag,
                _playerProps.WindowWidth
                );
            DrawBoard(host.Board.DrawableBoard);

            // a line in between screens
            int wW = _playerProps.WindowWidth, wH = _playerProps.WindowHeight;

            SplashKit.DrawLine(Constants.TEXT_COLOR, wW, 0, wW, wH);

            // draw opponent side
            InformationBar.Draw(
                TimeFormatter.GetTime(guest.Time),
                guest.Flag,
                _opponentProps.WindowWidth, true,
                _playerProps.WindowWidth
                );
            DrawBoard(guest.Board.DrawableBoard, true);
        }
예제 #2
0
        public ResultPage(int usedFlags, int totalFlags, int timePlayed, bool isWin)
        {
            _isWin = isWin;

            GetRank(usedFlags, totalFlags, timePlayed);

            _drawingObjects.AddRange(new UIRectangle[]
            {
                new Button(0, 0, "You " + (_isWin ? "win!" : "lose!"), Constants.HEADER_FONT_SIZE)
                {
                    HorizontalAlign = 0.5f,
                    VerticalAlign   = 0.15f,
                    BorderColor     = Constants.BACKGROUND_COLOR
                },
                new Button($"Used flags: {usedFlags}", 0, 0)
                {
                    HorizontalAlign = 0.5f,
                    VerticalAlign   = 0.35f,
                    BorderColor     = Constants.BACKGROUND_COLOR
                },
                new Button($"Time used: {TimeFormatter.GetTime(timePlayed)}", 0, 0)
                {
                    HorizontalAlign = 0.5f,
                    VerticalAlign   = 0.45f,
                    BorderColor     = Constants.BACKGROUND_COLOR
                },
                new Button($"Rank: {_rank}", 0, 0)
                {
                    HorizontalAlign = 0.5f,
                    VerticalAlign   = 0.55f,
                    BorderColor     = Constants.BACKGROUND_COLOR
                },
                new Button("Back to main menu", 0, 0)
                {
                    HorizontalAlign = 0.5f,
                    VerticalAlign   = 0.8f,
                    Action          = () => MultiplayerMinesweeper.UI.Back()
                }
            });
            _drawingObjects.ForEach((rect) => { rect.AlignHorizontally(); rect.AlignVertically(); });
        }