Skip to content

Commit

Permalink
Support mandatory releases
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirKhil committed Mar 6, 2024
1 parent 190f978 commit 20bb157
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Authors>Vladimir Khil</Authors>
<Company>Khil-soft</Company>
<SIGameVersion>7.11.10</SIGameVersion>
<SIGameVersion>7.11.11</SIGameVersion>
<SIQuesterVersion>6.0.2</SIQuesterVersion>
<SImulatorVersion>2.15.0</SImulatorVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/SIUI.ViewModel/TableInfoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public double Volume
get => _volume;
set
{
if (_volume != value)
if (_volume != value && _volume >= 0.0 && _volume <= 1.0)
{
var oldValue = _volume;
_volume = value;
Expand Down
6 changes: 3 additions & 3 deletions src/Common/SIUI/Behaviors/MediaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static MediaController()

public static void UpdateVolume(double factor)
{
Volume *= factor;
Volume = Math.Min(1.0, Math.Max(0.0, Volume * factor));
_ = waveOutSetVolume(IntPtr.Zero, (uint)(0xFFFF * 2 * Volume));
}

Expand Down Expand Up @@ -125,9 +125,9 @@ void resumeHandler()
mediaElement.Dispatcher.BeginInvoke(mediaElement.Play);
}

void volumeChangedHandler(double volume)
void volumeChangedHandler(double factor)
{
mediaElement.Volume *= volume;
mediaElement.Volume = Math.Min(1.0, Math.Max(0.0, mediaElement.Volume * factor));
}

tableInfo.MediaSeek += seekHandler;
Expand Down
7 changes: 6 additions & 1 deletion src/SICore/SICore/Clients/IConnector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace SICore;

namespace SICore;

public interface IConnector
{
Expand All @@ -12,11 +13,15 @@ public interface IConnector

int GameId { get; }

Uri? HostUri { get; }

Task<bool> ReconnectToServer();

Task RejoinGame();

void SetHost(IViewerClient newHost);

void SetGameID(int gameID);

void SetHostUri(Uri? hostUri);
}
1 change: 1 addition & 0 deletions src/SICore/SICore/Clients/Viewer/Viewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2127,6 +2127,7 @@ await _client.Node.ConnectionsLock.WithLockAsync(() =>
UpdateDeleteTableCommand();

SendPicture();
_viewerActions.SendMessage(Messages.Moveable);
}

private void UpdateDeleteTableCommand()
Expand Down
5 changes: 5 additions & 0 deletions src/SICore/SICore/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ public static class Messages
/// </summary>
public const string Move = "MOVE";

/// <summary>
/// Denotes that the person could be moved during the game.
/// </summary>
public const string Moveable = "MOVEABLE";

/// <summary>
/// Выбрать следующего игрока
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/SIGame/SIGame.ViewModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public bool MainMenuSound
private double _volume = 25;

/// <summary>
/// Громкость звука
/// Sound volume level.
/// </summary>
public double Volume
{
Expand Down
4 changes: 3 additions & 1 deletion src/SIGame/SIGame.ViewModel/ViewModel/GameViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ private async void PrintOnlineInformation()

try
{
Host.AddLog($"{Resources.OnlineGameAddress}: {CommonSettings.NewOnlineGameUrl}{Host.Connector?.GameId}&invite=true");
var hostUri = Host.Connector?.HostUri;
var hostInfo = hostUri != null ? "&host=" + Uri.EscapeDataString(hostUri.ToString()) : "";
Host.AddLog($"{Resources.OnlineGameAddress}: {CommonSettings.NewOnlineGameUrl}{Host.Connector?.GameId}{hostInfo}&invite=true");
}
catch (Exception exc)
{
Expand Down
4 changes: 4 additions & 0 deletions src/SIGame/SIGame.ViewModel/ViewModel/ReconnectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ internal sealed class ReconnectManager : IConnector

public int GameId { get; set; } = -1;

public Uri? HostUri { get; set; }

public ReconnectManager(
SecondaryNode server,
Client client,
Expand Down Expand Up @@ -147,4 +149,6 @@ private async Task JoinGameAsync()
}

public void SetHost(IViewerClient newHost) => _host = newHost;

public void SetHostUri(Uri? hostUri) => HostUri = hostUri;
}
1 change: 1 addition & 0 deletions src/SIGame/SIGame.ViewModel/ViewModel/SIOnlineViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ public override async Task JoinGameCoreAsync(
}

_host.Connector.SetGameID(gameInfo.GameID);
_host.Connector.SetHostUri(gameInfo.HostUri);
}
catch (TaskCanceledException exc)
{
Expand Down
13 changes: 10 additions & 3 deletions src/SIGame/SIGame/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,17 @@ private void SearchForUpdatesFinished(AppInstallerReleaseInfoResponse updateInfo
{
var updateUri = updateInfo.Installer?.Uri!;

var mainViewModel = (MainViewModel)MainWindow.DataContext;
if (updateInfo.Release != null && updateInfo.Release.IsMandatory)
{
Update_Executed(updateUri);
}
else
{
var mainViewModel = (MainViewModel)MainWindow.DataContext;

mainViewModel.StartMenu.UpdateVersion = updateInfo.Release?.Version!;
mainViewModel.StartMenu.Update = new CustomCommand(obj => Update_Executed(updateUri));
mainViewModel.StartMenu.UpdateVersion = updateInfo.Release?.Version!;
mainViewModel.StartMenu.Update = new CustomCommand(obj => Update_Executed(updateUri));
}
}

private bool _isUpdating = false;
Expand Down
2 changes: 1 addition & 1 deletion src/SIGame/SIGame/SIGame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.0" />
<PackageReference Include="VKhil.AppRegistry.Client" Version="1.0.1" />
<PackageReference Include="VKhil.AppRegistry.Client" Version="1.0.4" />
</ItemGroup>
<ItemGroup>
<Resource Include="Fonts\Jost-Bold.ttf" />
Expand Down
2 changes: 1 addition & 1 deletion test/Common/Notions.Tests/Notions.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion test/Common/SIEngine.Core.Tests/SIEngine.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion test/Common/SIEngine.Tests/SIEngine.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion test/Common/SIPackages.Tests/SIPackages.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 20bb157

Please sign in to comment.