/// <summary> /// スコアー初期化 /// </summary> /// <returns></returns> public IScore InitScore(int EndGameScore) { CacheScore = ScoreFactory.Create(0, EndGameScore); IsCreated = true; return(CacheScore); }
internal override void Initialize() { InputManager.ReplayScore = autoScore = ScoreFactory.Create(Player.Mode, "osu!", player.hitObjectManager.Beatmap); player.Ruleset.CreateAutoplayReplay(); Player.currentScore.InvalidateSubmission(); //This mode is totally unranked. base.Initialize(); }
public IEnumerable <Score> GetHighScoresForAllPlayers(DateTime startDate, DateTime endDate) { GetHighScoresForAllPlayersResult dbResult = _gameRepository.GetHighScoresForAllPlayers(ROUNDS_PER_GAME, startDate, endDate); // One extra database round trip to get all user names... on second thought, this should've been in the USP Dictionary <int, UserEntity> userIds = _userRepository.GetAll(dbResult.Results.Select(r => r.UserId)); return(dbResult.Results .Select(r => ScoreFactory.Create(r, userIds)) .OrderBy(x => x.AmountOfCorrectAnswers) .ThenBy(x => x.Duration).ToList()); }
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 void HandleUpdate(bScoreFrame frame) { Score newScore = ScoreFactory.Create(playMode, frame, null); newScore.EnabledMods = mods; Frame = frame; Score oldScore = Score; SetScore(newScore, frame.totalScore); Passing = frame.pass; if (oldScore != null && newScore.TotalHits != oldScore.TotalHits) { string value = @"0"; bool mania = playMode == PlayModes.OsuMania; if (mania) { if (newScore.Count300 > oldScore.Count300) { value = @"300"; } else if (newScore.Count100 > oldScore.Count100) { value = @"100"; } else if (newScore.Count50 > oldScore.Count50) { value = @"50"; } else if (newScore.CountGeki > oldScore.CountGeki) { value = @"300g"; } else if (newScore.CountKatu > oldScore.CountKatu) { value = @"200"; } } else { if (newScore.Count300 > oldScore.Count300) { value = @"300"; } else if (newScore.Count100 > oldScore.Count100) { value = @"100"; } else if (newScore.Count50 > oldScore.Count50) { value = @"50"; } if (newScore.CountGeki > oldScore.CountGeki) { value += @"g"; } if (newScore.CountKatu > oldScore.CountKatu) { value += @"k"; } } if (newScore.CurrentCombo == 0 && oldScore.CurrentCombo == 0) { return; //Don't draw consecutive misses. } bool miss = value == @"0"; if (!miss && lastHitSprite != null && lastHitSprite.Transformations.Count > 0 && lastHitSprite.Transformations[0].Time1 == GameBase.Time) { return; //Bundled sprites don't need to be drawn unless they are a miss. } if (lastHitSprite != null && lastHitSprite.TagNumeric == 0) { lastHitSprite.Depth -= 0.0001f; lastHitSprite.FadeOut(100); //Fade out any non-miss previously being displayed. scoreboard.spriteManager.Remove(lastHitSprite); scoreboard.spriteManager.Add(lastHitSprite); } if (lastHitSprite != null) { SpriteCollection.Remove(lastHitSprite); } var texture = mania ? TextureManager.LoadAll(@"mania-hit" + value)[0] : TextureManager.Load(@"hit" + value); pSprite p = new pSprite(texture, Origins.Centre, SpriteAvatar.Position, (miss ? 0.95f : 0.949f) - (rank * 0.001f), false, Color.White) { Field = SpriteBackground.Field, TagNumeric = miss ? 1 : 0 }; lastHitSprite = p; SpriteCollection.Add(lastHitSprite); if (value == @"0") { p.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, GameBase.Time, GameBase.Time + HitObjectManager.HitFadeIn)); p.Transformations.Add(new Transformation(TransformationType.Scale, 0.6F, 0.4F, GameBase.Time, (int)(GameBase.Time + (HitObjectManager.HitFadeIn * 1.4)))); p.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + HitObjectManager.PostEmpt / 2, GameBase.Time + HitObjectManager.PostEmpt + HitObjectManager.HitFadeOut)); } else { p.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, GameBase.Time, GameBase.Time + HitObjectManager.HitFadeIn)); p.Transformations.Add(new Transformation(TransformationType.Scale, 0.2F, 0.4F, GameBase.Time, (int)(GameBase.Time + (HitObjectManager.HitFadeIn * 0.8)))); p.Transformations.Add(new Transformation(TransformationType.Scale, 0.4F, 0.3F, GameBase.Time + HitObjectManager.HitFadeIn, (int)(GameBase.Time + (HitObjectManager.HitFadeIn * 1.2)))); p.Transformations.Add(new Transformation(TransformationType.Scale, 0.3F, 0.35F, GameBase.Time + HitObjectManager.HitFadeIn, (int)(GameBase.Time + (HitObjectManager.HitFadeIn * 1.4)))); p.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + HitObjectManager.PostEmpt, GameBase.Time + HitObjectManager.PostEmpt / 2 + HitObjectManager.HitFadeOut)); } scoreboard.spriteManager.Add(p); } }
public static void HandleSongChange(bool resetStart, bool useScoreV2) { lock (LockReplayScore) { if (CurrentlySpectating == null) { return; } Beatmap b = BeatmapManager.GetBeatmapByChecksum(CurrentlySpectating.CurrentBeatmapChecksum); if (b != null) { NotificationManager.ShowMessage("Host is playing:" + b.DisplayTitle, Color.Green, 1000); BeatmapManager.Current = b; InputManager.ReplayMode = true; InputManager.ReplayToEnd = false; InputManager.ReplayStreaming = true; InputManager.ReplayScore = ScoreFactory.Create(CurrentlySpectating.PlayMode, null, BeatmapManager.Current, useScoreV2); InputManager.ReplayScore.InvalidateSubmission(); InputManager.ReplayScore.EnabledMods = CurrentlySpectating.CurrentMods; if (resetStart) { InputManager.ReplayStartTime = 0; } if (NewUserAndSong) { GameBase.Scheduler.Add(delegate { if (ChatEngine.IsVisible) { ChatEngine.Visibility = ChatVisibility.ChatOnly; } }); NewUserAndSong = false; } GameBase.ChangeMode(OsuModes.Play, true); } else if (!string.IsNullOrEmpty(CurrentlySpectating.BeatmapName)) { if (CurrentlySpectating.BeatmapId > 0 && (BanchoClient.Permission & Permissions.Supporter) > 0) { if (OsuDirect.ActiveDownloads.Find(d => d.beatmap != null && d.beatmap.beatmapId == CurrentlySpectating.BeatmapId) == null && (OsuDirect.RespondingBeatmap == null || OsuDirect.RespondingBeatmap.beatmapId != CurrentlySpectating.BeatmapId)) { OsuDirect.HandlePickup(LinkId.Beatmap, CurrentlySpectating.BeatmapId, RestartSpectating); } } else { string message = string.Format("You don't have the beatmap the host is playing ({0}).", CurrentlySpectating.BeatmapName); NotificationManager.ShowMessage(message); } BanchoClient.SendRequest(RequestType.Osu_CantSpectate, null); iDontHaveThatBeatmap = true; InputManager.ReplayMode = false; if (GameBase.Mode == OsuModes.Play) { GameBase.ChangeMode(OsuModes.Menu, true); } } } }