more changes....

This commit is contained in:
Bitl 2021-09-21 19:18:10 -07:00
parent 58d59c662e
commit a220d4cddd
6 changed files with 100 additions and 28 deletions

View File

@ -1062,7 +1062,7 @@ namespace NovetusLauncher
}
}
private static int GetSpecialNameID(string text)
public int GetSpecialNameID(string text)
{
string[] names = File.ReadAllLines(GlobalPaths.ConfigDir + "\\names-special.txt");
int returnname = 0;

View File

@ -32,7 +32,6 @@ namespace NovetusLauncher
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherFormStylish));
this.splashLabel = new System.Windows.Forms.Label();
this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
this.launcherFormStylishInterface1 = new LauncherFormStylishInterface(this);
this.logoImageBox = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.logoImageBox)).BeginInit();
this.SuspendLayout();
@ -64,7 +63,6 @@ namespace NovetusLauncher
this.elementHost1.Size = new System.Drawing.Size(707, 303);
this.elementHost1.TabIndex = 0;
this.elementHost1.Text = "elementHost1";
this.elementHost1.Child = this.launcherFormStylishInterface1;
//
// logoImageBox
//
@ -102,7 +100,6 @@ namespace NovetusLauncher
#endregion
private System.Windows.Forms.Integration.ElementHost elementHost1;
private LauncherFormStylishInterface launcherFormStylishInterface1;
private System.Windows.Forms.Label splashLabel;
private System.Windows.Forms.PictureBox logoImageBox;
}

View File

@ -13,9 +13,13 @@ namespace NovetusLauncher
{
public partial class LauncherFormStylish : Form
{
LauncherFormStylishInterface launcherFormStylishInterface1;
public LauncherFormStylish()
{
InitializeComponent();
launcherFormStylishInterface1 = new LauncherFormStylishInterface(this);
elementHost1.Child = launcherFormStylishInterface1;
}
private void LauncherFormStylish_Load(object sender, EventArgs e)

View File

@ -530,14 +530,14 @@
<ColumnDefinition Width="447*"/>
</Grid.ColumnDefinitions>
<Rectangle x:Name="userInfoGroupBox" Fill="#FFDEDCDC" HorizontalAlignment="Left" Height="120" Margin="6,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="163" Grid.ColumnSpan="2"/>
<Button x:Name="regenerateIDButton" Content="Regen" HorizontalAlignment="Left" Margin="21,82,0,0" VerticalAlignment="Top" Width="39" Height="19" RenderTransformOrigin="0.42,0.512" Grid.Column="1" Click="regenerateIDButton_Click"/>
<TextBox x:Name="userNameBox" HorizontalAlignment="Left" Height="20" Margin="66,53,0,0" TextWrapping="Wrap" Text="Player" VerticalAlignment="Top" Width="95" Grid.ColumnSpan="2"/>
<Button x:Name="regenerateIDButton" Content="Regen ID" HorizontalAlignment="Left" Margin="16,105,0,0" VerticalAlignment="Top" Width="64" Height="20" Click="regenerateIDButton_Click"/>
<TextBox x:Name="userNameBox" HorizontalAlignment="Left" Height="20" Margin="66,53,0,0" TextWrapping="Wrap" Text="Player" VerticalAlignment="Top" Width="95" Grid.ColumnSpan="2" TextChanged="userNameBox_TextChanged"/>
<Rectangle x:Name="joinServerGroupBox" Fill="#FFDEDCDC" HorizontalAlignment="Left" Height="120" Margin="6,135,0,0" Stroke="Black" VerticalAlignment="Top" Width="163" Grid.ColumnSpan="2"/>
<Rectangle x:Name="joinServerLabelBox" Fill="#FFAAA8A8" HorizontalAlignment="Left" Height="30" Margin="6,135,0,0" Stroke="Black" VerticalAlignment="Top" Width="163" Grid.ColumnSpan="2"/>
<Rectangle x:Name="userInfoLabelBox" Fill="#FFAAA8A8" HorizontalAlignment="Left" Height="30" Margin="6,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="163" Grid.ColumnSpan="2"/>
<Label x:Name="userInfoLabel" Content="User Info" HorizontalAlignment="Left" Margin="44,10,0,0" VerticalAlignment="Top" FontSize="15" Grid.ColumnSpan="2" Width="95"/>
<Label x:Name="userName" Content="Name:" HorizontalAlignment="Left" Margin="16,47,0,0" VerticalAlignment="Top" FontSize="12" Height="29" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<TextBox x:Name="userIDBox" HorizontalAlignment="Left" Height="20" Margin="66,81,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="51" Grid.ColumnSpan="2"/>
<TextBox x:Name="userIDBox" HorizontalAlignment="Left" Height="20" Margin="66,81,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="95" Grid.ColumnSpan="2" TextChanged="userIDBox_TextChanged"/>
<Label x:Name="userID" Content="ID:" HorizontalAlignment="Left" Margin="26,75,0,0" VerticalAlignment="Top" FontSize="12" Height="29" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Label x:Name="joinServerLabel" Content="Join Server" HorizontalAlignment="Left" Margin="37,134,0,0" VerticalAlignment="Top" FontSize="15" Width="102" Grid.ColumnSpan="2"/>
<TextBox x:Name="ipAddressBox" HorizontalAlignment="Left" Height="20" Margin="26,186,0,0" TextWrapping="Wrap" Text="localhost" VerticalAlignment="Top" Width="120" Grid.ColumnSpan="2"/>
@ -563,7 +563,7 @@
<Button x:Name="searchButton" Style="{DynamicResource SearchButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="310,44,0,0" VerticalAlignment="Top" Width="24" Height="17" Click="searchButton_Click" RenderTransformOrigin="0.598,0.275"/>
<Button x:Name="refreshButton" Style="{DynamicResource RefreshButton}" Content="" Grid.Column="2" HorizontalAlignment="Left" Margin="334,44,0,0" VerticalAlignment="Top" Width="26" Height="17" Click="refreshButton_Click" RenderTransformOrigin="0.603,0.981"/>
<Button x:Name="addMapButton" Content="Add Place" Grid.Column="2" HorizontalAlignment="Left" Margin="365,45,0,0" VerticalAlignment="Top" Width="67" Click="addMapButton_Click"/>
<Button x:Name="customizeButton" Style="{DynamicResource ImportantButtonSmall}" Content="Customize Character" HorizontalAlignment="Left" Margin="16,105,0,0" VerticalAlignment="Top" Width="145" Grid.ColumnSpan="2" Click="customizeButton_Click"/>
<Button x:Name="customizeButton" Style="{DynamicResource ImportantButtonSmall}" Content="Customize" HorizontalAlignment="Left" Margin="85,105,0,0" VerticalAlignment="Top" Width="76" Grid.ColumnSpan="2" Click="customizeButton_Click"/>
<Label x:Name="serverPortLabel" Content="Host Port:" Grid.Column="1" HorizontalAlignment="Left" Margin="78,43,0,0" VerticalAlignment="Top" Width="68" Grid.ColumnSpan="2"/>
<TextBox x:Name="serverPortBox" HorizontalAlignment="Left" Height="20" Margin="16.166,47,0,0" TextWrapping="Wrap" Text="53640" VerticalAlignment="Top" Width="65" Grid.Column="2"/>
<Label x:Name="maxPlayersLabel" Content="Max Players:" Grid.Column="1" HorizontalAlignment="Left" Margin="68,64,0,0" VerticalAlignment="Top" Width="86" Grid.ColumnSpan="2"/>

View File

@ -24,7 +24,7 @@ namespace NovetusLauncher
{
public LauncherFormShared launcherForm;
private System.Windows.Forms.TreeView _fieldsTreeCache;
private LauncherFormStylish FormParent;
public LauncherFormStylish FormParent;
public LauncherFormStylishInterface(LauncherFormStylish parent)
{
@ -45,11 +45,14 @@ namespace NovetusLauncher
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!IsLoaded)
return;
try
{
if (e.Source is System.Windows.Controls.TabControl)
if (e.Source is TabItem)
{
if (playTab != null && playTab.IsSelected)
if (e.Source == playTab && playTab.IsSelected)
{
launcherForm.RefreshMaps();
LoadMapDesc();
@ -57,8 +60,7 @@ namespace NovetusLauncher
clientWarningBox.Text = "";
clientDescBox.Text = "";
}
if (clientTab != null && clientTab.IsSelected)
else if (e.Source == clientTab && clientTab.IsSelected)
{
string clientdir = GlobalPaths.ClientDir;
DirectoryInfo dinfo = new DirectoryInfo(clientdir);
@ -81,14 +83,21 @@ namespace NovetusLauncher
_fieldsTreeCache.Nodes.Clear();
mapsDescBox.Text = "";
}
else
{
clientListBox.Items.Clear();
clientWarningBox.Text = "";
clientDescBox.Text = "";
mapsBox.Nodes.Clear();
_fieldsTreeCache.Nodes.Clear();
mapsDescBox.Text = "";
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
}
e.Handled = true;
}
public void LoadMapDesc()
@ -105,6 +114,9 @@ namespace NovetusLauncher
private void mapsBox_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
if (!IsLoaded)
return;
if (mapsBox.SelectedNode != null)
{
mapsBox.SelectedNode.BackColor = System.Drawing.SystemColors.Control;
@ -114,6 +126,9 @@ namespace NovetusLauncher
private void mapsBox_AfterSelect(object sender, TreeViewEventArgs e)
{
if (!IsLoaded)
return;
if (mapsBox.SelectedNode != null)
{
mapsBox.SelectedNode.BackColor = System.Drawing.SystemColors.Highlight;
@ -126,6 +141,9 @@ namespace NovetusLauncher
private void clientListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!IsLoaded)
return;
if (clientListBox.Items.Count == 0)
return;
@ -182,6 +200,9 @@ namespace NovetusLauncher
private void customizeButton_Click(object sender, RoutedEventArgs e)
{
if (!IsLoaded)
return;
CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended();
ccustom.Show();
}
@ -218,7 +239,8 @@ namespace NovetusLauncher
private void regenerateIDButton_Click(object sender, RoutedEventArgs e)
{
GlobalFuncs.GeneratePlayerID();
userIDBox.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID);
}
private void addMapButton_Click(object sender, RoutedEventArgs e)
@ -240,14 +262,56 @@ namespace NovetusLauncher
private void refreshButton_Click(object sender, RoutedEventArgs e)
{
if (!IsLoaded)
return;
launcherForm.RefreshMaps();
LoadMapDesc();
}
private void versionLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
if (!IsLoaded)
return;
launcherForm.EasterEggLogic();
}
private void userNameBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (!IsLoaded)
return;
GlobalVars.UserConfiguration.PlayerName = userNameBox.Text;
int autoNameID = launcherForm.GetSpecialNameID(GlobalVars.UserConfiguration.PlayerName);
if (LocalVars.launcherInitState == false && autoNameID > 0)
{
userIDBox.Text = autoNameID.ToString();
}
}
private void userIDBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (!IsLoaded)
return;
int parsedValue;
if (int.TryParse(userIDBox.Text, out parsedValue))
{
if (userIDBox.Text.Equals(""))
{
GlobalVars.UserConfiguration.UserID = 0;
}
else
{
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(userIDBox.Text);
}
}
else
{
GlobalVars.UserConfiguration.UserID = 0;
}
}
}
public class ClientListItem

View File

@ -26,19 +26,26 @@ namespace NovetusLauncher
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
if (args.Length == 0)
{
switch (GlobalVars.UserConfiguration.LauncherStyle)
{
case Settings.Style.Compact:
System.Windows.Forms.Application.Run(new LauncherFormCompact());
break;
case Settings.Style.Extended:
System.Windows.Forms.Application.Run(new LauncherFormExtended());
break;
case Settings.Style.Stylish:
default:
System.Windows.Forms.Application.Run(new LauncherFormStylish());
break;
try
{
switch (GlobalVars.UserConfiguration.LauncherStyle)
{
case Settings.Style.Compact:
System.Windows.Forms.Application.Run(new LauncherFormCompact());
break;
case Settings.Style.Extended:
System.Windows.Forms.Application.Run(new LauncherFormExtended());
break;
case Settings.Style.Stylish:
default:
System.Windows.Forms.Application.Run(new LauncherFormStylish());
break;
}
}
catch(Exception ex)
{
GlobalFuncs.LogExceptions(ex);
}
}
else
{