/// <summary> /// Gets formatted score status. Score can be disabled, it can be scheduled to rebuild in the future or its status is one of <see cref="ScoreStatusEnum"/>. /// </summary> private FormattedText GetFormattedStatus(ScoreInfo info) { var formatter = new ScoreStatusFormatter(info); formatter.RecalculationURL = GetRecalculationURL(info.ScoreID); formatter.DisplayTooltips = true; return formatter.GetFormattedStatus(); }
protected void ScheduleRecalculation(ScoreInfo scoreInfo) { // Validate input if (radLater.Checked && !(calendarControl.SelectedDateTime > DateTime.Now)) { ShowError(GetString("om.score.recalculationscheduledinvaliddate")); return; } if (!scoreInfo.CheckPermissions(PermissionsEnum.Modify, CurrentSiteName, CurrentUser)) { RedirectToAccessDenied(scoreInfo.TypeInfo.ModuleName, "modify"); } if (radLater.Checked && (calendarControl.SelectedDateTime > DateTime.Now)) { StartRecalculationLater(scoreInfo); } else if (radNow.Checked) { StartRecalculationNow(scoreInfo); } ScriptHelper.RegisterWOpenerScript(this); ScriptHelper.RegisterStartupScript(this, typeof(string), "RefreshPage", ScriptHelper.GetScript("wopener.RefreshPage(); CloseDialog();")); }
public void MoveItemUp(ScoreInfo scoreToMove) { var itemIndex = Playlist.IndexOf(scoreToMove); if (itemIndex <= 0) return; Playlist.RemoveAt(itemIndex); Playlist.Insert(itemIndex - 1, scoreToMove); }
public void DuplicateScoresAreNotAddedToQueue() { var duplicateItem = new ScoreInfo { Id = 123 }; queue.Tweets.Add(duplicateItem); queue.ScoreReceived(duplicateItem); Assert.That(queue.Tweets.Count(s => s.Id == duplicateItem.Id), Is.EqualTo(1)); }
public void MoveItemDown(ScoreInfo scoreToMove) { var itemIndex = Playlist.IndexOf(scoreToMove); if (itemIndex == Playlist.Count - 1) return; Playlist.RemoveAt(itemIndex); Playlist.Insert(itemIndex + 1, scoreToMove); }
public void ScoreAtBottomOfPlaylistIsntMoved() { var scoreToMove = new ScoreInfo { Id = 123 }; queue.Playlist.Add(new ScoreInfo()); queue.Playlist.Add(scoreToMove); queue.MoveItemDown(scoreToMove); Assert.That(queue.Playlist.Last(), Is.EqualTo(scoreToMove)); }
public void ScoreAtTopOfPlaylistIsntMoved() { var scoreToMove = new ScoreInfo { Id = 123 }; queue.Playlist.Add(scoreToMove); queue.Playlist.Add(new ScoreInfo()); queue.MoveItemUp(scoreToMove); Assert.That(queue.Playlist.First(), Is.EqualTo(scoreToMove)); }
object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName) { case "scorestatus": var rowView = parameter as DataRowView; var info = new ScoreInfo(rowView.Row); return GetFormattedStatus(info); } return sender; }
public void Show(ScoreInfo levelScore) { ContinueButton.IsEnabled = true; Screen.lockCursor = false; HitsBlockedText.text = string.Empty; HitsMissedText.text = string.Empty; MotherHitsText.text = string.Empty; TotalText.text = string.Empty; UpdateDelay = updateDelay; gameObject.SetActive(true); Showing(); StartCoroutine(UpdateScore(levelScore)); }
/// <summary> /// Loads controls with values from existing score. /// </summary> /// <param name="score"></param> private void LoadValuesFromExistingScore(ScoreInfo score) { if (score.ScoreScheduledTaskID > 0) { TaskInfo taskInfo = TaskInfoProvider.GetTaskInfo(score.ScoreScheduledTaskID); if ((taskInfo != null) && taskInfo.TaskEnabled) { radLater.Checked = true; calendarControl.Enabled = true; calendarControl.SelectedDateTime = taskInfo.TaskNextRunTime; } } }
private static string GetPosition(ScoreInfo si) { var position = si.Position + 1; switch (position) { case 2: return "2nd"; case 3: return "3rd"; default: return position + "th"; } }
public void MovesTopTweetScoreToPlaylist() { var scoreToMove = new ScoreInfo { Id = 123 }; queue.Tweets.Add(scoreToMove); queue.Tweets.Add(new ScoreInfo()); queue.Tweets.Add(new ScoreInfo()); queue.MoveTopTweetToPlaylist(); Assert.That(queue.Playlist.Contains(scoreToMove)); Assert.That(queue.Tweets.Contains(scoreToMove), Is.False); }
public ScoreInfo Calculate(bool gameOver) { var blockedPts = blocked*BlockedAdj; var missPts = misses*MissAdj; var motherHitPts = motherHits*MotherHitAdj; var total = blockedPts + missPts + motherHitPts; var totalToReport = totalScore; if (GameManager.IsEndless) { if (!gameOver) { totalScore = total; } totalToReport = totalScore; } else { if (!gameOver) { totalScore += total; } totalToReport += total; } int position; if (LeaderBoardManager.CheckHighScore(totalToReport, out position) && gameOver) LeaderBoardManager.SetHighScore(GameManager.PlayerName, totalToReport); var result = new ScoreInfo { HitsBlocked = blocked, HitsBlockedPts = blockedPts, HitsMissed = misses, HitsMissedPts = missPts, MotherHits = motherHits, MotherHitsPts = motherHitPts, LevelTotal = total, TotalScore = totalToReport, Position = position, }; if (gameOver && GameManager.IsEndless) { OnlineLeaderBoardManager.Submit(result.TotalScore, OnlineLeaderBoardManager.EndlessBoard); } if (!GameManager.IsEndless || gameOver) { blocked = 0; misses = 0; motherHits = 0; } return result; }
private void TweetReceived(GenericEventArgs<ITweet> tweetEvent) { if (!tweetEvent.Value.Text.Contains(ConfigurationManager.AppSettings["AccountName"])) return; var tweet = tweetEvent.Value; var scoreInfo = new ScoreInfo { Id = tweet.Id, TextScore = StripMentions(tweet.Text), Username = tweet.Creator.ScreenName, DateTime = tweet.CreatedAt, }; if (Received != null) Received(scoreInfo); }
public IEnumerator UpdateScore(ScoreInfo levelScore) { IsScoring = true; HitsBlockedText.text = levelScore.HitsBlockedPts + " (" + levelScore.HitsBlocked + ")"; yield return new WaitForSeconds(UpdateDelay); HitsMissedText.text = levelScore.HitsMissedPts + " (" + levelScore.HitsMissed + ")"; yield return new WaitForSeconds(UpdateDelay); MotherHitsText.text = levelScore.MotherHitsPts + " (" + levelScore.MotherHits + ")"; yield return new WaitForSeconds(UpdateDelay); TotalText.text = levelScore.LevelTotal.ToString(CultureInfo.InvariantCulture); foreach (var additionalActions in AdditionalActions) { yield return new WaitForSeconds(UpdateDelay); additionalActions(levelScore); } IsScoring = false; }
public void SendError(ScoreInfo invalidScore, UnrecognisedTokenException exception) { try { var sendNotifications = bool.Parse(ConfigurationManager.AppSettings["SendNotifications"]); if (!sendNotifications) return; var user = new TokenUser(TokenSingleton.Token); var tweet = string.Format("@{0} Unrecognised token: \"{1}\". Language spec: http://t.co/mESKiN9qSS", invalidScore.Username, exception.Message.Length > tokenLength ? exception.Message.Substring(0, tokenLength) : exception.Message); user.PublishTweet(tweet); } catch (Exception) { // ToDo: implement UI notifications } }
private static void GenerateScoringWithRulesAndMailNotification() { ScoreInfo score = new ScoreInfo { ScoreDisplayName = "Score with notification " + Guid.NewGuid(), ScoreName = "ScoreMailAndTrigger-" + Guid.NewGuid(), ScoreBelongsToPersona = false, ScoreEnabled = true, ScoreStatus = ScoreStatusEnum.RecalculationRequired, ScoreSiteID = SiteContext.CurrentSiteID, ScoreEmailAtScore = 50, ScoreNotificationEmail = "*****@*****.**" }; score.Insert(); GenerateBasicScoringRule( score, "Notification test: 10 points per ONE page visit, NOT recurring", 10, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); GenerateBasicScoringRule( score, "Notification test: 15 points for Home landing page", 15, RuleTypeEnum.Activity, "<condition><activity name=\"landingpage\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>Home</value><params><operator>0</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='landingpage') AND (ISNULL([ActivityURL], '') LIKE N'%Home%')</wherecondition></condition>", "landingpage" ); GenerateBasicScoringRule( score, "Notification test: Contact has filled \"Contact us\" form for 30p", 30, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.SubmittedForm(\\\"ContactUs\\\", ToInt(150))\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"and\\\" n=\\\"CMSContactHasSubmittedSpecifiedFormInLastXDays\\\" ><p n=\\\"_perfectum\\\"><t>has</t><v></v><r>0</r><d>select operation</d><vt>text</vt><tv>0</tv></p><p n=\\\"days\\\"><t>150</t><v>150</v><r>0</r><d>enter days</d><vt>integer</vt><tv>1</tv></p><p n=\\\"item\\\"><t>&lt;Contact Us&gt;</t><v>ContactUs</v><r>1</r><d>select form</d><vt>text</vt><tv>0</tv></p></r></rules>\")%}</value></macro></condition>" ); }
public ManiaPerformanceCalculator(Ruleset ruleset, WorkingBeatmap beatmap, ScoreInfo score) : base(ruleset, beatmap, score) { }
private double computeAimValue(ScoreInfo score, OsuDifficultyAttributes attributes) { double rawAim = attributes.AimDifficulty; if (score.Mods.Any(m => m is OsuModTouchDevice)) { rawAim = Math.Pow(rawAim, 0.8); } double aimValue = Math.Pow(5.0 * Math.Max(1.0, rawAim / 0.0675) - 4.0, 3.0) / 100000.0; double lengthBonus = 0.95 + 0.4 * Math.Min(1.0, totalHits / 2000.0) + (totalHits > 2000 ? Math.Log10(totalHits / 2000.0) * 0.5 : 0.0); aimValue *= lengthBonus; // Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses. if (effectiveMissCount > 0) { aimValue *= 0.97 * Math.Pow(1 - Math.Pow(effectiveMissCount / totalHits, 0.775), effectiveMissCount); } aimValue *= getComboScalingFactor(attributes); double approachRateFactor = 0.0; if (attributes.ApproachRate > 10.33) { approachRateFactor = 0.3 * (attributes.ApproachRate - 10.33); } else if (attributes.ApproachRate < 8.0) { approachRateFactor = 0.1 * (8.0 - attributes.ApproachRate); } aimValue *= 1.0 + approachRateFactor * lengthBonus; // Buff for longer maps with high AR. if (score.Mods.Any(m => m is OsuModBlinds)) { aimValue *= 1.3 + (totalHits * (0.0016 / (1 + 2 * effectiveMissCount)) * Math.Pow(accuracy, 16)) * (1 - 0.003 * attributes.DrainRate * attributes.DrainRate); } else if (score.Mods.Any(h => h is OsuModHidden)) { // We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR. aimValue *= 1.0 + 0.04 * (12.0 - attributes.ApproachRate); } // We assume 15% of sliders in a map are difficult since there's no way to tell from the performance calculator. double estimateDifficultSliders = attributes.SliderCount * 0.15; if (attributes.SliderCount > 0) { double estimateSliderEndsDropped = Math.Clamp(Math.Min(countOk + countMeh + countMiss, attributes.MaxCombo - scoreMaxCombo), 0, estimateDifficultSliders); double sliderNerfFactor = (1 - attributes.SliderFactor) * Math.Pow(1 - estimateSliderEndsDropped / estimateDifficultSliders, 3) + attributes.SliderFactor; aimValue *= sliderNerfFactor; } aimValue *= accuracy; // It is important to consider accuracy difficulty when scaling with accuracy. aimValue *= 0.98 + Math.Pow(attributes.OverallDifficulty, 2) / 2500; return(aimValue); }
public ReplayDownloadButton(ScoreInfo score) { Score.Value = score; Size = new Vector2(50, 30); }
protected void CalculateAccuracy(ScoreInfo score) { int countMiss = score.GetCountMiss() ?? 0; int count50 = score.GetCount50() ?? 0; int count100 = score.GetCount100() ?? 0; int count300 = score.GetCount300() ?? 0; int countGeki = score.GetCountGeki() ?? 0; int countKatu = score.GetCountKatu() ?? 0; switch (score.Ruleset.ID) { case 0: { int totalHits = count50 + count100 + count300 + countMiss; score.Accuracy = totalHits > 0 ? (double)(count50 * 50 + count100 * 100 + count300 * 300) / (totalHits * 300) : 1; float ratio300 = (float)count300 / totalHits; float ratio50 = (float)count50 / totalHits; if (ratio300 == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) { score.Rank = ScoreRank.A; } else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) { score.Rank = ScoreRank.B; } else if (ratio300 > 0.6) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 1: { int totalHits = count50 + count100 + count300 + countMiss; score.Accuracy = totalHits > 0 ? (double)(count100 * 150 + count300 * 300) / (totalHits * 300) : 1; float ratio300 = (float)count300 / totalHits; float ratio50 = (float)count50 / totalHits; if (ratio300 == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) { score.Rank = ScoreRank.A; } else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) { score.Rank = ScoreRank.B; } else if (ratio300 > 0.6) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 2: { int totalHits = count50 + count100 + count300 + countMiss + countKatu; score.Accuracy = totalHits > 0 ? (double)(count50 + count100 + count300) / totalHits : 1; if (score.Accuracy == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (score.Accuracy > 0.98) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if (score.Accuracy > 0.94) { score.Rank = ScoreRank.A; } else if (score.Accuracy > 0.9) { score.Rank = ScoreRank.B; } else if (score.Accuracy > 0.85) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 3: { int totalHits = count50 + count100 + count300 + countMiss + countGeki + countKatu; score.Accuracy = totalHits > 0 ? (double)(count50 * 50 + count100 * 100 + countKatu * 200 + (count300 + countGeki) * 300) / (totalHits * 300) : 1; if (score.Accuracy == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (score.Accuracy > 0.95) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if (score.Accuracy > 0.9) { score.Rank = ScoreRank.A; } else if (score.Accuracy > 0.8) { score.Rank = ScoreRank.B; } else if (score.Accuracy > 0.7) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } } }
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new ManiaPerformanceCalculator(this, beatmap, score);
public void SubmitterIsNotifiedOfInvalidScore() { var invalidScore = new ScoreInfo { Id = 123, TextScore = "BadScore", Username = "******" }; var expectedException = new UnrecognisedTokenException("Invalid Token"); interpreter.Setup(i => i.Interpret(invalidScore.TextScore)).Throws(expectedException); queue.ScoreReceived(invalidScore); notifications.Verify(n => n.SendError(invalidScore, expectedException), Times.Once()); Assert.That(queue.Tweets, Is.Empty); }
protected override IEnumerable <LeaderboardScoreStatistic> GetStatistics(ScoreInfo model) => new[] { new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:0%}" : @"{0:0.00%}", model.Accuracy)), new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", score.TotalAttempts.ToString()), new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", score.CompletedBeatmaps.ToString()), };
public MultiplayerResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem) : base(score, roomId, playlistItem, false, false) { }
protected virtual ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score, true);
public OsuPerformanceCalculator(Ruleset ruleset, DifficultyAttributes attributes, ScoreInfo score) : base(ruleset, attributes, score) { }
private void writeModSpecificData(ScoreInfo score, SerializationWriter sw) { }
public FadeAccessibleResults(ScoreInfo score) : base(score, true) { }
public DrawableScore(int index, ScoreInfo score) { ScoreModsContainer modsContainer; RelativeSizeAxes = Axes.X; Height = 30; CornerRadius = 3; Masking = true; Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Text = $"#{index + 1}", Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Left = side_margin } }, new DrawableFlag(score.User.Country) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), Margin = new MarginPadding { Left = 60 } }, new ClickableUsername { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, User = score.User, Margin = new MarginPadding { Left = 100 } }, modsContainer = new ScoreModsContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Width = 0.06f, RelativePositionAxes = Axes.X, X = 0.42f }, new DrawableRank(score.Rank) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), FillMode = FillMode.Fit, RelativePositionAxes = Axes.X, X = 0.55f }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.TotalScore:N0}", Font = OsuFont.Numeric.With(fixedWidth: true), RelativePositionAxes = Axes.X, X = 0.75f, }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.Accuracy:P2}", Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), RelativePositionAxes = Axes.X, X = 0.85f }, new OsuSpriteText { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Text = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}", Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Right = side_margin } }, }; foreach (Mod mod in score.Mods) { modsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.35f), }); } }
public void ScoreReceived(ScoreInfo scoreInfo) { try { scoreInfo.Score = interpreter.Interpret(scoreInfo.TextScore); Tweets.Add(scoreInfo); OnQueueChanged(); } catch (UnrecognisedTokenException exception) { notifications.SendError(scoreInfo, exception); } }
protected override ResultsScreen CreateResults(ScoreInfo score) { Debug.Assert(roomId.Value != null); return(new TimeshiftResultsScreen(score, roomId.Value.Value, playlistItem, true)); }
protected void PresentScore(ScoreInfo score) => FinaliseSelection(score.Beatmap, score.Ruleset, () => this.Push(new SoloResultsScreen(score, false)));
public new void SetScores(IEnumerable <ScoreInfo> scores, ScoreInfo userScore = default) => base.SetScores(scores, userScore);
protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score);
private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore) { var multiplayerUserScore = new MultiplayerScore { ID = (int)(userScore.OnlineScoreID ?? currentScoreId++), Accuracy = userScore.Accuracy, EndedAt = userScore.Date, Passed = userScore.Passed, Rank = userScore.Rank, Position = 200, MaxCombo = userScore.MaxCombo, TotalScore = userScore.TotalScore, User = userScore.User, Statistics = userScore.Statistics, ScoresAround = new MultiplayerScoresAround { Higher = new MultiplayerScores(), Lower = new MultiplayerScores() } }; totalCount++; for (int i = 1; i <= scores_per_result; i++) { multiplayerUserScore.ScoresAround.Lower.Scores.Add(new MultiplayerScore { ID = currentScoreId++, Accuracy = userScore.Accuracy, EndedAt = userScore.Date, Passed = true, Rank = userScore.Rank, MaxCombo = userScore.MaxCombo, TotalScore = userScore.TotalScore - i, User = new APIUser { Id = 2, Username = $"peppy{i}", CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", }, Statistics = userScore.Statistics }); multiplayerUserScore.ScoresAround.Higher.Scores.Add(new MultiplayerScore { ID = currentScoreId++, Accuracy = userScore.Accuracy, EndedAt = userScore.Date, Passed = true, Rank = userScore.Rank, MaxCombo = userScore.MaxCombo, TotalScore = userScore.TotalScore + i, User = new APIUser { Id = 2, Username = $"peppy{i}", CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", }, Statistics = userScore.Statistics }); totalCount += 2; } addCursor(multiplayerUserScore.ScoresAround.Lower); addCursor(multiplayerUserScore.ScoresAround.Higher); return(multiplayerUserScore); }
private Drawable[] createContent(int index, ScoreInfo score) { var content = new List <Drawable> { new OsuSpriteText { Text = $"#{index + 1}", Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) }, new DrawableRank(score.Rank) { Size = new Vector2(30, 20) }, new OsuSpriteText { Margin = new MarginPadding { Right = horizontal_inset }, Text = $@"{score.TotalScore:N0}", Font = OsuFont.GetFont(size: text_size, weight: index == 0 ? FontWeight.Bold : FontWeight.Medium) }, new OsuSpriteText { Margin = new MarginPadding { Right = horizontal_inset }, Text = $@"{score.Accuracy:P2}", Font = OsuFont.GetFont(size: text_size), Colour = score.Accuracy == 1 ? highAccuracyColour : Color4.White }, }; var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: text_size)) { AutoSizeAxes = Axes.Both }; username.AddUserLink(score.User); content.AddRange(new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Right = horizontal_inset }, Spacing = new Vector2(5, 0), Children = new Drawable[] { new DrawableFlag(score.User.Country) { Size = new Vector2(20, 13) }, username } }, new OsuSpriteText { Text = $@"{score.MaxCombo:N0}x", Font = OsuFont.GetFont(size: text_size) } }); foreach (var kvp in score.Statistics) { content.Add(new OsuSpriteText { Text = $"{kvp.Value}", Font = OsuFont.GetFont(size: text_size), Colour = kvp.Value == 0 ? Color4.Gray : Color4.White }); } content.AddRange(new Drawable[] { new OsuSpriteText { Text = $@"{score.PP:N0}", Font = OsuFont.GetFont(size: text_size) }, new FillFlowContainer { Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m) { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.3f) }) }, }); return(content.ToArray()); }
// Use this for initialization void Start() { gameScore = 0; //swManager = new ScoreWordMGR(); //swManager.Load(); scoreText = GetComponentInChildren<Text>(); scoreInfo = transform.root.gameObject.GetComponent<AppliController>().GetCurrentScene().GetComponent<GameScene>().levelTables.ScoreRatio; //_scoreCanvas = null; SetScore(); popScoreTextObject = Resources.Load<GameObject>(popScoreTextPath); }
public Score Parse(Stream stream) { var score = new Score { Replay = new Replay() }; WorkingBeatmap workingBeatmap; using (SerializationReader sr = new SerializationReader(stream)) { currentRuleset = GetRuleset(sr.ReadByte()); var scoreInfo = new ScoreInfo { Ruleset = currentRuleset.RulesetInfo }; score.ScoreInfo = scoreInfo; var version = sr.ReadInt32(); workingBeatmap = GetBeatmap(sr.ReadString()); if (workingBeatmap is DummyWorkingBeatmap) { throw new BeatmapNotFoundException(); } scoreInfo.User = new User { Username = sr.ReadString() }; // MD5Hash sr.ReadString(); scoreInfo.SetCount300(sr.ReadUInt16()); scoreInfo.SetCount100(sr.ReadUInt16()); scoreInfo.SetCount50(sr.ReadUInt16()); scoreInfo.SetCountGeki(sr.ReadUInt16()); scoreInfo.SetCountKatu(sr.ReadUInt16()); scoreInfo.SetCountMiss(sr.ReadUInt16()); scoreInfo.TotalScore = sr.ReadInt32(); scoreInfo.MaxCombo = sr.ReadUInt16(); /* score.Perfect = */ sr.ReadBoolean(); scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray(); // lazer replays get a really high version number. if (version < LegacyScoreEncoder.FIRST_LAZER_VERSION) { scoreInfo.Mods = scoreInfo.Mods.Append(currentRuleset.CreateMod <ModClassic>()).ToArray(); } currentBeatmap = workingBeatmap.GetPlayableBeatmap(currentRuleset.RulesetInfo, scoreInfo.Mods); scoreInfo.BeatmapInfo = currentBeatmap.BeatmapInfo; /* score.HpGraphString = */ sr.ReadString(); scoreInfo.Date = sr.ReadDateTime(); var compressedReplay = sr.ReadByteArray(); if (version >= 20140721) { scoreInfo.OnlineScoreID = sr.ReadInt64(); } else if (version >= 20121008) { scoreInfo.OnlineScoreID = sr.ReadInt32(); } if (scoreInfo.OnlineScoreID <= 0) { scoreInfo.OnlineScoreID = null; } if (compressedReplay?.Length > 0) { using (var replayInStream = new MemoryStream(compressedReplay)) { byte[] properties = new byte[5]; if (replayInStream.Read(properties, 0, 5) != 5) { throw new IOException("input .lzma is too short"); } long outSize = 0; for (int i = 0; i < 8; i++) { int v = replayInStream.ReadByte(); if (v < 0) { throw new IOException("Can't Read 1"); } outSize |= (long)(byte)v << (8 * i); } long compressedSize = replayInStream.Length - replayInStream.Position; using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var reader = new StreamReader(lzma)) readLegacyReplay(score.Replay, reader); } } } CalculateAccuracy(score.ScoreInfo); // before returning for database import, we must restore the database-sourced BeatmapInfo. // if not, the clone operation in GetPlayableBeatmap will cause a dereference and subsequent database exception. score.ScoreInfo.BeatmapInfo = workingBeatmap.BeatmapInfo; return(score); }
public TestSoloResults(ScoreInfo score) : base(score) { }
public void ScoreInfoCanBeMovedUpAndDownPlaylist() { var scoreToMove = new ScoreInfo { Id = 123 }; queue.Playlist.Add(new ScoreInfo()); queue.Playlist.Add(scoreToMove); queue.Playlist.Add(new ScoreInfo()); queue.MoveItemUp(scoreToMove); Assert.That(queue.Playlist[0], Is.EqualTo(scoreToMove)); queue.MoveItemDown(scoreToMove); Assert.That(queue.Playlist[1], Is.EqualTo(scoreToMove)); }
private IEnumerable<RuleInfo> GenerateRules(ScoreInfo score) { var rules = new List<RuleInfo>(); int ruleCount = StaticRandom.Next(15, 25); for (int i = 0; i < ruleCount; i++) { var ruleInfo = GenerateRule(score.ScoreSiteID); ruleInfo.RuleScoreID = score.ScoreID; rules.Add(ruleInfo); } return rules; }
public AccuracyHeatmap(ScoreInfo score, IBeatmap playableBeatmap) { this.score = score; this.playableBeatmap = playableBeatmap; }
public TestResultsScreen(ScoreInfo score, int roomId, PlaylistItem playlistItem, bool allowRetry = true) : base(score, roomId, playlistItem, allowRetry) { }
void MyAI_ChooseInjectionPointEvent() { int HealConvoysWithContainers = 0; int BigHealConvoys = 0; int HealConvoysWithCollectors = 0; int count = 0; int tmp = 0; int tmp1 = 0; int FHPnum = -1; int FAPnum = -1; Point p = new Point(); NavigationPointInfo FirstNavPoint = new NavigationPointInfo(); ScoreInfo FirstScoreObj = new ScoreInfo(); BattlePointInfo bp = new BattlePointInfo(); AtackPointInfo ap = new AtackPointInfo(); Pathfinder = new AStar(this.Tissue); ePathfinder = new eAStar(this.Tissue, new Point(PierreTeamInjectionPoint.X - 12, PierreTeamInjectionPoint.Y - 12), 24); //��������� ������ ReadAllMissions(); //������� HP � AP ReadHPsAndAPs(); //���������� ����� ������ � ������� HP, �� ������� ������ ����� AnalizeMap(ref FHPnum, ref FAPnum); //������� ����� ������ � ����� ������� ScoreMission`� if (ScoreObjectives != null) { count = 0; tmp = 10000; tmp1 = 0; for (int i = 0; i < ScoreObjectives.Length; i++) { if (ScoreObjectives[i].Score > count) { count = ScoreObjectives[i].Score; } if (ScoreObjectives[i].Turn < tmp) { tmp = ScoreObjectives[i].Turn; tmp1 = i; } } FirstScoreObj = ScoreObjectives[tmp1]; MinHPsToTake = (int)(count / 220) + 1; } else { FirstScoreObj.Score = 0; FirstScoreObj.Turn = 2000; MinHPsToTake = 0; } //������� ����� ������ NavigationMission if (NavigationPoints != null) { count = 10000; tmp = -1; for (int i = 0; i < NavigationPoints.Length; i++) { if (NavigationPoints[i].EndTurn < count) { count = NavigationPoints[i].EndTurn; tmp = i; } } FirstNavPoint = NavigationPoints[tmp]; } else { FirstNavPoint.Location = HoshimiPoints[FHPnum].Location; } //�������� � ����� ������ �� Pierre`� this.InjectionPointWanted = FinallyChooseInjectionPoint(HoshimiPoints[FHPnum].Location, AZNPoints[FAPnum].Location, FirstNavPoint.Location); if (KillPierre) { ap.Location = PierreTeamInjectionPoint; ap.Need = 5; ap.Exist = 0; ATargets.Add(ap); } //���� �������� HP � AP /* if (BattleExpected) { //��� ���������� ������������ ����� HP ���������� ����� for (int i = 0; i < MinHPsToTake; i++) { p = HoshimiPoints[(int)MyHPs[i]].Location; bp.Location = p; bp.Covered = 0; BTargets.Add(bp); } //��� ������ AP ���������� ����� p = AZNPoints[FAPnum].Location; bp.Location = p; bp.Covered = 0; BTargets.Add(bp); } */ //���������, ������� � ����� ����� ��� ���� NBPROTECTORTOBUILD = BTargets.Count; OBSERVERSTOBUILD = 1; NBBODYGUARSTOBUILD = 4; BodyGuards = new BodyGuard[NBBODYGUARSTOBUILD]; for (int i = 0; i < BodyGuards.Length; i++) { BodyGuards[i] = null; } //if (KillPierre) //{ // NBNAVIGATORTOBUILD = NavigationPoints.Length * 2; // NBATACKERTOBUILD = 4; //} //else //{ NBATACKERTOBUILD = 0; if (NavigationPoints != null) { for (int i = 0; i < NavigationPoints.Length; i++) { if ((NavigationPoints[i].BotType == NanoBotType.NanoExplorer) || ((NavigationPoints[i].BotType == NanoBotType.Unknown) && (NavigationPoints[i].Stock <= 0))) { NBNAVIGATORTOBUILD++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoCollector) && (NavigationPoints[i].Stock <= 0)) { NBATACKERTOBUILD++; AtackPointInfo api = new AtackPointInfo(); api.Location = NavigationPoints[i].Location; api.Need = 1; api.Exist = 0; ATargets.Add(api); } else if (((NavigationPoints[i].BotType == NanoBotType.NanoCollector) || (NavigationPoints[i].BotType == NanoBotType.Unknown)) && (NavigationPoints[i].Stock > 0) && (NavigationPoints[i].Stock <= 10)) { NBDOCTORSTOBUILD++; } else if (((NavigationPoints[i].BotType == NanoBotType.NanoContainer) || ((NavigationPoints[i].BotType == NanoBotType.Unknown) && (NavigationPoints[i].Stock > 0))) && (NavigationPoints[i].Stock <= 50)) { HealConvoysWithContainers++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoContainer || (NavigationPoints[i].BotType == NanoBotType.Unknown)) && (NavigationPoints[i].Stock > 50)) { BigHealConvoys++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoCollector) && (NavigationPoints[i].Stock > 10)) { HealConvoysWithCollectors++; } } } else { NBNAVIGATORTOBUILD = 0; } //} if (HealConvoysWithCollectors > 0) { CollConvoys = new ConvoyWithCollector[HealConvoysWithCollectors]; for (int i = 0; i < CollConvoys.Length; i++) { CollConvoys[i] = new ConvoyWithCollector(); } } if (BigHealConvoys > 0) { BigConvoys = new ConvoyWithBigContainer[BigHealConvoys]; for (int i = 0; i < BigConvoys.Length; i++) { BigConvoys[i] = new ConvoyWithBigContainer(); } } //����� ������� - ������� �� ����, ������� �� � �������� ����� ��������� � ������� ��� �� ���� int NotAllocatedBots = Utils.NbrMaxBots - 2 - NBBODYGUARSTOBUILD - NBATACKERTOBUILD - NBPROTECTORTOBUILD - MyHPs.Count; int ConvoysNumber = Math.Min((NotAllocatedBots - (NotAllocatedBots % 3)) / 3, MyHPs.Count + HealConvoysWithContainers); ConvoysNumber = Math.Max(ConvoysNumber, 3); Convoys = new Convoy[ConvoysNumber]; for (int i = 0; i < Convoys.Length; i++) { Convoys[i] = new Convoy(false); } for (int i = 0; i < HealConvoysWithContainers; i++) { Convoys[i].IsNavigating = true; } }
/// <summary> /// Initializes panel with basic info. /// </summary> /// <param name="score">ScoreInfo object</param> private void InitInfoPanel(ScoreInfo score) { if (score != null) { pnlInfo.GroupingText = GetString("om.score.info"); pnlInfo.Attributes.Add("style", "margin:0 30px;"); // Last evaluation time if ((task != null) && (task.TaskLastRunTime != DateTimeHelper.ZERO_TIME)) { lblLastEvalValue.Text = task.TaskLastRunTime.ToString(); } else { lblLastEvalValue.Text = GetString("general.na"); } // Display score status... switch (score.ScoreStatus) { case ScoreStatusEnum.Recalculating: // Status and progress if the status is 'Recalculating' ltrProgress.Text = String.Empty; string buildStr = GetString("om.score.recalculating"); ltrProgress.Text = "<img style=\"width:12px;height:12px;\" src=\"" + UIHelper.GetImageUrl(Page, "Design/Preloaders/preload16.gif") + "\" alt=\"" + buildStr + "\" tooltip=\"" + buildStr + "\" />"; lblStatusValue.Text = "<span class=\"StatusDisabled\">" + buildStr + "</span>"; break; case ScoreStatusEnum.Ready: // 'Ready' status lblStatusValue.Text = "<span class=\"StatusEnabled\">" + GetString("om.contactgroup.ready") + "</span>"; break; case ScoreStatusEnum.New: // 'Condition changed' status lblStatusValue.Text = "<span class=\"StatusDisabled\">" + GetString("om.score.recalcrequired") + "</span>"; break; case ScoreStatusEnum.Failed: // 'Recalculation failed' status lblStatusValue.Text = "<span class=\"StatusDisabled\" title=\"" + GetString("general.seeeventlog") + "\">" + GetString("om.score.recalcfailed") + "</span>"; break; case ScoreStatusEnum.Unspecified: // 'Unspecified' status lblStatusValue.Text = "<span class=\"StatusDisabled\">" + GetString("general.na") + "</span>"; break; } } }
private static RuleInfo GenerateBasicScoringRule(ScoreInfo score, string displayName, int ruleValue, RuleTypeEnum ruleType, string ruleCondition, string ruleParameter = null) { var rule = new RuleInfo { RuleScoreID = score.ScoreID, RuleDisplayName = displayName, RuleName = "Rule-" + Guid.NewGuid(), RuleValue = ruleValue, RuleType = ruleType, RuleParameter = ruleParameter, RuleCondition = ruleCondition, RuleSiteID = score.ScoreSiteID, RuleBelongsToPersona = false, RuleIsRecurring = false }; rule.Insert(); return rule; }
IEnumerator GetScores() { yield return(new WaitForSeconds(1)); if (Application.internetReachability == NetworkReachability.NotReachable) { Debug.Log("Error. Check internet connection!"); GameManager.instance.leaderboardText.SetActive(false); GameManager.instance.networkError.SetActive(true); GameManager.instance.startText.SetActive(false); } else { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(String.Format("https://waila.ml/api/dodgyrocks/getScores?score=" + PlayerPrefs.GetInt("best"))); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string jsonResponse = reader.ReadToEnd(); ScoreInfo info = new ScoreInfo { scores = JsonHelper2.FromJson <Scores>(jsonResponse) }; // For the pop-able view from the start GameManager.instance.name1.text = "1. " + info.scores[1].name; GameManager.instance.name2.text = "2. " + info.scores[2].name; GameManager.instance.name3.text = "3. " + info.scores[3].name; GameManager.instance.name4.text = "4. " + info.scores[4].name; GameManager.instance.name5.text = "5. " + info.scores[5].name; GameManager.instance.score1.text = info.scores[1].score.ToString(); GameManager.instance.score2.text = info.scores[2].score.ToString(); GameManager.instance.score3.text = info.scores[3].score.ToString(); GameManager.instance.score4.text = info.scores[4].score.ToString(); GameManager.instance.score5.text = info.scores[5].score.ToString(); // For the Game Over view GameManager.instance.name1a.text = "1. " + info.scores[1].name; GameManager.instance.name2a.text = "2. " + info.scores[2].name; GameManager.instance.name3a.text = "3. " + info.scores[3].name; GameManager.instance.name4a.text = "4. " + info.scores[4].name; GameManager.instance.name5a.text = "5. " + info.scores[5].name; GameManager.instance.score1a.text = info.scores[1].score.ToString(); GameManager.instance.score2a.text = info.scores[2].score.ToString(); GameManager.instance.score3a.text = info.scores[3].score.ToString(); GameManager.instance.score4a.text = info.scores[4].score.ToString(); GameManager.instance.score5a.text = info.scores[5].score.ToString(); if (info.scores[0].score.ToString() == "-1") { GameManager.instance.playersPos.text = ""; GameManager.instance.playersScore.text = ""; GameManager.instance.playersPos2.text = ""; GameManager.instance.playersScore2.text = ""; } else { GameManager.instance.playersPos.text = info.scores[0].score.ToString() + ". You"; GameManager.instance.playersScore.text = PlayerPrefs.GetInt("best").ToString(); GameManager.instance.playersPos2.text = info.scores[0].score.ToString() + ". You"; GameManager.instance.playersScore2.text = PlayerPrefs.GetInt("best").ToString(); } if (PlayerPrefs.GetInt("best").ToString() == info.scores[1].score.ToString()) { GameManager.instance.name1.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score1.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.name1a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score1a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); } if (PlayerPrefs.GetInt("best").ToString() == info.scores[2].score.ToString()) { GameManager.instance.name2.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score2.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.name2a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score2a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); } if (PlayerPrefs.GetInt("best").ToString() == info.scores[3].score.ToString()) { GameManager.instance.name3.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score3.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.name3a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score3a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); } if (PlayerPrefs.GetInt("best").ToString() == info.scores[4].score.ToString()) { GameManager.instance.name4.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score4.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.name4a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score4a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); } if (PlayerPrefs.GetInt("best").ToString() == info.scores[5].score.ToString()) { GameManager.instance.name5.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score5.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.name5a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); GameManager.instance.score5a.color = new Color(43.0f / 255.0f, 43.0f / 255.0f, 43.0f / 255.0f); } } }
/// <summary> /// Gets formatted score status. Score can be disabled, it can be scheduled to rebuild in the future or its status is one of <see cref="ScoreStatusEnum"/>. /// </summary> private FormattedText GetFormattedStatus(ScoreInfo info) { var formatter = new ScoreStatusFormatter(info); return formatter.GetFormattedStatus(); }
public TestReplayDownloadButton(ScoreInfo score) : base(score) { }
public void GenerateScores(int scoresCount, int siteId) { List<ScoreInfo> scores = new List<ScoreInfo>(); for (int i = 0; i < scoresCount; i++) { ScoreInfo score = new ScoreInfo { ScoreDisplayName = "Score #" + i, ScoreName = "Score-" + Guid.NewGuid(), ScoreBelongsToPersona = false, ScoreEnabled = true, ScoreStatus = ScoreStatusEnum.RecalculationRequired, ScoreSiteID = siteId }; score.Insert(); scores.Add(score); } List<RuleInfo> rules = new List<RuleInfo>(); foreach (var score in scores) { rules.AddRange(GenerateRules(score)); } BulkInsertion.Insert(rules); }
public ScorePanel(ScoreInfo score) { Score = score; }
private static void GenerateScoringWithRules() { ScoreInfo score = new ScoreInfo { ScoreDisplayName = "Score " + Guid.NewGuid(), ScoreName = "Score-" + Guid.NewGuid(), ScoreBelongsToPersona = false, ScoreEnabled = true, ScoreStatus = ScoreStatusEnum.RecalculationRequired, ScoreSiteID = SiteContext.CurrentSiteID }; score.Insert(); GenerateBasicScoringRule( score, "Has got e-mail address filled attribute rule", 10, RuleTypeEnum.Attribute, "<condition><attribute name=\"ContactEmail\"><value>@</value><params><Operator>0</Operator></params></attribute><wherecondition>ISNULL([ContactEmail], '') LIKE N'%@%'</wherecondition></condition>", "ContactEmail" ); GenerateBasicScoringRule( score, "Has got e-mail address filled macro rule", 10, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.ContactEmail.Contains(\\\"@\\\")\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"and\\\" n=\\\"CMSContactFieldContainsValue\\\" ><p n=\\\"field\\\"><t>E-mail address</t><v>ContactEmail</v><r>1</r><d>select field</d><vt>text</vt><tv>0</tv></p><p n=\\\"op\\\"><t>contains</t><v>Contains</v><r>0</r><d>select operator</d><vt>text</vt><tv>0</tv></p><p n=\\\"value\\\"><t>@</t><v>@</v><r>0</r><d>enter value</d><vt>text</vt><tv>1</tv></p></r></rules>\")%}</value></macro></condition>" ); GenerateBasicScoringRule( score, "Contact has filled \"Contact us\" form for 10p", 10, RuleTypeEnum.Macro, "<condition><macro><value>{%Rule(\"Contact.SubmittedForm(\\\"ContactUs\\\", ToInt(150))\", \"<rules><r pos=\\\"0\\\" par=\\\"\\\" op=\\\"and\\\" n=\\\"CMSContactHasSubmittedSpecifiedFormInLastXDays\\\" ><p n=\\\"_perfectum\\\"><t>has</t><v></v><r>0</r><d>select operation</d><vt>text</vt><tv>0</tv></p><p n=\\\"days\\\"><t>150</t><v>150</v><r>0</r><d>enter days</d><vt>integer</vt><tv>1</tv></p><p n=\\\"item\\\"><t>&lt;Contact Us&gt;</t><v>ContactUs</v><r>1</r><d>select form</d><vt>text</vt><tv>0</tv></p></r></rules>\")%}</value></macro></condition>" ); GenerateBasicScoringRule( score, "10 points per ONE page visit, NOT recurring", 10, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); var pageVisitRule = GenerateBasicScoringRule( score, "10 points per every page visit, recurring, max 35 total points", 10, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); pageVisitRule.RuleMaxPoints = 35; pageVisitRule.RuleIsRecurring = true; pageVisitRule.Update(); var pageVisitRuleWithValidity = GenerateBasicScoringRule( score, "10 points per ONE page visit, NOT recurring, 5 days validity", 10, RuleTypeEnum.Activity, "<condition><activity name=\"pagevisit\"><field name=\"ActivityCreated\"><params><seconddatetime>1/1/0001 12:00:00 AM</seconddatetime></params></field><field name=\"ActivityURL\"><value>XXXYYYZZZ</value><params><operator>1</operator></params></field><field name=\"ActivityTitle\"><params><operator>0</operator></params></field><field name=\"ActivityComment\"><params><operator>0</operator></params></field><field name=\"ActivityCampaign\"><params><operator>0</operator></params></field><field name=\"ActivityIPAddress\"><params><operator>0</operator></params></field><field name=\"ActivityURLReferrer\"><params><operator>0</operator></params></field><field name=\"PageVisitDetail\"><params><operator>0</operator></params></field><field name=\"PageVisitABVariantName\"><params><operator>0</operator></params></field><field name=\"PageVisitMVTCombinationName\"><params><operator>0</operator></params></field></activity><wherecondition>(ActivityType='pagevisit') AND (ISNULL([ActivityURL], '') NOT LIKE N'%XXXYYYZZZ%')</wherecondition></condition>", "pagevisit" ); pageVisitRuleWithValidity.RuleValidFor = 5; pageVisitRuleWithValidity.RuleValidity = ValidityEnum.Days; pageVisitRuleWithValidity.Update(); }
protected override ResultsScreen CreateResults(ScoreInfo score) { Debug.Assert(RoomId.Value != null); return(new PlaylistsResultsScreen(score, RoomId.Value.Value, PlaylistItem, true)); }
public void OnSuccess(object response) { var game = (Game)response; var scores = new ScoreInfo[game.GetScoreList().Count]; for(int i = 0; i < game.GetScoreList().Count; ++i) { scores[i] = new ScoreInfo(game.GetScoreList()[i].GetUserName(), (int)game.GetScoreList()[i].GetValue()); } _callback(scores); }
protected void CalculateAccuracy(ScoreInfo score) { score.Statistics.TryGetValue(HitResult.Miss, out int countMiss); score.Statistics.TryGetValue(HitResult.Meh, out int count50); score.Statistics.TryGetValue(HitResult.Good, out int count100); score.Statistics.TryGetValue(HitResult.Great, out int count300); score.Statistics.TryGetValue(HitResult.Perfect, out int countGeki); score.Statistics.TryGetValue(HitResult.Ok, out int countKatu); switch (score.Ruleset.ID) { case 0: { int totalHits = count50 + count100 + count300 + countMiss; score.Accuracy = totalHits > 0 ? (double)(count50 * 50 + count100 * 100 + count300 * 300) / (totalHits * 300) : 1; float ratio300 = (float)count300 / totalHits; float ratio50 = (float)count50 / totalHits; if (ratio300 == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) { score.Rank = ScoreRank.A; } else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) { score.Rank = ScoreRank.B; } else if (ratio300 > 0.6) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 1: { int totalHits = count50 + count100 + count300 + countMiss; score.Accuracy = totalHits > 0 ? (double)(count100 * 150 + count300 * 300) / (totalHits * 300) : 1; float ratio300 = (float)count300 / totalHits; float ratio50 = (float)count50 / totalHits; if (ratio300 == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (ratio300 > 0.9 && ratio50 <= 0.01 && countMiss == 0) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if ((ratio300 > 0.8 && countMiss == 0) || ratio300 > 0.9) { score.Rank = ScoreRank.A; } else if ((ratio300 > 0.7 && countMiss == 0) || ratio300 > 0.8) { score.Rank = ScoreRank.B; } else if (ratio300 > 0.6) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 2: { int totalHits = count50 + count100 + count300 + countMiss + countKatu; score.Accuracy = totalHits > 0 ? (double)(count50 + count100 + count300) / totalHits : 1; if (score.Accuracy == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (score.Accuracy > 0.98) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if (score.Accuracy > 0.94) { score.Rank = ScoreRank.A; } else if (score.Accuracy > 0.9) { score.Rank = ScoreRank.B; } else if (score.Accuracy > 0.85) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } case 3: { int totalHits = count50 + count100 + count300 + countMiss + countGeki + countKatu; score.Accuracy = totalHits > 0 ? (double)(count50 * 50 + count100 * 100 + countKatu * 200 + (count300 + countGeki) * 300) / (totalHits * 300) : 1; if (score.Accuracy == 1) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.XH : ScoreRank.X; } else if (score.Accuracy > 0.95) { score.Rank = score.Mods.Any(m => m is ModHidden || m is ModFlashlight) ? ScoreRank.SH : ScoreRank.S; } else if (score.Accuracy > 0.9) { score.Rank = ScoreRank.A; } else if (score.Accuracy > 0.8) { score.Rank = ScoreRank.B; } else if (score.Accuracy > 0.7) { score.Rank = ScoreRank.C; } else { score.Rank = ScoreRank.D; } break; } } }
public virtual PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => null;
public override PerformanceCalculator CreatePerformanceCalculator(DifficultyAttributes attributes, ScoreInfo score) => new CatchPerformanceCalculator(this, attributes, score);
public void MoveToPlaylist(ScoreInfo scoreToMove) { Tweets.Remove(scoreToMove); Playlist.Add(scoreToMove); }
public TimeshiftResultsScreen(ScoreInfo score, int roomId, PlaylistItem playlistItem, bool allowRetry = true) : base(score, allowRetry) { this.roomId = roomId; this.playlistItem = playlistItem; }