private void Awake() { context = this; modEnabled = Config.Bind <bool>("General", "Enabled", true, "Enable this mod"); showingClock = Config.Bind <bool>("General", "ShowClock", true, "Show the clock?"); showClockOnChange = Config.Bind <bool>("General", "ShowClockOnChange", true, "Only show the clock when the time changes?"); showClockOnChangeFadeTime = Config.Bind <float>("General", "ShowClockOnChangeFadeTime", 5f, "If only showing on change, length in seconds to show the clock before begining to fade"); showClockOnChangeFadeLength = Config.Bind <float>("General", "ShowClockOnChangeFadeLength", 1f, "How long fade should take in seconds"); clockLocation = Config.Bind <Vector2>("General", "ClockLocation", new Vector2(Screen.width / 2, 40), "obsolete"); clockLocationString = Config.Bind <string>("General", "ClockLocationString", "50%,3%", "Location on the screen to show the clock (x,y) or (x%,y%)"); clockUseOSFont = Config.Bind <bool>("General", "ClockUseOSFont", false, "Set to true to specify the name of a font from your OS; otherwise limited to fonts in the game resources"); clockUseShadow = Config.Bind <bool>("General", "ClockUseShadow", false, "Add a shadow behind the text"); clockShadowOffset = Config.Bind <int>("General", "ClockShadowOffset", 2, "Shadow offset in pixels"); clockFontName = Config.Bind <string>("General", "ClockFontName", "AveriaSerifLibre-Bold", "Name of the font to use"); clockFontSize = Config.Bind <int>("General", "ClockFontSize", 24, "Location on the screen in pixels to show the clock"); clockFontColor = Config.Bind <Color>("General", "ClockFontColor", Color.white, "Font color for the clock"); clockShadowColor = Config.Bind <Color>("General", "ClockShadowColor", Color.black, "Color for the shadow"); toggleClockKeyMod = Config.Bind <string>("General", "ShowClockKeyMod", "", "Extra modifier key used to toggle the clock display. Leave blank to not require one. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html"); toggleClockKey = Config.Bind <string>("General", "ShowClockKey", "home", "Key used to toggle the clock display. use https://docs.unity3d.com/Manual/ConventionalGameInput.html"); toggleClockKeyOnPress = Config.Bind <bool>("General", "ShowClockKeyOnPress", false, "If true, limit clock display to when the hotkey is down"); clockFormat = Config.Bind <string>("General", "ClockFormat", "HH:mm", "Time format; set to 'fuzzy' for fuzzy time"); clockString = Config.Bind <string>("General", "ClockString", "<b>{0}</b>", "Formatted clock string - {0} is replaced by the actual time string, and {1} is replaced by the fuzzy string (if you want both)"); clockFuzzyStrings = Config.Bind <string>("General", "ClockFuzzyStrings", "Midnight,Before Dawn,Before Dawn,Dawn,Dawn,Morning,Morning,Late Morning,Late Morning,Midday,Midday,Afternoon,Afternoon,Evening,Evening,Night,Night,Late Night,Late Night,Midnight", "Fuzzy time strings to split up the day into custom periods if ClockFormat is set to 'fuzzy'; comma-separated"); nexusID = Config.Bind <int>("General", "NexusID", 85, "Nexus mod ID for updates"); if (clockLocation.Value.y != 40 && clockLocationString.Value == "50%,3%") { clockLocationString.Value = $"{clockLocation.Value.x},{clockLocation.Value.y}"; Config.Save(); } if (clockFuzzyStrings.Value == "Night,Early Morning,Morning,Late Morning,Midday,Early Afternoon,Afternoon,Late Afternoon,Early Evening,Evening,Late Evening,Night") { clockFuzzyStrings.Value = "Midnight,Before Dawn,Before Dawn,Dawn,Dawn,Morning,Morning,Late Morning,Late Morning,Midday,Midday,Afternoon,Afternoon,Evening,Evening,Night,Night,Late Night,Late Night,Midnight"; } Config.Save(); if (!modEnabled.Value) { return; } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); }
public void LoadConfig() { context = this; modEnabled = Config.Bind <bool>("General", "Enabled", true, "Enable this mod"); showingClock = Config.Bind <bool>("General", "ShowClock", true, "Show the clock?"); showClockOnChange = Config.Bind <bool>("General", "ShowClockOnChange", false, "Only show the clock when the time changes?"); showClockOnChangeFadeTime = Config.Bind <float>("General", "ShowClockOnChangeFadeTime", 5f, "If only showing on change, length in seconds to show the clock before begining to fade"); showClockOnChangeFadeLength = Config.Bind <float>("General", "ShowClockOnChangeFadeLength", 1f, "How long fade should take in seconds"); clockUseOSFont = Config.Bind <bool>("General", "ClockUseOSFont", false, "Set to true to specify the name of a font from your OS; otherwise limited to fonts in the game resources"); clockUseShadow = Config.Bind <bool>("General", "ClockUseShadow", false, "Add a shadow behind the text"); clockShadowOffset = Config.Bind <int>("General", "ClockShadowOffset", 2, "Shadow offset in pixels"); clockFontName = Config.Bind <string>("General", "ClockFontName", "AveriaSerifLibre-Bold", "Name of the font to use"); clockFontSize = Config.Bind <int>("General", "ClockFontSize", 24, "Location on the screen in pixels to show the clock"); clockFontColor = Config.Bind <Color>("General", "ClockFontColor", Color.white, "Font color for the clock"); clockShadowColor = Config.Bind <Color>("General", "ClockShadowColor", Color.black, "Color for the shadow"); toggleClockKeyMod = Config.Bind <string>("General", "ShowClockKeyMod", "", "Extra modifier key used to toggle the clock display. Leave blank to not require one. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html"); toggleClockKeyOnPress = Config.Bind <bool>("General", "ShowClockKeyOnPress", false, "If true, limit clock display to when the hotkey is down"); clockFormat = Config.Bind <string>("General", "ClockFormat", "HH:mm", "Time format; set to 'fuzzy' for fuzzy time"); clockString = Config.Bind <string>("General", "ClockString", "<b>{0}</b>", "Formatted clock string - {0} is replaced by the actual time string, and {1} is replaced by the fuzzy string"); clockTextAlignment = Config.Bind <TextAnchor>("General", "ClockTextAlignment", TextAnchor.MiddleCenter, "Clock text alignment."); clockFuzzyLang = Config.Bind <string>("General", "ClockFuzzyLang", "en", "Fuzzy string language. Avaiable: en (English),pt (Portuguese)"); //clockFuzzyStrings = Config.Bind<string>("General", "ClockFuzzyStrings", "Midnight,Early Morning,Early Morning,Before Dawn,Before Dawn,Dawn,Dawn,Morning,Morning,Late Morning,Late Morning,Midday,Midday,Early Afternoon,Early Afternoon,Afternoon,Afternoon,Evening,Evening,Night,Night,Late Night,Late Night,Midnight", "Fuzzy time strings to split up the day into custom periods if ClockFormat is set to 'fuzzy'; comma-separated"); newTimeString = GetCurrentTimeString(DateTime.Now, 0.5f); style = new GUIStyle { richText = true, fontSize = clockFontSize.Value, alignment = clockTextAlignment.Value, }; style2 = new GUIStyle { richText = true, fontSize = clockFontSize.Value, alignment = clockTextAlignment.Value, }; }