A lot of work, beginning client UI, adding lesson and page handling, etc
This commit is contained in:
154
ADEPT-Godot/Client/Scenes/ClientMain.tscn
Normal file
154
ADEPT-Godot/Client/Scenes/ClientMain.tscn
Normal file
@@ -0,0 +1,154 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bbogimp25gyre"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dta0h5g01sooo" path="res://Client/Scripts/UI/ClientMain.cs" id="1_t0hef"]
|
||||
[ext_resource type="Texture2D" uid="uid://chm704rgdebfb" path="res://icon.png" id="2_gv8lv"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gv8lv"]
|
||||
bg_color = Color(0, 0.301961, 0.301961, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nd7pt"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_inrp4"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[node name="ClientMain" type="Control" node_paths=PackedStringArray("_lessonTitleLabel", "_pageTitleLabel", "_backNavButton", "_nextNavButton", "_menuNavButton")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_t0hef")
|
||||
_lessonTitleLabel = NodePath("VBoxContainer/Header/MarginContainer/VBoxContainer/LessonTitle")
|
||||
_pageTitleLabel = NodePath("VBoxContainer/Header/MarginContainer/VBoxContainer/PageTitle")
|
||||
_backNavButton = NodePath("VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer/BackButton")
|
||||
_nextNavButton = NodePath("VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer/NextButton")
|
||||
_menuNavButton = NodePath("VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer/MenuButton")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Header" type="Panel" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 80)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_gv8lv")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Header"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Header/MarginContainer"]
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource("2_gv8lv")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Header/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="LessonTitle" type="Label" parent="VBoxContainer/Header/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "Lesson Title"
|
||||
|
||||
[node name="PageTitle" type="Label" parent="VBoxContainer/Header/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "Page Title"
|
||||
|
||||
[node name="MainContentMargin" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/MainContentMargin"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Footer" type="Panel" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 60)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_nd7pt")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Footer"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 15
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 15
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="NavigationButtons" type="Control" parent="VBoxContainer/Footer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/Footer/MarginContainer/NavigationButtons"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_inrp4")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -49.0
|
||||
offset_top = -15.5
|
||||
offset_right = 49.0
|
||||
offset_bottom = 15.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="BackButton" type="Button" parent="VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(30, 20)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 2
|
||||
text = "<"
|
||||
|
||||
[node name="MenuButton" type="Button" parent="VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(30, 20)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
text = "≡"
|
||||
|
||||
[node name="NextButton" type="Button" parent="VBoxContainer/Footer/MarginContainer/NavigationButtons/Panel/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(30, 20)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 10
|
||||
text = ">"
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://c35ohffpqfqnr"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c35ohffpqfqnr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://chm704rgdebfb" path="res://icon.png" id="2_swjw6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbogimp25gyre" path="res://Client/Scenes/ClientMain.tscn" id="2_uaail"]
|
||||
[ext_resource type="PackedScene" uid="uid://caivf0icbv7gk" path="res://Core/Scenes/CogwheelConsole.tscn" id="3_ama40"]
|
||||
|
||||
[node name="MainCanvas" type="CanvasLayer"]
|
||||
@@ -30,4 +31,6 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_swjw6")
|
||||
|
||||
[node name="ClientMain" parent="." instance=ExtResource("2_uaail")]
|
||||
|
||||
[node name="CogwheelConsole" parent="." instance=ExtResource("3_ama40")]
|
||||
|
||||
48
ADEPT-Godot/Client/Scripts/UI/ClientMain.cs
Normal file
48
ADEPT-Godot/Client/Scripts/UI/ClientMain.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using ADEPT.Core;
|
||||
using Cogwheel;
|
||||
|
||||
public partial class ClientMain : Control
|
||||
{
|
||||
[Export] private Label _lessonTitleLabel;
|
||||
[Export] private Label _pageTitleLabel;
|
||||
|
||||
[Export] private Button _backNavButton;
|
||||
[Export] private Button _nextNavButton;
|
||||
[Export] private Button _menuNavButton;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GetTree().CreateTimer(1).Timeout += () => { COGWHEEL.RegisterObject(this); Init(); };
|
||||
|
||||
}
|
||||
|
||||
[Command(Name = "client.init", Description = "Initialize the client")]
|
||||
private void Init()
|
||||
{
|
||||
Adept.LessonHandler.LessonLoaded += (s, o) =>
|
||||
{
|
||||
_lessonTitleLabel.Text = Adept.LessonHandler.CurrentLesson.Title;
|
||||
_pageTitleLabel.Text = Adept.LessonHandler.CurrentPage.Title;
|
||||
};
|
||||
|
||||
Adept.LessonHandler.PageChanged += (s, o) =>
|
||||
{
|
||||
_pageTitleLabel.Text = Adept.LessonHandler.CurrentPage.Title;
|
||||
};
|
||||
|
||||
_backNavButton.Pressed += () =>
|
||||
{
|
||||
// Adept.LessonHandler.LoadPreviousPage();
|
||||
COGWHEEL.RunCommand("lesson.previous");
|
||||
};
|
||||
|
||||
_nextNavButton.Pressed += () =>
|
||||
{
|
||||
// Adept.LessonHandler.LoadNextPage();
|
||||
COGWHEEL.RunCommand("lesson.next");
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
1
ADEPT-Godot/Client/Scripts/UI/ClientMain.cs.uid
Normal file
1
ADEPT-Godot/Client/Scripts/UI/ClientMain.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dta0h5g01sooo
|
||||
Reference in New Issue
Block a user