/// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="size"></param>
        /// <param name="screen"></param>
        public ResultHitDifferenceGraph(ScalableVector2 size, ResultScreen screen)
        {
            Tint  = Color.Black;
            Alpha = 0.2f;
            Size  = size;

            Processor        = GetScoreProcessor(screen);
            LargestHitWindow = Processor.JudgementWindow.Values.Max();

            CreateMiddleLine();
            CreateJudgementAreas();
            CreateEarlyLateText();

            // Make some fake hits for debugging.
            // CreateFakeHitStats();

            // Exit early if there are no dots to draw.
            if (Processor.Stats == null)
            {
                return;
            }

            FilterHitStats();
            CreateDots();
        }
Пример #2
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="size"></param>
        /// <param name="screen"></param>
        public ResultHitDifferenceGraph(ScalableVector2 size, ResultScreen screen)
        {
            Tint  = Color.Black;
            Alpha = 0.2f;
            Size  = size;

            Processor        = GetScoreProcessor(screen);
            LargestHitWindow = Processor.JudgementWindow.Values.Max();

            CreateMiddleLine();
            CreateJudgementAreas();

            // Make some fake hits for debugging.
            // CreateFakeHitStats();

            // Draw the dots if there are any.
            if (Processor.Stats != null)
            {
                FilterHitStats();
                CreateDotsWithHitDifference();
                CreateDotsWithoutHitDifference();
            }

            CreateEarlyLateText();

            AddBorder(Color.White);
            Border.Alpha = 0.6f;
        }
Пример #3
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultScoreContainer(ResultScreen screen, ScoreProcessor standardizedProcessor = null)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 490);
            Image  = UserInterface.ResultScorePanel;
            DestroyIfParentIsNull = false;
            Processor             = Screen.GetScoreProcessor();
            StandardizedProcessor = standardizedProcessor;

            if (Processor.Stats != null)
            {
                HitStatistics = Processor.GetHitStatistics();
            }
            else
            {
                HitStatistics = new HitStatistics();
            }

            CreateTopHorizontalDividerLine();
            CreateHeaderBackground();
            CreateBottomHorizontalDividerLine();
            CreateVerticalDividerLine();
            CreateScoreResultsText();
            CreateStatisticsText();
            CreateKeyValueItems();
            CreateStatisticsKeyValueItems();
            CreateOffsetFixButtons();
            CreateJudgementBreakdown();
            CreateOnlineStats();

            // Create the graph but don't set a constructor, as we need to draw it to a RenderTarget2D
            HitDifferenceGraphRaw = new ResultHitDifferenceGraph(new ScalableVector2(Width - VerticalDividerLine.X - 30, 200), Processor);
        }
Пример #4
0
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public ResultMultiplayerContainer(ResultScreen screen)
        {
            Screen = screen;

            if (OnlineManager.CurrentGame.Ruleset == MultiplayerGameRuleset.Team)
            {
                TeamPanel = new ResultMultiplayerTeamPanel(screen)
                {
                    Parent    = this,
                    Alignment = Alignment.TopCenter,
                    Y         = 208
                };
            }

            Scoreboard = new ResultMultiplayerScoreboard(screen.MultiplayerScores)
            {
                Parent    = this,
                Alignment = Alignment.TopCenter,
                Y         = 212
            };

            if (TeamPanel != null)
            {
                Scoreboard.Y = TeamPanel.Y + TeamPanel.Height + 16;
            }
        }
Пример #5
0
    public void ShowEndScreen(EndGameMessage message)
    {
        game.gameObject.SetActive(false);
        resultScreen = Instantiate(Resources.Load <GameObject>("ResultScreen") as GameObject).GetComponent <ResultScreen>();
        resultScreen.gameObject.name = "Result of player: " + myData.playerIndex;

        resultScreen.ShowScore(message, players, myData);
    }
Пример #6
0
        /// <inheritdoc />
        ///  <summary>
        ///  </summary>
        public ResultButtonContainer(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 54);
            Tint   = Color.Black;
            Alpha  = 0;

            // AddBorder(Color.White, 2);
            InitializeButtons();
        }
        /// <summary>
        ///     Returns the score processor to use. Loads hit stats from a replay if needed.
        /// </summary>
        /// <param name="screen"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        private static ScoreProcessor GetScoreProcessor(ResultScreen screen)
        {
            // If we already have stats (for example, this is a result screen right after a player finished playing a map), use them.
            if (screen.ScoreProcessor.Stats != null)
            {
                return(screen.ScoreProcessor);
            }

            // Otherwise, get the stats from a replay.
            Replay replay = null;

            // FIXME: unify this logic with watching a replay from a ResultScreen.
            try
            {
                switch (screen.ResultsType)
                {
                case ResultScreenType.Gameplay:
                case ResultScreenType.Replay:
                    replay = screen.Replay;
                    break;

                case ResultScreenType.Score:
                    // Don't do anything for online replays since they aren't downloaded yet.
                    if (!screen.Score.IsOnline)
                    {
                        replay = new Replay($"{ConfigManager.DataDirectory.Value}/r/{screen.Score.Id}.qr");
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                NotificationManager.Show(NotificationLevel.Error, "Unable to read replay file");
                Logger.Error(e, LogType.Runtime);
            }

            // Load a replay if we got one.
            if (replay == null)
            {
                return(screen.ScoreProcessor);
            }

            var qua = ResultScreen.Map.LoadQua();

            qua.ApplyMods(replay.Mods);

            var player = new VirtualReplayPlayer(replay, qua);

            player.PlayAllFrames();

            return(player.ScoreProcessor);
        }
Пример #8
0
 private void updateTime()
 {
     if (timeLeft > 0)
     {
         timeLeft         -= Time.deltaTime;
         timeLeftText.text = timeLeft.ToString();
     }
     else
     {
         gameOver = true;
         ResultScreen resultScreen = (ResultScreen)ViewHandler.Instance.Show(ViewNames.RESULT_SCREEN_NAME);
         resultScreen.SetResult(currentLevel, currentScore, correctMatches, incorrectMatches);
     }
 }
Пример #9
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultMapInformation(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 126);
            Image  = UserInterface.ResultHeaderPanel;

            CreateThumbnail();
            CreateDifficultyName();
            CreateSongTitle();
            CreateMapCreator();
            CreatePlayerName();
            CreateGrade();

            BackgroundHelper.Loaded += OnBackgroundLoaded;
        }
Пример #10
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultScoreContainer(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 450);
            Tint   = Color.Black;
            Alpha  = 0.45f;
            AddBorder(Color.White, 2);

            CreateTopHorizontalDividerLine();
            CreateHeaderBackground();
            CreateBottomHorizontalDividerLine();
            CreateVerticalDividerLine();
            CreateScoreResultsText();
            CreateStatisticsText();
            CreateKeyValueItems();
            CreateJudgementBreakdown();
            CreateOnlineStats();
        }
Пример #11
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultMapInformation(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 160);
            Tint   = Color.Black;
            Alpha  = 0.45f;

            AddBorder(Color.White, 2);

            CreateThumbnail();
            CreateDifficultyName();
            CreateSongTitle();
            CreateMapCreator();
            CreatePlayerName();
            CreateGrade();

            BackgroundHelper.Loaded += OnBackgroundLoaded;
        }
Пример #12
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultScoreContainer(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 490);
            Image  = UserInterface.ResultScorePanel;
            DestroyIfParentIsNull = false;

            CreateTopHorizontalDividerLine();
            CreateHeaderBackground();
            CreateBottomHorizontalDividerLine();
            CreateVerticalDividerLine();
            CreateScoreResultsText();
            CreateStatisticsText();
            CreateKeyValueItems();
            CreateJudgementBreakdown();
            CreateOnlineStats();

            // Create the graph but don't set a constructor, as we need to draw it to a RenderTarget2D
            HitDifferenceGraphRaw = new ResultHitDifferenceGraph(new ScalableVector2(Width - VerticalDividerLine.X - 30, 200), Screen);
        }
Пример #13
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="container"></param>
        public ResultOnlineStats(ResultScreen screen, ResultScoreContainer container) : base(new ScalableVector2(0, 0), new ScalableVector2(0, 0))
        {
            Screen    = screen;
            Container = container;

            Size = new ScalableVector2(Container.Width - Container.Border.Thickness * 2,
                                       Container.Height - Container.BottomHorizontalDividerLine.Y - Container.Border.Thickness);

            ContentContainer.Size = Size;
            Alpha = 0;

            if (Screen.ResultsType == ResultScreenType.Gameplay)
            {
                CreateStats();
            }

            if (OnlineManager.Client != null)
            {
                OnlineManager.Client.OnScoreSubmitted += OnScoreSubmitted;
            }
        }
Пример #14
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        public ResultScoreContainer(ResultScreen screen)
        {
            Screen = screen;
            Size   = new ScalableVector2(WindowManager.Width - 56, 450);
            Tint   = Color.Black;
            Alpha  = 0.45f;
            AddBorder(Color.White, 2);

            CreateTopHorizontalDividerLine();
            CreateHeaderBackground();
            CreateBottomHorizontalDividerLine();
            CreateVerticalDividerLine();
            CreateScoreResultsText();
            CreateStatisticsText();
            CreateKeyValueItems();
            CreateJudgementBreakdown();
            CreateOnlineStats();

            // Create the graph but don't set a constructor, as we need to draw it to a RenderTarget2D
            HitDifferenceGraphRaw = new ResultHitDifferenceGraph(new ScalableVector2(Width - VerticalDividerLine.X - 30, 200), Screen);
        }
    // Update is called once per frame
    void Update()
    {
        if (this.gameOver || this.gamePaused)
        {
            return;
        }

        this.ticks += Time.deltaTime;
        if (this.ticks >= 1.0f)
        {
            this.ticks = 0;

            this.timeLeft--;
            this.timerText.text = "TIME LEFT: " + this.timeLeft;

            if (this.timeLeft <= 0.0f)
            {
                //stop game
                this.gameOver = true;
                ResultScreen resultScreen = (ResultScreen)ViewHandler.Instance.Show(ViewNames.RESULT_SCREEN_NAME);
                resultScreen.SetResult(GameMechanicHandler.Instance.GetCurrentLevel(), this.score, this.correctMatches, this.wrongMatches);
            }
        }
    }
Пример #16
0
 private void Clear(object sender, EventArgs e)
 {
     Screen.Clear();
     ResultScreen.Clear();
 }
Пример #17
0
        public ResultMultiplayerTeamPanel(ResultScreen screen)
        {
            Size  = new ScalableVector2(WindowManager.Width - 56, 36);
            Image = UserInterface.ResultMultiplayerTeamPanel;

            var redScoreValue  = screen.GetTeamAverage(MultiplayerTeam.Red);
            var blueScoreValue = screen.GetTeamAverage(MultiplayerTeam.Blue);

            var redTeamBackground = new Sprite()
            {
                Parent    = this,
                Size      = new ScalableVector2(82, 30),
                X         = 2,
                Alignment = Alignment.MidLeft,
                Alpha     = 0
            };

            var redScore = new SpriteTextBitmap(FontsBitmap.GothamRegular,
                                                $"{redScoreValue:00.00}")
            {
                Parent    = redTeamBackground,
                Alignment = Alignment.MidCenter,
                FontSize  = 18,
            };

            var blueTeamBackground = new Sprite()
            {
                Parent    = this,
                Size      = new ScalableVector2(82, 30),
                X         = -2,
                Alignment = Alignment.MidRight,
                Alpha     = 0
            };

            var blueScore = new SpriteTextBitmap(FontsBitmap.GothamRegular,
                                                 $"{blueScoreValue:00.00}")
            {
                Parent    = blueTeamBackground,
                Alignment = Alignment.MidCenter,
                FontSize  = 18,
            };

            var redTeamWinCountBackground = new Sprite()
            {
                Parent    = this,
                Alignment = Alignment.MidCenter,
                Size      = new ScalableVector2(62, 30),
                X         = -116,
                Alpha     = 0
            };

            var redTeamWinCount = new SpriteTextBitmap(FontsBitmap.GothamRegular,
                                                       OnlineManager.CurrentGame.RedTeamWins.ToString())
            {
                Parent    = redTeamWinCountBackground,
                Alignment = Alignment.MidCenter,
                FontSize  = 18,
            };

            var blueTeamWinCountBackground = new Sprite()
            {
                Parent    = this,
                Alignment = Alignment.MidCenter,
                Size      = new ScalableVector2(62, 30),
                X         = 116,
                Alpha     = 0
            };

            var blueTeamWinCount = new SpriteTextBitmap(FontsBitmap.GothamRegular,
                                                        OnlineManager.CurrentGame.BlueTeamWins.ToString())
            {
                Parent    = blueTeamWinCountBackground,
                Alignment = Alignment.MidCenter,
                FontSize  = 18,
            };

            var crown = new Sprite()
            {
                Parent    = this,
                Alignment = Alignment.MidCenter,
                Size      = new ScalableVector2(16, 16),
                Image     = FontAwesome.Get(FontAwesomeIcon.fa_crown),
                // ReSharper disable once CompareOfFloatsByEqualityOperator
                Visible = redScoreValue != blueScoreValue,
                X       = blueScoreValue > redScoreValue ? 436 : -436,
                Y       = -1,
                Tint    = Color.Gold
            };
        }