Launcher milestone 2: player list, kick/ban, live stats
Adds an admin-protocol client (token-authed TCP JSON on 127.0.0.1:AdminPort, reusing the server's .admin-token) that polls connected players and status every 3s, plus Kick/Ban on the selected player and a players/uptime readout.
This commit is contained in:
+48
-17
@@ -3,14 +3,14 @@
|
||||
xmlns:vm="clr-namespace:CommonwealthOnline.Host.ViewModels"
|
||||
x:Class="CommonwealthOnline.Host.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Width="920" Height="640"
|
||||
MinWidth="760" MinHeight="520"
|
||||
Width="960" Height="700"
|
||||
MinWidth="820" MinHeight="600"
|
||||
Title="Commonwealth Online — Server Host"
|
||||
Background="{StaticResource CoBackgroundBrush}">
|
||||
|
||||
<Grid RowDefinitions="Auto,*,Auto" Margin="18">
|
||||
|
||||
<Image Grid.Row="0" Source="/Assets/logo.png" Height="88"
|
||||
<Image Grid.Row="0" Source="/Assets/logo.png" Height="84"
|
||||
HorizontalAlignment="Left" Margin="0,0,0,14" />
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="330,*">
|
||||
@@ -38,20 +38,51 @@
|
||||
HorizontalAlignment="Stretch" />
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Column="1" Background="{StaticResource CoSurfaceBrush}"
|
||||
CornerRadius="4" Padding="10">
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{Binding Log}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Foreground="{StaticResource CoTextBrush}"
|
||||
FontFamily="Cascadia Mono,Consolas,monospace" FontSize="12"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<Grid Grid.Column="1" RowDefinitions="*,Auto">
|
||||
|
||||
<Border Grid.Row="0" Background="{StaticResource CoSurfaceBrush}"
|
||||
CornerRadius="4" Padding="10">
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{Binding Log}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Foreground="{StaticResource CoTextBrush}"
|
||||
FontFamily="Cascadia Mono,Consolas,monospace" FontSize="12"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Background="{StaticResource CoSurfaceBrush}"
|
||||
CornerRadius="4" Padding="10" Margin="0,10,0,0" Height="188">
|
||||
<Grid RowDefinitions="Auto,*,Auto">
|
||||
<DockPanel Grid.Row="0" Margin="0,0,0,6">
|
||||
<TextBlock DockPanel.Dock="Left" Text="PLAYERS"
|
||||
Foreground="{StaticResource CoAccentBrush}" FontWeight="Bold" FontSize="12" />
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding StatsText}"
|
||||
Foreground="{StaticResource CoTextBrush}" FontSize="11"
|
||||
HorizontalAlignment="Right" />
|
||||
</DockPanel>
|
||||
<ListBox Grid.Row="1" Background="Transparent"
|
||||
ItemsSource="{Binding Players}" SelectedItem="{Binding SelectedPlayer}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Display}" Foreground="{StaticResource CoTextBrush}"
|
||||
FontFamily="Cascadia Mono,Consolas,monospace" FontSize="12" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="8" Margin="0,6,0,0">
|
||||
<Button Content="Kick" Command="{Binding KickCommand}" Padding="18,4" />
|
||||
<Button Content="Ban" Command="{Binding BanCommand}" Padding="18,4"
|
||||
Background="{StaticResource CoDangerBrush}" Foreground="White" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user