mirror of
https://github.com/Ace-73/RC2Launcher-Git.git
synced 2025-04-01 09:31:00 +00:00
Added online playercount display, and text and a link pointing to the 'looking for players' channel in discord to help casual players organize sessions easier
This commit is contained in:
parent
6305f3fc32
commit
a99b0c6e71
4 changed files with 83 additions and 1 deletions
Bobocraft 2 Launcher v11 actually fixed countdown/GameLauncher
|
@ -15,9 +15,14 @@
|
||||||
<None Remove="images\LauncherBackground.png" />
|
<None Remove="images\LauncherBackground.png" />
|
||||||
<None Remove="LauncherBackground.png" />
|
<None Remove="LauncherBackground.png" />
|
||||||
<None Remove="shape_square.png" />
|
<None Remove="shape_square.png" />
|
||||||
|
<None Remove="user-1808597_1280.png" />
|
||||||
<None Remove="vector_dizzy.png" />
|
<None Remove="vector_dizzy.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="avatar.png" />
|
<Resource Include="avatar.png" />
|
||||||
<Resource Include="bobocraft 2 logo vector.png" />
|
<Resource Include="bobocraft 2 logo vector.png" />
|
||||||
|
@ -26,6 +31,7 @@
|
||||||
<Resource Include="images\LauncherBackground.png" />
|
<Resource Include="images\LauncherBackground.png" />
|
||||||
<Resource Include="LauncherBackground.png" />
|
<Resource Include="LauncherBackground.png" />
|
||||||
<Resource Include="shape_square.png" />
|
<Resource Include="shape_square.png" />
|
||||||
|
<Resource Include="user-1808597_1280.png" />
|
||||||
<Resource Include="vector_dizzy.png" />
|
<Resource Include="vector_dizzy.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,14 @@
|
||||||
</Button>
|
</Button>
|
||||||
<TextBlock x:Name="CountdownHeadline" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="10" Background="#7F000000" Foreground="White" Margin="0,50,0,0" Text="Time Until Next Scheduled Bobo Session:"/>
|
<TextBlock x:Name="CountdownHeadline" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="10" Background="#7F000000" Foreground="White" Margin="0,50,0,0" Text="Time Until Next Scheduled Bobo Session:"/>
|
||||||
<Label Name="CountdownLabel" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,70,0,0" Height="30" Width="235" Foreground="White" Background="#7F000000"/>
|
<Label Name="CountdownLabel" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,70,0,0" Height="30" Width="235" Foreground="White" Background="#7F000000"/>
|
||||||
|
<Image Name="OnlineUserpfp" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="62,57,0,0" Height="40" Width="40" Source="/user-1808597_1280.png"/>
|
||||||
|
<TextBlock x:Name="CraftersOnlineText" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="10" Background="#7F000000" Foreground="LightGreen" Margin="15,105,0,0" Text="Crafters Online Now!"/>
|
||||||
|
<TextBlock x:Name="CraftersOnlineNumber" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="30" Background="#7F000000" Foreground="LightGreen" Margin="21,57,0,0" Text="0"/>
|
||||||
|
<Button Name ="DiscordButtonLFP" BorderThickness="0" Click ="DiscordButton_ClickLFP" Background="#00000000" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,102,316,0" Height="20" Width="23" RenderTransformOrigin="-1.39,1.253">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Width="20" Height="20">
|
||||||
|
<Image Source="/discord-mark-blue.png" HorizontalAlignment="Left" VerticalAlignment="Center" Width="20" Height="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<TextBlock x:Name="CountdownTailline" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="10" Background="#7F000000" Foreground="White" Margin="0,105,0,0" Text="Want To Play Now? Ask In The 'looking-for-players' Channel If Anyone Wants To Join!"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
@ -12,6 +12,10 @@ using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace GameLauncher
|
namespace GameLauncher
|
||||||
{
|
{
|
||||||
|
@ -61,7 +65,11 @@ namespace GameLauncher
|
||||||
private string NextSessionString;
|
private string NextSessionString;
|
||||||
private string NextSessionFile;
|
private string NextSessionFile;
|
||||||
private string NextSessionFileLink;
|
private string NextSessionFileLink;
|
||||||
|
private string NorbiServerInfoLink;
|
||||||
|
private string ServerInfoJson;
|
||||||
|
private string ServerInfoString;
|
||||||
|
private int PlayerCount;
|
||||||
|
|
||||||
|
|
||||||
private LauncherStatus _status;
|
private LauncherStatus _status;
|
||||||
internal LauncherStatus Status
|
internal LauncherStatus Status
|
||||||
|
@ -140,7 +148,10 @@ namespace GameLauncher
|
||||||
CRF2ManagerZipLink = "https://drive.usercontent.google.com/u/0/uc?id=1ah4QN3HOj2nsCsHKxRkyTI_eKJIK3atb&export=download";
|
CRF2ManagerZipLink = "https://drive.usercontent.google.com/u/0/uc?id=1ah4QN3HOj2nsCsHKxRkyTI_eKJIK3atb&export=download";
|
||||||
CSCZipLink = "https://cloud.norbipeti.eu/s/6dTzZyAbyXRwHc9/download/Connection%20Health%20Calculator.zip";
|
CSCZipLink = "https://cloud.norbipeti.eu/s/6dTzZyAbyXRwHc9/download/Connection%20Health%20Calculator.zip";
|
||||||
NextSessionFileLink = "https://drive.google.com/uc?export=download&id=1lMctvUExhyjw8FRrpiCKmfVnqNQMI7U7";
|
NextSessionFileLink = "https://drive.google.com/uc?export=download&id=1lMctvUExhyjw8FRrpiCKmfVnqNQMI7U7";
|
||||||
|
NorbiServerInfoLink = "https://norbipeti.eu/rc2matchmaking/servers";
|
||||||
|
PlayerCount = 0;
|
||||||
SetupTimer();
|
SetupTimer();
|
||||||
|
CheckPlayerCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupTimer()
|
private void SetupTimer()
|
||||||
|
@ -163,6 +174,7 @@ namespace GameLauncher
|
||||||
CountdownLabel.Content = "ROBOCRAFT SESSION TODAY!";
|
CountdownLabel.Content = "ROBOCRAFT SESSION TODAY!";
|
||||||
}
|
}
|
||||||
else { CountdownLabel.Content = $"{timeLeft.Days} days {timeLeft.Hours} hours {timeLeft.Minutes} minutes {timeLeft.Seconds} seconds"; }
|
else { CountdownLabel.Content = $"{timeLeft.Days} days {timeLeft.Hours} hours {timeLeft.Minutes} minutes {timeLeft.Seconds} seconds"; }
|
||||||
|
CheckPlayerCount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void PullSessionTimeFromLink()
|
private void PullSessionTimeFromLink()
|
||||||
|
@ -308,6 +320,52 @@ namespace GameLauncher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CheckPlayerCount()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WebClient webClient = new WebClient();
|
||||||
|
webClient.Headers.Add("Authorization", "TlBDQVRSQzI=");
|
||||||
|
ServerInfoJson = webClient.DownloadString(NorbiServerInfoLink);
|
||||||
|
JArray _ServerArray = new JArray();
|
||||||
|
_ServerArray = JArray.Parse(ServerInfoJson);
|
||||||
|
PlayerCount = 0;
|
||||||
|
for(int i = 0; i < _ServerArray.Count; i++)
|
||||||
|
{
|
||||||
|
var server = _ServerArray[i];
|
||||||
|
var onlinePlayers = server["onlinePlayers"];
|
||||||
|
int PlayersInt = 0;
|
||||||
|
int.TryParse(onlinePlayers.ToString(), out PlayersInt);
|
||||||
|
PlayerCount += PlayersInt;
|
||||||
|
}
|
||||||
|
if (PlayerCount > 0)
|
||||||
|
{
|
||||||
|
CraftersOnlineNumber.Text = PlayerCount.ToString();
|
||||||
|
//CraftersOnlineNumber.Foreground = new SolidColorBrush(Colors.LightGreen);
|
||||||
|
CraftersOnlineNumber.Visibility = Visibility.Visible;
|
||||||
|
CraftersOnlineText.Visibility = Visibility.Visible;
|
||||||
|
OnlineUserpfp.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CraftersOnlineNumber.Visibility = Visibility.Hidden;
|
||||||
|
CraftersOnlineText.Visibility = Visibility.Hidden;
|
||||||
|
OnlineUserpfp.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Status = LauncherStatus.failed;
|
||||||
|
MessageBox.Show($"Error checking for server info: {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void CheckForCRFManagerUpdates()
|
private void CheckForCRFManagerUpdates()
|
||||||
{
|
{
|
||||||
|
@ -581,6 +639,15 @@ namespace GameLauncher
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DiscordButton_ClickLFP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = "https://discord.gg/4szuSwTURA",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void FAQButton_Click(object sender, RoutedEventArgs e)
|
private void FAQButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (FAQFullText.Visibility == Visibility.Visible) { FAQFullText.Visibility = Visibility.Hidden; }
|
if (FAQFullText.Visibility == Visibility.Visible) { FAQFullText.Visibility = Visibility.Hidden; }
|
||||||
|
|
Binary file not shown.
After ![]() (image error) Size: 94 KiB |
Loading…
Add table
Reference in a new issue