Merge branch 'TAS_UI'

This commit is contained in:
alex-kumpula 2023-11-11 16:14:24 -07:00
commit b3259e9585
9 changed files with 244 additions and 1 deletions

View File

@ -33,6 +33,11 @@ public partial class TAS_System : Node
private set { this._currentFrame = value; }
}
public int AdvancedFramesRemaining
{
get { return this.LastAdvancedFrame - this.CurrentFrame; }
}
/// <summary>
/// The last frame that can be advanced to. This will
/// only be greater than CurrentFrame after the player
@ -112,6 +117,7 @@ public partial class TAS_System : Node
if (this.TimeSinceLastFrame >= this.FrameLength)
{
this.CurrentFrame++;
this.LastAdvancedFrame = this.CurrentFrame;
EmitSignal(SignalName.FrameIncremented, this.CurrentFrame);
this.TimeSinceLastFrame = 0 + (this.TimeSinceLastFrame - this.FrameLength);
}

View File

@ -0,0 +1,27 @@
using Godot;
using System;
public partial class AdvanceButton : Button
{
TAS_System TAS;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS = GetNode<TAS_System>("/root/TAS_System");
this.Pressed += () => { TAS.Advance(1); };
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
if (TAS.AdvancedFramesRemaining == 0)
{
this.Disabled = true;
}
else
{
this.Disabled = false;
}
}
}

View File

@ -0,0 +1,24 @@
using Godot;
using System;
public partial class CurrentFrameLabel : Label
{
TAS_System TAS;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS = GetNode<TAS_System>("/root/TAS_System");
// TAS.FrameIncremented += OnFrameIncremented;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
this.Text = $"Current frame: {TAS.CurrentFrame}";
}
public virtual void OnFrameIncremented(int newFrame)
{
this.Text = $"Current frame: {newFrame}";
}
}

View File

@ -0,0 +1,17 @@
using Godot;
using System;
public partial class RegressButton : Button
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS_System TAS = GetNode<TAS_System>("/root/TAS_System");
this.Pressed += () => { TAS.Regress(1); };
}
public virtual void OnFrameIncremented(int newFrame)
{
this.Text = $"Current frame: {newFrame}";
}
}

View File

@ -0,0 +1,18 @@
using Godot;
using System;
public partial class ResetFramesButton : Button
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS_System TAS = GetNode<TAS_System>("/root/TAS_System");
this.Pressed += () => { TAS.ResetFrameCount(); };
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

View File

@ -0,0 +1,17 @@
using Godot;
using System;
public partial class StartIncrementButton : Button
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS_System TAS = GetNode<TAS_System>("/root/TAS_System");
this.Pressed += () => { TAS.StartIncrementingFrames(); };
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

View File

@ -0,0 +1,17 @@
using Godot;
using System;
public partial class StopIncrementButton : Button
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
TAS_System TAS = GetNode<TAS_System>("/root/TAS_System");
this.Pressed += () => { TAS.StopIncrementingFrames(); };
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

114
godot/UI/TAS UI/TAS UI.tscn Normal file
View File

@ -0,0 +1,114 @@
[gd_scene load_steps=7 format=3 uid="uid://b1uf31ed6h0ir"]
[ext_resource type="Script" path="res://UI/TAS UI/CurrentFrameLabel.cs" id="1_27u4w"]
[ext_resource type="Script" path="res://UI/TAS UI/RegressButton.cs" id="2_fhmsa"]
[ext_resource type="Script" path="res://UI/TAS UI/AdvanceButton.cs" id="3_0ti6q"]
[ext_resource type="Script" path="res://UI/TAS UI/StopIncrementButton.cs" id="4_4gd4c"]
[ext_resource type="Script" path="res://UI/TAS UI/StartIncrementButton.cs" id="5_5af83"]
[ext_resource type="Script" path="res://UI/TAS UI/ResetFramesButton.cs" id="6_nwwkv"]
[node name="TAS UI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="DEBUG" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="DEBUG"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -26.0
offset_right = 199.0
grow_vertical = 0
text = "Current Frame: 0"
script = ExtResource("1_27u4w")
[node name="FrameButtons" type="Control" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -131.5
offset_top = -52.0
offset_right = 131.5
grow_horizontal = 2
grow_vertical = 0
[node name="RegressButton" type="Button" parent="FrameButtons"]
layout_mode = 1
anchors_preset = -1
anchor_right = 0.5
anchor_bottom = 1.0
grow_vertical = 2
text = "Regress"
script = ExtResource("2_fhmsa")
[node name="AdvanceButton" type="Button" parent="FrameButtons"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
grow_vertical = 2
disabled = true
text = "Advance"
script = ExtResource("3_0ti6q")
[node name="TASButtons" type="Control" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -205.0
offset_top = -103.0
grow_horizontal = 0
grow_vertical = 0
[node name="StopIncrementButton" type="Button" parent="TASButtons"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 31.0
grow_horizontal = 2
text = "Stop Increment"
script = ExtResource("4_4gd4c")
[node name="StartIncrementButton" type="Button" parent="TASButtons"]
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -15.5
offset_bottom = 15.5
grow_horizontal = 2
grow_vertical = 2
text = "Start Increment"
script = ExtResource("5_5af83")
[node name="ResetFramesButton" type="Button" parent="TASButtons"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -31.0
grow_horizontal = 2
grow_vertical = 0
text = "Reset Frames"
script = ExtResource("6_nwwkv")

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://by3rnp88l4plx"]
[gd_scene load_steps=8 format=3 uid="uid://by3rnp88l4plx"]
[ext_resource type="PackedScene" uid="uid://bua7f25rpewkp" path="res://small_room.glb" id="1_bo0jp"]
[ext_resource type="PackedScene" uid="uid://cbp8c4kpmr0hk" path="res://control_scheme/is_targetable.tscn" id="2_d7v5s"]
[ext_resource type="PackedScene" uid="uid://drmb4sitb74fx" path="res://control_scheme/controller.tscn" id="3_0hshv"]
[ext_resource type="PackedScene" uid="uid://bjhii55pagkb5" path="res://TAS_system/is_TASable.tscn" id="3_srlbt"]
[ext_resource type="Script" path="res://tests/TAS_system/TAS_test_001.cs" id="5_0ber1"]
[ext_resource type="PackedScene" uid="uid://b1uf31ed6h0ir" path="res://UI/TAS UI/TAS UI.tscn" id="6_au5mx"]
[sub_resource type="Environment" id="Environment_f0m14"]
ambient_light_source = 2
@ -34,3 +35,5 @@ initial_target = NodePath("../grape")
[node name="TAS_test_001" type="Node" parent="." index="6"]
script = ExtResource("5_0ber1")
[node name="TAS UI" parent="." index="7" instance=ExtResource("6_au5mx")]