-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPlayerDataListItem.cs
35 lines (29 loc) · 1.02 KB
/
PlayerDataListItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using ControlBinding;
using Godot;
using Godot.Community.ControlBinding;
using Godot.Community.ControlBinding.Extensions;
using PropertyChanged.SourceGenerator;
namespace ControlBinding;
public partial class PlayerDataListItem : ControlViewModel
{
[Notify]
private PlayerData _viewModelData;
public BindingContext BindingContext { get; set; }
public override void SetViewModelData(object viewModelData)
{
ViewModelData = viewModelData as PlayerData;
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
BindingContext = new BindingContext(this);
GetNode<TextEdit>("%TextEdit").BindProperty(BindingContext, "Text", "ViewModelData.Health", BindingMode.TwoWay);
GetNode<Button>("%Button").Pressed += () => this.QueueFree();
base._Ready();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
// Nothing to process
}
}