Skip to content

Commit

Permalink
0.3.7.750
Browse files Browse the repository at this point in the history
  • Loading branch information
gleblebedev committed Jan 29, 2024
1 parent ffd746c commit 442f5ce
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"unofficial.Urho3DNet.Editor": {
"version": "0.3.7.748",
"version": "0.3.7.750",
"commands": [
"rbfx"
]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Urho3DNetVersion>0.3.7.748</Urho3DNetVersion>
<Urho3DNetVersion>0.3.7.750</Urho3DNetVersion>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions RbfxTemplate.UWP/RbfxTemplate.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
Expand Down Expand Up @@ -107,7 +107,7 @@
<Pack>true</Pack>
<PackagePath>Data/%(RecursiveDir)%(FileName)%(Extension)</PackagePath>
</Content>
<Content Remove="**/*.user.json"/>
<Content Remove="**/*.user.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
Expand Down
31 changes: 1 addition & 30 deletions RbfxTemplate/MainMenuState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
24 changes: 13 additions & 11 deletions RbfxTemplate/RmlUIStateBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace RbfxTemplate
public abstract class RmlUIStateBase : ApplicationState
{
private readonly SharedPtr<Scene> _scene;
private readonly GameRmlUIComponent _uiComponent;

/// <summary>
/// Construct RmlUIStateBase.
Expand All @@ -21,20 +22,21 @@ public RmlUIStateBase(UrhoPluginApplication app, string rmlResource) : base(app.
Application = app;

_scene = Context.CreateObject<Scene>();
RmlUiComponent = _scene.Ptr.CreateComponent<GameRmlUIComponent>();
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);
}

/// <summary>
/// RmlUI Component for the game state.
/// RmlUI Component for the game state.
/// </summary>
public GameRmlUIComponent RmlUiComponent { get; }
public GameRmlUIComponent RmlUiComponent => _uiComponent;

/// <summary>
/// Application instance.
/// Application instance.
/// </summary>
public UrhoPluginApplication Application { get; }

Expand All @@ -50,8 +52,8 @@ public RmlUIStateBase(UrhoPluginApplication app, string rmlResource) : base(app.
/// <param name="bundle">Game state parameters.</param>
public override void Activate(StringVariantMap bundle)
{
RmlUiComponent.IsEnabled = true;
RmlUiComponent.UpdateProperties();
_uiComponent.IsEnabled = true;
_uiComponent.UpdateProperties();
SubscribeToEvent(E.KeyUp, HandleKeyUp);
base.Activate(bundle);
}
Expand All @@ -61,7 +63,7 @@ public override void Activate(StringVariantMap bundle)
/// </summary>
public override void Deactivate()
{
RmlUiComponent.IsEnabled = false;
_uiComponent.IsEnabled = false;
UnsubscribeFromEvent(E.KeyUp);
base.Deactivate();
}
Expand Down

0 comments on commit 442f5ce

Please sign in to comment.