Skip to content

Commit

Permalink
remove mEditorState in favor of a more comprehensible Task based appr…
Browse files Browse the repository at this point in the history
…oach (async/await)
  • Loading branch information
jupahe64 committed Dec 5, 2023
1 parent 3b9367f commit 8e5cccb
Show file tree
Hide file tree
Showing 5 changed files with 431 additions and 498 deletions.
14 changes: 0 additions & 14 deletions Fushigi/ui/CourseAreaEditContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ public void DeleteActor(CourseActor actor)
batchAction.Commit($"{IconUtil.ICON_TRASH} Delete {actor.mPackName}");
}

public void DeleteSelectedActors()
{
var selectedActors = GetSelectedObjects<CourseActor>().ToList();

var batchAction = BeginBatchAction();

foreach (var actor in selectedActors)
{
DeleteActor(actor);
}

batchAction.Commit($"{IconUtil.ICON_TRASH} Delete selected");
}

public void AddActorToGroup(CourseGroup group, CourseActor actor)
{
Console.WriteLine($"Adding actor {actor.mPackName}[{actor.mHash}] to group [{group.mHash}].");
Expand Down
4 changes: 2 additions & 2 deletions Fushigi/ui/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void LoadFromSettings(GL gl)
if (latestCourse != null && ParamDB.sIsInit)
{
mCurrentCourseName = latestCourse;
mSelectedCourseScene = new(new(mCurrentCourseName), gl);
mSelectedCourseScene = new(new(mCurrentCourseName), gl, this);
mIsChoosingPreferences = false;
mIsWelcome = false;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ void DrawMainMenu(GL gl)
{
mCurrentCourseName = selectedCourse;
Console.WriteLine($"Selected course {mCurrentCourseName}!");
mSelectedCourseScene = new(new(mCurrentCourseName), gl);
mSelectedCourseScene = new(new(mCurrentCourseName), gl, this);
UserSettings.AppendRecentCourse(mCurrentCourseName);
}
}).ConfigureAwait(false); //fire and forget
Expand Down
5 changes: 3 additions & 2 deletions Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ void IViewportDrawable.Draw2D(CourseAreaEditContext ctx, LevelViewport viewport,
if (ImGui.IsMouseReleased(0))
OnMouseUp(ctx, viewport);

if (viewport.mEditorState == LevelViewport.EditorState.Selecting)
OnSelecting(ctx, viewport);
//TODO does it still need a condition like this?
//if (viewport.mEditorState == LevelViewport.EditorState.Selecting)
OnSelecting(ctx, viewport);

OnKeyDown(ctx, viewport);

Expand Down
Loading

0 comments on commit 8e5cccb

Please sign in to comment.