上传文件至 TslGameLauncher
This commit is contained in:
parent
9ea64886a7
commit
c6b76dcc4f
5 changed files with 130 additions and 0 deletions
10
TslGameLauncher/AssemblyInfo.cs
Normal file
10
TslGameLauncher/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
17
TslGameLauncher/MainWindow.xaml
Normal file
17
TslGameLauncher/MainWindow.xaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<Window x:Class="TslLauncher.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="PUBG Launcher"
|
||||
Height="360"
|
||||
Width="640"
|
||||
WindowStyle="None"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
Topmost="True">
|
||||
<Window.Background>
|
||||
<ImageBrush ImageSource="/Resource/Image/Splash.png" Stretch="Fill"/>
|
||||
</Window.Background>
|
||||
<TextBlock x:Name="StatusText"
|
||||
FontSize="20" Background="#FFFBE31E" Foreground="Black" Text="游戏启动中" FontFamily="Alimama FangYuanTi VF SemiBold" FontWeight="Bold" Margin="257,79,256,258"/>
|
||||
</Window>
|
70
TslGameLauncher/MainWindow.xaml.cs
Normal file
70
TslGameLauncher/MainWindow.xaml.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TslLauncher
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private const string TargetDirectory = @"TslGame\Binaries\Win64";
|
||||
private const string TargetExecutable = "TslGame.exe";
|
||||
private const string Arguments = "-LobbyUrl=https://lobby.ogbattlegrounds.com/ -NoVerifyGC -NoEAC -NoBattleEye";
|
||||
|
||||
private DispatcherTimer _timer;
|
||||
private int _dotCount = 0;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += MainWindow_Loaded;
|
||||
InitializeStatusTextAnimation();
|
||||
}
|
||||
|
||||
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
LaunchGame();
|
||||
}
|
||||
|
||||
private void LaunchGame()
|
||||
{
|
||||
string targetPath = Path.Combine(Environment.CurrentDirectory, TargetDirectory, TargetExecutable);
|
||||
|
||||
if (File.Exists(targetPath))
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(targetPath)
|
||||
{
|
||||
Arguments = Arguments,
|
||||
UseShellExecute = false
|
||||
};
|
||||
|
||||
Process.Start(startInfo);
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this,"游戏文件不完整,请尝试重新下载!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeStatusTextAnimation()
|
||||
{
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(500)
|
||||
};
|
||||
_timer.Tick += Timer_Tick;
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_dotCount = (_dotCount + 1) % 5;
|
||||
StatusText.Text = "游戏启动中" + new string('.', _dotCount);
|
||||
}
|
||||
}
|
||||
}
|
27
TslGameLauncher/TslLauncher.csproj
Normal file
27
TslGameLauncher/TslLauncher.csproj
Normal file
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>Resource\Image\icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resource\Fonts\Alimama FYT VF.ttf" />
|
||||
<None Remove="Resource\Image\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resource\Image\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Fonts\Alimama FYT VF.ttf" />
|
||||
<Resource Include="Resource\Image\icon.ico" />
|
||||
<Resource Include="Resource\Image\Splash.png" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
6
TslGameLauncher/TslLauncher.csproj.user
Normal file
6
TslGameLauncher/TslLauncher.csproj.user
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>C:\Users\WMR-821\source\repos\TslGameLauncher\TslGameLauncher\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue