changed splash functionality

This commit is contained in:
Bitl 2021-10-25 11:17:36 -07:00
parent c1beb71c6b
commit 327968b878
4 changed files with 201 additions and 71 deletions

View File

@ -4,41 +4,83 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
#endregion
#region Splash Reader
public static class SplashReader
{
private static string RandomSplash()
{
string[] splashes = File.ReadAllLines(GlobalPaths.ConfigDir + "\\splashes.txt");
CryptoRandom random = new CryptoRandom();
string splash = "";
try
{
splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)];
string[] splashes = File.ReadAllLines(GlobalPaths.ConfigDir + "\\splashes.txt");
try
{
bool checkStylishSplash = true;
string generatedSplash = splashes[random.Next(0, splashes.Length - 1)];
while (checkStylishSplash)
{
if (generatedSplash.Contains("[stylish]"))
{
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish)
{
splash = generatedSplash.Replace("[stylish]", "");
checkStylishSplash = false;
}
else
{
generatedSplash = splashes[random.Next(0, splashes.Length - 1)];
}
}
else if (generatedSplash.Contains("[normal]"))
{
if (GlobalVars.UserConfiguration.LauncherStyle != Settings.Style.Stylish)
{
splash = generatedSplash.Replace("[normal]", "");
checkStylishSplash = false;
}
else
{
generatedSplash = splashes[random.Next(0, splashes.Length - 1)];
}
}
else
{
splash = generatedSplash;
checkStylishSplash = false;
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
try
{
splash = splashes[0];
}
catch (Exception ex2)
{
GlobalFuncs.LogExceptions(ex2);
splash = "missingno";
return splash;
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
try
{
splash = splashes[0];
}
catch (Exception ex2)
{
GlobalFuncs.LogExceptions(ex2);
splash = "missingno";
return splash;
}
splash = "missingno";
return splash;
}
CryptoRandom random = new CryptoRandom();
string formattedsplash = splash
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, 32)));
.Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish ? 64 : 32))));
return formattedsplash;
}

View File

@ -117,6 +117,17 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label4.Text" xml:space="preserve">
<value>NOTE:
- If you have a problem where you can't see your character, REGENERATE YOUR PLAYER ID THEN REJOIN THE SERVER.
- If you tried to connect to the server and you get an error, REJOIN THE SERVER.
- To reset your character, type !!!reset into chat.
- Your tripcode will only be seen by you and the server host of any server you join. It is used to verify that you are a unique player.
</value>
</data>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@ -125,7 +136,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB0
CQAAAk1TRnQBSQFMAgEBAgEAAXABAAFwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBAgEAAYgBAAGIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@ -166,17 +177,6 @@
AT8EAAL/AfABBwQAAf8BxwHAAQMEAAH/AYMBxAEhBAAB/wEDAYgBAQQAAfgBBwGRAQcEAAHgAQ8BkwHP
BAAB4gEfARIBAQQAAecBHwESAQEEAAHnAZ8BkwEZBAAB5wEfAZABCQQAAeABPwGIAQEEAAHwAX8BxgFB
BAAC/wHAAQEEAAL/AfABGQQAA/8B+QQACw==
</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>NOTE:
- If you have a problem where you can't see your character, REGENERATE YOUR PLAYER ID THEN REJOIN THE SERVER.
- If you tried to connect to the server and you get an error, REJOIN THE SERVER.
- To reset your character, type !!!reset into chat.
- Your tripcode will only be seen by you and the server host of any server you join. It is used to verify that you are a unique player.
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

View File

@ -37,63 +37,101 @@ partial class SplashTester
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashTester));
this.label12 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.splashLabelNormal = new System.Windows.Forms.Label();
this.entryBox = new System.Windows.Forms.TextBox();
this.Preview = new System.Windows.Forms.Label();
this.splashLabelStylish = new System.Windows.Forms.Label();
this.changeStylishColor = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label12
// splashLabelNormal
//
this.label12.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.label12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label12.ForeColor = System.Drawing.Color.Black;
this.label12.Location = new System.Drawing.Point(31, 22);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(214, 17);
this.label12.TabIndex = 0;
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.splashLabelNormal.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.splashLabelNormal.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.splashLabelNormal.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splashLabelNormal.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.splashLabelNormal.ForeColor = System.Drawing.Color.Black;
this.splashLabelNormal.Location = new System.Drawing.Point(297, 23);
this.splashLabelNormal.Name = "splashLabelNormal";
this.splashLabelNormal.Size = new System.Drawing.Size(214, 17);
this.splashLabelNormal.TabIndex = 0;
this.splashLabelNormal.Text = "Novetus!";
this.splashLabelNormal.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox1
// entryBox
//
this.textBox1.Location = new System.Drawing.Point(12, 58);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(261, 39);
this.textBox1.TabIndex = 52;
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
this.entryBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.entryBox.Location = new System.Drawing.Point(12, 110);
this.entryBox.Multiline = true;
this.entryBox.Name = "entryBox";
this.entryBox.Size = new System.Drawing.Size(795, 96);
this.entryBox.TabIndex = 52;
this.entryBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.entryBox.TextChanged += new System.EventHandler(this.entryBox_TextChanged);
//
// Preview
//
this.Preview.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.Preview.AutoSize = true;
this.Preview.Location = new System.Drawing.Point(115, 9);
this.Preview.Location = new System.Drawing.Point(381, 7);
this.Preview.Name = "Preview";
this.Preview.Size = new System.Drawing.Size(45, 13);
this.Preview.TabIndex = 53;
this.Preview.Text = "Preview";
//
// splashLabelStylish
//
this.splashLabelStylish.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.splashLabelStylish.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(135)))), ((int)(((byte)(13)))));
this.splashLabelStylish.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splashLabelStylish.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold);
this.splashLabelStylish.ForeColor = System.Drawing.Color.White;
this.splashLabelStylish.Location = new System.Drawing.Point(62, 47);
this.splashLabelStylish.Name = "splashLabelStylish";
this.splashLabelStylish.Size = new System.Drawing.Size(689, 32);
this.splashLabelStylish.TabIndex = 54;
this.splashLabelStylish.Text = "Novetus!";
this.splashLabelStylish.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.splashLabelStylish.Paint += new System.Windows.Forms.PaintEventHandler(this.splashLabelStylish_Paint);
//
// changeStylishColor
//
this.changeStylishColor.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.changeStylishColor.Location = new System.Drawing.Point(353, 82);
this.changeStylishColor.Name = "changeStylishColor";
this.changeStylishColor.Size = new System.Drawing.Size(103, 22);
this.changeStylishColor.TabIndex = 55;
this.changeStylishColor.Text = "Change Color";
this.changeStylishColor.UseVisualStyleBackColor = true;
this.changeStylishColor.Click += new System.EventHandler(this.changeStylishColor_Click);
//
// SplashTester
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(285, 109);
this.ClientSize = new System.Drawing.Size(819, 213);
this.Controls.Add(this.changeStylishColor);
this.Controls.Add(this.splashLabelStylish);
this.Controls.Add(this.Preview);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label12);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Controls.Add(this.entryBox);
this.Controls.Add(this.splashLabelNormal);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimumSize = new System.Drawing.Size(835, 252);
this.Name = "SplashTester";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Splash Tester";
this.Load += new System.EventHandler(this.SplashTester_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label splashLabelNormal;
private System.Windows.Forms.TextBox entryBox;
private System.Windows.Forms.Label Preview;
private System.Windows.Forms.Label splashLabelStylish;
private System.Windows.Forms.Button changeStylishColor;
}

View File

@ -1,23 +1,73 @@
#region Usings
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
#endregion
#region Splash Tester
public partial class SplashTester : Form
public partial class SplashTester : Form
{
#region Constructor
public SplashTester()
{
#region Constructor
public SplashTester()
{
InitializeComponent();
}
#endregion
#region Form Events
private void textBox1_TextChanged(object sender, EventArgs e)
{
label12.Text = textBox1.Text;
}
#endregion
InitializeComponent();
}
#endregion
#region Form Events
private void entryBox_TextChanged(object sender, EventArgs e)
{
splashLabelNormal.Text = entryBox.Text;
splashLabelStylish.Text = entryBox.Text;
}
private void SplashTester_Load(object sender, EventArgs e)
{
//splash loader
CryptoRandom rand = new CryptoRandom();
int randColor = rand.Next(0, 3);
if (randColor == 0)
{
splashLabelStylish.BackColor = Color.FromArgb(245, 135, 13);
}
else if (randColor == 1)
{
splashLabelStylish.BackColor = Color.FromArgb(255, 3, 2);
}
else if (randColor == 2)
{
splashLabelStylish.BackColor = Color.FromArgb(238, 154, 181);
}
CenterToScreen();
}
private void changeStylishColor_Click(object sender, EventArgs e)
{
Color orange = Color.FromArgb(245, 135, 13);
Color red = Color.FromArgb(255, 3, 2);
Color pink = Color.FromArgb(238, 154, 181);
if (splashLabelStylish.BackColor == pink)
{
splashLabelStylish.BackColor = orange;
}
else if (splashLabelStylish.BackColor == orange)
{
splashLabelStylish.BackColor = red;
}
else if (splashLabelStylish.BackColor == red)
{
splashLabelStylish.BackColor = pink;
}
}
void splashLabelStylish_Paint(object sender, PaintEventArgs e)
{
GlobalFuncs.DrawBorderSimple(e.Graphics, splashLabelStylish.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1);
}
#endregion
}
#endregion