Skip to content

Commit

Permalink
0.3.7.802
Browse files Browse the repository at this point in the history
  • Loading branch information
gleblebedev committed May 3, 2024
1 parent 90a128c commit f34ab26
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 83 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.800",
"version": "0.3.7.802",
"commands": [
"rbfx"
]
Expand Down
3 changes: 3 additions & 0 deletions Content/Common/Data/UI/MainMenu.rml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<input type="button" class="blue-button" style="display: block" data-event-click="NewGame">
New game
</input>
<input type="button" class="blue-button" style="display: block" data-event-click="Settings">
Settings
</input>
<input type="button" class="blue-button" style="display: block" data-event-click="Exit">
Exit
</input>
Expand Down
3 changes: 3 additions & 0 deletions Content/Common/Data/UI/PrivacyPolicy.rml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<input type="button" class="blue-button" style="display: block" data-event-click="Accept">
Accept
</input>
<input type="button" class="orange-button" style="display: block" data-event-click="Reject">
Reject
</input>
</div>
</body>

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.800</Urho3DNetVersion>
<Urho3DNetVersion>0.3.7.802</Urho3DNetVersion>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions RbfxTemplate/AcceptPrivacyPolicyState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public override void OnDataModelInitialized(GameRmlUIComponent component)
{
component.BindDataModelEvent("PrivacyPolicy", OnPrivacyPolicy);
component.BindDataModelEvent("Accept", OnAccept);
component.BindDataModelEvent("Reject", OnReject);
}

public void OnPrivacyPolicy(VariantList variantList)
Expand All @@ -39,6 +40,11 @@ public void OnAccept(VariantList variantList)
Application.AcceptPrivacyPolicy();
}

public void OnReject(VariantList variantList)
{
Application.RejectPrivacyPolicy();
}

public void OnContinue(VariantList variantList)
{
Application.ContinueGame();
Expand Down
8 changes: 7 additions & 1 deletion RbfxTemplate/GameSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Urho3DNet;
using System;
using Urho3DNet;

namespace RbfxTemplate
{
Expand Down Expand Up @@ -30,6 +31,11 @@ public class GameSettings
/// </summary>
public float EffectVolume { get; set; } = 1.0f;

/// <summary>
/// Time when privacy policy was accepted or null if it wasn't.
/// </summary>
public bool? PrivacyPolicyAccepted { get; set; }

/// <summary>
/// Apply settings to the application global settings.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions RbfxTemplate/MainMenuState.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime;
using System.Runtime.InteropServices;
using Urho3DNet;

Expand Down Expand Up @@ -31,6 +32,7 @@ public override void OnDataModelInitialized(GameRmlUIComponent component)
component.BindDataModelProperty("game_title", _ => _.Set("Awesome game"), _ => { });
component.BindDataModelEvent("Continue", OnContinue);
component.BindDataModelEvent("NewGame", OnNewGame);
component.BindDataModelEvent("Settings", OnSettings);
component.BindDataModelEvent("Exit", OnExit);
component.BindDataModelEvent("Discord", OnDiscord);
}
Expand All @@ -40,6 +42,11 @@ public void OnNewGame(VariantList variantList)
Application.ToNewGame();
}

public void OnSettings(VariantList variantList)
{
Application.ToSettings();
}

public void OnExit(VariantList variantList)
{
Application.Quit();
Expand Down
7 changes: 3 additions & 4 deletions RbfxTemplate/RmlUIStateBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public abstract class RmlUIStateBase : ApplicationState, INotifyPropertyChanged
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;


/// <summary>
/// Construct RmlUIStateBase.
/// </summary>
Expand Down Expand Up @@ -56,7 +55,7 @@ public RmlUIStateBase(UrhoPluginApplication app, string rmlResource) : base(app.
public abstract void OnDataModelInitialized(GameRmlUIComponent component);

/// <summary>
/// Game state activation handler.
/// Game state activation handler.
/// </summary>
/// <param name="bundle">Game state parameters.</param>
public override void Activate(StringVariantMap bundle)
Expand All @@ -68,7 +67,7 @@ public override void Activate(StringVariantMap bundle)
}

/// <summary>
/// Game state deactivation handler.
/// Game state deactivation handler.
/// </summary>
public override void Deactivate()
{
Expand All @@ -78,7 +77,7 @@ public override void Deactivate()
}

/// <summary>
/// Key up handler to navigate back in the game state hierarchy.
/// Key up handler to navigate back in the game state hierarchy.
/// </summary>
/// <param name="args"></param>
private void HandleKeyUp(VariantMap args)
Expand Down
7 changes: 3 additions & 4 deletions RbfxTemplate/SettingsMenuState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public override void OnDataModelInitialized(GameRmlUIComponent menuComponent)
val => Settings.MusicVolume = val.Float);
menuComponent.BindDataModelProperty("effects", val => val.Set(Settings.EffectVolume),
val => Settings.EffectVolume = val.Float);
//menuComponent.BindDataModelProperty("shadows", val => val.Set(_shadowsQuality), (val) => _shadowsQuality = val.Convert(VariantType.VarInt).Int);
}

public override void Activate(StringVariantMap bundle)
Expand All @@ -40,15 +39,15 @@ public override void Deactivate()

private void OnCancel(VariantList obj)
{
Application.HandleBackKey();
Application.ResetSettings();

//Application.Settings = GameSettings.Load(Context);
Application.HandleBackKey();
}

private void OnApply(VariantList obj)
{
Settings.Apply(Context);
//Settings.Save(Context);
Application.SaveSettings();

Application.HandleBackKey();
}
Expand Down
5 changes: 5 additions & 0 deletions RbfxTemplate/StateStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public StateStack(StateManager stateManager)
/// </summary>
public ApplicationState State => _stack.Count > 0 ? _stack.Peek() : null;

/// <summary>
/// Number of states in the stack.
/// </summary>
public int Count => _stack.Count;

/// <summary>
/// Push state to the stack and make it current.
/// </summary>
Expand Down
Loading

0 comments on commit f34ab26

Please sign in to comment.