// ReSharper disable once MemberCanBePrivate.Global public ColorfulFlyFeather(Vector2 position, bool shielded, bool singleUse, FeatherColor color) : base(position, shielded, singleUse) { Sprite sprite = Get <Sprite>(); this.color = color; // ReSharper disable once SwitchStatementMissingSomeCases switch (color) { case FeatherColor.Blue: MySpriteBank.CreateOn(sprite, "DJMapHelper_blueFlyFeather"); starFlyColor = BlueStarFlyColor; break; case FeatherColor.Green: MySpriteBank.CreateOn(sprite, "DJMapHelper_greenFlyFeather"); starFlyColor = GreenStarFlyColor; break; case FeatherColor.Red: MySpriteBank.CreateOn(sprite, "DJMapHelper_redFlyFeather"); starFlyColor = RedStarFlyColor; break; default: throw new ArgumentOutOfRangeException(nameof(color), color, null); } }
private static void TryRecolorSprite(Strawberry berry) { if (berry.GetFieldValue("sprite") is not Sprite sprite) { return; } string spriteId = berry.GetType().FullName switch { "Celeste.Mod.CollabUtils2.Entities.SpeedBerry" => "speedrun_tool_speedberry", "Celeste.Mod.CollabUtils2.Entities.SilverBerry" => "speedrun_tool_silverberry", _ => "speedrun_tool_goldberry" }; mySpriteBank.CreateOn(sprite, spriteId); }
private void SetPoemColour(On.Celeste.Poem.orig_ctor orig, Poem self, string text, int heartIndex, float heartAlpha) { var data = AreaData.Get((Engine.Scene as Level).Session.Area); var m = GetModeMetaForAltSide(data); if (data != null) { Logger.Log("AltSidesHelper", $"Customising poem UI for \"{data.SID}\"."); } if (!(m?.ShowHeartPoem) ?? false) { text = null; } orig(self, text, heartIndex, heartAlpha); // customize heart gem icon string animId = null; // our sprite ID will be "AltSidesHelper_<heart sprite path keyified>" // log duplicate entries for a map var sid = (Engine.Scene as Level).Session.Area.SID; Color?color = null; AltSidesHelperMode mode = GetModeMetaForAltSide(AreaData.Get(sid)); if (mode != null && mode.OverrideHeartTextures) { animId = mode.ChapterPanelHeartIcon.DialogKeyify(); if (!mode.HeartColour.Equals("")) { color = Calc.HexToColor(mode.HeartColour); } } if (animId != null) { if (HeartSpriteBank.Has(animId)) { HeartSpriteBank.CreateOn(self.Heart, animId); self.Heart.Play("spin"); self.Heart.CenterOrigin(); Logger.Log("AltSidesHelper", $"Changed poem heart sprite for \"{data.SID}\"."); } } if (color != null) { new DynData <Poem>(self)["Color"] = color; Logger.Log("AltSidesHelper", $"Changed poem colour for \"{data.SID}\"."); } }
private void SetPoemColour(On.Celeste.Poem.orig_ctor orig, Poem self, string text, int heartIndex, float heartAlpha) { orig(self, text, heartIndex, heartAlpha); // customize heart gem icon string animId = null; // our sprite ID will be "AltSidesHelper_<heart sprite path keyified>" // log duplicate entries for a map var sid = (Engine.Scene as Level).Session.Area.SID; Color?color = null; AltSidesHelperMeta parentHelperMeta = GetMetaForAreaData(AreaData.Get(GetMetaForAreaData(AreaData.Get(sid))?.AltSideData?.For)); if (parentHelperMeta != null) { foreach (var mode in parentHelperMeta.Sides) { if (mode.Map.Equals(sid)) { animId = mode.ChapterPanelHeartIcon.DialogKeyify(); if (!mode.PoemDisplayColor.Equals("")) { color = Calc.HexToColor(mode.PoemDisplayColor); } } } } if (animId != null) { if (HeartSpriteBank.Has(animId)) { HeartSpriteBank.CreateOn(self.Heart, animId); self.Heart.Play("spin"); self.Heart.CenterOrigin(); } } if (color != null) { new DynData <Poem>(self)["Color"] = color; } }