49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
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");
|
|
};
|
|
|
|
}
|
|
}
|