internal ScoreboardEntryExtended(int rank, User user, MatchScoringTypes scoreType, PlayModes playMode, SlotTeams team, Mods mods = Mods.None)
            : base(rank, user.Name, playMode)
        {
            PositionOffset = new Vector2(32.4f, 0);

            Team           = team;
            this.scoreType = scoreType;
            this.mods      = mods;


            //SpriteCollection.AddRange(ModManager.ShowModSprites(mods, new Vector2(34, 6), 0.5f));

            SpriteAvatar = new pSpriteDynamic(null, null, 0, new Vector2(-15.6f, 12.51f), 0.920001f)
            {
                Alpha = 0
            };
            user.LoadAvatarInto(SpriteAvatar, 51f);

            SpriteSkip = new pSprite(TextureManager.Load(@"multi-skipped"), Fields.TopLeft, Origins.BottomRight, Clocks.Game, new Vector2(86, 30), SpriteBackground.Depth + 0.000001f, true, Color.White)
            {
                Alpha  = 0,
                Bypass = true
            };

            SpriteCollection.Add(SpriteSkip);
            SpriteCollection.Add(SpriteAvatar);

            UpdateSpriteLayout();
        }
        //this stuff below should be done in a new MultiRuleset for TeamVs.

        internal override void HandlePlayerFailed(int i)
        {
            //mark slot [i] as failed.
            base.HandlePlayerFailed(i);

            SlotTeams failTeam = player.ScoreEntries[i].Team;
            //check each slot for the team [i] to see if all failed
            bool teamFailed = true;

            foreach (ScoreboardEntry s in player.ScoreEntries)
            {
                if (s != null && s.Team == failTeam && s.Passing == true)
                {
                    teamFailed = false;
                    break;
                }
            }

            if (teamFailed)
            {
                if (player.scoreEntry.Team == failTeam)
                {
                    player.Ruleset.HpBar.SetCurrentHp(0);
                    player.OnFailableHp();
                    ourTeamFailed = true;
                }
                else
                {
                    BanchoClient.SendRequest(RequestType.Osu_MatchComplete, null);
                    player.InitializeScoreGraphs();
                    GameBase.ChangeMode(OsuModes.RankingTeam);
                    NotificationManager.ClearMessageMassive();
                }
            }
        }
        private float getTeamAccuracy(SlotTeams team)
        {
            float totalAccuracy = 0;
            int   playerCount   = 0;

            List <ScoreboardEntryExtended> scores = player.ScoreEntries ?? PlayerVs.LastScoreEntries;
            int count = scores.Count;

            for (int i = 0; i < count; i++)
            {
                ScoreboardEntry se = scores[i];

                if (se == null)
                {
                    continue;
                }
                if (se.Team != team)
                {
                    continue;
                }
                if (se.Score != null)
                {
                    totalAccuracy += se.Score.Accuracy;
                }
                playerCount++;
            }

            return(totalAccuracy / playerCount);
        }
Example #4
0
 public void Clear()
 {
     Mods     = Mods.None;
     Presence = null;
     Status   = SlotStatus.Open;
     Team     = SlotTeams.Neutral;
 }
Example #5
0
 public void CopyFrom(Slot source)
 {
     Mods     = source.Mods;
     Presence = source.Presence;
     Status   = source.Status;
     Team     = source.Team;
 }
Example #6
0
 // Token: 0x060028DD RID: 10461
 // RVA: 0x00101C30 File Offset: 0x000FFE30
 internal Class661(int int_4, Class861 class861_1, MatchScoringTypes matchScoringTypes_1, PlayModes playModes_1, SlotTeams slotTeams_1, Mods mods_1)
     : base(int_4, class861_1.Name, playModes_1)
 {
     base.method_1(slotTeams_1);
     this.class861_0 = class861_1;
     this.matchScoringTypes_0 = matchScoringTypes_1;
     this.mods_0 = mods_1;
     for (int i = 0; i < this.list_0.Count; i++)
     {
         Class531 class = this.list_0[i];
Example #7
0
        internal static bool TeamFailed(SlotTeams Team)
        {
            if (LastScoreEntries == null)
            {
                return(false);
            }

            foreach (ScoreboardEntry s in LastScoreEntries)
            {
                if (s != null && s.Team == Team && s.Passing == true)
                {
                    return(false);
                }
            }
            return(true);
        }
        private int getTeamScore(SlotTeams team)
        {
            int totalScore  = 0;
            int playerCount = 0;

            List <ScoreboardEntryExtended> scores = player.ScoreEntries ?? PlayerVs.LastScoreEntries;
            int count = scores.Count;

            for (int i = 0; i < count; i++)
            {
                ScoreboardEntryExtended se = scores[i];

                if (se == null)
                {
                    continue;
                }
                if (se.Team != team)
                {
                    continue;
                }

                playerCount++;

                if (se.Score != null && !se.Score.Pass)
                {
                    continue;
                }

                totalScore += se.score;
            }

            if (playerCount == 0)
            {
                return(totalScore);
            }

            //players don't want the balance. they like to do 4 vs 2 matches and get (un)fair results
            //if (PlayerVs.Match.matchTeamType == MatchTeamTypes.TeamVs)
            //    totalScore /= playerCount;
            return(totalScore);
        }
        private int getTeamCombo(SlotTeams team)
        {
            int totalCombo  = 0;
            int playerCount = 0;

            List <ScoreboardEntryExtended> scores = player.ScoreEntries ?? PlayerVs.LastScoreEntries;
            int count = scores.Count;

            for (int i = 0; i < count; i++)
            {
                ScoreboardEntryExtended se = scores[i];

                if (se == null)
                {
                    continue;
                }
                if (se.Team != team)
                {
                    continue;
                }

                playerCount++;

                if (se.Score != null && !se.Score.Pass)
                {
                    continue;
                }

                totalCombo += se.Score.CurrentCombo;
            }

            if (playerCount == 0)
            {
                return(totalCombo);
            }

            return(totalCombo);
        }
Example #10
0
        public override void Initialize()
        {
            base.Initialize();

            Player.ScoreBoard.spriteManager.WidescreenAutoOffset = true;
            Player.ScoreBoard.spriteManager.Alpha = 1;

            lock (StreamingManager.LockReplayScore)
            {
                InputManager.ReplayMode      = false;
                InputManager.ReplayStreaming = false;
                InputManager.ReplayStartTime = 0;
            }

            pText     text   = null;
            SlotTeams winner = PlayerVs.TeamOverlay.winner;

            if (PlayerVs.TeamFailed(SlotTeams.Blue))
            {
                text = new pText("Blue team failed!", 20, new Vector2(GameBase.WindowManager.WidthScaled / 2, 85), Vector2.Zero, 1, true, Color.Blue, false);
            }
            else if (PlayerVs.TeamFailed(SlotTeams.Red))
            {
                text = new pText("Red team failed!", 20, new Vector2(GameBase.WindowManager.WidthScaled / 2, 85), Vector2.Zero, 1, true, Color.Red, false);
            }
            else
            {
                switch (winner)
                {
                case SlotTeams.Blue:
                    text = new pText("Blue team wins!", 20, new Vector2(GameBase.WindowManager.WidthScaled / 2, 85), Vector2.Zero, 1, true, Color.Blue,
                                     false);
                    break;

                case SlotTeams.Red:
                    text = new pText("Red team wins!", 20, new Vector2(GameBase.WindowManager.WidthScaled / 2, 85), Vector2.Zero, 1, true, Color.Red,
                                     false);
                    break;
                }
            }

            text.TextBold = true;
            text.Origin   = Origins.Centre;
            spriteManagerWideScrolling.Add(text);

            int tabHeight = 113;

            //add
            team1Tabs = new pTabCollection(spriteManagerWideScrolling, 3, new Vector2(56, tabHeight), 0.8f, true, Color.BlueViolet, 40);
            team2Tabs = new pTabCollection(spriteManagerWideScrolling, 3, new Vector2(GameBase.WindowManager.WidthScaled - 224, tabHeight), 0.8f, true, Color.BlueViolet, 40);
            team1Tabs.Add("Total", 0);
            team2Tabs.Add("Total", 0);
            team1Tabs.SetSelected(0);
            team2Tabs.SetSelected(0);
            team1Tabs.OnTabChanged +=
                delegate(object sender, EventArgs e) { loadScores(SlotTeams.Blue, (int)sender, false); };
            team2Tabs.OnTabChanged +=
                delegate(object sender, EventArgs e) { loadScores(SlotTeams.Red, (int)sender, false); };

            int count = PlayerVs.LastScoreEntries.Count;

            for (int i = 0; i < count; i++)
            {
                ScoreboardEntry entry = PlayerVs.LastScoreEntries[i];
                if (entry != null)
                {
                    (entry.Team == SlotTeams.Blue ? team1Tabs : team2Tabs).Add(entry.name, i + 1);
                }
            }

            pSprite scoreBackground1 = new pSprite(TextureManager.Load(@"ranking-panel"), Fields.TopLeft,
                                                   Origins.TopLeft,
                                                   Clocks.Game,
                                                   new Vector2(1, SkinManager.UseNewLayout ? 107 : 97), 0.79f, true, Color.White);

            scoreBackground1.Alpha       = 1.0f;
            scoreBackground1.VectorScale = new Vector2(0.715f, 0.77f);

            pSprite scoreBackground2 = new pSprite(TextureManager.Load(@"ranking-panel"), Fields.TopLeft,
                                                   Origins.TopLeft,
                                                   Clocks.Game,
                                                   new Vector2(GameBase.WindowManager.WidthScaled - 279, SkinManager.UseNewLayout ? 107 : 97), 0.79f, true, Color.White);

            scoreBackground2.Alpha       = 1.0f;
            scoreBackground2.VectorScale = new Vector2(0.715f, 0.77f);
            spriteManagerWideScrolling.Add(scoreBackground1);
            spriteManagerWideScrolling.Add(scoreBackground2);
            initializeStatics();

            //cache scores for more efficiency
            team1Score = getTeamScore(SlotTeams.Blue);
            team2Score = getTeamScore(SlotTeams.Red);

            loadScores(SlotTeams.Blue, 0, true);
            loadScores(SlotTeams.Red, 0, true);

            playMode = Player.Mode;
        }
Example #11
0
        private void loadScores(SlotTeams teamId, int tabId, bool slowAnimations)
        {
            bool isFruits = playMode == PlayModes.CatchTheBeat;

            int startTime = GameBase.Time;

            Score scoreEntry = tabId != 0 ? PlayerVs.LastScoreEntries[tabId - 1].Score : (teamId == SlotTeams.Blue ? team1Score : team2Score);

            //load the right scoreSprites we are about to replace
            List <pSprite> scoreSprites = teamId == SlotTeams.Blue ? scoreSpritesBlue : scoreSpritesRed;
            HealthGraph    currentHpGraph;

            spriteManagerWideScrolling.RemoveRange(scoreSprites);
            scoreSprites.Clear();
            //create new scoresprites
            const int textx1 = 80;
            const int imgx1  = 40;
            const int textx2 = 280;
            //const int imgx2 = 240;

            const int row1 = 160;
            const int row2 = 220;
            const int row3 = 280;
            const int row4 = 320;

            int textoffset = SkinManager.UseNewLayout ? -16 : -25;

            Vector2 tMove = new Vector2(0, 20);

            int            timeOffset  = slowAnimations ? 1000 : 0;
            int            timeOffset2 = slowAnimations ? 1300 : 0;
            int            length      = slowAnimations ? 400 : 20;
            pSprite        p;
            Transformation t;

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count300), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row1 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count100), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row2 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;

            t =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count50), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row3 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            if (!isFruits)
            {
                p =
                    new pSpriteText(String.Format("{0}x", scoreEntry.CountGeki), SkinManager.Current.FontScore,
                                    SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                    Origins.TopLeft, Clocks.Game,
                                    new Vector2(textx2, row1 + textoffset), 0.8F, true, Color.TransparentWhite);
                p.Scale = 1.12F;

                t =
                    new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                       startTime + timeOffset2 + length);
                timeOffset2 += length;
                t.Easing     = EasingTypes.Out;
                p.Transformations.Add(t);
                scoreSprites.Add(p);

                p =
                    new pSpriteText(String.Format("{0}x", scoreEntry.CountKatu), SkinManager.Current.FontScore,
                                    SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                    Origins.TopLeft, Clocks.Game,
                                    new Vector2(textx2, row2 + textoffset), 0.8F, true, Color.TransparentWhite);
                p.Scale = 1.12F;
                t       =
                    new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                       startTime + timeOffset2 + length);
                timeOffset2 += length;
                t.Easing     = EasingTypes.Out;
                p.Transformations.Add(t);
                scoreSprites.Add(p);
            }

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.CountMiss), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx2, (isFruits ? row1 : row3) + textoffset), 0.8F, true,
                                Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(tabId == 0 ? "xxxx" : String.Format("{0}x", scoreEntry.MaxCombo),
                                SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1 - 65, row4 + 10), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0:0.00}%", scoreEntry.Accuracy * 100), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx2 - 86, row4 + 10), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            t.Easing = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);
            timeOffset2 += length;

            string stringTotalScore = String.Format("{0:00000000}", scoreEntry.TotalScore);

            pSpriteText ps =
                new pSpriteText(stringTotalScore, SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                Fields.TopLeft, Origins.Centre, Clocks.Game,
                                /*new Vector2(180, row4 + 110)*/ new Vector2(180, 94), 0.8F, true, Color.White);

            ps.Scale = SkinManager.UseNewLayout ? 1.3f : 1.2f;
            if (SkinManager.UseNewLayout)
            {
                ps.SpacingOverlap = -2;
            }
            ps.Alpha = 0;
            t        =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length * 2);
            t.Easing = EasingTypes.Out;
            ps.Transformations.Add(t);
            scoreSprites.Add(ps);


            int offsetX = 0;

            switch (teamId)
            {
            case SlotTeams.Blue:
                break;

            case SlotTeams.Red:
                offsetX = GameBase.WindowManager.WidthScaled - 279;
                break;
            }
            //scale and move the sprites to the correct panel
            float scale = 0.6f * 1.10f;

            for (int j = 0; j < scoreSprites.Count; j++)
            {
                pSprite pp = scoreSprites[j];
                pp.Scale     *= scale;
                pp.Position.X = imgx1 + (pp.Position.X - imgx1) * scale + offsetX;
                pp.Position.Y = row1 + (pp.Position.Y - row1) * scale + 18;
                spriteManagerWideScrolling.Add(pp);
            }

            //Actual graph position relative to the graph sprite
            float healthGraphX = rankingGraphPosition.X + (SkinManager.UseNewLayout ? 0 : 5) + offsetX;
            float healthGraphY = rankingGraphPosition.Y - (SkinManager.UseNewLayout ? 65 : 44);

            //finally create the hpGraph
            currentHpGraph = new HealthGraph(startTime, slowAnimations ? 2000 : 4000, scoreEntry, new RectangleF(healthGraphX, healthGraphY, 150, 68));

            if (teamId == SlotTeams.Blue)
            {
                team1HPgraph = currentHpGraph;
            }
            else
            {
                team2HPgraph = currentHpGraph;
            }

            spriteManagerWideScrolling.Add(currentHpGraph);
        }
Example #12
0
        private Score getTeamScore(SlotTeams teamId)
        {
            Score teamScore = ScoreFactory.Create(playMode, string.Empty, BeatmapManager.Current);

            int teamCount = 0;

            teamScore.HpGraph = new List <Vector2>();
            //we need the combined hpgaphs to be sorted
            //because it's probably out of order due to latency
            SortedDictionary <float, float> timeHealth = new SortedDictionary <float, float>();

            for (int i = 0; i < PlayerVs.LastScoreEntries.Count; i++)
            {
                ScoreboardEntry entry = PlayerVs.LastScoreEntries[i];
                if (entry != null)
                {
                    Score score = entry.Score;
                    if (score != null)
                    {
                        if (entry.Team == teamId)
                        {
                            teamScore.MaxCombo   += score.MaxCombo;
                            teamScore.TotalScore += score.TotalScore;
                            teamScore.Count300   += score.Count300;
                            teamScore.CountGeki  += score.CountGeki;
                            teamScore.Count100   += score.Count100;
                            teamScore.CountKatu  += score.CountKatu;
                            teamScore.Count50    += score.Count50;
                            teamScore.CountMiss  += score.CountMiss;

                            if (score.HpGraph != null)
                            {
                                if (PlayerVs.Match.matchTeamType == MatchTeamTypes.TeamVs)
                                {
                                    if (teamCount == 0)
                                    {
                                        teamScore.HpGraph.AddRange(score.HpGraph);
                                    }
                                    else // calculate average hpGraph
                                    {
                                        for (int j = Math.Min(teamScore.HpGraph.Count, score.HpGraph.Count) - 1;
                                             j >= 0;
                                             j--)
                                        {
                                            teamScore.HpGraph[j] = new Vector2(teamScore.HpGraph[j].X,
                                                                               (teamScore.HpGraph[j].Y * teamCount +
                                                                                score.HpGraph[j].Y) /
                                                                               (teamCount + 1));
                                        }
                                    }
                                }
                                else
                                {
                                    foreach (Vector2 TimeHealth in score.HpGraph)
                                    {
                                        // Will be sorted automaticlly
                                        if (!timeHealth.ContainsKey(TimeHealth.X))
                                        {
                                            timeHealth.Add(TimeHealth.X, TimeHealth.Y);
                                        }
                                    }
                                }
                            }

                            teamCount++;
                        }
                    }
                }
            }

            if (PlayerVs.Match.matchTeamType == MatchTeamTypes.TagTeamVs)
            {
                foreach (KeyValuePair <float, float> th in timeHealth)
                {
                    teamScore.HpGraph.Add(new Vector2(th.Key, th.Value));
                }
            }


            return(teamScore);
        }
 internal ScoreboardEntryCoop(int rank, User user, MatchScoringTypes scoreType, PlayModes playMode, SlotTeams team)
     : base(rank, user, scoreType, playMode, team)
 {
     SpriteRank.Text = string.Empty;
 }
Example #14
0
		// Token: 0x060028DE RID: 10462
		// RVA: 0x0001F6FB File Offset: 0x0001D8FB
		internal Class662(int int_4, Class861 class861_1, MatchScoringTypes matchScoringTypes_1, PlayModes playModes_1, SlotTeams slotTeams_1) : base(int_4, class861_1, matchScoringTypes_1, playModes_1, slotTeams_1, Mods.None)
		{
			this.class533_2.Text = string.Empty;
		}
Example #15
0
 // Token: 0x060028EC RID: 10476
 // RVA: 0x001024D0 File Offset: 0x001006D0
 internal Class665(int int_3, Class660 class660_1, Vector2 vector2_3, bool bool_6, SlotTeams slotTeams_0)
     : base(int_3, class660_1, vector2_3, bool_6)
 {
     bool flag = slotTeams_0 == SlotTeams.Red;
     this.class531_0 = new Class531(Class885.Load("play-warningarrow", Enum112.flag_1), flag ? Enum115.const_7 : Enum115.const_5, Origins.Centre, Enum114.const_0, new Vector2(vector2_3.X + 150f, -100f), 1f, true, Class115.bool_32 ? Color.get_YellowGreen() : Color.get_White(), "extra");
     Class746 class = new Class746(TransformationType.MovementX, vector2_3.X + 170f, vector2_3.X + 150f, Class115.int_1, Class115.int_1 + 300, Enum70.const_2);