Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #37

Merged
merged 57 commits into from
Jul 13, 2024
Merged

Dev #37

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4d078d8
Update host URL in ResourceKeysDictionary
gamerviihub Jun 2, 2024
2dd54b8
Update submodule link Gml.Client
gamerviihub Jun 2, 2024
a07b44a
Merge pull request #26 from GamerVII-NET/dev-linux
GamerVII-NET Jun 2, 2024
74b5ff3
Replace submodule update with git clone in scripts
GamerVII-NET Jun 2, 2024
f7f2a10
Update submodule link Gml.Client
GamerVII-NET Jun 2, 2024
7bcc2ff
Update submodule link Gml.Client
GamerVII-NET Jun 2, 2024
883bce2
Update submodule link Gml.Client
GamerVII-NET Jun 2, 2024
8eb0dcc
Update system service, resources, and application UI
GamerVII-NET Jun 6, 2024
5400913
Update submodule link Gml.Client
GamerVII-NET Jun 6, 2024
f81fe07
Update submodule Gml.Client
GamerVII-NET Jun 6, 2024
2242c13
Add error tracking to AsyncStreamToImageLoader
GamerVII-NET Jun 6, 2024
e5df19f
Update host URL and clean up code
GamerVII-NET Jun 6, 2024
20a0333
Update submodule link Gml.Client
GamerVII-NET Jun 6, 2024
17f6ab7
Add error tracking to AsyncStreamToImageLoader
GamerVII-NET Jun 6, 2024
7958c64
Update host URL and clean up code
GamerVII-NET Jun 6, 2024
08c2c45
Update submodule link Gml.Client
GamerVII-NET Jun 6, 2024
00e8ee9
Update submodule link Gml.Client
GamerVII-NET Jun 6, 2024
19237dc
Merge remote-tracking branch 'origin/dev' into dev
GamerVII-NET Jun 6, 2024
57be648
Gif background functionality (#29)
l1sonnn Jun 6, 2024
a81428d
Refactor LoginPageViewModel and update AsyncStreamToImageLoader
GamerVII-NET Jun 7, 2024
3501902
Update submodule link Gml.Client
GamerVII-NET Jun 7, 2024
6a777d7
Update background component in MainWindow
GamerVII-NET Jun 9, 2024
a6b8668
Remove invalid character from document.svg
GamerVII-NET Jun 9, 2024
b63bd9c
Add 'launcher' project and comment out language combo box
GamerVII-NET Jun 9, 2024
0a01277
Update submodule Gml.Client
GamerVII-NET Jun 9, 2024
542d249
Update dor merge request
GamerVII-NET Jun 9, 2024
0e3367d
Update submodule Update submodule link Gml.Client
GamerVII-NET Jun 9, 2024
583c708
Switch host and update debugging settings
GamerVII-NET Jun 10, 2024
93ac738
Optimize system data loading process
GamerVII-NET Jun 10, 2024
9838796
Change execution context for MainWindow in debug mode
GamerVII-NET Jun 10, 2024
76d46a3
Disable window resizing and update pointer events handling
GamerVII-NET Jun 11, 2024
5ff625d
Update settings validation for window size
GamerVII-NET Jun 11, 2024
74eb8b8
Remove commented out code in MainWindow.axaml.cs
GamerVII-NET Jun 11, 2024
f0b0b91
Added default font
GamerVII-NET Jun 11, 2024
f30bec5
Update font styles and host URL
GamerVII-NET Jun 11, 2024
6c4a520
Update submodule link Gml.Client
GamerVII-NET Jun 11, 2024
4dabc51
Merge branch 'refs/heads/main' into dev
GamerVII-NET Jun 11, 2024
c73a739
Update submodule link Gml.Client
GamerVII-NET Jun 11, 2024
64961b2
Update submodule link Gml.Client
GamerVII-NET Jun 15, 2024
e212a41
Remove unnecessary whitespace in OverviewPageViewModel
GamerVII-NET Jun 16, 2024
572b95d
Update submodule link Gml.Client
GamerVII-NET Jun 16, 2024
da1a065
Add new game session management and enhance game profile features
GamerVII-NET Jun 20, 2024
f071cb0
Refactor code for skin rendering and noise string conversion
GamerVII-NET Jun 20, 2024
76e9cd3
Update ProfileUserControl design
GamerVII-NET Jun 30, 2024
e030bb1
Refactor client module for improved readability
GamerVII-NET Jun 30, 2024
e45bf00
Merge branch 'main' into dev
GamerVII-NET Jun 30, 2024
0fcc913
Add architecture check in splash screen initialization
GamerVII-NET Jul 2, 2024
173e21e
Update settings handling in OverviewPageViewModel
GamerVII-NET Jul 2, 2024
128b699
Merge branch 'main' into dev
GamerVII-NET Jul 2, 2024
88a6bfe
Enhance process restart commands for Linux and Windows
GamerVII-NET Jul 2, 2024
ef38571
Refactor method names and update host URL
GamerVII-NET Jul 5, 2024
46e06a1
Update client processing logic.
GamerVII-NET Jul 6, 2024
fad2696
Add online player component and Java not found error handler
GamerVII-NET Jul 13, 2024
b5cb9ab
Switch ProfileUserControl to ItemsControl and add Spacing
GamerVII-NET Jul 13, 2024
1977b19
Add URL redirect attached property
GamerVII-NET Jul 13, 2024
23cbe6a
Add additional button and group ProfilePageView buttons
GamerVII-NET Jul 13, 2024
5c6081e
Update submodule link Gml.Client
GamerVII-NET Jul 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Gml.Client
1 change: 1 addition & 0 deletions src/Gml.Launcher/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<StyleInclude Source="/Views/Components/ProfileUserControl.axaml" />
<StyleInclude Source="/Views/Components/ProfileInfoComponent.axaml" />
<StyleInclude Source="/Views/Components/ProgressBar.axaml" />
<StyleInclude Source="/Views/Components/OnlineComponent.axaml" />

<StyleInclude Source="Assets/Styles/Classes.axaml"/>

Expand Down
8 changes: 8 additions & 0 deletions src/Gml.Launcher/Assets/Images/users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class ResourceKeysDictionary
public const string CheckUpdates = "CheckUpdates";
public const string InstallingUpdates = "InstallingUpdates";
public const string FailedOs = "FailedOs";
public const string JavaNotFound = "JavaNotFound";
public const string Host = "{{HOST}}";
public const string FolderName = "{{FOLDER_NAME}}";
}
5 changes: 3 additions & 2 deletions src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public static class ResourceKeysDictionary
public const string CheckUpdates = "CheckUpdates";
public const string InstallingUpdates = "InstallingUpdates";
public const string FailedOs = "FailedOs";
public const string Host = "http://192.168.31.199:5000";
// public const string Host = "https://gmlb.recloud.tech";
public const string JavaNotFound = "JavaNotFound";
// public const string Host = "http://192.168.31.199:5000";
public const string Host = "https://gmlb.recloud.tech";
// public const string Host = "https://gmlb-test.recloud.tech";
public const string FolderName = "GamerVIILacunerhV2";
}
16 changes: 16 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,13 @@
<data name="FailedOs" xml:space="preserve">
<value>Failed to determine the operating system</value>
</data>
<data name="OnServers" xml:space="preserve">
<value>On servers</value>
</data>
<data name="PlayersShort" xml:space="preserve">
<value>pl.</value>
</data>
<data name="JavaNotFound" xml:space="preserve">
<value>Unable to detect a loaded Java for your operating system, please contact support or the project administrator.</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,13 @@
<data name="FailedOs" xml:space="preserve">
<value>Failed to determine the operating system</value>
</data>
<data name="OnServers" xml:space="preserve">
<value>On servers</value>
</data>
<data name="PlayersShort" xml:space="preserve">
<value>pl.</value>
</data>
<data name="JavaNotFound" xml:space="preserve">
<value>Unable to detect a loaded Java for your operating system, please contact support or the project administrator.</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,13 @@
<data name="FailedOs" xml:space="preserve">
<value>Не удалось определить операционную систему</value>
</data>
<data name="OnServers" xml:space="preserve">
<value>На серверах</value>
</data>
<data name="PlayersShort" xml:space="preserve">
<value>чел.</value>
</data>
<data name="JavaNotFound" xml:space="preserve">
<value>Не удалось обнаружить загруженную Java для Вашей операционной системы, обратитесь в поддержку или к администратору проекта</value>
</data>
</root>
32 changes: 32 additions & 0 deletions src/Gml.Launcher/Core/Converters/SumServersOnlineConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Avalonia.Data.Converters;
using Avalonia.Markup.Xaml;
using Gml.Web.Api.Dto.Servers;

namespace Gml.Launcher.Core.Converters;

public class SumServersOnlineConverter : MarkupExtension, IValueConverter
{
public override object ProvideValue(IServiceProvider serviceProvider) => this;

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is List<ServerReadDto> server)
{
return server
.Where(c => c.IsOnline)
.Sum(c => c.Online)?
.ToString() ?? "0";
}

return "0";
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return "0";
}
}
30 changes: 30 additions & 0 deletions src/Gml.Launcher/Core/Converters/UrlRedirectProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Diagnostics;
using Avalonia;
using Avalonia.Controls;

namespace Gml.Launcher.Core.Converters;

public class UrlRedirectProperty
{
public static readonly AttachedProperty<string> RedirectUrlProperty =
AvaloniaProperty.RegisterAttached<UrlRedirectProperty, Control, string>("RedirectUrl");

public static void SetRedirectUrl(Control obj, string value) => obj.SetValue(RedirectUrlProperty, value);
public static string GetRedirectUrl(Control obj) => obj.GetValue(RedirectUrlProperty);

public UrlRedirectProperty()
{
RedirectUrlProperty.Changed.AddClassHandler<Control>(OnSourceChanged);
}

private void OnSourceChanged(Control control, AvaloniaPropertyChangedEventArgs args)
{
var url = args.GetNewValue<string>();

Process.Start(new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
});
}
}
2 changes: 2 additions & 0 deletions src/Gml.Launcher/Models/SettingsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

public record SettingsInfo(int GameWidth, int GameHeight, bool FullScreen, bool IsDynamicRam, double RamValue, string? LanguageCode)
{
public static SettingsInfo Default
=> new SettingsInfo(900, 600, false, true, 0, "ru-RU");
}
24 changes: 14 additions & 10 deletions src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reactive.Concurrency;
Expand Down Expand Up @@ -130,7 +131,7 @@ await ExecuteFromNewThread(async () =>
{
try
{
var profileInfo = await PrepareLaunch();
var profileInfo = await GetProfileInfo();

if (profileInfo is { Data: not null })
{
Expand All @@ -147,6 +148,12 @@ await ExecuteFromNewThread(async () =>
ShowError(ResourceKeysDictionary.Error, ResourceKeysDictionary.ProfileNotConfigured);
}
}
catch (FileNotFoundException exception)
{
ShowError(ResourceKeysDictionary.Error, LocalizationService.GetString(ResourceKeysDictionary.JavaNotFound));

Console.WriteLine(exception);
}
catch (Exception exception)
{
ShowError(ResourceKeysDictionary.Error, string.Join(". ", exception.Message));
Expand Down Expand Up @@ -191,7 +198,7 @@ private async Task<Process> GenerateProcess(CancellationToken cancellationToken,
return process;
}

private async Task<ResponseMessage<ProfileReadInfoDto?>?> PrepareLaunch()
private async Task<ResponseMessage<ProfileReadInfoDto?>?> GetProfileInfo()
{
UpdateProgress(
LocalizationService.GetString(ResourceKeysDictionary.Updating),
Expand All @@ -200,23 +207,20 @@ private async Task<Process> GenerateProcess(CancellationToken cancellationToken,

await _gmlManager.UpdateDiscordRpcState($"{LocalizationService.GetString(ResourceKeysDictionary.PlayDRpcText)} \"{ListViewModel.SelectedProfile!.Name}\"");

var settings = await _storageService.GetAsync<SettingsInfo>(StorageConstants.Settings);

if (settings is null)
{
throw new Exception(LocalizationService.GetString(ResourceKeysDictionary.NotSetting));
}
var settings = await _storageService.GetAsync<SettingsInfo>(StorageConstants.Settings) ?? SettingsInfo.Default;

var localProfile = new ProfileCreateInfoDto
{
ProfileName = ListViewModel.SelectedProfile!.Name,
RamSize = Convert.ToInt32(settings.RamValue),
IsFullScreen = false,
IsFullScreen = settings.FullScreen,
OsType = ((int)_systemService.GetOsType()).ToString(),
OsArchitecture = Environment.Is64BitOperatingSystem ? "64" : "32",
UserAccessToken = User.AccessToken,
UserName = User.Name,
UserUuid = User.Uuid
UserUuid = User.Uuid,
WindowWidth = settings.GameWidth,
WindowHeight = settings.GameHeight
};

var profileInfo = await _gmlManager.GetProfileInfo(localProfile);
Expand Down
9 changes: 6 additions & 3 deletions src/Gml.Launcher/ViewModels/SplashScreenViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Avalonia.Controls.Shapes;
using Gml.Client;
Expand Down Expand Up @@ -46,11 +47,12 @@ public SplashScreenViewModel(ISystemService? systemService = null, IGmlClientMan
public async Task InitializeAsync()
{
var osType = _systemService.GetOsType();
var osArch = RuntimeInformation.ProcessArchitecture;

await _systemService.LoadSystemData();
ChangeState(_localizationService.GetString(ResourceKeysDictionary.CheckUpdates), true);

var versionInfo = await CheckActualVersion(osType);
var versionInfo = await CheckActualVersion(osType, osArch);

if (!versionInfo.IsActuallVersion)
{
Expand All @@ -68,9 +70,10 @@ public async Task InitializeAsync()
}
}

private async Task<(IVersionFile? ActualVersion, bool IsActuallVersion)> CheckActualVersion(OsType osType)
private async Task<(IVersionFile? ActualVersion, bool IsActuallVersion)> CheckActualVersion(OsType osType,
Architecture osArch)
{
var actualVersion = await _manager.GetActualVersion(osType);
var actualVersion = await _manager.GetActualVersion(osType, osArch);

if (actualVersion is null)
{
Expand Down
64 changes: 64 additions & 0 deletions src/Gml.Launcher/Views/Components/OnlineComponent.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Gml.Launcher.Views.Components"
xmlns:lang="clr-namespace:Gml.Launcher.Assets.Resources">
<Design.PreviewWith>
<Grid Width="350" Height="100">
<controls:BackgroundComponent Classes="Image" Source="/Assets/Images/background.jpg" />
<Rectangle Fill="{DynamicResource BackgroundOverlay}" />

<Border Padding="20">
<controls:OnlineComponent />
</Border>
</Grid>
</Design.PreviewWith>

<Style Selector="controls|OnlineComponent">

<Setter Property="Background" Value="{DynamicResource FrameBackgroundColor}" />
<Setter Property="CornerRadius" Value="8" />
<Setter Property="VerticalAlignment" Value="Top" />

<Setter Property="Template">
<ControlTemplate>
<!-- Component Border -->
<Border Background="{TemplateBinding Background}"
Padding="10, 8, 15, 8"
CornerRadius="12"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalAlignment="Left">
<Grid ColumnDefinitions="Auto, 10, Auto">

<!-- Icon -->
<Border Background="{DynamicResource PrimaryColor}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="12"
CornerRadius="{TemplateBinding CornerRadius}">
<Svg Path="/Assets/Images/users.svg" Width="18" />
</Border>

<!-- Content -->
<StackPanel Grid.Column="2">
<TextBlock Text="{x:Static lang:Resources.OnServers}"
Foreground="{DynamicResource ContentColor}"
FontSize="14"
FontWeight="Medium" />
<TextBlock>
<Run Text="{TemplateBinding Online}"
Foreground="{DynamicResource HeadlineColor}"
FontSize="20"
FontWeight="Bold" />
<Run Text="{x:Static lang:Resources.PlayersShort}"
Foreground="{DynamicResource ContentColor}"
FontSize="14"
FontWeight="Medium" />
</TextBlock>
</StackPanel>

</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
</Styles>
18 changes: 18 additions & 0 deletions src/Gml.Launcher/Views/Components/OnlineComponent.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;

namespace Gml.Launcher.Views.Components;

public class OnlineComponent : TemplatedControl
{
public static readonly StyledProperty<string> OnlineProperty = AvaloniaProperty.Register<OnlineComponent, string>(
"Online", "0");

public string Online
{
get => GetValue(OnlineProperty);
set => SetValue(OnlineProperty, value);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public class ProfileInfoComponent : TemplatedControl
AvaloniaProperty.Register<ProfileUserControl, IEnumerable<ProfileInfoItem>>(
nameof(ProfileInfoItems), new List<ProfileInfoItem>
{
new("На проекте", "150 дней"),
new("Наиграно", " 551 час 45 мин"),
new("Баланс", "150 руб."),
new("Группа", "Premium"),
// new("На проекте", "150 дней"),
// new("Наиграно", " 551 час 45 мин"),
// new("Баланс", "150 руб."),
// new("Группа", "Premium"),
});


Expand Down
9 changes: 1 addition & 8 deletions src/Gml.Launcher/Views/Components/ProfileUserControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@
FontWeight="ExtraBlack" />
</Grid>
<StackPanel Grid.Row="1" Margin="30">

<controls:ProfileInfoComponent />

<controls:GmlButton Classes="TextIcon Primary"
Margin="0, 15, 0, 0"
Padding="15, 10, 10, 10"
Text="{x:Static lang:Resources.Cabinet}"
HorizontalAlignment="Center" />
<ItemsPresenter/>
</StackPanel>
</Grid>

Expand Down
Loading
Loading