diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 597c92f..7ccc845 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -9,7 +9,7 @@
]
},
"unofficial.Urho3DNet.Editor": {
- "version": "0.3.7.748",
+ "version": "0.3.7.750",
"commands": [
"rbfx"
]
diff --git a/Directory.Build.props b/Directory.Build.props
index 6a43a44..39f5114 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,6 +1,6 @@
- 0.3.7.748
+ 0.3.7.750
\ No newline at end of file
diff --git a/RbfxTemplate.UWP/RbfxTemplate.UWP.csproj b/RbfxTemplate.UWP/RbfxTemplate.UWP.csproj
index 579f766..ca44746 100644
--- a/RbfxTemplate.UWP/RbfxTemplate.UWP.csproj
+++ b/RbfxTemplate.UWP/RbfxTemplate.UWP.csproj
@@ -70,7 +70,7 @@
false
prompt
true
- true
+ false
PackageReference
@@ -107,7 +107,7 @@
true
Data/%(RecursiveDir)%(FileName)%(Extension)
-
+
diff --git a/RbfxTemplate/MainMenuState.cs b/RbfxTemplate/MainMenuState.cs
index cf5c726..b68fd71 100644
--- a/RbfxTemplate/MainMenuState.cs
+++ b/RbfxTemplate/MainMenuState.cs
@@ -50,38 +50,9 @@ public void OnContinue(VariantList variantList)
Application.ContinueGame();
}
- private void OpenUrlInBrowser(string url)
- {
- // Open URL in default browser: https://stackoverflow.com/questions/4580263/how-to-open-in-default-browser-in-c-sharp
- try
- {
- Process.Start(url);
- }
- catch
- {
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- url = url.Replace("&", "^&");
- Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
- {
- Process.Start("xdg-open", url);
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- Process.Start("open", url);
- }
- else
- {
- throw;
- }
- }
- }
-
private void OnDiscord(VariantList obj)
{
- OpenUrlInBrowser("https://discord.gg/46aKYFQj7W");
+ Urho3D.OpenURL("https://discord.gg/46aKYFQj7W");
}
}
}
\ No newline at end of file
diff --git a/RbfxTemplate/RmlUIStateBase.cs b/RbfxTemplate/RmlUIStateBase.cs
index cf7077b..971110e 100644
--- a/RbfxTemplate/RmlUIStateBase.cs
+++ b/RbfxTemplate/RmlUIStateBase.cs
@@ -8,6 +8,7 @@ namespace RbfxTemplate
public abstract class RmlUIStateBase : ApplicationState
{
private readonly SharedPtr _scene;
+ private readonly GameRmlUIComponent _uiComponent;
///
/// Construct RmlUIStateBase.
@@ -21,20 +22,21 @@ public RmlUIStateBase(UrhoPluginApplication app, string rmlResource) : base(app.
Application = app;
_scene = Context.CreateObject();
- RmlUiComponent = _scene.Ptr.CreateComponent();
- RmlUiComponent.IsEnabled = false;
- RmlUiComponent.State = this;
- RmlUiComponent.SetResource(rmlResource);
- RmlUiComponent.IsEnabled = false;
+ _uiComponent = new GameRmlUIComponent(Context);
+ _uiComponent.IsEnabled = false;
+ _uiComponent.State = this;
+ _uiComponent.SetResource(rmlResource);
+ _uiComponent.IsEnabled = false;
+ _scene.Ptr.AddComponent(_uiComponent,0);
}
///
- /// RmlUI Component for the game state.
+ /// RmlUI Component for the game state.
///
- public GameRmlUIComponent RmlUiComponent { get; }
+ public GameRmlUIComponent RmlUiComponent => _uiComponent;
///
- /// Application instance.
+ /// Application instance.
///
public UrhoPluginApplication Application { get; }
@@ -50,8 +52,8 @@ public RmlUIStateBase(UrhoPluginApplication app, string rmlResource) : base(app.
/// Game state parameters.
public override void Activate(StringVariantMap bundle)
{
- RmlUiComponent.IsEnabled = true;
- RmlUiComponent.UpdateProperties();
+ _uiComponent.IsEnabled = true;
+ _uiComponent.UpdateProperties();
SubscribeToEvent(E.KeyUp, HandleKeyUp);
base.Activate(bundle);
}
@@ -61,7 +63,7 @@ public override void Activate(StringVariantMap bundle)
///
public override void Deactivate()
{
- RmlUiComponent.IsEnabled = false;
+ _uiComponent.IsEnabled = false;
UnsubscribeFromEvent(E.KeyUp);
base.Deactivate();
}