-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a loading popup while generating paramDB
- Loading branch information
1 parent
4bc3a87
commit e273262
Showing
4 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Fushigi.param; | ||
using ImGuiNET; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Numerics; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Fushigi.ui.widgets | ||
{ | ||
class ParamDBDialog | ||
{ | ||
static Task? mLoadParamDB; | ||
|
||
public static void Draw(ref bool shouldDraw) | ||
{ | ||
mLoadParamDB ??= ParamDB.sIsInit ? Task.Run(ParamDB.Reload) : Task.Run(ParamDB.Load); | ||
|
||
if (mLoadParamDB.IsCompleted) | ||
{ | ||
shouldDraw = false; | ||
mLoadParamDB = null; | ||
return; | ||
} | ||
|
||
Vector2 center = ImGui.GetMainViewport().GetCenter(); | ||
ImGui.SetNextWindowPos(center, ImGuiCond.Appearing, new Vector2(0.5f, 0.5f)); | ||
|
||
ImGui.OpenPopup("ParamDB"); | ||
|
||
if (ImGui.BeginPopupModal("ParamDB", ref shouldDraw, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoDecoration)) | ||
{ | ||
ImGui.Text("Generating ParamDB..."); | ||
// TODO: replace this progress bar with an animated loading bar | ||
ImGui.ProgressBar(0.33f, new Vector2(0, 0), "Loading..."); | ||
|
||
ImGui.EndPopup(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters