mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2026-08-15 02:57:49 +04:00
add config file
This commit is contained in:
@@ -26,6 +26,7 @@ public class App
|
||||
public ImFontPtr OpenSansFont;
|
||||
|
||||
private List<IImGuiPanel> _imGuiPanels = [];
|
||||
private Later _later = new();
|
||||
|
||||
public App()
|
||||
{
|
||||
@@ -40,6 +41,9 @@ public class App
|
||||
|
||||
IServiceCollection serviceCollection = new ServiceCollection();
|
||||
|
||||
serviceCollection.AddSingleton<ILater>(_later);
|
||||
serviceCollection.AddSingleton<IConfigProvider>(new ConfigProvider(new ConfigJson()));
|
||||
|
||||
foreach (var type in Utils.GetAssignableTypes<IService>())
|
||||
{
|
||||
serviceCollection.AddSingleton(type);
|
||||
@@ -50,6 +54,11 @@ public class App
|
||||
serviceCollection.AddSingleton(type);
|
||||
}
|
||||
|
||||
foreach (var type in Utils.GetAssignableTypes<ILaunchReceiver>())
|
||||
{
|
||||
serviceCollection.AddSingleton(type);
|
||||
}
|
||||
|
||||
serviceCollection.AddSingleton(openGl);
|
||||
serviceCollection.AddSingleton(window);
|
||||
|
||||
@@ -68,6 +77,12 @@ public class App
|
||||
_imGuiPanels = Utils.GetAssignableTypes<IImGuiPanel>()
|
||||
.Select(t => (serviceProvider.GetService(t) as IImGuiPanel)!)
|
||||
.ToList();
|
||||
|
||||
foreach (var type in Utils.GetAssignableTypes<ILaunchReceiver>())
|
||||
{
|
||||
var launchReceiver = serviceProvider.GetService(type) as ILaunchReceiver;
|
||||
launchReceiver?.OnLaunch();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnImGuiRender()
|
||||
@@ -123,6 +138,11 @@ public class App
|
||||
{
|
||||
imGuiPanel.OnImGuiRender();
|
||||
}
|
||||
|
||||
foreach (var action in _later.Enumerate())
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
||||
// ImGui.ShowMetricsWindow();
|
||||
// ImGui.ShowDemoWindow();
|
||||
|
||||
Reference in New Issue
Block a user