From 7d702b0f8dc69369dc03c97eeb2f307546187137 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 3 Aug 2019 05:06:17 +0200 Subject: [PATCH 1/5] Updated to v0.3.1 --- CrosshairMod/Button.cs | 41 ------- CrosshairMod/Crosshair.cs | 21 +++- CrosshairMod/CrosshairMod.csproj | 10 +- CrosshairMod/Interface.cs | 134 ++++++++++++++-------- CrosshairMod/Interface/Button.cs | 60 ++++++++++ CrosshairMod/Interface/InputObject.cs | 36 ++++++ CrosshairMod/Interface/Slider.cs | 40 +++++++ CrosshairMod/Logging.cs | 36 +++++- CrosshairMod/Main.cs | 33 ++++-- CrosshairMod/Settings.cs | 49 ++++++-- CrosshairMod/bin/Release/CrosshairMod.dll | Bin 13312 -> 0 bytes CrosshairMod/chSettings.sett | 6 - LICENSE | 21 ++++ README.md | 8 +- 14 files changed, 371 insertions(+), 124 deletions(-) delete mode 100644 CrosshairMod/Button.cs create mode 100644 CrosshairMod/Interface/Button.cs create mode 100644 CrosshairMod/Interface/InputObject.cs create mode 100644 CrosshairMod/Interface/Slider.cs delete mode 100644 CrosshairMod/bin/Release/CrosshairMod.dll delete mode 100644 CrosshairMod/chSettings.sett create mode 100644 LICENSE diff --git a/CrosshairMod/Button.cs b/CrosshairMod/Button.cs deleted file mode 100644 index 687f67e..0000000 --- a/CrosshairMod/Button.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using UnityEngine; - -namespace CrosshairMod -{ - // Button Wrapper class, utilizing GUI.Button() - class GUIButton - { - - public Vector2 position = new Vector2(0, 0); - public Vector2 dimensions = new Vector2(0, 0); - public string label = ""; - public event EventHandler OnClick; - - public GUIButton(uint x, uint y, uint width, uint height, string label) - { - Logging.Log("Button Constructor"); - - this.position = new Vector2(x, y); - this.dimensions = new Vector2(width, height); - this.label = label; - } - - public GUIButton() - { - // Empty - } - - public void Update() - { - bool buttonPressed = GUI.Button(new Rect(position, dimensions), label); - if (buttonPressed) - OnClick?.Invoke(this, EventArgs.Empty); - } - } -} diff --git a/CrosshairMod/Crosshair.cs b/CrosshairMod/Crosshair.cs index 1b6c7ee..d8727c9 100644 --- a/CrosshairMod/Crosshair.cs +++ b/CrosshairMod/Crosshair.cs @@ -2,16 +2,23 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; + using UnityEngine; namespace CrosshairMod { + /* The class responsible for drawing/creating/administrating the crosshair. + * + * This is where settings are applied to the crosshair. + */ static class Crosshair { + // Crosshair Texture / Style private static Texture2D m_texture = new Texture2D(0, 0); private static GUIStyle m_style; + + // If crosshair is visible or hidden private static bool m_enabled = true; private static bool m_validState = true; @@ -22,6 +29,12 @@ namespace CrosshairMod Settings.SetSetting("crosshairVisible", 1, true); } + // Returns wether the crosshair is enabled + public static bool Enabled() + { + return m_enabled; + } + // Change Color public static void SetColor(int r, int g, int b, int a) { @@ -112,8 +125,11 @@ namespace CrosshairMod m_style.normal.background = m_texture; } + // Render the Crosshair public static void Render() { + // If the crosshair is faulty, then don't execute this code + // This is here to stop the Logger from spamming the console. if (m_validState) { if (InvalidCrosshair()) @@ -122,13 +138,14 @@ namespace CrosshairMod return; } + // Don't draw a hidden crosshair. Duh. if (m_enabled) GUI.Label(new Rect(Screen.width / 2 - m_texture.width / 2, Screen.height / 2 - m_texture.height / 2, m_texture.width, m_texture.height), m_texture, m_style); } } - + // Check Crosshair State private static bool InvalidCrosshair() { // Check if the texture is bigger than (0, 0) to see if it was initialized. diff --git a/CrosshairMod/CrosshairMod.csproj b/CrosshairMod/CrosshairMod.csproj index 1f918ef..b48e39e 100644 --- a/CrosshairMod/CrosshairMod.csproj +++ b/CrosshairMod/CrosshairMod.csproj @@ -9,9 +9,10 @@ Properties CrosshairMod CrosshairMod - v4.7.2 + v3.5 512 true + true @@ -44,16 +45,15 @@ - + + + - - - \ No newline at end of file diff --git a/CrosshairMod/Interface.cs b/CrosshairMod/Interface.cs index d8e4634..53b71c7 100644 --- a/CrosshairMod/Interface.cs +++ b/CrosshairMod/Interface.cs @@ -2,55 +2,86 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; + using UnityEngine; namespace CrosshairMod { + + /* A class that handles the Crosshair GUI. + * + * Contains all Buttons, Sliders etc. that are able to modify the crosshair. + */ + + // TODO: Create GUILayout.Window to make a less crappy version of the settings window static class Interface { + // Saves wether the interface is visible or not private static bool m_visible = false; - private static Dictionary m_buttons = new Dictionary(); + // Stores all Buttons used in the interface. + private static List m_inputs = new List(); + + // Values of the RGBA Sliders private static int rSliderValue, gSliderValue, bSliderValue, aSliderValue; - - private static Texture2D m_background = new Texture2D(1, 1); - private static GUIStyle m_style = new GUIStyle(); - + // Position ind dimension of the GUI background private static Vector2 m_position; private static Vector2 m_dimension; + + // Creates a new button object and adds it to the List + private static void AddButton(float x, float y, float width, float height, string label, string ID, params EventHandler[] onClickEvent) + { + GUIButton buttonObj = new GUIButton(x, y, width, height, label, ID, onClickEvent); + m_inputs.Add(buttonObj); + } + + // Creates a new slider object and adds it to the List + // Returns the index of the button + private static void AddSlider(float x, float y, float width, float height, float min, float max, float init, string ID) + { + GUISlider sliderObj = new GUISlider(x, y, width, height, min, max, init, ID); + m_inputs.Add(sliderObj); + } + // Initializes all Buttons, gives them their function etc public static void Init() { + // Set dimension to 0.25 of the screen width/height m_dimension = new Vector2(Screen.width / 4, Screen.height / 4); + // Center the interface m_position = new Vector2((Screen.width - m_dimension.x) / 2, (Screen.height - m_dimension.y) / 2); - m_background.SetPixel(0, 0, new Color(0.4f, 0.4f, 0.4f, 0.4f)); - m_background.wrapMode = TextureWrapMode.Repeat; - m_background.Apply(); - m_style.normal.background = m_background; + // Create Crosshair Visibilty Button + AddButton(20, 20, 200, 30, + (Crosshair.Enabled() ? "Hide Crosshair" : "Show Crosshair"), "Toggle", (object sender, EventArgs e) => { Crosshair.Toggle(); }, + (object sender, EventArgs e) => { GUIButton btn = (GUIButton)sender; btn.label = (Crosshair.Enabled() ? "Hide Crosshair" : "Show Crosshair"); }); - m_buttons.Add("visibility", new GUIButton((uint)m_position.x + 20, (uint)m_position.y + 20, 200, 30, "Toggle Crosshair")); - m_buttons["visibility"].OnClick += (object sender, EventArgs e) => { Crosshair.Toggle(); }; + // Create Crosshair Size +/- Buttons + AddButton(20, 60, 30, 30, + "-", "sizedown", (object sender, EventArgs e) => { Crosshair.ChangeSize(-1); }); + AddButton(190, 60, 30, 30, + "+", "sizeup", (object sender, EventArgs e) => { Crosshair.ChangeSize(+1); }); - m_buttons.Add("size-", new GUIButton((uint)m_position.x + 20, (uint)m_position.y + 60, 30, 30, "-")); - m_buttons.Add("size+", new GUIButton((uint)m_position.x + 190, (uint)m_position.y + 60, 30, 30, "+")); - m_buttons["size-"].OnClick += (object sender, EventArgs e) => { Crosshair.ChangeSize(-1); }; - m_buttons["size+"].OnClick += (object sender, EventArgs e) => { Crosshair.ChangeSize(+1); }; - - m_buttons.Add("thick-", new GUIButton((uint)m_position.x + 20, (uint)m_position.y + 100, 30, 30, "-")); - m_buttons.Add("thick+", new GUIButton((uint)m_position.x + 190, (uint)m_position.y + 100, 30, 30, "+")); - m_buttons["thick-"].OnClick += (object sender, EventArgs e) => { Crosshair.ChangeThickness(-1); }; - m_buttons["thick+"].OnClick += (object sender, EventArgs e) => { Crosshair.ChangeThickness(+1); }; + // Create Crosshair Thickness +/- Buttons + AddButton(20, 100, 30, 30, + "-", "thickdown", (object sender, EventArgs e) => { Crosshair.ChangeThickness(-1); }); + AddButton(190, 100, 30, 30, + "+", "thickup", (object sender, EventArgs e) => { Crosshair.ChangeThickness(+1); }); rSliderValue = Settings.GetValue("crosshairColorRed"); gSliderValue = Settings.GetValue("crosshairColorGreen"); bSliderValue = Settings.GetValue("crosshairColorBlue"); aSliderValue = Settings.GetValue("crosshairColorAlpha"); + + // Create RGBA Sliders + AddSlider(m_dimension.x / 2 + 60, 30, 200, 10, 0, 255, rSliderValue, "red"); + AddSlider(m_dimension.x / 2 + 60, 70, 200, 30, 0, 255, gSliderValue, "green"); + AddSlider(m_dimension.x / 2 + 60, 110, 200, 30, 0, 255, bSliderValue, "blue"); + AddSlider(m_dimension.x / 2 + 60, 150, 200, 30, 0, 255, aSliderValue, "alpha"); } // Displays / Hides the menu @@ -59,40 +90,47 @@ namespace CrosshairMod m_visible = !m_visible; } - // Renders the Panel, but also handles Updating the buttons + // Renders the window public static void Render() { - if(m_visible) - { - GUI.Label(new Rect(m_position, m_dimension), m_background, m_style); - - GUI.Label(new Rect(m_position.x + 60, m_position.y + 70, 120, 30), "Length: " + Settings.GetValue("crosshairLength")); - GUI.Label(new Rect(m_position.x + 60, m_position.y + 110, 120, 30), "Thickness: " + Settings.GetValue("crosshairThickness")); - - GUI.Label(new Rect(m_position.x + m_dimension.x / 2 + 20, m_position.y + 30, 200, 30), "R: " + rSliderValue); - rSliderValue = (int)GUI.HorizontalSlider(new Rect(m_position.x + m_dimension.x / 2 + 60, m_position.y + 20, 200, 30), (int)rSliderValue, 0f, 255f); - - GUI.Label(new Rect(m_position.x + m_dimension.x / 2 + 20, m_position.y + 70, 200, 30), "G: " + gSliderValue); - gSliderValue = (int)GUI.HorizontalSlider(new Rect(m_position.x + m_dimension.x / 2 + 60, m_position.y + 60, 200, 30), (int)gSliderValue, 0f, 255f); - - GUI.Label(new Rect(m_position.x + m_dimension.x / 2 + 20, m_position.y + 110, 200, 30), "B: " + bSliderValue); - bSliderValue = (int)GUI.HorizontalSlider(new Rect(m_position.x + m_dimension.x / 2 + 60, m_position.y + 100, 200, 30), (int)bSliderValue, 0f, 255f); - - GUI.Label(new Rect(m_position.x + m_dimension.x / 2 + 20, m_position.y + 150, 200, 30), "A: " + aSliderValue); - aSliderValue = (int)GUI.HorizontalSlider(new Rect(m_position.x + m_dimension.x / 2 + 60, m_position.y + 140, 200, 30), (int)aSliderValue, 0f, 255f); - - Crosshair.SetColor(rSliderValue, gSliderValue, bSliderValue, aSliderValue); - - // Update Buttons - HandleButtons(); - } + if (m_visible) + GUI.Window(420, new Rect(m_position, m_dimension), RenderFunc, "Crosshair Settings"); } + // Renders the Panel, but also handles Updating the buttons + private static void RenderFunc(int windowID) + { + + // Draw the Length and Thickness Labels + GUI.Label(new Rect(60, 70, 120, 30), "Length: " + Settings.GetValue("crosshairLength")); + GUI.Label(new Rect(60, 110, 120, 30), "Thickness: " + Settings.GetValue("crosshairThickness")); + + // Draw the RGBA Labels and Sliders + GUI.Label(new Rect(m_dimension.x / 2 + 20, 30, 200, 30), "R: " + rSliderValue); + GUI.Label(new Rect(m_dimension.x / 2 + 20, 70, 200, 30), "G: " + gSliderValue); + GUI.Label(new Rect(m_dimension.x / 2 + 20, 110, 200, 30), "B: " + bSliderValue); + GUI.Label(new Rect(m_dimension.x / 2 + 20, 150, 200, 30), "A: " + aSliderValue); + + // Set crosshair Colour after getting slider values + IEnumerable it = m_inputs.OfType(); + rSliderValue = (int)it.First(slider => slider.ID == "red").Value; + gSliderValue = (int)it.First(slider => slider.ID == "green").Value; + bSliderValue = (int)it.First(slider => slider.ID == "blue").Value; + aSliderValue = (int)it.First(slider => slider.ID == "alpha").Value; + + Crosshair.SetColor(rSliderValue, gSliderValue, bSliderValue, aSliderValue); + + // Update Buttons + HandleButtons(); + + } + + // Calls the Update function on all Buttons to check if they were pressed, and execute their Action private static void HandleButtons() { - foreach(KeyValuePair pair in m_buttons) + foreach(InputObject obj in m_inputs) { - pair.Value.Update(); + obj.Update(); } } } diff --git a/CrosshairMod/Interface/Button.cs b/CrosshairMod/Interface/Button.cs new file mode 100644 index 0000000..895da89 --- /dev/null +++ b/CrosshairMod/Interface/Button.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +using UnityEngine; + +namespace CrosshairMod +{ + /* + * A button wrapper class that is used right now as I don't have access to + * the games buttons. Since UnityEngine.GUI only has a function to draw Buttons, + * I made this class for easy handling. + * + */ + class GUIButton : InputObject + { + // da_google thinks this Button Wrapper is stupid, so let's see what ths Button Wrapper thinks about him + private const bool IS_DA_GOOGLE_STUPID = true; + // Interesting. + + // OnClick event + public event EventHandler OnClick; + + // Label of the Button + public string label { get; set; } = ""; + + // Initialize Button + public GUIButton(float x, float y, float width, float height, string label, string ID, params EventHandler[] OnClickEvent) + : base(x, y, width, height, ID) + { + Logging.Debug.Log("Button Constructor"); + + // Assign position, dimension and label + this.label = label; + + // Push OnClickEvents + foreach(EventHandler e in OnClickEvent) + OnClick += e; + } + + public GUIButton(string ID) + : base(0, 0, 0, 0, ID) + { + // Empty + } + + // Updates and Draws the Button. + public override float Update() + { + // Get if the Button was pressed and invoke OnClick event accordingly + bool buttonPressed = GUI.Button(new Rect(position, dimensions), label); + if (buttonPressed) + OnClick?.Invoke(this, EventArgs.Empty); + + return (buttonPressed ? 1.0f : 0.0f); + } + } +} diff --git a/CrosshairMod/Interface/InputObject.cs b/CrosshairMod/Interface/InputObject.cs new file mode 100644 index 0000000..7e14d2a --- /dev/null +++ b/CrosshairMod/Interface/InputObject.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +using UnityEngine; + +namespace CrosshairMod +{ + /* + * Base of all Input Objects. + * + * Any Input Object that wants to be displayed in the Interface must + * inherit from this class. + */ + abstract class InputObject + { + // position and dimension of the object + public Vector2 position, dimensions; + + // ID of the Object + public readonly string ID; + + // constructor to set position and size + public InputObject(float x, float y, float width, float height, string ID) + { + this.position = new Vector2(x, y); + this.dimensions = new Vector2(width, height); + this.ID = ID; + } + + // the update method (that works as renderer) must be overriden by each object + public abstract float Update(); + } +} diff --git a/CrosshairMod/Interface/Slider.cs b/CrosshairMod/Interface/Slider.cs new file mode 100644 index 0000000..47dbf80 --- /dev/null +++ b/CrosshairMod/Interface/Slider.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +using UnityEngine; + +namespace CrosshairMod +{ + class GUISlider : InputObject + { + // Min/Max values for the slider + public float Min { get; set; } = 0; + public float Max { get; set; } = 0; + + // Current slider value + public float Value { get; set; } = 0; + + public GUISlider(float x, float y, float width, float height, float min, float max, float init, string ID) + : base(x, y, width, height, ID) + { + Min = min; + Max = max; + Value = init; + } + + public GUISlider(string ID) + :base (0, 0, 0, 0, ID) + { + + } + + public override float Update() + { + Value = GUI.HorizontalSlider(new Rect(position, dimensions), Value, Min, Max); + return Value; + } + } +} diff --git a/CrosshairMod/Logging.cs b/CrosshairMod/Logging.cs index 2a7864a..db9fd39 100644 --- a/CrosshairMod/Logging.cs +++ b/CrosshairMod/Logging.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; + using UnityEngine; @@ -13,21 +13,53 @@ namespace CrosshairMod // However, I prefer this over Debug.Log() since it doesn't include a stacktrace (Except for Errors) public static class Logging { + // The Prefix that gets put in front of every Log public const string PREFIX = "[CROSSHAIRMOD]"; + // A kind of sub-class that is used to Log messages that will only appear + // when the User installs a Debug build of the Mod. Release versions will + // not log Debug messages this way. + public static class Debug + { + public static void Log(string message) + { +#if DEBUG + Logging.Log(message); +#endif // DEBUG + } + + public static void LogWarning(string message) + { +#if DEBUG + Logging.LogWarning(message); +#endif // DEBUG + } + + public static void LogError(string message) + { +#if DEBUG + Logging.LogError(PREFIX + "Error: " + message); +#endif // DEBUG + } + } + + + // Logs information public static void Log(string message) { Console.WriteLine(PREFIX + "Info: " + message); } + // Logs warnings public static void LogWarning(string message) { Console.WriteLine(PREFIX + "Warning: " + message); } + // Logs errors public static void LogError(string message) { - Debug.Log(PREFIX + "Error: " + message); + UnityEngine.Debug.Log(PREFIX + "Error: " + message); } } } diff --git a/CrosshairMod/Main.cs b/CrosshairMod/Main.cs index f6fb2ea..d0a81da 100644 --- a/CrosshairMod/Main.cs +++ b/CrosshairMod/Main.cs @@ -3,44 +3,60 @@ * the game Blackwake. * * @author Lauchmelder - * @version v0.2 + * @version v0.3 */ + using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; + using UnityEngine; namespace CrosshairMod { + + /* + * This is the Main class that is responsible for + * handling initializing and updating the components + * of the crosshair mod. + */ public class Main : MonoBehaviour { - private const string MENU_OPEN_KEY = "H"; - private const string CH_TOGGLE_KEY = "J"; + // Define Hotkeys for Menu and Crosshair Toggle + private char MENU_OPEN_KEY = 'H'; + private char CH_TOGGLE_KEY = 'J'; // This will be executed first void Start() { + // Update the settings Settings.LoadSettings(".\\Blackwake_Data\\Managed\\Mods\\chSettings.sett"); // Create Crosshair Crosshair.Create(); // Create Panel Interface.Init(); + + // Load Hotkeys + MENU_OPEN_KEY = (char)Settings.GetValue("hotkeyCrosshairToggle", true, MENU_OPEN_KEY); + CH_TOGGLE_KEY = (char)Settings.GetValue("hotkeyGUIToggle", true, CH_TOGGLE_KEY); } + // This gets called on every GUI Update (Can be multiple tiems per Frame) void OnGUI() { - // Check for Key press - if(Event.current.Equals(Event.KeyboardEvent(MENU_OPEN_KEY))) + // Check for Key presses + if (Event.current.Equals(Event.KeyboardEvent(MENU_OPEN_KEY.ToString()))) { + // Toggle Crosshair GUI Interface.Toggle(); } - if (Event.current.Equals(Event.KeyboardEvent(CH_TOGGLE_KEY))) + if (Event.current.Equals(Event.KeyboardEvent(CH_TOGGLE_KEY.ToString()))) { + // Toggle Crosshair Crosshair.Toggle(); } @@ -50,11 +66,12 @@ namespace CrosshairMod Crosshair.Render(); } + // Will be called when the application is closed void OnApplicationQuit() { // Save settings Settings.SaveSettings(".\\Blackwake_Data\\Managed\\Mods\\chSettings.sett"); - Logging.Log("Saved Settings"); + Logging.Debug.Log("Saved Settings"); } } } diff --git a/CrosshairMod/Settings.cs b/CrosshairMod/Settings.cs index 7bf7b2e..795ad70 100644 --- a/CrosshairMod/Settings.cs +++ b/CrosshairMod/Settings.cs @@ -2,29 +2,58 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; + namespace CrosshairMod { + /* + * The class that is responsible for loading and storing all the + * necessary settings. There is much room for improvement. + */ static class Settings { // Initialize Settings dictionary private static Dictionary m_settings = new Dictionary(); + // Load settings from file public static void LoadSettings(string filepath) { - Logging.Log("Accessing Settings at " + filepath); + Logging.Debug.Log("Accessing Settings at " + filepath); // Try to read file contents into string + // If no file exists, create one string settings = ""; + if(!System.IO.File.Exists(filepath)) + { + // No settings file found, create one + Logging.Debug.LogWarning("Settings file not found, creating one..."); + try + { + System.IO.File.Create(filepath); + } + // If that fails then shit just hit the fan. React accordingly + catch(Exception e) + { + Logging.LogError("Something went wrong while creating a settings file... :("); + Logging.LogError(e.Message); + Logging.LogError(e.StackTrace); + + return; + } + } + + // Read file to string try { settings = System.IO.File.ReadAllText(filepath); } + // Something incredibly weird just happened catch (Exception e) { - // Log error and return invalid state + Logging.LogError("Something went wrong while reading a settings file... :("); Logging.LogError(e.Message); + Logging.LogError(e.StackTrace); + return; } @@ -43,7 +72,7 @@ namespace CrosshairMod m_settings.Add(vals[0], Int32.Parse(vals[1])); // Store key and value in settings dictionary } - Logging.Log("Successfully loaded settings!"); + Logging.Log("Settings loaded."); } // Converts the dictionary to a sett file @@ -67,21 +96,21 @@ namespace CrosshairMod m_settings.Add(key, value); } - // Changes a settings value + // Changes a settings value, and adds it if specified public static void SetSetting(string key, int newVal, bool addIfDoesntExist = false) { - + // If the setting doesn't exist, either add and set it, or print a Debug.Warning if(!m_settings.ContainsKey(key)) { if (!addIfDoesntExist) { - Logging.LogError("Tried to change a setting with key \"" + key + "\" that doesn't exist."); + Logging.Debug.LogError("Tried to change a setting with key \"" + key + "\" that doesn't exist."); return; } else { AddSetting(key, newVal); - Logging.LogWarning("Tried to change a setting with key \"" + key + "\" that doesn't exist. It has been added now."); + Logging.Debug.LogWarning("Tried to change a setting with key \"" + key + "\" that doesn't exist. It has been added now."); } } @@ -100,12 +129,12 @@ namespace CrosshairMod { if (!addIfDoesntExist) { - Logging.LogError("Tried to access unknown setting: \"" + key + "\". Check your chSettings.sett for errors."); + Logging.Debug.LogError("Tried to access unknown setting: \"" + key + "\". Check your chSettings.sett for errors."); } else { AddSetting(key, initialValue); - Logging.LogWarning("Tried to access unknown setting: \"" + key + "\". A new setting with this key was created."); + Logging.Debug.LogWarning("Tried to access unknown setting: \"" + key + "\". A new setting with this key was created."); return initialValue; } } diff --git a/CrosshairMod/bin/Release/CrosshairMod.dll b/CrosshairMod/bin/Release/CrosshairMod.dll deleted file mode 100644 index 1080c7e0adf46aa0f8645a74ac5c34d330599e94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13312 zcmeHNYj7M_l|Hwpr)M-8k2R7#a{O%hm5E;H;SkGljPoIOA-RbnpYquEKp&?Ru%%G0%2J;uvs9fqLxZQiVXycRE6b{P%dC0{#km|=iYPfdEIl*y?t-D_Pq683J{Tw`_)&8zKoKu?EAlrZb*5vw5?tx6d54GgjlGMUnNs>V4fr zyH$XiKb`wk(b`XFty!*`i0VNxJnB6+qBL>ejGL%J>YC>_6MQzJ3qU~UD?m5DlUez1 zw)9aZ;kq7rd%1Em(T6w?^RH>5C}?-}5N)2{b|u^-3YWBpf$u888w=K{0`L#i0-#O$ z>iZ2$E)!lgI|6TT-%8{N>HiV99LZI zn?^zU(3^-ZUPYvY`o=+3Q-H34806#H891v)jPg(*i6Mv-;-E*h+n5>-CBae`F+#0B z<`BG=T;=PKyVZA7Tgw#zZWZLt!h*hlh`{KYgQl^w7;jxmE&;29>R1v&h8CC@(I-Yq z6a*(mVlxzxjs-=u_O}a^zkZ9g&uC|a`wXjem%<6{3_Fxepjw~sg14bT+gPhjRfA+N z1E{@aDg>UyB{j{ZgHVrES0`7&@!Dsdn}BHv!5ka)fM5S0>bhTl9QB}APexeGi+v3u z2S?)0&(WSpBv+#;B8Z_KnaeI?HNziNCH#zBjz2^{Kwr^2Pk;5A#l8U+sJ=>&a&f=f z#3DpOh)N%-*SuY@MGp6(+Pqk7uF@UuONl^Lu+j*RtR=d=^H`Z*#`R()=vR`+?no%K z>}~adM4hTWQf^cqUG~=MBYxp7NAq-$gIpD=+mWaW*ELKr8V|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~ zOM8L$0PaAYugCS@T=L#D7AJvM;xoBiyx4eC+b5vt!mXf{H(opNfai^7al^)3>t%`J zhca&|T(tA{AdAN}P8D)JtltNv3O?}($J?ST)O1RCny}&aew(lnKn(C*jpM=Rno<0C zV^DwyXZ zd>EUh0(chEOnf6S@oRxU&GJqd|1mO0k2g}htr~@12iuQgG>L8$zk7WfJW_1A*l)(X z$i5!`w@BRgK^I5SJJ*(u&1>o4zHgFv&y}4Y_4zU1EHdrr4R82H<&4bRs{cuj?fsu! U+wo|Fv3v2KGJm=L|3%=x0dvWuGXMYp diff --git a/CrosshairMod/chSettings.sett b/CrosshairMod/chSettings.sett deleted file mode 100644 index 55e84e0..0000000 --- a/CrosshairMod/chSettings.sett +++ /dev/null @@ -1,6 +0,0 @@ -crosshairLength=15 -crosshairThickness=3 -crosshairColorRed=255 -crosshairColorGreen=94 -crosshairColorBlue=244 -crosshairColorAlpha=100 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..26abfe3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Lauchmelder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 11a15c5..836c034 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # CrosshairMod v0.3 A Blackwake Mod that adds a crosshair -Simply copy and paste the *CrosshairMod.dll* and the *chSettings.sett* -files from the *bin/Release* directory into your Blackwake directory under */Blackwake_Data/Managed/Mods* +Simply copy and paste the *CrosshairMod.dll* files from the *bin/Release* directory into your Blackwake directory under */Blackwake_Data/Managed/Mods*. Requires BWModLoader v0.3 or newer to be installed. ## Customization With Version v0.3 you can now toggle the crosshair with *J*, and you can open a customization interface with *H*. This now lets you edit virtually every aspect of the current crosshair design, and even saves it to the settings so that your customization will still be there after restarting the game, @@ -28,3 +27,8 @@ With Version v0.3 you can now toggle the crosshair with *J*, and you can open a * Colour * Added Hotkeys to open GUI (H) and to toggle the Crosshair (J) * Added auto-save, so any editing you do to the crosshair gets saved into the settings file. + +#### v0.3.1 + * Hotkeys can now be changed in the settings + * A missing settings file will no longer crash the mod + * Updated GUI Window. It looks nice now From 147f53a52d6da76ae70fe81462e3fe1cd6b14b0e Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 3 Aug 2019 16:16:46 +0200 Subject: [PATCH 2/5] Made GUI Movable, renamed mod --- CrosshairMod/Interface.cs | 4 +++- CrosshairMod/Main.cs | 2 +- CrosshairMod/bin/Release/CrosshairMod.dll | Bin 15360 -> 15872 bytes 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CrosshairMod/Interface.cs b/CrosshairMod/Interface.cs index 53b71c7..82a207f 100644 --- a/CrosshairMod/Interface.cs +++ b/CrosshairMod/Interface.cs @@ -100,7 +100,9 @@ namespace CrosshairMod // Renders the Panel, but also handles Updating the buttons private static void RenderFunc(int windowID) { - + // Make Window draggable + GUI.DragWindow(new Rect(0, 0, 10000, 20)); + // Draw the Length and Thickness Labels GUI.Label(new Rect(60, 70, 120, 30), "Length: " + Settings.GetValue("crosshairLength")); GUI.Label(new Rect(60, 110, 120, 30), "Thickness: " + Settings.GetValue("crosshairThickness")); diff --git a/CrosshairMod/Main.cs b/CrosshairMod/Main.cs index d0a81da..a73c6b3 100644 --- a/CrosshairMod/Main.cs +++ b/CrosshairMod/Main.cs @@ -22,7 +22,7 @@ namespace CrosshairMod * handling initializing and updating the components * of the crosshair mod. */ - public class Main : MonoBehaviour + public class CrosshairMod : MonoBehaviour { // Define Hotkeys for Menu and Crosshair Toggle private char MENU_OPEN_KEY = 'H'; diff --git a/CrosshairMod/bin/Release/CrosshairMod.dll b/CrosshairMod/bin/Release/CrosshairMod.dll index 717523228f2a627db52f70e263aa574f65f607a7..db70273308fd3e7d8e44d4539692a6535fbd4c85 100644 GIT binary patch delta 3155 zcmaKu4Qv$0702J3z1#cn+4yYh{DHC0K5Ulr2gV;5uuW`iOdU*YaBy%@sVxGO5_;yK z4grfhgrGo7!m)}Wt_j9XBZNqk$}LSILMwt&6jiBOqzY1ExfE4NN&}=-3PnNv&)gb9 zBXySdXK<}K&iR@55Gb#2;TB}4JILwJCt@=;uX?Oq z9Ca4$7b=3_rMN_<5ZQJZL~i&-8n#S_Wt2e7TkbNwRMIT7Fri}7{BADPhbt&m~@1 zI1etvk95Mwg$A3$-_xj981tpS1_ICFZ+Ol>^wgRclGaw&AyV|GBek(W_IwNys)rQY zjWpyn;sF`|6JT~vS-=hE@hKS*H6Wt&FcbBHizcm)hvXv*qZtnOcwYGA|BW6G?aaiaLdzE;Tu(oULUVyH*L^I6W#dlp zd5Ru$IENBlYF0)Id?i8GgRr`ISgK7W@!EVtUR(N*@i@XlOU!-At!rClmZF9fHkQKj zOg)&Q2GB++TFz*R5KA;XbCWwTBZ>)sw>_Q>M*0;wALrlDqoTw6q;P#dbkN= ziSRp6Lp92hPv%-7bCFDjtb~Q;^||A1DHQ57C%kEkA0#Zw5w>{7G>6RiGw8#NwxAv? z-SQOjMP=Dxmt&kL*0U{`BiCe2%F1e4H!TWN>VEBXfbPeXP3 zv(gsl22n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QO%$s_N=*;4YBRoPIiS}=TYeM z&>>du8er2Y1vy>p=jIS9?{bZ>#VoG<6#j>76uQ;<3s!_VT*NJ~&ea&lrA+@=P2z88 zz_d`P)%7`2H@b++$r&86Av-^(CnJ`V;N+kHPoYi<;(2(T=0HD#n)ENK=ee|&_Gl$I zr2pn6ltw1vY$||;s1#aA^PuI>cnQ@gn6DaIs0j@n%6U-fa_WKe7;V$)RnZ2eJxZ4; z?Nd6R$srf8r=ZKYjQf=iDRpSl@6n{+r}U80Q;XE)l2UTW<}7NU71T>7=`AW|arO%1 zI0$(A8Fg4S!_niQ#l}By`GIi*`nXH#4*dofJTS-QWpmjedxu>X&4Cc}i`9XG96#^E zKLEU|v295>w;`&fZt}3@_>LY6Jm?zr&gd{x|G8-D0H2L2{wh?y0k)X~3te>iqEzwJlw@6BJ9wWL5iQnB230?iYj gw`H802>RJ+ajjzMXiD|x8h@{R)LZ*8OO!hQ13)4^dH?_b From 85a4c7b2549aa41003a2210456472cf3f6282056 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 4 Aug 2019 15:50:04 +0200 Subject: [PATCH 3/5] Commented everything properly --- CrosshairMod/Crosshair.cs | 22 ++++---- CrosshairMod/Interface.cs | 73 ++++++++++++++++++--------- CrosshairMod/Interface/Button.cs | 55 ++++++++++++-------- CrosshairMod/Interface/InputObject.cs | 30 +++++++---- CrosshairMod/Interface/Slider.cs | 41 +++++++++++---- CrosshairMod/Logging.cs | 18 +++---- CrosshairMod/Main.cs | 25 ++++----- CrosshairMod/Settings.cs | 41 ++++++++++----- 8 files changed, 188 insertions(+), 117 deletions(-) diff --git a/CrosshairMod/Crosshair.cs b/CrosshairMod/Crosshair.cs index d8727c9..aa42e23 100644 --- a/CrosshairMod/Crosshair.cs +++ b/CrosshairMod/Crosshair.cs @@ -8,34 +8,31 @@ using UnityEngine; namespace CrosshairMod { - /* The class responsible for drawing/creating/administrating the crosshair. - * - * This is where settings are applied to the crosshair. - */ + /// + /// Contains Crosshair information and draws/creates it + /// static class Crosshair { - // Crosshair Texture / Style + /// + /// Graphics information for the crosshair + /// private static Texture2D m_texture = new Texture2D(0, 0); private static GUIStyle m_style; - // If crosshair is visible or hidden private static bool m_enabled = true; private static bool m_validState = true; - // Toggles visibilty of the crosshair public static void Toggle() { m_enabled = !m_enabled; Settings.SetSetting("crosshairVisible", 1, true); } - // Returns wether the crosshair is enabled public static bool Enabled() { return m_enabled; } - // Change Color public static void SetColor(int r, int g, int b, int a) { Settings.SetSetting("crosshairColorRed", r); @@ -46,7 +43,6 @@ namespace CrosshairMod Create(); } - // Change Size public static void ChangeSize(int difference) { int currentLength = Settings.GetValue("crosshairLength"); @@ -56,7 +52,6 @@ namespace CrosshairMod Create(); } - // Change Thickness public static void ChangeThickness(int difference) { int currentThickness = Settings.GetValue("crosshairThickness"); @@ -66,7 +61,9 @@ namespace CrosshairMod Create(); } - // This must be called, or else no crosshair will be rendered + /// + /// Creates a new crosshair texture with the current settings + /// public static void Create() { // Creates a crosshair texture @@ -125,7 +122,6 @@ namespace CrosshairMod m_style.normal.background = m_texture; } - // Render the Crosshair public static void Render() { // If the crosshair is faulty, then don't execute this code diff --git a/CrosshairMod/Interface.cs b/CrosshairMod/Interface.cs index 82a207f..1acb1c8 100644 --- a/CrosshairMod/Interface.cs +++ b/CrosshairMod/Interface.cs @@ -8,45 +8,65 @@ using UnityEngine; namespace CrosshairMod { - - /* A class that handles the Crosshair GUI. - * - * Contains all Buttons, Sliders etc. that are able to modify the crosshair. - */ - - // TODO: Create GUILayout.Window to make a less crappy version of the settings window + /// + /// Handles and contains every Object needed for the interface + /// static class Interface { - // Saves wether the interface is visible or not private static bool m_visible = false; - // Stores all Buttons used in the interface. + /// + /// A list of all Objects (That includes buttons, sliders etc) inside the GUI Window + /// This makes it easy to add more components if it is needed. + /// private static List m_inputs = new List(); + // TODO: Replace with dictionary, the whole concept of having IDs inside the objects is stupid and unnecessary - // Values of the RGBA Sliders + /// + /// RGBA Slider values + /// private static int rSliderValue, gSliderValue, bSliderValue, aSliderValue; - // Position ind dimension of the GUI background private static Vector2 m_position; private static Vector2 m_dimension; - // Creates a new button object and adds it to the List + /// + /// Creates a new Button and adds it to the content list + /// + /// X-Position + /// Y-position + /// Width + /// Height + /// Text to be displayed on the button + /// Key of the Button + /// Action to be executed when the button is pressed private static void AddButton(float x, float y, float width, float height, string label, string ID, params EventHandler[] onClickEvent) { - GUIButton buttonObj = new GUIButton(x, y, width, height, label, ID, onClickEvent); + Input.Button buttonObj = new Input.Button(x, y, width, height, label, ID, onClickEvent); m_inputs.Add(buttonObj); } - // Creates a new slider object and adds it to the List - // Returns the index of the button + /// + /// Creates a new Slider and adds ot to the content list + /// + /// X-Position + /// Y-Position/param> + /// Width + /// Height + /// Minimum value of the slider + /// Maximum value of the slider + /// Starting value of the slider + /// Key of the slider private static void AddSlider(float x, float y, float width, float height, float min, float max, float init, string ID) { - GUISlider sliderObj = new GUISlider(x, y, width, height, min, max, init, ID); + Input.Slider sliderObj = new Input.Slider(x, y, width, height, min, max, init, ID); m_inputs.Add(sliderObj); } - // Initializes all Buttons, gives them their function etc + /// + /// Creates all needed input objects and initializes window + /// public static void Init() { // Set dimension to 0.25 of the screen width/height @@ -58,7 +78,7 @@ namespace CrosshairMod // Create Crosshair Visibilty Button AddButton(20, 20, 200, 30, (Crosshair.Enabled() ? "Hide Crosshair" : "Show Crosshair"), "Toggle", (object sender, EventArgs e) => { Crosshair.Toggle(); }, - (object sender, EventArgs e) => { GUIButton btn = (GUIButton)sender; btn.label = (Crosshair.Enabled() ? "Hide Crosshair" : "Show Crosshair"); }); + (object sender, EventArgs e) => { Input.Button btn = (Input.Button)sender; btn.Label = (Crosshair.Enabled() ? "Hide Crosshair" : "Show Crosshair"); }); // Create Crosshair Size +/- Buttons AddButton(20, 60, 30, 30, @@ -84,20 +104,21 @@ namespace CrosshairMod AddSlider(m_dimension.x / 2 + 60, 150, 200, 30, 0, 255, aSliderValue, "alpha"); } - // Displays / Hides the menu public static void Toggle() { m_visible = !m_visible; } - // Renders the window public static void Render() { + // TODO: Think about making this a GUILayout.ModalWindow if (m_visible) GUI.Window(420, new Rect(m_position, m_dimension), RenderFunc, "Crosshair Settings"); } - // Renders the Panel, but also handles Updating the buttons + /// + /// Where actual rendering happens. Draws all objects and updated them + /// private static void RenderFunc(int windowID) { // Make Window draggable @@ -114,7 +135,7 @@ namespace CrosshairMod GUI.Label(new Rect(m_dimension.x / 2 + 20, 150, 200, 30), "A: " + aSliderValue); // Set crosshair Colour after getting slider values - IEnumerable it = m_inputs.OfType(); + IEnumerable it = m_inputs.OfType(); rSliderValue = (int)it.First(slider => slider.ID == "red").Value; gSliderValue = (int)it.First(slider => slider.ID == "green").Value; bSliderValue = (int)it.First(slider => slider.ID == "blue").Value; @@ -123,12 +144,14 @@ namespace CrosshairMod Crosshair.SetColor(rSliderValue, gSliderValue, bSliderValue, aSliderValue); // Update Buttons - HandleButtons(); + HandleInputObjects(); } - // Calls the Update function on all Buttons to check if they were pressed, and execute their Action - private static void HandleButtons() + /// + /// Calls the Update function of each input object + /// + private static void HandleInputObjects() { foreach(InputObject obj in m_inputs) { diff --git a/CrosshairMod/Interface/Button.cs b/CrosshairMod/Interface/Button.cs index 895da89..6e4f259 100644 --- a/CrosshairMod/Interface/Button.cs +++ b/CrosshairMod/Interface/Button.cs @@ -6,51 +6,62 @@ using System.Text; using UnityEngine; -namespace CrosshairMod +namespace CrosshairMod.Input { - /* - * A button wrapper class that is used right now as I don't have access to - * the games buttons. Since UnityEngine.GUI only has a function to draw Buttons, - * I made this class for easy handling. - * - */ - class GUIButton : InputObject + /// + /// Button wrapper for Unitys GUI.Button() function. I made this in order + /// to store buttons and render them in Lists + /// + class Button : InputObject { - // da_google thinks this Button Wrapper is stupid, so let's see what ths Button Wrapper thinks about him - private const bool IS_DA_GOOGLE_STUPID = true; - // Interesting. - - // OnClick event + /// + /// Event Handler that contains the actions to execute when the Button was clicked + /// public event EventHandler OnClick; - // Label of the Button - public string label { get; set; } = ""; + public string Label = ""; - // Initialize Button - public GUIButton(float x, float y, float width, float height, string label, string ID, params EventHandler[] OnClickEvent) + /// + /// Create new Button + /// + /// X-Position + /// Y-Position + /// Width + /// Height + /// Text inside the button + /// Button ID + /// Action to execute when button is pressed + public Button(float x, float y, float width, float height, string label, string ID, params EventHandler[] OnClickEvent) : base(x, y, width, height, ID) { - Logging.Debug.Log("Button Constructor"); + Logging.Debug.Log("Button Constructor: " + label); // Assign position, dimension and label - this.label = label; + this.Label = label; // Push OnClickEvents foreach(EventHandler e in OnClickEvent) OnClick += e; } - public GUIButton(string ID) + /// + /// Sad, pathetic default constructor + /// + /// + public Button(string ID) : base(0, 0, 0, 0, ID) { // Empty } - // Updates and Draws the Button. + /// + /// Draws button and returns button state / executes button action + /// + /// 1f if the button is pressed, 0f else public override float Update() { // Get if the Button was pressed and invoke OnClick event accordingly - bool buttonPressed = GUI.Button(new Rect(position, dimensions), label); + bool buttonPressed = GUI.Button(new Rect(position, dimensions), Label); if (buttonPressed) OnClick?.Invoke(this, EventArgs.Empty); diff --git a/CrosshairMod/Interface/InputObject.cs b/CrosshairMod/Interface/InputObject.cs index 7e14d2a..11743bf 100644 --- a/CrosshairMod/Interface/InputObject.cs +++ b/CrosshairMod/Interface/InputObject.cs @@ -8,21 +8,25 @@ using UnityEngine; namespace CrosshairMod { - /* - * Base of all Input Objects. - * - * Any Input Object that wants to be displayed in the Interface must - * inherit from this class. - */ + /// + /// Base class for all InputObjects. Defines basic attributes that + /// every input object needs + /// abstract class InputObject { - // position and dimension of the object public Vector2 position, dimensions; - - // ID of the Object + + // TODO: Remove once dictionary was implemented public readonly string ID; - // constructor to set position and size + /// + /// Create new InputObject + /// + /// X-Position + /// Y-Position + /// Width + /// Height + /// ID public InputObject(float x, float y, float width, float height, string ID) { this.position = new Vector2(x, y); @@ -30,7 +34,11 @@ namespace CrosshairMod this.ID = ID; } - // the update method (that works as renderer) must be overriden by each object + /// + /// The Update method every Input Object needs. + /// This is needed to store all kinds of input objects in one List for example + /// + /// Value of the Object public abstract float Update(); } } diff --git a/CrosshairMod/Interface/Slider.cs b/CrosshairMod/Interface/Slider.cs index 47dbf80..df6a28d 100644 --- a/CrosshairMod/Interface/Slider.cs +++ b/CrosshairMod/Interface/Slider.cs @@ -6,18 +6,33 @@ using System.Text; using UnityEngine; -namespace CrosshairMod +namespace CrosshairMod.Input { - class GUISlider : InputObject + class Slider : InputObject { - // Min/Max values for the slider - public float Min { get; set; } = 0; - public float Max { get; set; } = 0; + /// + /// Min/Max Slider values + /// + public float Min = 0; + public float Max = 0; - // Current slider value - public float Value { get; set; } = 0; + /// + /// Current slider value + /// + public float Value = 0; - public GUISlider(float x, float y, float width, float height, float min, float max, float init, string ID) + /// + /// Creates a new Slider + /// + /// X-Position + /// Y-Position + /// Width + /// Height + /// Minimum Slider value + /// Maximum Slider value + /// Initial Slider value + /// ID + public Slider(float x, float y, float width, float height, float min, float max, float init, string ID) : base(x, y, width, height, ID) { Min = min; @@ -25,12 +40,20 @@ namespace CrosshairMod Value = init; } - public GUISlider(string ID) + /// + /// Sad, pathetic default constructor + /// + /// + public Slider(string ID) :base (0, 0, 0, 0, ID) { } + /// + /// Draws and Updates the slider + /// + /// Value of the Slider public override float Update() { Value = GUI.HorizontalSlider(new Rect(position, dimensions), Value, Min, Max); diff --git a/CrosshairMod/Logging.cs b/CrosshairMod/Logging.cs index db9fd39..3f1c199 100644 --- a/CrosshairMod/Logging.cs +++ b/CrosshairMod/Logging.cs @@ -8,17 +8,17 @@ using UnityEngine; namespace CrosshairMod { - // CrosshairMod's Logging class - // Simply writes messages to the Unity Debug output - // However, I prefer this over Debug.Log() since it doesn't include a stacktrace (Except for Errors) + /// + /// Handles Logging in the Crosshair mod + /// public static class Logging { - // The Prefix that gets put in front of every Log public const string PREFIX = "[CROSSHAIRMOD]"; - // A kind of sub-class that is used to Log messages that will only appear - // when the User installs a Debug build of the Mod. Release versions will - // not log Debug messages this way. + /// + /// Logging's subclass for Debug Logging. + /// This only logs messages in the debug build of the mod. + /// public static class Debug { public static void Log(string message) @@ -44,19 +44,17 @@ namespace CrosshairMod } - // Logs information public static void Log(string message) { Console.WriteLine(PREFIX + "Info: " + message); } - // Logs warnings public static void LogWarning(string message) { Console.WriteLine(PREFIX + "Warning: " + message); } - // Logs errors + public static void LogError(string message) { UnityEngine.Debug.Log(PREFIX + "Error: " + message); diff --git a/CrosshairMod/Main.cs b/CrosshairMod/Main.cs index a73c6b3..910981d 100644 --- a/CrosshairMod/Main.cs +++ b/CrosshairMod/Main.cs @@ -1,12 +1,11 @@ /* - * Source code of a mode that adds a crosshair into + * Source code of a mod that adds a crosshair into * the game Blackwake. * * @author Lauchmelder - * @version v0.3 + * @version v0.3.1 */ - using System; using System.Collections.Generic; using System.Linq; @@ -16,24 +15,22 @@ using UnityEngine; namespace CrosshairMod { - - /* - * This is the Main class that is responsible for - * handling initializing and updating the components - * of the crosshair mod. - */ + /// + /// Class that gets loaded by the ModLoader. Calls every component of the Mod + /// public class CrosshairMod : MonoBehaviour { - // Define Hotkeys for Menu and Crosshair Toggle + /// + /// Default Hotkey Definitions + /// private char MENU_OPEN_KEY = 'H'; private char CH_TOGGLE_KEY = 'J'; - // This will be executed first void Start() { // Update the settings - Settings.LoadSettings(".\\Blackwake_Data\\Managed\\Mods\\chSettings.sett"); + Settings.LoadSettings(".\\Blackwake_Data\\Managed\\Mods\\Assets\\chSettings.sett"); // Create Crosshair Crosshair.Create(); // Create Panel @@ -44,7 +41,6 @@ namespace CrosshairMod CH_TOGGLE_KEY = (char)Settings.GetValue("hotkeyGUIToggle", true, CH_TOGGLE_KEY); } - // This gets called on every GUI Update (Can be multiple tiems per Frame) void OnGUI() { // Check for Key presses @@ -66,11 +62,10 @@ namespace CrosshairMod Crosshair.Render(); } - // Will be called when the application is closed void OnApplicationQuit() { // Save settings - Settings.SaveSettings(".\\Blackwake_Data\\Managed\\Mods\\chSettings.sett"); + Settings.SaveSettings(".\\Blackwake_Data\\Managed\\Mods\\Assets\\chSettings.sett"); Logging.Debug.Log("Saved Settings"); } } diff --git a/CrosshairMod/Settings.cs b/CrosshairMod/Settings.cs index 795ad70..a48bedc 100644 --- a/CrosshairMod/Settings.cs +++ b/CrosshairMod/Settings.cs @@ -6,16 +6,17 @@ using System.Text; namespace CrosshairMod { - /* - * The class that is responsible for loading and storing all the - * necessary settings. There is much room for improvement. - */ + /// + /// Loads, contains and handles settings + /// static class Settings { - // Initialize Settings dictionary private static Dictionary m_settings = new Dictionary(); - // Load settings from file + /// + /// Load settings from file + /// + /// public static void LoadSettings(string filepath) { Logging.Debug.Log("Accessing Settings at " + filepath); @@ -75,7 +76,10 @@ namespace CrosshairMod Logging.Log("Settings loaded."); } - // Converts the dictionary to a sett file + /// + /// Converts dictionary to a string to be stored in the settings file + /// + /// Save location public static void SaveSettings(string filepath) { string filecontent = ""; @@ -87,7 +91,11 @@ namespace CrosshairMod System.IO.File.WriteAllText(filepath, filecontent); } - // Adds a setting to the settings + /// + /// Create new setting and add it to the dictionary + /// + /// Setting name + /// Setting value public static void AddSetting(string key, int value) { if (m_settings.ContainsKey(key)) @@ -96,7 +104,12 @@ namespace CrosshairMod m_settings.Add(key, value); } - // Changes a settings value, and adds it if specified + /// + /// Change a settings value + /// + /// Setting name + /// New setting value + /// If the setting doesn't exist, create it public static void SetSetting(string key, int newVal, bool addIfDoesntExist = false) { // If the setting doesn't exist, either add and set it, or print a Debug.Warning @@ -117,9 +130,13 @@ namespace CrosshairMod m_settings[key] = newVal; } - // Tries to return the value belonging to a certain key - // If the specified key doesn't exist, it returns 0 and logs an error - // One can also specify that the setting should be created with some initial value + /// + /// Returns the value of a setting + /// + /// Setting name + /// Add the setting if it doesn't exist + /// Initial value of the setting in case it doesn't exist + /// public static int GetValue(string key, bool addIfDoesntExist = false, int initialValue = 0) { int value = 0; From d908c8d70f4e2d397cb2510441d16c98d477020a Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 4 Aug 2019 16:21:32 +0200 Subject: [PATCH 4/5] Reworked Input Objects --- CrosshairMod/Interface.cs | 24 +++++++++++------------- CrosshairMod/Interface/Button.cs | 10 ++++------ CrosshairMod/Interface/InputObject.cs | 9 ++------- CrosshairMod/Interface/Slider.cs | 10 ++++------ 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/CrosshairMod/Interface.cs b/CrosshairMod/Interface.cs index 1acb1c8..1d77afe 100644 --- a/CrosshairMod/Interface.cs +++ b/CrosshairMod/Interface.cs @@ -19,8 +19,7 @@ namespace CrosshairMod /// A list of all Objects (That includes buttons, sliders etc) inside the GUI Window /// This makes it easy to add more components if it is needed. /// - private static List m_inputs = new List(); - // TODO: Replace with dictionary, the whole concept of having IDs inside the objects is stupid and unnecessary + private static Dictionary m_inputs = new Dictionary(); /// /// RGBA Slider values @@ -43,8 +42,8 @@ namespace CrosshairMod /// Action to be executed when the button is pressed private static void AddButton(float x, float y, float width, float height, string label, string ID, params EventHandler[] onClickEvent) { - Input.Button buttonObj = new Input.Button(x, y, width, height, label, ID, onClickEvent); - m_inputs.Add(buttonObj); + Input.Button buttonObj = new Input.Button(x, y, width, height, label, onClickEvent); + m_inputs.Add(ID, buttonObj); } /// @@ -60,8 +59,8 @@ namespace CrosshairMod /// Key of the slider private static void AddSlider(float x, float y, float width, float height, float min, float max, float init, string ID) { - Input.Slider sliderObj = new Input.Slider(x, y, width, height, min, max, init, ID); - m_inputs.Add(sliderObj); + Input.Slider sliderObj = new Input.Slider(x, y, width, height, min, max, init); + m_inputs.Add(ID, sliderObj); } /// @@ -111,7 +110,6 @@ namespace CrosshairMod public static void Render() { - // TODO: Think about making this a GUILayout.ModalWindow if (m_visible) GUI.Window(420, new Rect(m_position, m_dimension), RenderFunc, "Crosshair Settings"); } @@ -136,10 +134,10 @@ namespace CrosshairMod // Set crosshair Colour after getting slider values IEnumerable it = m_inputs.OfType(); - rSliderValue = (int)it.First(slider => slider.ID == "red").Value; - gSliderValue = (int)it.First(slider => slider.ID == "green").Value; - bSliderValue = (int)it.First(slider => slider.ID == "blue").Value; - aSliderValue = (int)it.First(slider => slider.ID == "alpha").Value; + rSliderValue = (int)((Input.Slider)m_inputs["red"]).Value; + gSliderValue = (int)((Input.Slider)m_inputs["green"]).Value; + bSliderValue = (int)((Input.Slider)m_inputs["blue"]).Value; + aSliderValue = (int)((Input.Slider)m_inputs["alpha"]).Value; Crosshair.SetColor(rSliderValue, gSliderValue, bSliderValue, aSliderValue); @@ -153,9 +151,9 @@ namespace CrosshairMod /// private static void HandleInputObjects() { - foreach(InputObject obj in m_inputs) + foreach(KeyValuePair obj in m_inputs) { - obj.Update(); + obj.Value.Update(); } } } diff --git a/CrosshairMod/Interface/Button.cs b/CrosshairMod/Interface/Button.cs index 6e4f259..17e42db 100644 --- a/CrosshairMod/Interface/Button.cs +++ b/CrosshairMod/Interface/Button.cs @@ -29,10 +29,9 @@ namespace CrosshairMod.Input /// Width /// Height /// Text inside the button - /// Button ID /// Action to execute when button is pressed - public Button(float x, float y, float width, float height, string label, string ID, params EventHandler[] OnClickEvent) - : base(x, y, width, height, ID) + public Button(float x, float y, float width, float height, string label, params EventHandler[] OnClickEvent) + : base(x, y, width, height) { Logging.Debug.Log("Button Constructor: " + label); @@ -47,9 +46,8 @@ namespace CrosshairMod.Input /// /// Sad, pathetic default constructor /// - /// - public Button(string ID) - : base(0, 0, 0, 0, ID) + public Button() + : base(0, 0, 0, 0) { // Empty } diff --git a/CrosshairMod/Interface/InputObject.cs b/CrosshairMod/Interface/InputObject.cs index 11743bf..cd039f0 100644 --- a/CrosshairMod/Interface/InputObject.cs +++ b/CrosshairMod/Interface/InputObject.cs @@ -6,7 +6,7 @@ using System.Text; using UnityEngine; -namespace CrosshairMod +namespace CrosshairMod.Input { /// /// Base class for all InputObjects. Defines basic attributes that @@ -15,9 +15,6 @@ namespace CrosshairMod abstract class InputObject { public Vector2 position, dimensions; - - // TODO: Remove once dictionary was implemented - public readonly string ID; /// /// Create new InputObject @@ -26,12 +23,10 @@ namespace CrosshairMod /// Y-Position /// Width /// Height - /// ID - public InputObject(float x, float y, float width, float height, string ID) + public InputObject(float x, float y, float width, float height) { this.position = new Vector2(x, y); this.dimensions = new Vector2(width, height); - this.ID = ID; } /// diff --git a/CrosshairMod/Interface/Slider.cs b/CrosshairMod/Interface/Slider.cs index df6a28d..bab072e 100644 --- a/CrosshairMod/Interface/Slider.cs +++ b/CrosshairMod/Interface/Slider.cs @@ -31,9 +31,8 @@ namespace CrosshairMod.Input /// Minimum Slider value /// Maximum Slider value /// Initial Slider value - /// ID - public Slider(float x, float y, float width, float height, float min, float max, float init, string ID) - : base(x, y, width, height, ID) + public Slider(float x, float y, float width, float height, float min, float max, float init) + : base(x, y, width, height) { Min = min; Max = max; @@ -43,9 +42,8 @@ namespace CrosshairMod.Input /// /// Sad, pathetic default constructor /// - /// - public Slider(string ID) - :base (0, 0, 0, 0, ID) + public Slider() + :base (0, 0, 0, 0) { } From 002899d9829c3690c689789cffae4817ea354dbe Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Mon, 5 Aug 2019 15:48:51 +0200 Subject: [PATCH 5/5] Update LICENSE --- LICENSE | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/LICENSE b/LICENSE index cd9e927..f288702 100644 --- a/LICENSE +++ b/LICENSE @@ -1,26 +1,3 @@ -<<<<<<< HEAD -MIT License - -Copyright (c) 2019 Lauchmelder - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -======= GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -695,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ->>>>>>> releaseLicense