A lot of work, beginning client UI, adding lesson and page handling, etc
This commit is contained in:
parent
119609f38c
commit
4d0e64ed87
@ -1,5 +1,6 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACOGWHEEL_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb946d2ce7ffb4216bc1b230d32963b475600_003F51_003Fe7e8cc77_003FCOGWHEEL_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACOGWHEEL_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd3166b6b3b7c4a20a04fe7048e9bb1e65600_003F5b_003F6031ed07_003FCOGWHEEL_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACommandsManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb946d2ce7ffb4216bc1b230d32963b475600_003F53_003Fe083e0a5_003FCommandsManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="/home/chris/.nuget/packages/cogwheellib/1.3.0/lib/net9.0/CogwheelLib.dll" />
|
||||
|
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
|
@ -1,9 +1,32 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://udmowtmx1o3l"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://udmowtmx1o3l"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dnmj6a1ptvwry" path="res://Core/Scripts/Main.cs" id="1_0ovck"]
|
||||
[ext_resource type="PackedScene" uid="uid://c35ohffpqfqnr" path="res://Client/Scenes/MainCanvas.tscn" id="2_0ovck"]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0ovck"]
|
||||
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_r0sft"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_0ovck")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_h3byd"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_r0sft")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[node name="Main" type="Node3D"]
|
||||
script = ExtResource("1_0ovck")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_h3byd")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.21642)
|
||||
|
||||
[node name="MainCanvas" parent="." instance=ExtResource("2_0ovck")]
|
||||
|
@ -1,17 +1,16 @@
|
||||
using System.Reflection;
|
||||
using ADEPT.Core.Cogwheel;
|
||||
using Cogwheel;
|
||||
using Godot;
|
||||
using ADEPT.Core.Lesson;
|
||||
|
||||
namespace ADEPT.Core;
|
||||
|
||||
public static class ADEPT
|
||||
public static class Adept
|
||||
{
|
||||
public static Main MainNode { get; private set; }
|
||||
public static LessonHandler LessonHandler { get; private set; }
|
||||
|
||||
public static void Initialize(Main mainNode)
|
||||
public static void Initialize(Main mainNode, LessonHandler lessonHandler)
|
||||
{
|
||||
MainNode = mainNode;
|
||||
LessonHandler = lessonHandler;
|
||||
}
|
||||
|
||||
public static class Constants
|
@ -102,6 +102,11 @@ public partial class GodotCogwheelConsole : Control, ICogwheelConsole
|
||||
_output.Text += $"> {command}\n";
|
||||
_commandsManager.RunCommand(command);
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("debug"))
|
||||
{
|
||||
ToggleConsole();
|
||||
}
|
||||
}
|
||||
|
||||
private Godot.Collections.Dictionary BuildKeywords()
|
||||
@ -115,4 +120,9 @@ public partial class GodotCogwheelConsole : Control, ICogwheelConsole
|
||||
return keywords;
|
||||
}
|
||||
|
||||
private void ToggleConsole()
|
||||
{
|
||||
Visible = !Visible;
|
||||
}
|
||||
|
||||
}
|
7
ADEPT-Godot/Core/Scripts/Interfaces/IPageComponent.cs
Normal file
7
ADEPT-Godot/Core/Scripts/Interfaces/IPageComponent.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace ADEPT.Core.Interfaces;
|
||||
|
||||
public interface IPageComponent
|
||||
{
|
||||
public void Initialize();
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
uid://bre7ys55gndei
|
@ -1,6 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public interface ILesson
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IPage> Pages { get; set; }
|
||||
public object LessonStateMachine { get; set; } // TODO: Implement an ILessonStateMachine
|
||||
|
||||
|
||||
public void StartLesson();
|
||||
public void EndLesson();
|
||||
public void AddPage(IPage page);
|
||||
public void RemovePage(IPage page);
|
||||
}
|
@ -1,7 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public interface ILessonHandler
|
||||
{
|
||||
public ILesson loadLesson(string lessonName);
|
||||
public void saveLesson(ILesson lesson, string lessonName);
|
||||
|
||||
public event EventHandler LessonLoaded;
|
||||
public event EventHandler PageChanged;
|
||||
|
||||
public ILesson CurrentLesson { get; }
|
||||
public IPage CurrentPage { get; }
|
||||
|
||||
public void LoadLesson(string lessonName);
|
||||
public void SaveLesson(ILesson lesson, string lessonName);
|
||||
|
||||
public void LoadNextPage();
|
||||
public void LoadPreviousPage();
|
||||
public void LoadPageToIndex(int index);
|
||||
}
|
@ -1,6 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public interface IPage
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public ILesson Lesson { get; }
|
||||
public PageContext PageContext { get; set; }
|
||||
public List<IPageComponent> Components { get; set; }
|
||||
|
||||
public void Start();
|
||||
public void End();
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public class Lesson : ILesson
|
||||
{
|
||||
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IPage> Pages { get; set; }
|
||||
public object LessonStateMachine { get; set; }
|
||||
public void StartLesson()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void EndLesson()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddPage(IPage page)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void RemovePage(IPage page)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
@ -1,18 +1,104 @@
|
||||
using System;
|
||||
using Cogwheel;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public class LessonHandler : ILessonHandler
|
||||
{
|
||||
public ILesson loadLesson(string lessonName)
|
||||
public event EventHandler LessonLoaded;
|
||||
public event EventHandler PageChanged;
|
||||
|
||||
public ILesson CurrentLesson { get; private set; }
|
||||
public IPage CurrentPage { get; private set; }
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
var path = $"{ADEPT.Constants.DefaultLessonPath}{lessonName}{ADEPT.Constants.DefaultLessonFileExtension}";
|
||||
COGWHEEL.RegisterObject(this);
|
||||
}
|
||||
|
||||
[Command(Name = "lesson.load", Description = "Load a lesson.")]
|
||||
public void LoadLesson(string lessonName)
|
||||
{
|
||||
var path = $"{Adept.Constants.DefaultLessonPath}{lessonName}{Adept.Constants.DefaultLessonFileExtension}";
|
||||
|
||||
COGWHEEL.Log($"[ADEPT] Attempting to load lesson '{lessonName}' at '{path}'");
|
||||
|
||||
// Lesson lesson = null;
|
||||
//
|
||||
// CurrentLesson = lesson;
|
||||
// CurrentPage = CurrentLesson.Pages.ToArray()[0];
|
||||
//
|
||||
// LessonLoaded?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
[Command(Name = "lesson.createtest", Description = "Create a test lesson.")]
|
||||
private void CreateTestLesson()
|
||||
{
|
||||
COGWHEEL.Log($"[ADEPT] Creating a Test Lesson");
|
||||
var lesson = new Lesson()
|
||||
{
|
||||
Title = "Test Lesson",
|
||||
Description = "This is a test lesson.",
|
||||
Pages = new()
|
||||
{
|
||||
new Page() { Title = "Test Page 1", Description = "A test page.", PageContext = PageContext.TwoD},
|
||||
new Page() { Title = "Test Page 2", Description = "A test page #2.", PageContext = PageContext.ThreeD},
|
||||
new Page() { Title = "Test Page 3", Description = "A test page #3.", PageContext = PageContext.TwoD},
|
||||
new Page() { Title = "Test Page 4", Description = "A test page #4.", PageContext = PageContext.ThreeD},
|
||||
new Page() { Title = "Test Page 5", Description = "A test page #5.", PageContext = PageContext.TwoD},
|
||||
}
|
||||
};
|
||||
|
||||
CurrentLesson = lesson;
|
||||
CurrentPage = CurrentLesson.Pages.ToArray()[0];
|
||||
|
||||
LessonLoaded?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void SaveLesson(ILesson lesson, string lessonName)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void saveLesson(ILesson lesson, string lessonName)
|
||||
[Command(Name = "lesson.next", Description = "Load the next page in the current lesson.")]
|
||||
public void LoadNextPage()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
var nextIndex = CurrentLesson.Pages.IndexOf(CurrentPage) + 1;
|
||||
if (nextIndex >= CurrentLesson.Pages.Count)
|
||||
{
|
||||
COGWHEEL.LogWarning("[LESSONHANDLER] Cannot load next page. No more pages in lesson.");
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentPage = CurrentLesson.Pages.ToArray()[nextIndex];
|
||||
PageChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
[Command(Name = "lesson.previous", Description = "Load the previous page in the current lesson.")]
|
||||
public void LoadPreviousPage()
|
||||
{
|
||||
var prevIndex = CurrentLesson.Pages.IndexOf(CurrentPage) - 1;
|
||||
if (prevIndex < 0)
|
||||
{
|
||||
COGWHEEL.LogWarning("[LESSONHANDLER] Cannot load previous page. No more pages in lesson.");
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentPage = CurrentLesson.Pages.ToArray()[prevIndex];
|
||||
PageChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
[Command(Name = "lesson.gotopage", Description = "Load a specific page in the current lesson.")]
|
||||
public void LoadPageToIndex(int index)
|
||||
{
|
||||
if (index >= CurrentLesson.Pages.Count || index < 0)
|
||||
{
|
||||
COGWHEEL.LogWarning("[LESSONHANDLER] Cannot load page. No such page in lesson.");
|
||||
return;
|
||||
}
|
||||
|
||||
COGWHEEL.Log("[LESSONHANDLER] Loading Page at index " + index);
|
||||
CurrentPage = CurrentLesson.Pages.ToArray()[index];
|
||||
PageChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
@ -1,6 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public class Page : IPage
|
||||
{
|
||||
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public ILesson Lesson { get; }
|
||||
public PageContext PageContext { get; set; }
|
||||
public List<IPageComponent> Components { get; set; }
|
||||
public void Start()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void End()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
7
ADEPT-Godot/Core/Scripts/Lesson/PageContext.cs
Normal file
7
ADEPT-Godot/Core/Scripts/Lesson/PageContext.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace ADEPT.Core.Lesson;
|
||||
|
||||
public enum PageContext
|
||||
{
|
||||
TwoD,
|
||||
ThreeD,
|
||||
}
|
1
ADEPT-Godot/Core/Scripts/Lesson/PageContext.cs.uid
Normal file
1
ADEPT-Godot/Core/Scripts/Lesson/PageContext.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://b2qkm2ug5c116
|
@ -2,6 +2,7 @@ using System.Reflection;
|
||||
using Godot;
|
||||
using ADEPT.Core;
|
||||
using ADEPT.Core.Cogwheel;
|
||||
using ADEPT.Core.Lesson;
|
||||
using Cogwheel;
|
||||
|
||||
|
||||
@ -11,6 +12,7 @@ public partial class Main : Node
|
||||
{
|
||||
private static CommandsManager _commandsManager;
|
||||
private static GodotCogwheelConsole _cogwheelConsole;
|
||||
private static LessonHandler _lessonHandler;
|
||||
|
||||
public CanvasLayer MainCanvas { get; private set; }
|
||||
|
||||
@ -18,7 +20,6 @@ public partial class Main : Node
|
||||
{
|
||||
MainCanvas = GetNode<CanvasLayer>("MainCanvas");
|
||||
|
||||
ADEPT.Initialize(this);
|
||||
|
||||
_commandsManager = new CommandsManager();
|
||||
_cogwheelConsole = MainCanvas.GetNode<GodotCogwheelConsole>("CogwheelConsole");
|
||||
@ -29,16 +30,13 @@ public partial class Main : Node
|
||||
|
||||
COGWHEEL.Initialize(_commandsManager, _cogwheelConsole);
|
||||
COGWHEEL.RegisterObject(this);
|
||||
|
||||
_lessonHandler = new LessonHandler();
|
||||
_lessonHandler.Initialize();
|
||||
Adept.Initialize(this, _lessonHandler);
|
||||
|
||||
_cogwheelConsole.LogInfo("COGWHEEL " + " initialized.");
|
||||
_cogwheelConsole.LogInfo("ADEPT " + ADEPT.Constants.Version + " initialized.");
|
||||
_cogwheelConsole.LogInfo("ADEPT " + Adept.Constants.Version + " initialized.");
|
||||
_cogwheelConsole.LogInfo("Type 'list' for a list of commands.");
|
||||
|
||||
}
|
||||
|
||||
[Command(Name = "test", Description = "Test command.")]
|
||||
private void Test()
|
||||
{
|
||||
COGWHEEL.LogWarning("Testing!\nTesting!\nTesting!");
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
namespace ADEPT.Core;
|
||||
|
||||
public partial class MainNode : Node
|
||||
{
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
uid://bl2h8ot302x3g
|
@ -29,3 +29,8 @@ Enter={
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194310,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
debug={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":96,"key_label":0,"unicode":96,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user