cool
This commit is contained in:
@@ -19,6 +19,11 @@ namespace BITKit.UX
|
||||
{
|
||||
name = "ReleasePress"
|
||||
};
|
||||
|
||||
private readonly UxmlStringAttributeDescription m_TextAttribute = new()
|
||||
{
|
||||
name = "Text"
|
||||
};
|
||||
|
||||
public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
|
||||
{
|
||||
@@ -26,12 +31,19 @@ namespace BITKit.UX
|
||||
var table = (OnScreenButton)ve;
|
||||
table.PressedValue = m_PressedValueAttribute.GetValueFromBag(bag, cc);
|
||||
table.ReleasePress = m_ReleasePressAttribute.GetValueFromBag(bag, cc);
|
||||
table.Text = m_TextAttribute.GetValueFromBag(bag, cc);
|
||||
}
|
||||
}
|
||||
public new class UxmlFactory : UxmlFactory<OnScreenButton, UxmlTraits> { }
|
||||
public float PressedValue { get; set; }= 1f;
|
||||
public bool ReleasePress { get; set; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => _label.text;
|
||||
set => _label.text = value;
|
||||
}
|
||||
|
||||
private bool _isPressed;
|
||||
private int _pointerId=-1;
|
||||
private Label _label;
|
||||
@@ -44,6 +56,7 @@ namespace BITKit.UX
|
||||
RegisterCallback<PointerMoveEvent>(OnPointerMove);
|
||||
this.AddManipulator(new Clickable(OnClick));
|
||||
_label = this.Create<Label>();
|
||||
_label.pickingMode = PickingMode.Ignore;
|
||||
|
||||
_isTriggered.AddListener(x =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user