Skip to content

Commit b8d90be

Browse files
Added Instructions for Unleashed Recomp on Windows
1 parent cac00b3 commit b8d90be

5 files changed

Lines changed: 97 additions & 10 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<local:WindowModal xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:cb="using:HedgeModManager.UI.Controls.Basic"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:local="using:HedgeModManager.UI.Controls.Modals"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:vm="using:HedgeModManager.UI.ViewModels"
8+
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="200"
9+
x:Class="HedgeModManager.UI.Controls.Modals.GameMissingInfoModal"
10+
x:DataType="vm:MainWindowViewModel"
11+
Loaded="OnLoaded"
12+
Title="Modal.Title.GameSearch">
13+
<local:WindowModal.Buttons>
14+
<StackPanel HorizontalAlignment="Right">
15+
<cb:Button Text="Common.Button.Stop" Click="OnStopClick" />
16+
</StackPanel>
17+
</local:WindowModal.Buttons>
18+
<local:WindowModal.Data>
19+
<TextBlock Text="{DynamicResource Modal.Message.GameSearch}"
20+
FontSize="14" Margin="50,70,50,20"
21+
TextAlignment="Center"/>
22+
</local:WindowModal.Data>
23+
</local:WindowModal>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using Avalonia.Interactivity;
2+
using Avalonia.Threading;
3+
using HedgeModManager.UI.ViewModels;
4+
5+
namespace HedgeModManager.UI.Controls.Modals;
6+
7+
public partial class GameMissingInfoModal : WindowModal
8+
{
9+
private DispatcherTimer? _timer;
10+
11+
private void OnLoaded(object? sender, RoutedEventArgs e)
12+
{
13+
var viewModel = DataContext as MainWindowViewModel;
14+
if (viewModel == null)
15+
return;
16+
17+
_timer?.Stop();
18+
_timer = new DispatcherTimer
19+
{
20+
Interval = TimeSpan.FromSeconds(1)
21+
};
22+
_timer.Tick += (_, _) =>
23+
{
24+
// Check if the modal is closed
25+
if (!viewModel.Modals.Any(x => x.Control == this))
26+
{
27+
_timer.Stop();
28+
return;
29+
}
30+
31+
var uiGames = Games.GetUIGames(ModdableGameLocator.LocateGames());
32+
var missingGames = uiGames.Where(x => !viewModel.Games.Any(y => y.Game.ID == x.Game.ID));
33+
if (missingGames.Any())
34+
{
35+
_timer.Stop();
36+
missingGames.ForEach(x => viewModel.Games.Add(x));
37+
viewModel.SelectedGame = viewModel.Games.LastOrDefault();
38+
Close();
39+
40+
// Close game selector
41+
var gameSelector = viewModel.Modals.FirstOrDefault(x => x.Control is GameSelectModal);
42+
if (gameSelector != null)
43+
viewModel.Modals.Remove(gameSelector);
44+
}
45+
};
46+
_timer.Start();
47+
}
48+
49+
private void OnStopClick(object? sender, RoutedEventArgs e)
50+
{
51+
Close();
52+
}
53+
}

Source/HedgeModManager.UI/Controls/Modals/GameSelectModal.axaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:cm="using:HedgeModManager.UI.Controls.Modals"
55
xmlns:cp="using:HedgeModManager.UI.Controls"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:h="using:HedgeModManager"
78
xmlns:materialIcons="using:Material.Icons.Avalonia"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
910
xmlns:vm="using:HedgeModManager.UI.ViewModels"
@@ -24,11 +25,12 @@
2425
</ItemsControl.ItemTemplate>
2526
</ItemsControl>
2627
</ScrollViewer>
27-
<StackPanel Margin="4" Orientation="Horizontal" IsVisible="{Binding IsGameMissing, RelativeSource={RelativeSource AncestorType=cm:GameSelectModal}}">
28+
<StackPanel Margin="4" Orientation="Horizontal" IsVisible="{Binding IsUnleashedRecompiledMissing, RelativeSource={RelativeSource AncestorType=cm:GameSelectModal}}">
2829
<TextBlock Text="{DynamicResource Modal.Text.GameMissing}" TextDecorations="Underline" Cursor="Hand"
2930
Margin="4"
3031
PointerReleased="OnGameMissingPointerReleased"/>
31-
<materialIcons:MaterialIcon Kind="OpenInNew" Foreground="{DynamicResource Text.NormalBrush}" />
32+
<materialIcons:MaterialIcon IsVisible="{x:Static h:Helpers.IsFlatpak}"
33+
Kind="OpenInNew" Foreground="{DynamicResource Text.NormalBrush}" />
3234

3335
</StackPanel>
3436
</StackPanel>

Source/HedgeModManager.UI/Controls/Modals/GameSelectModal.axaml.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Avalonia.Controls;
2+
using Avalonia.Input;
23
using Avalonia.Interactivity;
34
using Avalonia.Markup.Xaml;
45
using HedgeModManager.CoreLib;
@@ -9,14 +10,10 @@ namespace HedgeModManager.UI.Controls.Modals;
910

1011
public partial class GameSelectModal : UserControl
1112
{
12-
// For displaying if the game is missing while on Flatpak
13-
public bool IsGameMissing
13+
public bool IsUnleashedRecompiledMissing
1414
{
1515
get
1616
{
17-
if (!Helpers.IsFlatpak)
18-
return false;
19-
2017
var viewModel = DataContext as MainWindowViewModel;
2118
if (viewModel == null)
2219
return true;
@@ -56,9 +53,18 @@ private void OnLoaded(object? sender, RoutedEventArgs e)
5653
}
5754
}
5855

59-
// TODO: Handle pointer down
60-
private void OnGameMissingPointerReleased(object? sender, Avalonia.Input.PointerReleasedEventArgs e)
56+
private void OnGameMissingPointerReleased(object? sender, PointerReleasedEventArgs e)
6157
{
62-
Utils.OpenURL("https://github.com/hedge-dev/HedgeModManager/issues/44");
58+
if (Helpers.IsFlatpak)
59+
{
60+
Utils.OpenURL("https://github.com/hedge-dev/HedgeModManager/issues/44");
61+
}
62+
else
63+
{
64+
var modal = new GameMissingInfoModal();
65+
if (DataContext is MainWindowViewModel viewModel)
66+
modal.Open(viewModel);
67+
}
68+
6369
}
6470
}

Source/HedgeModManager.UI/Languages/en-AU.axaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<system:String x:Key="Common.Button.Save" >Save</system:String>
4343
<system:String x:Key="Common.Button.SavePlay">Save and Play</system:String>
4444
<system:String x:Key="Common.Button.Select" >Select</system:String>
45+
<system:String x:Key="Common.Button.Stop" >Stop</system:String>
4546
<system:String x:Key="Common.Button.Update" >Update</system:String>
4647
<system:String x:Key="Common.Button.Yes" >Yes</system:String>
4748

@@ -155,6 +156,7 @@
155156
<system:String x:Key="Modal.Title.DownloadMod" >Download {0}</system:String>
156157
<system:String x:Key="Modal.Title.DownloadModLoading">Download Mod</system:String>
157158
<system:String x:Key="Modal.Title.Games" >Games</system:String>
159+
<system:String x:Key="Modal.Title.GameSearch" >Information</system:String>
158160
<system:String x:Key="Modal.Title.Information" >Information</system:String>
159161
<system:String x:Key="Modal.Title.InstallError" >Install Error</system:String>
160162
<system:String x:Key="Modal.Title.LoadError" >Load Error</system:String>
@@ -181,6 +183,7 @@
181183
<system:String xml:space="preserve" x:Key="Modal.Message.GameMissingError">Hedge Mod Manager is unable to install &quot;{0}&quot;&#x0a;due to {1} not being found.</system:String>
182184
<system:String xml:space="preserve" x:Key="Modal.Message.GameNoAccess">Hedge Mod Manager does not have write&#x0a;access to the game files.&#x0a;&#x0a;Please make sure the game files are writable.</system:String>
183185
<system:String xml:space="preserve" x:Key="Modal.Message.GamescopeError">Mod configuration has been saved.&#x0a;&#x0a;Hedge Mod Manager currently cannot launch games while in Gaming Mode.&#x0a;&#x0a;Please exit Hedge Mod Manager then launch the game.</system:String>
186+
<system:String xml:space="preserve" x:Key="Modal.Message.GameSearch">Scanning for games...&#x0a;&#x0a;Launch Unleashed Recompiled to the title screen&#x0a;then return to Hedge Mod Manager.</system:String>
184187
<system:String xml:space="preserve" x:Key="Modal.Message.InstallError">Failed to install mod. Check log for exception.</system:String>
185188
<system:String xml:space="preserve" x:Key="Modal.Message.MissingDependency">The mods listed below are missing and are required to play.&#x0a;&#x0a;{0}</system:String>
186189
<system:String xml:space="preserve" x:Key="Modal.Message.ModLoaderInstallError">An error occurred while trying to install the mod loader.&#x0a;&#x0a;Check log for exception.</system:String>

0 commit comments

Comments
 (0)