31 lines
1.7 KiB
C#
31 lines
1.7 KiB
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class AttributeBox : SpinBox
|
|
{
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready()
|
|
{
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
}
|
|
|
|
public override void _ValueChanged(double new_value)
|
|
{
|
|
nuint Strength = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Strength/SpinBox").Value;
|
|
nuint Perception = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Perception/SpinBox").Value;
|
|
nuint Endurance = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Endurance/SpinBox").Value;
|
|
nuint Charisma = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Charisma/SpinBox").Value;
|
|
nuint Intelligence = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Intelligence/SpinBox").Value;
|
|
nuint Agility = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Agility/SpinBox").Value;
|
|
nuint Luck = (nuint) GetTree().Root.GetNode<SpinBox>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Luck/SpinBox").Value;
|
|
string Name = GetTree().Root.GetNode<TextEdit>("Root/MainMenu/MainMenuCanvas/VBoxContainer/Name/NameEdit").Text;
|
|
Player player = new Player{Name = Name, Strength = Strength, Perception = Perception, Endurance = Endurance, Charisma = Charisma, Intelligence = Intelligence, Agility = Agility, Luck = Luck};
|
|
|
|
GetTree().Root.GetNode<TextEdit>("Root/MainMenu/MainMenuCanvas/VBoxContainer/PointsLeft").Text = String.Format("Attribute Points Left: {0}", 35-player.StatSum());
|
|
}
|
|
}
|