Skip to content

Commit

Permalink
修复导出SRGF格式时间戳问题
Browse files Browse the repository at this point in the history
修复角色池右侧面板无法滚动问题
移除多余代码
  • Loading branch information
JamXi233 committed Jul 8, 2023
1 parent 6b9514c commit 6029a6f
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 43 deletions.
20 changes: 0 additions & 20 deletions SRTools/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,6 @@ public async void Init()
}

}


private async void OnUnhandledErrorDetected(object sender, Windows.ApplicationModel.Core.UnhandledErrorDetectedEventArgs e)
{
try
{
e.UnhandledError.Propagate();
}
catch (Exception ex)
{
var m_window = Window.Current;
try { m_window.Close(); }catch { }
TerminalMode.ShowConsole();
TerminalMode terminalMode = new TerminalMode();
terminalMode.Init(0, 1, ex.Message);
// 关闭应用程序
//await Task.Delay(TimeSpan.FromSeconds(5));
//Application.Current.Exit();
}
}
private Window m_window;
}
}
7 changes: 5 additions & 2 deletions SRTools/Depend/ExportSRGF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using Windows.Storage.Pickers;
using Windows.Storage;
using Windows.ApplicationModel;

namespace SRTools.Depend
{
Expand Down Expand Up @@ -99,13 +100,15 @@ public async void ExportAll()
id = oItem.Id
}).ToList();
ExportSRGF data = new ExportSRGF();
PackageVersion packageVersion = Package.Current.Id.Version;
string version = $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}.{packageVersion.Revision}";
var uid = oitems.FirstOrDefault()?.Uid;
data.info.uid = uid;
data.info.lang = "zh-cn";
data.info.region_time_zone = 8;
data.info.export_timestamp = 1684124992;
data.info.export_timestamp = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
data.info.export_app = "SRTools";
data.info.export_app_version = "1.1.2.0";
data.info.export_app_version = version;
data.info.srgf_version = "v1.0";
data.list = items;

Expand Down
2 changes: 1 addition & 1 deletion SRTools/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- 主界面 -->
<Grid x:Name="MainAPP" Visibility="Collapsed">

<NavigationView IsBackEnabled="False" IsBackButtonVisible="Collapsed" IsPaneOpen="False" SelectionChanged="NavView_SelectionChanged" Background="{ThemeResource SystemControlAcrylicElementMediumHighBrush}">
<NavigationView x:Name="navView" IsBackEnabled="False" IsBackButtonVisible="Collapsed" IsPaneOpen="False" SelectionChanged="NavView_SelectionChanged" Background="{ThemeResource SystemControlAcrylicElementMediumHighBrush}">
<NavigationView.Resources>
<Thickness x:Key="NavigationViewContentMargin">0,48,0,0</Thickness>
</NavigationView.Resources>
Expand Down
36 changes: 29 additions & 7 deletions SRTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
using System.Text.Json;
using Microsoft.UI.Xaml.Media.Imaging;
using System.Threading;
using System.Security.AccessControl;

namespace SRTools
{
public partial class MainWindow : Window
{
public event EventHandler NavViewControlRequested;

private GetNetData _getNetData;
private readonly GetGiteeLatest _getGiteeLatest = new GetGiteeLatest();
private readonly GetJSGLatest _getJSGLatest = new GetJSGLatest();
Expand Down Expand Up @@ -51,6 +54,9 @@ public partial class MainWindow : Window
private static extern bool FreeConsole();

private record LocalSettingsData(string FirstRun, string GamePath, string UnlockFPSValue, string UpdateService);

public NavigationView NavigationView { get; }

public MainWindow()
{
Windows.ApplicationModel.Core.CoreApplication.UnhandledErrorDetected += OnUnhandledErrorDetected;
Expand Down Expand Up @@ -344,9 +350,12 @@ private void DependReportProgress(double progressPercentage)

private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
NavigationViewItem item = args.SelectedItem as NavigationViewItem;
string tag = item.Tag.ToString();
Type pageType = null;
if (args.IsSettingsSelected)
{
// 处理设置菜单项单击事件
MainFrame.Navigate(typeof(AboutView));
}
else if (args.SelectedItemContainer != null)
{
Expand All @@ -362,15 +371,17 @@ private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelec
break;
case "gacha":
// 导航到启动游戏页
MainFrame.Navigate(typeof(GachaView));
pageType = typeof(GachaView);
GachaView gachaViewInstance = MainFrame.Content as GachaView;
if (gachaViewInstance == null)
{
gachaViewInstance = new GachaView();
gachaViewInstance.DisableNavigationItems += GachaView_DisableNavigationItems;
}
MainFrame.Navigate(pageType);
break;
}
}
if (args.IsSettingsSelected)
{
// 导航到默认设置页面
MainFrame.Navigate(typeof(AboutView));
}
}
public static async Task<ApiResponse> FetchData(string url)
{
Expand All @@ -386,6 +397,17 @@ public class ApiResponse
public Data data { get; set; }
}

private void GachaView_DisableNavigationItems(object sender, EventArgs e)
{
foreach (NavigationViewItem item in navView.MenuItems)
{
if (item.Tag.ToString() == "home" || item.Tag.ToString() == "startgame")
{
item.IsEnabled = false;
}
}
}

private void OnUnhandledErrorDetected(object sender, Windows.ApplicationModel.Core.UnhandledErrorDetectedEventArgs e)
{
try
Expand Down
2 changes: 1 addition & 1 deletion SRTools/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="2305cb6a-348b-48ce-906f-547149ecbd59"
Publisher="CN=JamXi"
Version="1.1.2.0" />
Version="1.1.3.0" />

<Properties>
<DisplayName>SRTools(星轨工具箱)</DisplayName>
Expand Down
3 changes: 2 additions & 1 deletion SRTools/Views/GachaView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<ToggleButton x:Name="ProxyButton" Content="开启代理" Click="ProxyButton_Click" Margin="0 0 0 8"/>
<Button x:Name="ExportSRGF" Content="导出记录" Click="ExportSRGF_Click" IsEnabled="False" Margin="8 0 0 8"/>
<Button x:Name="ImportSRGF" Content="导入记录" Click="ImportSRGF_Click" IsEnabled="true" Margin="8 0 0 8"/>
<Button Content="Debug测试" Click="Debug1_Click" IsEnabled="true" Visibility="Collapsed" Margin="8 0 0 8"/>

</StackPanel>
<StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
<TextBlock Text="状态:" />
Expand All @@ -29,7 +31,6 @@

<Grid Grid.Row="1" HorizontalAlignment="Stretch">


<NavigationView x:Name="gachaNav" Grid.Column="0" PaneDisplayMode="Top" IsSettingsVisible="False" IsBackButtonVisible="Collapsed" SelectionChanged="NavView_SelectionChanged" Visibility="Collapsed">
<NavigationView.MenuItems>
<NavigationViewItem Content="角色池" Tag="CharacterGacha" IsSelected="True" />
Expand Down
11 changes: 10 additions & 1 deletion SRTools/Views/GachaView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using SRTools.Views.GachaViews;
using Spectre.Console;
using Newtonsoft.Json.Linq;
using Windows.UI.Core;

namespace SRTools.Views
{
Expand All @@ -25,6 +26,7 @@ public sealed partial class GachaView : Page
BCCertMaker.BCCertMaker certProvider = new BCCertMaker.BCCertMaker();
private DispatcherQueueTimer dispatcherTimer;
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
public event EventHandler DisableNavigationItems;
public GachaView()
{
//Windows.ApplicationModel.Core.CoreApplication.UnhandledErrorDetected += OnUnhandledErrorDetected;
Expand Down Expand Up @@ -257,7 +259,7 @@ private async void DataChange(String serializedList, StorageFile gachaFile)
ProxyButton.IsEnabled = true;
}

private async void ExportSRGF_Click(object sender, RoutedEventArgs e)
private void ExportSRGF_Click(object sender, RoutedEventArgs e)
{
ExportSRGF exportSRGF = new ExportSRGF();
exportSRGF.ExportAll();
Expand All @@ -272,6 +274,12 @@ private async void ImportSRGF_Click(object sender, RoutedEventArgs e)
localSettings.Values["Gacha_Data"] = "1";
}

private async void Debug1_Click(object sender, RoutedEventArgs e)
{

}


private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
if (args.IsSettingsSelected)
Expand Down Expand Up @@ -302,6 +310,7 @@ private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelec
}
}


private void Window_Closed(object sender, EventArgs e)
{
dispatcherTimer.Stop();
Expand Down
18 changes: 8 additions & 10 deletions SRTools/Views/GachaViews/CharacterGachaView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
</ListView>
</StackPanel>

<StackPanel Grid.Column="1">
<ScrollViewer>
<StackPanel>
<TextBlock Text="五星:" FontSize="18" FontWeight="ExtraBold"/>
<StackPanel x:Name="Gacha5Stars" Margin="10 -12 0 10"/>
<TextBlock Text="四星:" FontSize="18" FontWeight="ExtraBold"/>
<StackPanel x:Name="Gacha4Stars" Margin="10 -12 0 10"/>
</StackPanel>
</ScrollViewer>
</StackPanel>
<ScrollViewer Grid.Column="1">
<StackPanel>
<TextBlock Text="五星:" FontSize="18" FontWeight="ExtraBold"/>
<StackPanel x:Name="Gacha5Stars" Margin="10 -12 0 10"/>
<TextBlock Text="四星:" FontSize="18" FontWeight="ExtraBold"/>
<StackPanel x:Name="Gacha4Stars" Margin="10 -12 0 10"/>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>

0 comments on commit 6029a6f

Please sign in to comment.