public UIButton(string label, Rectangle frame, UIButtonStyleSet styles, OnPressDelegate onPress)
 {
     this.label = label;
     this.frame = frame;
     this.styles = styles;
     this.onPress = onPress;
 }
Exemple #2
0
 public UIButton(string label, Rectangle frame, UIButtonStyle styles, OnPressDelegate onPress)
 {
     this.label   = label;
     this.frame   = frame;
     this.styles  = styles;
     this.onPress = onPress;
 }
Exemple #3
0
 public UIButton(string label, Rectangle frame, UIButtonStyle styles, OnPressDelegate onPress, List <OnPressDelegate> onPressActions = null)
 {
     this.label          = label;
     this.frame          = frame;
     this.styles         = styles;
     this.onPress        = onPress;
     this.onPressActions = onPressActions;
 }
Exemple #4
0
        /// <summary>
        /// Tries to create hotkey. This will return null if something goes wrong.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static HotkeyPress TryCreateHotkey(string input, OnPressDelegate function)
        {
            VirtualKeys[] vk;
            if (HotkeyBase.TryParse(input, out vk) && vk != null && vk.Length != 0)
            {
                return(new HotkeyPress(function, vk));
            }

            return(null);
        }
Exemple #5
0
 /// <summary>
 /// Initializes this instance
 /// </summary>
 /// <param name="onPress">On press.</param>
 public void Initialize(OnPressDelegate onPress)
 {
     m_onPress = onPress;
     InitializeInput();
     InitializeMovement();
     // Use the unpressed sprite
     if (m_unpressedSprite != null)
     {
         m_spriteRenderer.sprite = m_unpressedSprite;
     }
     // Ensure that the instance is upright
     transform.SetScaleY(Mathf.Abs(transform.localScale.y));
 }
    /// <summary>
    /// 添加按下事件
    /// </summary>
    public void AddOnPressEvent(GameObject go, OnPressDelegate onPressFunc)
    {
        if (go == null)
        {
            return;
        }

        if (m_dicOnPressDelegate.ContainsKey(go))
        {
            m_dicOnPressDelegate[go] = onPressFunc;
        }
        else
        {
            m_dicOnPressDelegate.Add(go, onPressFunc);
        }
    }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HotkeyPress"/> class.
 /// </summary>
 /// <param name="function">The function.</param>
 /// <param name="keys">The keys.</param>
 public HotkeyPress(OnPressDelegate function, params VirtualKeys[] keys) : base(keys)
 {
     this.Function = function;
 }
Exemple #8
0
 public void SetPressCallBack(OnPressDelegate pressDelegate)
 {
     base.PressBtnCallBack = pressDelegate;
 }
 /// <summary>
 /// Sets the press delegate.
 /// </summary>
 /// <param name="onPress">On press.</param>
 public void SetPressDelegate(OnPressDelegate onPress)
 {
     m_onPress = onPress;
 }
Exemple #10
0
 /// <summary>
 /// Initializes this instance
 /// </summary>
 /// <param name="onPress">On press.</param>
 public void Initialize(OnPressDelegate onPress)
 {
     m_onPress = onPress;
     InitializeInput();
 }
Exemple #11
0
 public UIBuyButton(string label, int price, Rectangle frame, UIButtonStyle style, OnPressDelegate onPress) : base(label, frame, style, onPress)
 {
     this.baseLabel = label;
     this.price     = price;
 }
Exemple #12
0
 public UIRadioButton(string label, T value, UIRadioButtonGroup <T> group, Rectangle frame, UIButtonStyle styles, UIButtonAppearance activeAppearance, OnPressDelegate onPress) :
     base(label, frame, styles, onPress)
 {
     this.group            = group;
     this.value            = value;
     this.activeAppearance = activeAppearance;
 }