Example #1
0
 private static void Game_OnWndProc(WndEventArgs args)
 {
     if (args.Msg == WM_MOUSEWHEEL && Game.IsInGame)
     {
         if (Game.IsKeyDown(VK_CTRL))
         {
             var delta     = (short)((args.WParam >> 16) & 0xFFFF);
             var zoomValue = ZoomVar.GetInt();
             if (delta < 0)
             {
                 zoomValue += 50;
             }
             if (delta > 0)
             {
                 zoomValue -= 50;
             }
             if (zoomValue < 1134)
             {
                 zoomValue = 1134;
             }
             ZoomVar.SetValue(zoomValue);
             Menu.Item("distance").SetValue(new Slider(zoomValue, 1134, 2500));
             args.Process = false;
         }
     }
 }
Example #2
0
 private static void Game_OnWndProc(WndEventArgs args)
 {
     if (args.Msg == WM_MOUSEWHEEL && Game.IsInGame)
     {
         if (Game.IsKeyDown(VK_CTRL))
         {
             // Get HIWORD(wParam)
             var delta = (short)((args.WParam >> 16) & 0xFFFF);
             // GetValue
             var zoomValue = ZoomVar.GetInt();
             if (delta < 0)
             {
                 zoomValue += 50;
             }
             else
             {
                 zoomValue -= 50;
             }
             // Set updated value
             ZoomVar.SetValue(zoomValue);
             Menu.Item("distance").SetValue(new Slider(zoomValue, 1134, 3000));
             // Block processed input from game
             args.Process = false;
         }
     }
 }
Example #3
0
    public static bool GetBool(string strName, bool strDefault)
    {
        bool   num;
        object obj;
        string str = ConVar.GetString(strName, (!strDefault ? bool.FalseString : bool.TrueString));

        try
        {
            num = bool.Parse(str);
        }
        catch
        {
            string str1 = strName;
            if (!strDefault)
            {
                obj = null;
            }
            else
            {
                obj = 1;
            }
            num = ConVar.GetInt(str1, (float)obj) != 0;
        }
        return(num);
    }
Example #4
0
 private static void Game_OnWndProc(WndEventArgs args)
 {
     if (args.Msg == WM_MOUSEWHEEL && Game.IsInGame)
     {
         var player = ObjectManager.LocalPlayer;
         if ((player == null) || (player.Team == Team.Observer))
         {
             return;
         }
         if (Game.IsKeyDown(VK_CTRL))
         {
             var delta     = (short)((args.WParam >> 16) & 0xFFFF);
             var zoomValue = ZoomVar.GetInt();
             if (delta < 0)
             {
                 zoomValue += 50;
             }
             if (delta > 0)
             {
                 zoomValue -= 50;
             }
             if (zoomValue < 1134)
             {
                 zoomValue = 1134;
             }
             ZoomVar.SetValue(zoomValue);
             Menu.Item("distance").SetValue(new Slider(zoomValue, 1134, 3100));
             args.Process = false;
         }
     }
 }
Example #5
0
        public static void ChangeDistance(WndEventArgs args)
        {
            if (!OnUpdate.CanUpdate() || args.Msg != WmMousewheel || !Game.IsKeyDown(VkCtrl))
            {
                return;
            }
            var delta     = (short)((args.WParam >> 16) & 0xFFFF);
            var zoomValue = ZoomVar.GetInt();

            if (delta < 0)
            {
                zoomValue += 50;
            }
            if (delta > 0)
            {
                zoomValue -= 50;
            }
            if (zoomValue < 1134)
            {
                zoomValue = 1134;
            }
            ZoomVar.SetValue(zoomValue);
            MenuVar.CameraDistance.SetValue(new Slider(zoomValue, 1134, 2000));
            args.Process = false;
        }
Example #6
0
    public void UpdateFromConVar()
    {
        dfSlider component = base.GetComponent <dfSlider>();

        if (component != null)
        {
            component.Value = ConVar.GetFloat(this.convarName, component.Value);
        }
        dfDropdown _dfDropdown = base.GetComponent <dfDropdown>();

        if (_dfDropdown != null)
        {
            if (!this.useValuesNotNumbers)
            {
                int num = ConVar.GetInt(this.convarName, -1f);
                if (num != -1)
                {
                    _dfDropdown.SelectedIndex = num;
                }
            }
            else
            {
                string str = ConVar.GetString(this.convarName, string.Empty);
                if (!string.IsNullOrEmpty(str))
                {
                    int selectedIndex = _dfDropdown.SelectedIndex;
                    _dfDropdown.SelectedValue = str;
                    if (_dfDropdown.SelectedIndex == -1)
                    {
                        _dfDropdown.SelectedIndex = selectedIndex;
                    }
                }
            }
        }
        dfCheckbox flag = base.GetComponent <dfCheckbox>();

        if (flag != null)
        {
            flag.IsChecked = ConVar.GetBool(this.convarName, flag.IsChecked);
        }
    }
Example #7
0
    public void UpdateFromConVar()
    {
        dfSlider component = base.GetComponent <dfSlider>();

        if (component != null)
        {
            component.Value = ConVar.GetFloat(this.convarName, component.Value);
        }
        dfDropdown dropdown = base.GetComponent <dfDropdown>();

        if (dropdown != null)
        {
            if (this.useValuesNotNumbers)
            {
                string str = ConVar.GetString(this.convarName, string.Empty);
                if (!string.IsNullOrEmpty(str))
                {
                    int selectedIndex = dropdown.SelectedIndex;
                    dropdown.SelectedValue = str;
                    if (dropdown.SelectedIndex == -1)
                    {
                        dropdown.SelectedIndex = selectedIndex;
                    }
                }
            }
            else
            {
                int @int = ConVar.GetInt(this.convarName, -1f);
                if (@int != -1)
                {
                    dropdown.SelectedIndex = @int;
                }
            }
        }
        dfCheckbox checkbox = base.GetComponent <dfCheckbox>();

        if (checkbox != null)
        {
            checkbox.IsChecked = ConVar.GetBool(this.convarName, checkbox.IsChecked);
        }
    }