private void UpdateTopScores(SongMeta songMeta, SongStatistic songStatistic) { Debug.Log("Updating top scores"); TopEntry topEntry = new TopEntry(songMeta.Title, songMeta.Artist, songStatistic); //Update the top score if (TopScore == null || songStatistic.Score > TopScore.SongStatistic.Score) { TopScore = topEntry; } //Update the top ten //Find where in the current top ten to place the current score int topTenIndex = -1; for (int i = 0; i < TopTenList.Count; ++i) { if (songStatistic.Score > TopTenList[i].SongStatistic.Score) { topTenIndex = i + 1; break; } } //List isn't full yet, just add the score to the end if (topTenIndex == -1 || TopTenList.Count < 10) { TopTenList.Add(topEntry); } else { //should be fine. an oversight //Otherwise just insert the top score into its respective place TopTenList.Insert(topTenIndex, topEntry); } //Remove any scores beyond the top ten in the list if (TopTenList.Count > 10) { TopTenList = TopTenList.Take(10).ToList(); } }
public BaseArena(Arkanoid game) { Game = game; TopLeftEntry = new TopEntry(Game, new Vector2(Sprites.FrmCorner.Width + Sprites.FrmTopOpen.Width, 0)); TopRightEntry = new TopEntry(Game, new Vector2( Game.FrameArea.Width - (Sprites.FrmCorner.Width + Sprites.FrmTopOpen.Width * 2), 0)); SideLeftTopEntry = new SideEntry(Game, new Vector2(0, Sprites.FrmCorner.Height), false); SideLeftMidEntry = new SideEntry(Game, new Vector2(0, Game.FrameArea.Height / 2f - Sprites.FrmSideWarp.Height / 2), false); SideRightTopEntry = new SideEntry(Game, new Vector2(Game.FrameArea.Width - Sprites.FrmSideOpen.Width, Sprites.FrmCorner.Height), true); SideRightMidEntry = new SideEntry(Game, new Vector2(Game.FrameArea.Width - Sprites.FrmSideOpen.Width, Game.FrameArea.Height / 2f - Sprites.FrmSideWarp.Height / 2), true); LeftWarp = new Warp(new Vector2(0, Game.FrameArea.Height - Sprites.FrmSideWarp.Height * 2), false); RightWarp = new Warp(new Vector2(Game.FrameArea.Width - Sprites.FrmSideWarp.Width, Game.FrameArea.Height - Sprites.FrmSideWarp.Height * 2), true); Fade = new Fader(true, true); }