Skip to content

Commit 162e668

Browse files
committed
Merge branch 'S1P4_Develop' into main
2 parents 44ff91d + 289a1cd commit 162e668

38 files changed

+268
-68
lines changed

Lessons/1/User/Diagram.sfc

-1.01 KB
Binary file not shown.

Lessons/2/User/Diagram.sfc

-706 Bytes
Binary file not shown.

Lessons/2/User/Flicker.sfc

639 Bytes
Binary file not shown.

Lessons/3/User/Diagram.sfc

-1.17 KB
Binary file not shown.

data/core/lesson/LessonEntity.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class LessonEntity
1414
public const string DescriptionFilePath = "/Description.json";
1515
public const string UserResultDirectory = "/User";
1616
public const string UserResultFilePath = UserResultDirectory + "/Results.json";
17-
public const string UserDiagramDirectory = UserResultDirectory + "/Diagram.sfc";
17+
public const string TemporaryDiagram = UserResultDirectory + "/Temp.sfc";
1818

1919
/// <summary>
2020
/// The lesson title as a BBCode.
@@ -37,9 +37,15 @@ public class LessonEntity
3737
public string FolderPath { get; private set; }
3838

3939
/// <summary>
40-
/// The complete path where the sfc file is stored for this lesson.
40+
/// The complete path where the temporary sfc file is stored for this lesson.
41+
/// Used for test / scene communication and immediate saves.
4142
/// </summary>
42-
public string DiagramFilePath { get { return FolderPath + UserDiagramDirectory; } }
43+
public string TemporaryDiagramFilePath { get { return FolderPath + TemporaryDiagram; } }
44+
45+
/// <summary>
46+
/// The complete path where the custom sfc file is stored for this lesson.
47+
/// </summary>
48+
public string CustomDiagramFilePath { get; set; }
4349

4450
/// <summary>
4551
/// The data path of the simulation.

data/diagram_models/sfc/editor/2d_editor/Sfc2dEditorControl.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ public void LoadDiagramOrDefault(string filepath)
6060
{
6161
if (!System.IO.File.Exists(filepath))
6262
{
63-
PatchEntity entity = new PatchEntity(1, 0)
63+
if (Data.SfcEntity.Lookup(1, 0) == null)
6464
{
65-
SfcStepType = StepType.StartingStep
66-
};
67-
Data.SfcEntity.AddPatch(entity);
65+
PatchEntity entity = new PatchEntity(1, 0)
66+
{
67+
SfcStepType = StepType.StartingStep
68+
};
69+
Data.SfcEntity.AddPatch(entity);
70+
}
6871
}
6972
else
7073
{
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Godot;
2+
3+
4+
namespace Osls.SfcEditor
5+
{
6+
public class EditorControls : Control
7+
{
8+
#region ==================== Fields / Properties ====================
9+
[Export] private NodePath SfcEditorNodePath = "../..";
10+
public SfcEditorNode SfcEditorNode { get { return GetNode<SfcEditorNode>(SfcEditorNodePath); } }
11+
#endregion
12+
}
13+
}

data/diagram_models/sfc/editor/Controls/EditorLoad.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ public override void _Ready()
1313

1414
public void OnButtonPressed()
1515
{
16-
GetNode<SfcEditorNode>("../../..").TryLoadDiagram();
17-
}
18-
19-
public override void _UnhandledKeyInput(InputEventKey @event)
20-
{
21-
if (@event.IsActionPressed("main_load"))
22-
{
23-
GetNode<SfcEditorNode>("../../..").TryLoadDiagram();
24-
}
16+
GetNode<FileDialog>("../FileDialog").LoadFile();
2517
}
2618
#endregion
2719
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Godot;
2+
3+
4+
namespace Osls.SfcEditor
5+
{
6+
public class EditorReload : Button
7+
{
8+
#region ==================== Public Methods ====================
9+
public override void _Ready()
10+
{
11+
Connect("pressed", this, nameof(OnButtonPressed));
12+
}
13+
14+
public void OnButtonPressed()
15+
{
16+
GetNode<SfcEditorNode>("../../..").TryLoadDiagram();
17+
}
18+
19+
public override void _UnhandledKeyInput(InputEventKey @event)
20+
{
21+
if (@event.IsActionPressed("main_load"))
22+
{
23+
GetNode<SfcEditorNode>("../../..").TryLoadDiagram();
24+
}
25+
}
26+
#endregion
27+
}
28+
}

data/diagram_models/sfc/editor/Controls/EditorToggleSfs.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)