private static void AddDefence(AIController AI) { HealthDefence HP = AI.GetComponentInParent <HealthDefence>(); ModDisplay display = AI.GetComponentInParent <ModDisplay>(); HP.defence += 1; if (display.Mods.Contains("\r\n Weak Defence Bonus")) { display.Mods.Add("\r\n Moderate Defence Bonus"); display.Mods.Remove("\r\n Weak Defence Bonus"); } else if (display.Mods.Contains("\r\n Moderate Defence Bonus")) { display.Mods.Add("\r\n Strong Defence Bonus"); display.Mods.Remove("\r\n Moderate Defence Bonus"); } else if (display.Mods.Contains("\r\n Strong Defence Bonus")) { display.Mods.Add("\r\n Great Defence Bonus"); display.Mods.Remove("\r\n Strong Defence Bonus"); } else if (!display.Mods.Contains("\r\n Great Defence Bonus")) { display.Mods.Add("\r\n Weak Defence Bonus"); } }
private static void AddAttackSpeed(AIController AI) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); foreach (Gun g in AI.weapons) { if (g.reload_time <= .5f) { AI.shoot_delay -= .25f; } else { g.reload_time -= .25f; } } if (display.Mods.Contains("\r\n Weak Attack Speed Bonus")) { display.Mods.Add("\r\n Moderate Attack Speed Bonus"); display.Mods.Remove("\r\n Weak Attack Speed Bonus"); } else if (display.Mods.Contains("\r\n Moderate Attack Speed Bonus")) { display.Mods.Add("\r\n Strong Attack Speed Bonus"); display.Mods.Remove("\r\n Moderate Attack Speed Bonus"); } else if (display.Mods.Contains("\r\n Strong Attack Speed Bonus")) { display.Mods.Add("\r\n Great Attack Speed Bonus"); display.Mods.Remove("\r\n Strong Attack Speed Bonus"); } else if (!display.Mods.Contains("\r\n Great Attack Speed Bonus")) { display.Mods.Add("\r\n Weak Attack Speed Bonus"); } }
private static void AddCritical(AIController AI) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); foreach (Gun g in AI.weapons) { g.crit_chance += .03; } if (display.Mods.Contains("\r\n Weak Critical Chance Bonus")) { display.Mods.Add("\r\n Moderate Critical Chance Bonus"); display.Mods.Remove("\r\n Weak Critical Chance Bonus"); } else if (display.Mods.Contains("\r\n Moderate Critical Chance Bonus")) { display.Mods.Add("\r\n Strong Critical Chance Bonus"); display.Mods.Remove("\r\n Moderate Critical Chance Bonus"); } else if (display.Mods.Contains("\r\n Strong Critical Chance Bonus")) { display.Mods.Add("\r\n Great Critical Chance Bonus"); display.Mods.Remove("\r\n Strong Critical Chance Bonus"); } else if (!display.Mods.Contains("\r\n Great Critical Chance Bonus")) { display.Mods.Add("\r\n Weak Critical Chance Bonus"); } }
private static void AddPotentialDamage(AIController AI) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); foreach (Gun g in AI.weapons) { g.upper_bound_damage += 2; } if (display.Mods.Contains("\r\n Weak Potential Damage Bonus")) { display.Mods.Add("\r\n Moderate Potential Damage Bonus"); display.Mods.Remove("\r\n Weak Potential Damage Bonus"); } else if (display.Mods.Contains("\r\n Moderate Potential Damage Bonus")) { display.Mods.Add("\r\n Strong Potential Damage Bonus"); display.Mods.Remove("\r\n Moderate Potential Damage Bonus"); } else if (display.Mods.Contains("\r\n Strong Potential Damage Bonus")) { display.Mods.Add("\r\n Great Potential Damage Bonus"); display.Mods.Remove("\r\n Strong Potential Damage Bonus"); } else if (!display.Mods.Contains("\r\n Great Potential Damage Bonus")) { display.Mods.Add("\r\n Weak Potential Damage Bonus"); } }
private static void AddProjectileSpeed(AIController AI) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); foreach (Gun g in AI.weapons) { g.projectile_speed++; } if (display.Mods.Contains("\r\n Weak Projectile Speed Bonus")) { display.Mods.Add("\r\n Moderate Projectile Speed Bonus"); display.Mods.Remove("\r\n Weak Projectile Speed Bonus"); } else if (display.Mods.Contains("\r\n Moderate Potential Damage Bonus")) { display.Mods.Add("\r\n Strong Projectile Speed Bonus"); display.Mods.Remove("\r\n Moderate Projectile Speed Bonus"); } else if (display.Mods.Contains("\r\n Strong Projectile Speed Bonus")) { display.Mods.Add("\r\n Great Projectile Speed Bonus"); display.Mods.Remove("\r\n Strong Projectile Speed Bonus"); } else if (!display.Mods.Contains("\r\n Great Projectile Speed Bonus")) { display.Mods.Add("\r\n Weak Projectile Speed Bonus"); } }
private static void AddMezmerizeStrength(AIController AI) { Gun gun = AI.main_gun; ModDisplay display = AI.GetComponentInParent <ModDisplay>(); if (gun.mezmerize_strength < .03) { display.Mods.Add("\r\n Weak Mezmerize Strength"); } else if (gun.mezmerize_strength < .06) { display.Mods.Add("\r\n Moderate Mezmerize Strength"); display.Mods.Remove("\r\n Weak Mezmerize Strength"); } else if (gun.mezmerize_strength < .09) { display.Mods.Add("\r\n Strong Mezmerize Strength"); display.Mods.Remove("\r\n Moderate Mezmerize Strength"); } else if (gun.mezmerize_strength < .12) { display.Mods.Add("\r\n Great Mezmerize Strength"); display.Mods.Remove("\r\n Strong Mezmerize Strength"); } foreach (Gun g in AI.weapons) { g.mezmerize_strength += .03; } }
private static void AddPrecision(AIController AI) { Gun gun = AI.main_gun; ModDisplay display = AI.GetComponentInParent <ModDisplay>(); int num = gun.upper_bound_damage - gun.lower_bound_damage; if (num > 1) { display.Mods.Add("\r\n Precise"); foreach (Gun g in AI.weapons) { g.lower_bound_damage += (int)((float)num * .5f); if (g.lower_bound_damage > g.upper_bound_damage) { g.lower_bound_damage = g.upper_bound_damage; } } } else { if (!display.Mods.Contains("\r\n Very Precise")) { display.Mods.Add("\r\n Very Precise"); display.Mods.Remove("\r\n Precise"); foreach (Gun g in AI.weapons) { g.lower_bound_damage = g.upper_bound_damage; } } } }
public override void Reset() { base.Reset(); Add(modSelect = new ModSelectOverlay { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, }); Add(modDisplay = new ModDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Position = new Vector2(0, 25), }); modDisplay.Current.BindTo(modSelect.SelectedMods); AddStep("Toggle", modSelect.ToggleVisibility); foreach (var ruleset in rulesets.AllRulesets) { AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); } }
private static void AddMezmerizeResistance(AIController AI) { HealthDefence HP = AI.GetComponentInParent <HealthDefence>(); ModDisplay display = AI.GetComponentInParent <ModDisplay>(); if (HP.mezmerize_resistance < .03) { display.Mods.Add("\r\n Weak Mezmerize Resistance"); } else if (HP.mezmerize_resistance < .06) { display.Mods.Add("\r\n Moderate Mezmerize Resistance"); display.Mods.Remove("\r\n Weak Mezmerize Resistance"); } else if (HP.mezmerize_resistance < .09) { display.Mods.Add("\r\n Strong Mezmerize Resistance"); display.Mods.Remove("\r\n Moderate Mezmerize Resistance"); } else if (HP.mezmerize_resistance < .12) { display.Mods.Add("\r\n Great Mezmerize Resistance"); display.Mods.Remove("\r\n Strong Mezmerize Resistance"); } HP.mezmerize_resistance += .03; }
private static void SetupUDN(UnityDisplayNode udn, ModDisplay modDisplay, Action <UnityDisplayNode> onComplete) { udn.name = modDisplay.Id + "(Clone)"; udn.RecalculateGenericRenderers(); try { modDisplay.ModifyDisplayNode(udn); } catch (Exception e) { MelonLogger.Error($"Failed to modify DisplayNode for {modDisplay.Name}"); MelonLogger.Error(e); } try { if (modDisplay.Scale < 1f || modDisplay.Scale > 1f) { udn.transform.GetChild(0).transform.localScale = new Vector3(modDisplay.Scale, modDisplay.Scale, modDisplay.Scale); } } catch (Exception e) { MelonLogger.Error($"Failed to change scale for {modDisplay.Name}"); MelonLogger.Error(e); } udn.RecalculateGenericRenderers(); onComplete.Invoke(udn); ResourceHandler.Prefabs[modDisplay.Id] = udn; }
private void load(RulesetStore rulesets) { this.rulesets = rulesets; Add(modSelect = new TestModSelectOverlay { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, }); Add(modDisplay = new ModDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Position = new Vector2(0, 25), }); modDisplay.Current.UnbindBindings(); modDisplay.Current.BindTo(modSelect.SelectedMods); AddStep("Show", modSelect.Show); AddStep("Toggle", modSelect.ToggleVisibility); AddStep("Toggle", modSelect.ToggleVisibility); }
private static void AddHealth(AIController AI) { HealthDefence HP = AI.GetComponentInParent <HealthDefence>(); ModDisplay display = AI.GetComponentInParent <ModDisplay>(); HP.maxHP += (int)((float)HP.maxHP * .2f); if (HP.maxHP > HP.HP) { HP.HP = HP.maxHP; } if (display.Mods.Contains("\r\n Weak Health Bonus")) { display.Mods.Add("\r\n Moderate Health Bonus"); display.Mods.Remove("\r\n Weak Health Bonus"); } else if (display.Mods.Contains("\r\n Moderate Health Bonus")) { display.Mods.Add("\r\n Strong Health Bonus"); display.Mods.Remove("\r\n Moderate Health Bonus"); } else if (display.Mods.Contains("\r\n Strong Health Bonus")) { display.Mods.Add("\r\n Great Health Bonus"); display.Mods.Remove("\r\n Strong Health Bonus"); } else if (!display.Mods.Contains("\r\n Great Health Bonus")) { display.Mods.Add("\r\n Weak Health Bonus"); } }
private static void AddExp(AIController AI) { HealthDefence HP = AI.GetComponentInParent <HealthDefence>(); ModDisplay display = AI.GetComponentInParent <ModDisplay>(); HP.exp_rate += .1f; if (display.Mods.Contains("\r\n Weak Experience Bonus")) { display.Mods.Add("\r\n Moderate Experience Bonus"); display.Mods.Remove("\r\n Weak Experience Bonus"); } else if (display.Mods.Contains("\r\n Moderate Experience Bonus")) { display.Mods.Add("\r\n Strong Experience Bonus"); display.Mods.Remove("\r\n Moderate Experience Bonus"); } else if (display.Mods.Contains("\r\n Strong Experience Bonus")) { display.Mods.Add("\r\n Great Experience Bonus"); display.Mods.Remove("\r\n Strong Experience Bonus"); } else if (!display.Mods.Contains("\r\n Great Experience Bonus")) { display.Mods.Add("\r\n Weak Experience Bonus"); } }
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, WorkingBeatmap working, IClock offsetClock, IAdjustableClock adjustableClock) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] { visibilityContainer = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 30, AutoSizeAxes = Axes.Both, AutoSizeDuration = 200, AutoSizeEasing = Easing.Out, Children = new Drawable[] { AccuracyCounter = CreateAccuracyCounter(), ScoreCounter = CreateScoreCounter(), ComboCounter = CreateComboCounter(), }, }, HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), } }, PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), new FillFlowContainer { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y), AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { KeyCounter = CreateKeyCounter(adjustableClock as IFrameBasedClock), HoldToQuit = CreateHoldForMenuButton(), } } }; BindProcessor(scoreProcessor); BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); ModDisplay.Current.BindTo(working.Mods); PlayerSettingsOverlay.PlaybackSettings.AdjustableClock = adjustableClock; }
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList <Mod> mods) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] { visibilityContainer = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 30, AutoSizeAxes = Axes.Both, AutoSizeDuration = 200, AutoSizeEasing = Easing.Out, Children = new Drawable[] { AccuracyCounter = CreateAccuracyCounter(), ScoreCounter = CreateScoreCounter(), ComboCounter = CreateComboCounter(), }, }, HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), } }, PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), new FillFlowContainer { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y), AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { KeyCounter = CreateKeyCounter(), HoldToQuit = CreateHoldForMenuButton(), } } }; BindProcessor(scoreProcessor); BindDrawableRuleset(drawableRuleset); Progress.Objects = drawableRuleset.Objects; Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value; Progress.RequestSeek = time => RequestSeek(time); ModDisplay.Current.Value = mods; }
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList <Mod> mods) { this.scoreProcessor = scoreProcessor; this.drawableRuleset = drawableRuleset; this.mods = mods; RelativeSizeAxes = Axes.Both; Children = new Drawable[] { visibilityContainer = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 30, AutoSizeAxes = Axes.Both, AutoSizeDuration = 200, AutoSizeEasing = Easing.Out, Children = new Drawable[] { AccuracyCounter = CreateAccuracyCounter(), ScoreCounter = CreateScoreCounter(), ComboCounter = CreateComboCounter(), }, }, HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), } }, PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), new FillFlowContainer { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y), AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { KeyCounter = CreateKeyCounter(), HoldToQuit = CreateHoldForMenuButton(), } } }; }
void AssignMiscMods(AIController Unit) { for (int i = 0; i < num_misc_mods; i++) { if (rand.NextDouble() < misc_mod_chance) { int n = rand.Next(MiscMods.Count - 1); MiscMods[n](Unit); } } ModDisplay display = Unit.GetComponentInParent <ModDisplay>(); if (display.Mods.Count == 0) { display.Mods.Add("\r\n No Mods"); } }
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, WorkingBeatmap working, IClock offsetClock, IAdjustableClock adjustableClock) { RelativeSizeAxes = Axes.Both; Add(content = new Container { RelativeSizeAxes = Axes.Both, AlwaysPresent = true, // The hud may be hidden but certain elements may need to still be updated Children = new Drawable[] { ComboCounter = CreateComboCounter(), ScoreCounter = CreateScoreCounter(), AccuracyCounter = CreateAccuracyCounter(), HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), new FillFlowContainer { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y), AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { KeyCounter = CreateKeyCounter(adjustableClock as IFrameBasedClock), HoldToQuit = CreateHoldForMenuButton(), } } } }); BindProcessor(scoreProcessor); BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); ModDisplay.Current.BindTo(working.Mods); PlayerSettingsOverlay.PlaybackSettings.AdjustableClock = adjustableClock; }
protected override void LoadComplete() { base.LoadComplete(); Add(modSelect = new TestModSelectOverlay { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, }); Add(modDisplay = new ModDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Position = new Vector2(0, 25), }); modDisplay.Current.BindTo(modSelect.SelectedMods); AddStep("Toggle", modSelect.ToggleVisibility); AddStep("Hide", modSelect.Hide); AddStep("Show", modSelect.Show); foreach (var rulesetInfo in rulesets.AvailableRulesets) { Ruleset ruleset = rulesetInfo.CreateInstance(); AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo); switch (ruleset) { case OsuRuleset or: testOsuMods(or); break; case ManiaRuleset mr: testManiaMods(mr); break; } } }
private static void AddLevel(AIController AI, Gun gun) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); for (int i = 0; i < gun.level; i++) { int n = rand.Next(11); while ((!(gun is Strike) && (n == 2 || n == 5 || n == 8 || n == 11)) || gun.claimed_gun_ability.Contains(n)) { n = rand.Next(11); } gun.claimed_gun_ability.Add(n); gun.Claimed_Gun_Mods += gun.ClassGunMods(n); } int index = display.Mods.Count; display.Mods.Add("\r\n Level " + gun.level + " " + gun.GetBaseName()); }
public void TestMode(ExpansionMode mode) { AddStep("create mod display", () => { Child = new ModDisplay { Anchor = Anchor.Centre, Origin = Anchor.Centre, ExpansionMode = mode, Current = { Value = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime(), new OsuModDifficultyAdjust(), new OsuModEasy(), } } }; }); }
private static void AddLevel(AIController AI) { ModDisplay display = AI.GetComponentInParent <ModDisplay>(); int n = rand.Next(11); while ((n == 2 || n == 5 || n == 8 || n == 11)) { n = rand.Next(11); } foreach (Gun g in AI.weapons) { if (!g.claimed_gun_ability.Contains(n) && g.ClassGunMods(n) != null) { g.level += 1; g.Claimed_Gun_Mods += g.ClassGunMods(n); g.claimed_gun_ability.Add(n); } } if (display.Mods.Contains("\r\n Level One Weapon")) { display.Mods.Add("\r\n Level Two Weapon"); display.Mods.Remove("\r\n Level One Weapon"); } else if (display.Mods.Contains("\r\n Level Two Weapon")) { display.Mods.Add("\r\n Level Three Weapon"); display.Mods.Remove("\r\n Level Two Weapon"); } else if (display.Mods.Contains("\r\n Level Three Weapon")) { display.Mods.Add("\r\n Level Four Weapon"); display.Mods.Remove("\r\n Level Three Weapon"); } else if (!display.Mods.Contains("\r\n Level Four Weapon")) { display.Mods.Add("\r\n Level One Weapon"); } }
void Start() { AIController AI = GetComponentInChildren <AIController>(); ModDisplay display = GetComponentInParent <ModDisplay>(); display.Mods.Add("<color=red>Boss: Adhutlio</color>"); AI.StartCoroutine(AI.SetState(AIController.Type.Conquer, Vector3.zero)); //AI.StartCoroutine(AI.PaintShell(Color.black)); Flurry flurry = GetComponentInChildren <Flurry>(); Blaster blaster = GetComponentInChildren <Blaster>(); string Layer = LayerMask.LayerToName(gameObject.layer); flurry.SetBaseStats(Layer); blaster.SetBaseStats(Layer); flurry.level = 3; blaster.level = 3; flurry.AddAbility(blaster.GetGunModAbility(5)); flurry.AddAbility(4); flurry.AddAbility(7); blaster.AddAbility(5); blaster.AddAbility(9); blaster.AddAbility(flurry.GetGunModAbility(6)); }
private void load() { var user = User.User; var backgroundColour = Color4Extensions.FromHex("#33413C"); InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 18), new Dimension(GridSizeMode.AutoSize), new Dimension(), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { crown = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.Crown, Size = new Vector2(14), Colour = Color4Extensions.FromHex("#F7E65D"), Alpha = 0 }, new TeamDisplay(User), new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = backgroundColour }, new UserCoverBackground { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, Width = 0.75f, User = user, Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f)) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Spacing = new Vector2(10), Direction = FillDirection.Horizontal, Children = new Drawable[] { new UpdateableAvatar { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, User = user }, new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), Country = user?.Country }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Text = user?.Username }, userRankText = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 14), } } }, new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Right = 70 }, Child = userModsDisplay = new ModDisplay { Scale = new Vector2(0.5f), ExpansionMode = ExpansionMode.AlwaysContracted, } }, userStateDisplay = new StateDisplay { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 10 }, } } }, kickButton = new KickButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0, Margin = new MarginPadding(4), Action = () => Client.KickUser(User.UserID), }, }, } }; }
private void load(OsuGameBase game, RulesetStore rulesets) { BeatmapDetailArea detailsArea; Add(detailsArea = new BeatmapDetailArea { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(550f, 450f), }); Add(modDisplay = new ModDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Position = new Vector2(0, 25), }); modDisplay.Current.BindTo(SelectedMods); AddStep("all metrics", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { BeatmapSet = new BeatmapSetInfo { Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } }, Version = "All Metrics", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has all the metrics", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 7, DrainRate = 1, OverallDifficulty = 5.7f, ApproachRate = 3.5f, }, StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } })); AddStep("all except source", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { BeatmapSet = new BeatmapSetInfo { Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } }, Version = "All Metrics", Metadata = new BeatmapMetadata { Tags = "this beatmap has all the metrics", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 7, DrainRate = 1, OverallDifficulty = 5.7f, ApproachRate = 3.5f, }, StarDifficulty = 5.3f, Metrics = new BeatmapMetrics { Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } })); AddStep("ratings", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { BeatmapSet = new BeatmapSetInfo { Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() } }, Version = "Only Ratings", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has ratings metrics but not retries or fails", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, DrainRate = 9, OverallDifficulty = 6, ApproachRate = 6, }, StarDifficulty = 4.8f } })); AddStep("fails+retries", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { Version = "Only Retries and Fails", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has retries and fails but no ratings", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.7f, DrainRate = 6, OverallDifficulty = 6, ApproachRate = 7, }, StarDifficulty = 2.91f, Metrics = new BeatmapMetrics { Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(), Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(), }, } })); AddStep("null metrics", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { Version = "No Metrics", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has no metrics", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 5, DrainRate = 5, OverallDifficulty = 5.5f, ApproachRate = 6.5f, }, StarDifficulty = 1.97f, } })); AddStep("null beatmap", () => detailsArea.Beatmap = null); Ruleset ruleset = rulesets.AvailableRulesets.First().CreateInstance(); AddStep("with EZ mod", () => { detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { Version = "Has Easy Mod", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has the easy mod enabled", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3, DrainRate = 3, OverallDifficulty = 3, ApproachRate = 3, }, StarDifficulty = 1f, } }); SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModEasy) }; }); AddStep("with HR mod", () => { detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap { BeatmapInfo = { Version = "Has Hard Rock Mod", Metadata = new BeatmapMetadata { Source = "osu!lazer", Tags = "this beatmap has the hard rock mod enabled", }, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3, DrainRate = 3, OverallDifficulty = 3, ApproachRate = 3, }, StarDifficulty = 1f, } }); SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModHardRock) }; }); }
protected override Drawable CreateContent() { Action <SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold); return(maskingContainer = new Container { RelativeSizeAxes = Axes.X, Height = 50, Masking = true, CornerRadius = 10, Children = new Drawable[] { new Box // A transparent box that forces the border to be drawn if the panel background is opaque { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true }, new PanelBackground { RelativeSizeAxes = Axes.Both, Beatmap = { BindTarget = beatmap } }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { difficultyIconContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Left = 8, Right = 8, }, }, new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { beatmapText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, explicitContentPill = new ExplicitContentBeatmapPill { Alpha = 0f, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Top = 3f }, } }, }, new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Child = modDisplay = new ModDisplay { Scale = new Vector2(0.4f), ExpansionMode = ExpansionMode.AlwaysExpanded } } } } } }, new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Left = 8, Right = 10, }, AutoSizeAxes = Axes.Both, Spacing = new Vector2(5), ChildrenEnumerable = CreateButtons().Select(button => button.With(b => { b.Anchor = Anchor.Centre; b.Origin = Anchor.Centre; })) } } } }, } }); }
protected override Drawable CreateContent() => maskingContainer = new Container { RelativeSizeAxes = Axes.X, Height = 50, Masking = true, CornerRadius = 10, Children = new Drawable[] { new Box // A transparent box that forces the border to be drawn if the panel background is opaque { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true }, new PanelBackground { RelativeSizeAxes = Axes.Both, Beatmap = { BindTarget = beatmap } }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 8 }, Spacing = new Vector2(8, 0), Direction = FillDirection.Horizontal, Children = new Drawable[] { difficultyIconContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, }, new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { beatmapText = new LinkFlowContainer { AutoSizeAxes = Axes.Both }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { authorText = new LinkFlowContainer { AutoSizeAxes = Axes.Both }, explicitContentPill = new ExplicitContentBeatmapPill { Alpha = 0f, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Top = 3f }, } }, }, new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Child = modDisplay = new ModDisplay { Scale = new Vector2(0.4f), DisplayUnrankedText = false, ExpansionMode = ExpansionMode.AlwaysExpanded } } } } } } } }, new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, X = -18, ChildrenEnumerable = CreateButtons() } } };
private void load(OsuColour colours) { BeatmapSelectButton beatmapButton; ModDisplay modDisplay; InternalChildren = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { new HeaderBackgroundSprite { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.7f), Color4.Black.Opacity(0.8f)), }, beatmapPanel = new MatchBeatmapPanel { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 100 }, } } }, new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Height = 1, Colour = colours.Yellow }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 20 }, Direction = FillDirection.Vertical, Children = new Drawable[] { new BeatmapTypeInfo(), modDisplay = new ModDisplay { Scale = new Vector2(0.75f), DisplayUnrankedText = false }, } }, new Container { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Y, Width = 200, Padding = new MarginPadding { Vertical = 10 }, Child = beatmapButton = new BeatmapSelectButton { RelativeSizeAxes = Axes.Both, Height = 1, }, }, Tabs = new MatchTabControl { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X }, }, }, }; CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods?.ToArray() ?? Array.Empty <Mod>(), true); beatmapButton.Action = () => RequestBeatmapSelection?.Invoke(); }
protected override Drawable CreateContent() { Action <SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold); return(maskingContainer = new Container { RelativeSizeAxes = Axes.X, Height = HEIGHT, Masking = true, CornerRadius = 10, Children = new Drawable[] { new Box // A transparent box that forces the border to be drawn if the panel background is opaque { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true }, panelBackground = new PanelBackground { RelativeSizeAxes = Axes.Both, }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new Drawable[] { difficultyIconContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Left = 8, Right = 8 }, }, new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { beatmapText = new LinkFlowContainer(fontParameters) { RelativeSizeAxes = Axes.X, // workaround to ensure only the first line of text shows, emulating truncation (but without ellipsis at the end). // TODO: remove when text/link flow can support truncation with ellipsis natively. Height = OsuFont.DEFAULT_FONT_SIZE, Masking = true }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, explicitContentPill = new ExplicitContentBeatmapPill { Alpha = 0f, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Top = 3f }, } }, }, new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Child = modDisplay = new ModDisplay { Scale = new Vector2(0.4f), ExpansionMode = ExpansionMode.AlwaysExpanded } } } } } }, new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Horizontal = 8 }, AutoSizeAxes = Axes.Both, Spacing = new Vector2(5), ChildrenEnumerable = CreateButtons().Select(button => button.With(b => { b.Anchor = Anchor.Centre; b.Origin = Anchor.Centre; })) }, ownerAvatar = new OwnerAvatar { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(ICON_HEIGHT), Margin = new MarginPadding { Right = 8 }, Masking = true, CornerRadius = 4, Alpha = showItemOwner ? 1 : 0 }, } } }, } }); }
private void load() { var user = User.User; var backgroundColour = Color4Extensions.FromHex("#33413C"); InternalChildren = new Drawable[] { crown = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.Crown, Size = new Vector2(14), Colour = Color4Extensions.FromHex("#F7E65D"), Alpha = 0 }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 24 }, Child = new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = backgroundColour }, new UserCoverBackground { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, Width = 0.75f, User = user, Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f)) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Spacing = new Vector2(10), Direction = FillDirection.Horizontal, Children = new Drawable[] { new UpdateableAvatar { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, User = user }, new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), Country = user?.Country }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Text = user?.Username }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 14), Text = user?.CurrentModeRank != null ? $"#{user.CurrentModeRank}" : string.Empty } } }, new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Right = 70 }, Child = userModsDisplay = new ModDisplay { Scale = new Vector2(0.5f), ExpansionMode = ExpansionMode.AlwaysContracted, DisplayUnrankedText = false, } }, userStateDisplay = new StateDisplay { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 10 }, } } } } }; }