예제 #1
0
        // 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 <GUISlider> it = m_inputs.OfType <GUISlider>();

            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();
        }
예제 #2
0
        // 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);
        }
예제 #3
0
        // This gets called on every GUI Update (Can be multiple tiems per Frame)
        void OnGUI()
        {
            // 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.ToString())))
            {
                // Toggle Crosshair
                Crosshair.Toggle();
            }

            //Render GUI
            Interface.Render();
            //Render Crosshair
            Crosshair.Render();
        }
예제 #4
0
        // 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);


            // 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"); });

            // 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); });

            // 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");
        }