first commit
This commit is contained in:
463
Nitrox.Launcher/Views/ManageServerView.axaml
Normal file
463
Nitrox.Launcher/Views/ManageServerView.axaml
Normal file
@@ -0,0 +1,463 @@
|
||||
<UserControl
|
||||
d:DesignWidth="700"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Nitrox.Launcher.Views.ManageServerView"
|
||||
x:DataType="vm:ManageServerViewModel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:controls="clr-namespace:Nitrox.Launcher.Models.Controls"
|
||||
xmlns:converters="clr-namespace:Nitrox.Launcher.Models.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:design="clr-namespace:Nitrox.Launcher.Models.Design"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:server="clr-namespace:NitroxModel.Server;assembly=NitroxModel"
|
||||
xmlns:vm="clr-namespace:Nitrox.Launcher.ViewModels"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:behaviors="clr-namespace:Nitrox.Launcher.Models.Behaviors">
|
||||
<Design.DataContext>
|
||||
<vm:ManageServerViewModel ServerName="My fun server" />
|
||||
</Design.DataContext>
|
||||
<UserControl.KeyBindings>
|
||||
<KeyBinding Command="{Binding ForceDeleteServerCommand}" Gesture="Shift+Delete" />
|
||||
</UserControl.KeyBindings>
|
||||
<Grid
|
||||
Background="{DynamicResource BrandWhite}"
|
||||
Classes="viewPadding"
|
||||
RowDefinitions="Auto,*,Auto">
|
||||
<StackPanel>
|
||||
<Button
|
||||
Background="Transparent"
|
||||
Command="{Binding BackCommand}"
|
||||
Cursor="Hand"
|
||||
HotKey="Escape"
|
||||
Margin="0,0,0,26">
|
||||
<Image
|
||||
Height="24"
|
||||
HorizontalAlignment="Left"
|
||||
Source="/Assets/Images/world-manager/back.png"
|
||||
Width="24" />
|
||||
</Button>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<StackPanel Margin="0,0,20,0">
|
||||
<Border
|
||||
ClipToBounds="True"
|
||||
CornerRadius="12"
|
||||
Height="72">
|
||||
<Grid>
|
||||
<Button
|
||||
Classes="anycontent"
|
||||
Command="{Binding ChangeServerIconCommand}"
|
||||
IsHitTestVisible="{Binding !ServerIsOnline}"
|
||||
ToolTip.Tip="Set a custom server icon">
|
||||
<Grid>
|
||||
<Image IsVisible="{Binding ServerIcon, Converter={converters:EqualityConverter}}" Source="/Assets/Images/subnautica-icon.png" />
|
||||
<Border
|
||||
CornerRadius="12"
|
||||
Height="70"
|
||||
Width="70">
|
||||
<Border.Background>
|
||||
<ImageBrush Source="{Binding ServerIcon}" Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Button.Styles>
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Style>
|
||||
</Button.Styles>
|
||||
</Button>
|
||||
<controls:GrayscaleControl IsHitTestVisible="False" Opacity="{Binding !ServerIsOnline}">
|
||||
<controls:GrayscaleControl.Transitions>
|
||||
<Transitions>
|
||||
<DoubleTransition Duration="0:0:0.10" Property="Opacity" />
|
||||
</Transitions>
|
||||
</controls:GrayscaleControl.Transitions>
|
||||
</controls:GrayscaleControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<TextBlock
|
||||
FontSize="7.5"
|
||||
Foreground="{DynamicResource BrandSubText}"
|
||||
HorizontalAlignment="Center"
|
||||
Text="Click to change icon" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<StackPanel
|
||||
Classes="description"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,10"
|
||||
Orientation="Horizontal"
|
||||
Width="223">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="StackPanel.description > :is(Control)">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="6 0" />
|
||||
</Style>
|
||||
<Style Selector="StackPanel.description > :is(Control):nth-child(1)">
|
||||
<Setter Property="Margin" Value="0 0 6 0" />
|
||||
</Style>
|
||||
<Style Selector="StackPanel.description > :is(Control):nth-last-child(1)">
|
||||
<Setter Property="Margin" Value="6 0 0 0" />
|
||||
</Style>
|
||||
<Style Selector="Ellipse">
|
||||
<Setter Property="Height" Value="6" />
|
||||
<Setter Property="Width" Value="6" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<Panel>
|
||||
<StackPanel IsVisible="{Binding ServerIsOnline}" Orientation="Horizontal">
|
||||
<Ellipse Fill="{DynamicResource BrandOnColor}" Margin="0,0,6,0" />
|
||||
<TextBlock IsVisible="{Binding ServerIsOnline}" Text="Online" />
|
||||
</StackPanel>
|
||||
<StackPanel IsVisible="{Binding !ServerIsOnline}" Orientation="Horizontal">
|
||||
<Ellipse Fill="{DynamicResource BrandOffColor}" Margin="0,0,6,0" />
|
||||
<TextBlock IsVisible="{Binding !ServerIsOnline}" Text="Offline" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
<TextBlock Text="{Binding ServerGameMode, Converter={converters:ToStringConverter}}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding ServerPlayers}" />
|
||||
<TextBlock Text="/" />
|
||||
<TextBlock Text="{Binding ServerMaxPlayers}" />
|
||||
<TextBlock Margin="6,0,0,0" Text="playing" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,200">
|
||||
<ScrollViewer
|
||||
Grid.Column="0"
|
||||
Margin="0,0,10,0"
|
||||
design:NitroxAttached.PrimaryScrollWheelDirection="Horizontal">
|
||||
<TextBlock
|
||||
Classes="header"
|
||||
Foreground="White"
|
||||
Text="{Binding ServerName}" />
|
||||
</ScrollViewer>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Height="40"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="5">
|
||||
<Button
|
||||
Classes="abort"
|
||||
Command="{Binding UndoCommand}"
|
||||
Content="UNDO"
|
||||
HorizontalAlignment="Stretch"
|
||||
HotKey="Ctrl+Alt+Z" />
|
||||
<Button
|
||||
Classes="primary"
|
||||
Command="{Binding SaveCommand}"
|
||||
Content="SAVE"
|
||||
HorizontalAlignment="Stretch"
|
||||
HotKey="Ctrl+S"
|
||||
Margin="5,0,0,0" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Margin="0,26"
|
||||
design:NitroxAttached.AutoScrollToHome="True">
|
||||
<StackPanel Spacing="42" VerticalAlignment="Stretch">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="ScrollViewer > StackPanel > Grid > StackPanel > TextBlock, ScrollViewer > StackPanel > StackPanel > TextBlock">
|
||||
<Setter Property="Margin" Value="0 0 0 11" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<Grid ColumnDefinitions="*,30,*">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="SERVER NAME" />
|
||||
<TextBox
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
Text="{Binding ServerName, Converter={converters:TrimConverter}}"
|
||||
Watermark="My server">
|
||||
<Interaction.Behaviors>
|
||||
<behaviors:FocusOnViewShowBehavior />
|
||||
</Interaction.Behaviors>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2">
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="PASSWORD" />
|
||||
<TextBox
|
||||
Classes="revealPasswordButton"
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
Text="{Binding ServerPassword, Converter={converters:TrimConverter}}"
|
||||
Watermark="Server password" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="GAMEMODE" />
|
||||
<controls:RadioButtonGroup
|
||||
Classes="radioGroup"
|
||||
Enum="{x:Type server:NitroxGameMode}"
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
SelectedItem="{Binding ServerGameMode, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,30,*,30,*">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="SEED" />
|
||||
<TextBox
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
IsReadOnly="{Binding !Server.IsNewServer}"
|
||||
MaxLength="10"
|
||||
Text="{Binding ServerSeed, Converter={converters:ToStringConverter}, ConverterParameter=upper}"
|
||||
Watermark="Server seed">
|
||||
<TextBox.Styles>
|
||||
<Style Selector="TextBox[IsReadOnly=False]">
|
||||
<Setter Property="ToolTip.Tip" Value="Leave blank to automatically generate one" />
|
||||
</Style>
|
||||
<Style Selector="TextBox[IsReadOnly=True]">
|
||||
<Setter Property="ToolTip.Tip" Value="Seed cannot be changed for servers that have been run" />
|
||||
</Style>
|
||||
</TextBox.Styles>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2">
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="DEFAULT PERMISSIONS" />
|
||||
<ComboBox
|
||||
FontSize="13"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
ItemsSource="{Binding PlayerPerms}"
|
||||
PlaceholderText="Default Perm"
|
||||
SelectedValue="{Binding ServerDefaultPlayerPerm}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={converters:ToStringConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="4">
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="AUTO SAVE INTERVAL (s)" />
|
||||
<TextBox
|
||||
FontSize="13"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
MaxLength="9"
|
||||
Text="{Binding ServerAutoSaveInterval, Converter={converters:IntToStringConverter}}"
|
||||
Watermark="Autosave interval"
|
||||
design:NitroxAttached.IsNumericInput="True" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,30,*">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="PLAYER LIMIT" />
|
||||
<TextBox
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
MaxLength="9"
|
||||
Text="{Binding ServerMaxPlayers, Converter={converters:IntToStringConverter}}"
|
||||
Watermark="Enter a player limit"
|
||||
design:NitroxAttached.IsNumericInput="True" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2">
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Opacity=".5"
|
||||
Text="SERVER PORT" />
|
||||
<TextBox
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
MaxLength="5"
|
||||
Text="{Binding ServerPort, Converter={converters:IntToStringConverter}}"
|
||||
Watermark="Enter a port number"
|
||||
design:NitroxAttached.IsNumericInput="True" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Margin="0,0,0,15"
|
||||
Opacity=".5"
|
||||
Text="OPTIONS" />
|
||||
<StackPanel IsEnabled="{Binding !ServerIsOnline}" Spacing="20">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Grid > TextBlock">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="FontWeight" Value="400" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<Grid>
|
||||
<TextBlock Text="Enable auto port forwarding" />
|
||||
<CheckBox
|
||||
Classes="switch"
|
||||
HorizontalAlignment="Right"
|
||||
IsChecked="{Binding ServerAutoPortForward}" />
|
||||
</Grid>
|
||||
<Grid>
|
||||
<TextBlock Text="Allow LAN Discovery" />
|
||||
<CheckBox
|
||||
Classes="switch"
|
||||
HorizontalAlignment="Right"
|
||||
IsChecked="{Binding ServerAllowLanDiscovery}" />
|
||||
</Grid>
|
||||
<Grid>
|
||||
<TextBlock Text="Enable Commands" />
|
||||
<CheckBox
|
||||
Classes="switch"
|
||||
HorizontalAlignment="Right"
|
||||
IsChecked="{Binding ServerAllowCommands}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
FontWeight="700"
|
||||
Margin="0,0,0,20"
|
||||
Opacity=".5"
|
||||
Text="ADVANCED" />
|
||||
<StackPanel Spacing="20">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="FontWeight" Value="400" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<Button Classes="icon" Command="{Binding ShowAdvancedSettingsCommand}">
|
||||
<StackPanel>
|
||||
<Image Source="/Assets/Images/world-manager/cog.png" />
|
||||
<TextBlock Text="Advanced settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Classes="icon" Command="{Binding OpenWorldFolderCommand}">
|
||||
<StackPanel>
|
||||
<Image Source="/Assets/Images/world-manager/window.png" />
|
||||
<TextBlock Text="Open world folder" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Classes="icon" Command="{Binding RestoreBackupCommand}">
|
||||
<StackPanel>
|
||||
<Image Source="/Assets/Images/world-manager/export.png" />
|
||||
<TextBlock Text="Restore a backup" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Classes="icon"
|
||||
Command="{Binding DeleteServerCommand}"
|
||||
Foreground="#ec1c24"
|
||||
HotKey="Delete">
|
||||
<StackPanel>
|
||||
<Image Source="/Assets/Images/world-manager/delete.png" />
|
||||
<TextBlock Text="Delete server" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<Border
|
||||
Background="{DynamicResource BrandPanelBackground}"
|
||||
CornerRadius="12"
|
||||
Grid.Row="2"
|
||||
Padding="25,17">
|
||||
<Grid
|
||||
ColumnDefinitions="*,*"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
<StackPanel Grid.Column="0"
|
||||
IsEnabled="{Binding !ServerIsOnline}"
|
||||
Background="Transparent">
|
||||
<OnPlatform>
|
||||
<OnPlatform.Default>
|
||||
<StackPanel>
|
||||
<RadioButton Content="External"
|
||||
GroupName="Choose runtime option"
|
||||
IsChecked="{Binding !ServerEmbedded}"
|
||||
ToolTip.ShowOnDisabled="True"
|
||||
ToolTip.Tip="Run server in external mode as a separate command line window" />
|
||||
|
||||
<RadioButton Content="Embedded"
|
||||
GroupName="Choose runtime option"
|
||||
IsChecked="{Binding ServerEmbedded}"
|
||||
ToolTip.ShowOnDisabled="True"
|
||||
ToolTip.Tip="Run server in embedded mode within the launcher UI" />
|
||||
</StackPanel>
|
||||
</OnPlatform.Default>
|
||||
|
||||
<OnPlatform.macOS>
|
||||
<RadioButton Content="Embedded"
|
||||
GroupName="Choose runtime option"
|
||||
IsChecked="True"
|
||||
ToolTip.ShowOnDisabled="True"
|
||||
ToolTip.Tip="Run server in embedded mode within the launcher UI" />
|
||||
</OnPlatform.macOS>
|
||||
</OnPlatform>
|
||||
</StackPanel>
|
||||
|
||||
<Panel Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Button
|
||||
Classes="abort big"
|
||||
Command="{Binding StopServerCommand}"
|
||||
Content="STOP SERVER"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding ServerIsOnline}" />
|
||||
<Button
|
||||
Classes="primary big"
|
||||
Command="{Binding StartServerCommand}"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding !ServerIsOnline}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="START SERVER" />
|
||||
<TextBlock Text="MULTIPLAYER" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Panel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
Reference in New Issue
Block a user