Skip to content

Commit d6d4f1d

Browse files
committedJul 25, 2023
Allow PlayTime to be modified
1 parent 7d8982a commit d6d4f1d

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed
 

‎src/MHWAppearanceEditor/MHWAppearanceEditor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
44
<TargetFrameworks>net461;net5.0</TargetFrameworks>
5-
<Version>1.7.0</Version>
5+
<Version>1.7.1</Version>
66
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
77
<Nullable>enable</Nullable>
88
<LangVersion>8.0</LangVersion>

‎src/MHWAppearanceEditor/ValueConverters/TimeSpanValueConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
2727
}
2828
}
2929

30-
throw new NotImplementedException();
30+
return null!;
3131
}
3232
}
3333
}

‎src/MHWAppearanceEditor/ViewModels/Tabs/SaveSlotViewModel.cs

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Avalonia.Media;
1+
using Avalonia.Data;
2+
using Avalonia.Media;
23
using Cirilla.Core.Enums;
34
using Cirilla.Core.Interfaces;
45
using Cirilla.Core.Models;
@@ -37,7 +38,21 @@ public class SaveSlotViewModel : ViewModelBase, ITabItemViewModel
3738
public int MasterXp { get => SaveSlot.MasterXp; set => SaveSlot.MasterXp = value; }
3839
public int Zenny { get => SaveSlot.Zenny; set => SaveSlot.Zenny = value; }
3940
public int ResearchPoints { get => SaveSlot.ResearchPoints; set => SaveSlot.ResearchPoints = value; }
40-
public TimeSpan PlayTime { get => TimeSpan.FromSeconds(SaveSlot.PlayTime); }
41+
public TimeSpan PlayTime
42+
{
43+
get => TimeSpan.FromSeconds(SaveSlot.PlayTime); set
44+
{
45+
// The game only displays up to 9999 hours.
46+
if (value.TotalSeconds < int.MaxValue && value.TotalSeconds > 0)
47+
{
48+
SaveSlot.PlayTime = (int)value.TotalSeconds;
49+
}
50+
else
51+
{
52+
throw new DataValidationException("Invalid value.");
53+
}
54+
}
55+
}
4156

4257
public double NoseHeight
4358
{

‎src/MHWAppearanceEditor/Views/SaveSlotEditors/SaveSlotInfoView.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<TextBox Grid.Column="2" Grid.Row="14" Text="{Binding ResearchPoints}"/>
5252

5353
<TextBlock Grid.Column="0" Grid.Row="16" Text="PlayTime" VerticalAlignment="Center" TextAlignment="Right"/>
54-
<TextBox Grid.Column="2" Grid.Row="16" Text="{Binding PlayTime, Converter={StaticResource TimeSpanConverter}}" IsReadOnly="True"/>
54+
<TextBox Grid.Column="2" Grid.Row="16" Text="{Binding PlayTime, Converter={StaticResource TimeSpanConverter}}"/>
5555

5656
<TextBlock Grid.Column="0" Grid.Row="18" Text="Gender" VerticalAlignment="Center" TextAlignment="Right"/>
5757
<ListBox Name="GenderListBox" Grid.Column="2" Grid.Row="18" Classes="FusionListBox" Items="{Binding Genders}" SelectedItem="{Binding Gender}"/>

0 commit comments

Comments
 (0)
Please sign in to comment.