Exemplo n.º 1
0
        private void OnBattleRoyalePlayerEliminated(object sender, PlayerBattleRoyaleEliminatedEventArgs e)
        {
            var name = "Player";

            if (e.UserId == OnlineManager.Self.OnlineUser.Id)
            {
                name = OnlineManager.Self.OnlineUser.Username;
            }
            else
            {
                var view = (GameplayScreenView)Screen.View;
                var user = view.ScoreboardLeft.Users.Find(x => x.LocalScore?.PlayerId == e.UserId);

                if (user != null)
                {
                    name = user.UsernameRaw;
                }
            }

            Username.Text = name;
            Eliminated.X  = Username.Width + 1;
            Size          = new ScalableVector2(Username.Width + Eliminated.Width + 1, Eliminated.Height);

            Username.ClearAnimations();
            Eliminated.ClearAnimations();

            Username.FadeTo(1, Easing.Linear, 300).Wait(1200);
            Eliminated.FadeTo(1, Easing.Linear, 300).Wait(1200);
            Username.FadeTo(0, Easing.Linear, 500);
            Eliminated.FadeTo(0, Easing.Linear, 500);
        }
Exemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void OnPlayerBattleRoyaleEliminated(object sender, PlayerBattleRoyaleEliminatedEventArgs e)
        {
            ScoreboardUser user = null;

            foreach (var u in Users)
            {
                if (u.Type == ScoreboardUserType.Self && e.UserId == OnlineManager.Self.OnlineUser.Id)
                {
                    user = u;
                    SkinManager.Skin.SoundFailure.CreateChannel().Play();
                    break;
                }

                if (u.LocalScore != null && u.LocalScore.PlayerId == e.UserId)
                {
                    user = u;
                    break;
                }
            }

            if (user == null)
            {
                return;
            }

            user.Processor.MultiplayerProcessor.IsBattleRoyaleEliminated = true;
            BattleRoyalePlayersLeft.Value--;

            user.Rank = e.Rank;
            user.SetTintBasedOnHealth();
            SetTargetYPositions();

            var game = (QuaverGame)GameBase.Game;

            if (game.CurrentScreen is GameplayScreen screen)
            {
                screen.SetRichPresence();
            }
        }