Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of LevelUpHUD v1.0.4
LevelUpHUD.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Il2CppScheduleOne.Levelling; using LevelUpHUD; using LevelUpHUD.GUI; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "LevelUpHUD", "1.0.4", "DiumStream", null)] [assembly: MelonGame(null, "Schedule One")] [assembly: AssemblyMetadata("NexusModID", "987")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LevelUpHUD { public class Main : MelonMod { private const float UPDATE_INTERVAL = 0.2f; private float timeSinceLastUpdate; private bool isMainSceneLoaded = false; private LevelManager levelManager = null; private UIHandler gui = null; public static Main Instance { get; private set; } public override void OnInitializeMelon() { Instance = this; Config.Load(); gui = new UIHandler(GetRankText, GetNextText); Config.OnConfigChanged = (Action)Delegate.Combine(Config.OnConfigChanged, new Action(ReloadUI)); } private void ReloadUI() { if (isMainSceneLoaded) { gui.CreateOrUpdateUI(); } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Main") { isMainSceneLoaded = true; FindLevelManager(); gui.CreateOrUpdateUI(); } else { isMainSceneLoaded = false; levelManager = null; gui.DestroyUI(); } } public override void OnUpdate() { if (!isMainSceneLoaded) { return; } if ((Object)(object)levelManager == (Object)null) { FindLevelManager(); if (!((Object)(object)levelManager == (Object)null)) { } } timeSinceLastUpdate += Time.deltaTime; if (timeSinceLastUpdate >= 0.2f) { gui.UpdateUI(); timeSinceLastUpdate = 0f; } } private void FindLevelManager() { GameObject val = GameObject.Find("Managers"); if ((Object)(object)val != (Object)null) { Transform val2 = val.transform.Find("@LevelManager"); if ((Object)(object)val2 != (Object)null) { levelManager = ((Component)val2).gameObject.GetComponent<LevelManager>(); } } if ((Object)(object)levelManager == (Object)null) { levelManager = Object.FindObjectOfType<LevelManager>(); } } public string GetRankText() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)levelManager == (Object)null) { return "<i>" + Localization.Get("loading") + "</i>"; } ERank rank_k__BackingField = levelManager._Rank_k__BackingField; int hashCode = ((object)(ERank)(ref rank_k__BackingField)).GetHashCode(); int tier_k__BackingField = levelManager._Tier_k__BackingField; string rankName = GetRankName(hashCode, tier_k__BackingField); if (string.IsNullOrEmpty(rankName)) { return ""; } return $"<b>{rankName} {tier_k__BackingField}</b>"; } public string GetNextText() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) string result; if ((Object)(object)levelManager == (Object)null) { result = ""; } else { ERank rank_k__BackingField = levelManager._Rank_k__BackingField; int hashCode = ((object)(ERank)(ref rank_k__BackingField)).GetHashCode(); int tier_k__BackingField = levelManager._Tier_k__BackingField; int xP_k__BackingField = levelManager._XP_k__BackingField; float xPToNextTier = levelManager.XPToNextTier; if (hashCode >= 10) { return ""; } int num = tier_k__BackingField + 1; int rankIndex = hashCode; if (num > 5) { rankIndex = hashCode + 1; num = 1; } string rankName = GetRankName(rankIndex, num); result = ((!(xPToNextTier <= 0f) && !string.IsNullOrEmpty(rankName)) ? $"{Localization.Get("next")}: <b>{rankName} {num}</b> \u00a0| \u00a0XP: <b>{xP_k__BackingField} / {(int)xPToNextTier}</b>" : ""); } return result; } private string GetRankName(int rankIndex, int tier) { string rankKey = Localization.GetRankKey(rankIndex); if (rankIndex >= 10) { return Localization.Get("rank_kingpin"); } return Localization.Get(rankKey); } } public enum LanguageCode { EN, FR, DE } public static class Config { public static MelonPreferences_Category CatMain; public static MelonPreferences_Entry<int> HudPosX; public static MelonPreferences_Entry<int> HudPosY; public static MelonPreferences_Entry<int> RankFontSize; public static MelonPreferences_Entry<Color> RankColor; public static MelonPreferences_Entry<Color> NextColor; public static MelonPreferences_Entry<Color> PanelColorTop; public static MelonPreferences_Entry<Color> PanelColorBottom; public static MelonPreferences_Entry<int> PanelWidth; public static MelonPreferences_Entry<int> PanelHeight; public static MelonPreferences_Entry<LanguageCode> Language; public static Action OnConfigChanged; public static void Load() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) CatMain = MelonPreferences.CreateCategory("LevelUpHUD_Main", "LevelUpHUD - Display"); HudPosX = CatMain.CreateEntry<int>("HudPosX", 1570, "HUD Position X", "Horizontal position of the HUD (pixels from left)", false, false, (ValueValidator)null, (string)null); HudPosY = CatMain.CreateEntry<int>("HudPosY", 8, "HUD Position Y", "Vertical position of the HUD (pixels from top)", false, false, (ValueValidator)null, (string)null); RankFontSize = CatMain.CreateEntry<int>("RankFontSize", 26, "Rank Text Size", "Font size for the rank text", false, false, (ValueValidator)null, (string)null); RankColor = CatMain.CreateEntry<Color>("RankColor", new Color(0.95f, 0.95f, 1f, 0.92f), "Rank Text Color", "Color for the rank text", false, false, (ValueValidator)null, (string)null); NextColor = CatMain.CreateEntry<Color>("NextColor", new Color(0.85f, 0.92f, 1f, 0.92f), "Next Rank Text Color", "Color for the next rank text", false, false, (ValueValidator)null, (string)null); PanelColorTop = CatMain.CreateEntry<Color>("PanelColorTop", new Color(0.13f, 0.15f, 0.21f, 0.95f), "Panel Gradient Top", "Top color of the panel gradient", false, false, (ValueValidator)null, (string)null); PanelColorBottom = CatMain.CreateEntry<Color>("PanelColorBottom", new Color(0.08f, 0.09f, 0.13f, 0.95f), "Panel Gradient Bottom", "Bottom color of the panel gradient", false, false, (ValueValidator)null, (string)null); PanelWidth = CatMain.CreateEntry<int>("PanelWidth", 340, "Panel Width", "Width of the HUD panel", false, false, (ValueValidator)null, (string)null); PanelHeight = CatMain.CreateEntry<int>("PanelHeight", 80, "Panel Height", "Height of the HUD panel", false, false, (ValueValidator)null, (string)null); Language = CatMain.CreateEntry<LanguageCode>("Language", LanguageCode.EN, "Language", "Language for the HUD text", false, false, (ValueValidator)null, (string)null); Localization.SetLanguage(Language.Value.ToString()); Localization.ClearCache(); Action onConfigChangedCallback = delegate { OnConfigChanged?.Invoke(); }; ((MelonEventBase<LemonAction<int, int>>)(object)HudPosX.OnEntryValueChanged).Subscribe((LemonAction<int, int>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<int, int>>)(object)HudPosY.OnEntryValueChanged).Subscribe((LemonAction<int, int>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<int, int>>)(object)RankFontSize.OnEntryValueChanged).Subscribe((LemonAction<int, int>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<Color, Color>>)(object)RankColor.OnEntryValueChanged).Subscribe((LemonAction<Color, Color>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<Color, Color>>)(object)NextColor.OnEntryValueChanged).Subscribe((LemonAction<Color, Color>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<Color, Color>>)(object)PanelColorTop.OnEntryValueChanged).Subscribe((LemonAction<Color, Color>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<Color, Color>>)(object)PanelColorBottom.OnEntryValueChanged).Subscribe((LemonAction<Color, Color>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<int, int>>)(object)PanelWidth.OnEntryValueChanged).Subscribe((LemonAction<int, int>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<int, int>>)(object)PanelHeight.OnEntryValueChanged).Subscribe((LemonAction<int, int>)delegate { onConfigChangedCallback(); }, 0, false); ((MelonEventBase<LemonAction<LanguageCode, LanguageCode>>)(object)Language.OnEntryValueChanged).Subscribe((LemonAction<LanguageCode, LanguageCode>)delegate(LanguageCode oldValue, LanguageCode newValue) { Localization.SetLanguage(newValue.ToString()); onConfigChangedCallback(); }, 0, false); } } public static class Localization { public const string LANG_EN = "EN"; public const string LANG_FR = "FR"; public const string LANG_DE = "DE"; private static string currentLanguage = "EN"; private static readonly Dictionary<string, string> cache = new Dictionary<string, string>(); public const string KEY_LOADING = "loading"; public const string KEY_NEXT = "next"; public const string KEY_KINGPIN = "rank_kingpin"; public const string KEY_RANK_0 = "rank_0"; public const string KEY_RANK_1 = "rank_1"; public const string KEY_RANK_2 = "rank_2"; public const string KEY_RANK_3 = "rank_3"; public const string KEY_RANK_4 = "rank_4"; public const string KEY_RANK_5 = "rank_5"; public const string KEY_RANK_6 = "rank_6"; public const string KEY_RANK_7 = "rank_7"; public const string KEY_RANK_8 = "rank_8"; public const string KEY_RANK_9 = "rank_9"; private static readonly Dictionary<string, Dictionary<string, string>> translations = new Dictionary<string, Dictionary<string, string>> { { "EN", new Dictionary<string, string> { { "loading", "Loading..." }, { "next", "Next" }, { "rank_kingpin", "Kingpin" }, { "rank_0", "Street Rat" }, { "rank_1", "Hoodlum" }, { "rank_2", "Peddler" }, { "rank_3", "Hustler" }, { "rank_4", "Bagman" }, { "rank_5", "Enforcer" }, { "rank_6", "Shot Caller" }, { "rank_7", "Block Boss" }, { "rank_8", "Underlord" }, { "rank_9", "Baron" } } }, { "FR", new Dictionary<string, string> { { "loading", "Chargement..." }, { "next", "Suivant" }, { "rank_kingpin", "PARRAIN" }, { "rank_0", "Rat des Rues" }, { "rank_1", "Voyou" }, { "rank_2", "Colporteur" }, { "rank_3", "Arnaqueur" }, { "rank_4", "Porteur de Sacs" }, { "rank_5", "Exécuteur" }, { "rank_6", "Donneur d'Ordres" }, { "rank_7", "Chef de Bloc" }, { "rank_8", "Sous-Seigneur" }, { "rank_9", "Baron" } } }, { "DE", new Dictionary<string, string> { { "loading", "Laden..." }, { "next", "Weiter" }, { "rank_kingpin", "OBERBOSS" }, { "rank_0", "Straßenratte" }, { "rank_1", "Ganove" }, { "rank_2", "Krämer" }, { "rank_3", "Schmuggler" }, { "rank_4", "Geldkurier" }, { "rank_5", "Vollstrecker" }, { "rank_6", "Befehlsgeber" }, { "rank_7", "Blockboss" }, { "rank_8", "Unterlord" }, { "rank_9", "Baron" } } } }; public static void ClearCache() { cache.Clear(); } public static string Get(string key) { if (cache.TryGetValue(key, out string value)) { return value; } if (translations.TryGetValue(currentLanguage, out Dictionary<string, string> value2) && value2.TryGetValue(key, out var value3)) { cache[key] = value3; return value3; } if (translations.TryGetValue("EN", out Dictionary<string, string> value4) && value4.TryGetValue(key, out value3)) { cache[key] = value3; return value3; } return "!" + key + "!"; } public static string GetRankKey(int rankIndex) { return $"rank_{rankIndex}"; } public static void SetLanguage(string lang) { if (translations.ContainsKey(lang)) { currentLanguage = lang; ClearCache(); } } public static int GetNextFontSize() { float num = 24f; if (currentLanguage == "FR" || currentLanguage == "DE") { return (int)(num * 0.55f); } return (int)(num * 0.65f); } } public static class PluginInfo { public const string PLUGIN_AUTHOR = "DiumStream"; public const string PLUGIN_NAME = "LevelUpHUD"; public const string PLUGIN_VERSION = "1.0.4"; } } namespace LevelUpHUD.GUI { public class UIHandler { private Text rankText = null; private Text nextText = null; private Func<string> getRankText; private Func<string> getNextText; public GameObject hudCanvas { get; private set; } = null; public UIHandler(Func<string> getRankText, Func<string> getNextText) { this.getRankText = getRankText; this.getNextText = getNextText; } public void CreateOrUpdateUI() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) DestroyUI(); hudCanvas = new GameObject("LevelUpHUD_Canvas"); Canvas val = hudCanvas.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; CanvasScaler val2 = hudCanvas.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 1f; hudCanvas.AddComponent<GraphicRaycaster>(); int radius = 10; int value = Config.PanelWidth.Value; int value2 = Config.PanelHeight.Value; GameObject val3 = new GameObject("HUD_Mask"); val3.transform.SetParent(hudCanvas.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0f, 1f); val4.anchorMax = new Vector2(0f, 1f); val4.pivot = new Vector2(0f, 1f); val4.anchoredPosition = new Vector2((float)Config.HudPosX.Value, 0f - (float)Config.HudPosY.Value); val4.sizeDelta = new Vector2((float)value, (float)value2); Image val5 = val3.AddComponent<Image>(); val5.sprite = MakeRoundSprite(radius); ((Graphic)val5).color = Color.white; val5.type = (Type)1; val3.AddComponent<Mask>().showMaskGraphic = false; GameObject val6 = new GameObject("HUD_Panel"); val6.transform.SetParent(val3.transform, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = new Vector2(0f, 0f); val7.anchorMax = new Vector2(1f, 1f); val7.pivot = new Vector2(0.5f, 0.5f); val7.anchoredPosition = Vector2.zero; val7.sizeDelta = Vector2.zero; Image val8 = val6.AddComponent<Image>(); Texture2D val9 = MakeVerticalGradient(Config.PanelColorTop.Value, Config.PanelColorBottom.Value, value, value2); val8.sprite = Sprite.Create(val9, new Rect(0f, 0f, (float)value, (float)value2), Vector2.one * 0.5f); ((Graphic)val8).color = Color.white; val8.type = (Type)0; GameObject val10 = new GameObject("Rank_Text"); val10.transform.SetParent(val3.transform, false); rankText = val10.AddComponent<Text>(); rankText.alignment = (TextAnchor)3; rankText.font = Font.GetDefault(); rankText.fontSize = Config.RankFontSize.Value; ((Graphic)rankText).color = Config.RankColor.Value; rankText.text = ""; RectTransform component = val10.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.5f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, 0f); component.offsetMin = new Vector2(10f, 0f); component.offsetMax = new Vector2(-10f, 0f); GameObject val11 = new GameObject("Next_Text"); val11.transform.SetParent(val3.transform, false); nextText = val11.AddComponent<Text>(); nextText.alignment = (TextAnchor)3; nextText.font = Font.GetDefault(); nextText.fontSize = Localization.GetNextFontSize(); ((Graphic)nextText).color = Config.NextColor.Value; nextText.text = ""; RectTransform component2 = val11.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 0.5f); component2.pivot = new Vector2(0.5f, 0f); component2.anchoredPosition = new Vector2(0f, 0f); component2.offsetMin = new Vector2(10f, 0f); component2.offsetMax = new Vector2(-10f, -5f); UpdateUI(); } public void DestroyUI() { if ((Object)(object)hudCanvas != (Object)null) { Object.Destroy((Object)(object)hudCanvas); hudCanvas = null; rankText = null; nextText = null; } } public void UpdateUI() { if (!((Object)(object)rankText == (Object)null) && !((Object)(object)nextText == (Object)null)) { string text = getRankText(); if (rankText.text != text) { rankText.text = text; } string text2 = getNextText(); if (nextText.text != text2) { nextText.text = text2; } } } private Sprite MakeRoundSprite(int radius) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) int num = radius * 2 + 1; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((float)radius, (float)radius); Color val3 = default(Color); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = Vector2.Distance(new Vector2((float)i, (float)j), val2); ((Color)(ref val3))..ctor(1f, 1f, 1f, (num2 <= (float)radius) ? 1f : 0f); val.SetPixel(i, j, val3); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 1u, (SpriteMeshType)0, new Vector4((float)radius, (float)radius, (float)radius, (float)radius)); } private Texture2D MakeVerticalGradient(Color top, Color bottom, int width, int height) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height); ((Texture)val).wrapMode = (TextureWrapMode)1; for (int i = 0; i < height; i++) { Color val2 = Color.Lerp(bottom, top, (float)i / (float)(height - 1)); for (int j = 0; j < width; j++) { val.SetPixel(j, i, val2); } } val.Apply(); return val; } } }