Esempio n. 1
0
    protected internal override void OnMouseWheel(dfMouseEventArgs args)
    {
        dfScrollbar value = this;

        value.Value = value.Value + this.IncrementAmount * -args.WheelDelta;
        args.Use();
        base.Signal("OnMouseWheel", new object[] { args });
    }
Esempio n. 2
0
 private void incrementPressed(dfControl sender, dfMouseEventArgs args)
 {
     if (args.Buttons.IsSet(dfMouseButtons.Left))
     {
         dfScrollbar value = this;
         value.Value = value.Value + this.IncrementAmount;
         args.Use();
     }
 }
Esempio n. 3
0
        internal static void PrepareCustomOptions()
        {
            CachedCentralPanel     = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.parent.gameObject.GetComponent <dfPanel>();
            CachedOptionsAtlas     = Patches.FullOptionsMenuController.Instance.TabGameplay.Atlas;
            CachedOptionsScrollbar = Patches.FullOptionsMenuController.Instance.TabGameplay.VertScrollbar;
            CachedCrosshairSelectionDoerControl = Patches.PreOptionsMenuController.Instance.TabGameplaySelector.GetComponent <MenuCrosshairSelectionDoer>().controlToPlace;

            CachedOptionMenuEntry   = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.GetChild(1).gameObject.GetComponent <dfPanel>();
            CachedCheckboxMenuEntry = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.GetChild(0).gameObject.GetComponent <dfPanel>();
        }
Esempio n. 4
0
 public override void OnDestroy()
 {
     if (this.horzScroll != null)
     {
         this.horzScroll.ValueChanged -= new PropertyChangedEventHandler <float>(this.horzScroll_ValueChanged);
     }
     if (this.vertScroll != null)
     {
         this.vertScroll.ValueChanged -= new PropertyChangedEventHandler <float>(this.vertScroll_ValueChanged);
     }
     this.horzScroll = null;
     this.vertScroll = null;
 }
Esempio n. 5
0
    public override void OnDestroy()
    {
        if (horzScroll != null)
        {
            horzScroll.ValueChanged -= horzScroll_ValueChanged;
        }

        if (vertScroll != null)
        {
            vertScroll.ValueChanged -= vertScroll_ValueChanged;
        }

        horzScroll = null;
        vertScroll = null;
    }
Esempio n. 6
0
    private void updateFromTrackClick(dfMouseEventArgs args)
    {
        float valueFromMouseEvent = this.getValueFromMouseEvent(args);

        if (valueFromMouseEvent > this.rawValue + this.scrollSize)
        {
            dfScrollbar value = this;
            value.Value = value.Value + this.scrollSize;
        }
        else if (valueFromMouseEvent < this.rawValue)
        {
            dfScrollbar _dfScrollbar = this;
            _dfScrollbar.Value = _dfScrollbar.Value - this.scrollSize;
        }
    }
Esempio n. 7
0
 protected internal override void OnKeyDown(dfKeyEventArgs args)
 {
     if (this.Orientation != dfControlOrientation.Horizontal)
     {
         if (args.KeyCode == KeyCode.UpArrow)
         {
             dfScrollbar value = this;
             value.Value = value.Value - this.IncrementAmount;
             args.Use();
             return;
         }
         if (args.KeyCode == KeyCode.DownArrow)
         {
             dfScrollbar _dfScrollbar = this;
             _dfScrollbar.Value = _dfScrollbar.Value + this.IncrementAmount;
             args.Use();
             return;
         }
     }
     else
     {
         if (args.KeyCode == KeyCode.LeftArrow)
         {
             dfScrollbar value1 = this;
             value1.Value = value1.Value - this.IncrementAmount;
             args.Use();
             return;
         }
         if (args.KeyCode == KeyCode.RightArrow)
         {
             dfScrollbar _dfScrollbar1 = this;
             _dfScrollbar1.Value = _dfScrollbar1.Value + this.IncrementAmount;
             args.Use();
             return;
         }
     }
     base.OnKeyDown(args);
 }
Esempio n. 8
0
    public override void OnDestroy()
    {
        if( horzScroll != null )
        {
            horzScroll.ValueChanged -= horzScroll_ValueChanged;
        }

        if( vertScroll != null )
        {
            vertScroll.ValueChanged -= vertScroll_ValueChanged;
        }

        horzScroll = null;
        vertScroll = null;
    }
Esempio n. 9
0
    private void openPopup()
    {
        if (this.popup != null || (int)this.items.Length == 0)
        {
            return;
        }
        Vector2 vector2 = this.calculatePopupSize();

        this.popup      = base.GetManager().AddControl <dfListbox>();
        this.popup.name = string.Concat(base.name, " - Dropdown List");
        this.popup.gameObject.hideFlags = HideFlags.DontSave;
        this.popup.Atlas            = base.Atlas;
        this.popup.Anchor           = dfAnchorStyle.Top | dfAnchorStyle.Left;
        this.popup.Font             = this.Font;
        this.popup.Pivot            = dfPivotPoint.TopLeft;
        this.popup.Size             = vector2;
        this.popup.Font             = this.Font;
        this.popup.ItemHeight       = this.ItemHeight;
        this.popup.ItemHighlight    = this.ItemHighlight;
        this.popup.ItemHover        = this.ItemHover;
        this.popup.ItemPadding      = this.TextFieldPadding;
        this.popup.ItemTextColor    = this.TextColor;
        this.popup.ItemTextScale    = this.TextScale;
        this.popup.Items            = this.Items;
        this.popup.ListPadding      = this.ListPadding;
        this.popup.BackgroundSprite = this.ListBackground;
        this.popup.Shadow           = this.Shadow;
        this.popup.ShadowColor      = this.ShadowColor;
        this.popup.ShadowOffset     = this.ShadowOffset;
        this.popup.ZOrder           = 2147483647;
        if (vector2.y >= (float)this.MaxListHeight && this.listScrollbar != null)
        {
            GameObject  gameObject = UnityEngine.Object.Instantiate(this.listScrollbar.gameObject) as GameObject;
            dfScrollbar component  = gameObject.GetComponent <dfScrollbar>();
            float       units      = base.PixelsToUnits();
            Vector3     vector3    = this.popup.transform.TransformDirection(Vector3.right);
            Vector3     width      = this.popup.transform.position + ((vector3 * (vector2.x - component.Width)) * units);
            component.transform.parent   = this.popup.transform;
            component.transform.position = width;
            component.Anchor             = dfAnchorStyle.Top | dfAnchorStyle.Bottom;
            component.Height             = this.popup.Height;
            dfListbox _dfListbox = this.popup;
            _dfListbox.Width        = _dfListbox.Width - component.Width;
            this.popup.Scrollbar    = component;
            this.popup.SizeChanged += new PropertyChangedEventHandler <Vector2>((dfControl control, Vector2 size) => component.Height = control.Height);
        }
        Vector2 vector21 = this.popup.Size;
        Vector3 vector31 = this.calculatePopupPosition((int)vector21.y);

        this.popup.transform.position    = vector31;
        this.popup.transform.rotation    = base.transform.rotation;
        this.popup.SelectedIndexChanged += new PropertyChangedEventHandler <int>(this.popup_SelectedIndexChanged);
        this.popup.LostFocus            += new FocusEventHandler(this.popup_LostFocus);
        this.popup.ItemClicked          += new PropertyChangedEventHandler <int>(this.popup_ItemClicked);
        this.popup.KeyDown      += new KeyPressHandler(this.popup_KeyDown);
        this.popup.SelectedIndex = Mathf.Max(0, this.SelectedIndex);
        this.popup.EnsureVisible(this.popup.SelectedIndex);
        this.popup.Focus();
        if (this.DropdownOpen != null)
        {
            bool flag = false;
            this.DropdownOpen(this, this.popup, ref flag);
        }
        base.Signal("OnDropdownOpen", new object[] { this, this.popup });
    }
Esempio n. 10
0
 public override void OnDestroy()
 {
     if (this.horzScroll != null)
     {
         this.horzScroll.ValueChanged -= new PropertyChangedEventHandler<float>(this.horzScroll_ValueChanged);
     }
     if (this.vertScroll != null)
     {
         this.vertScroll.ValueChanged -= new PropertyChangedEventHandler<float>(this.vertScroll_ValueChanged);
     }
     this.horzScroll = null;
     this.vertScroll = null;
 }