partcolors enhancements
This commit is contained in:
parent
ae8bf46a44
commit
83c92a486e
|
|
@ -42,7 +42,7 @@ class CharacterCustomizationShared
|
|||
#endregion
|
||||
|
||||
#region Form Event Functions
|
||||
public async void InitForm()
|
||||
public void InitForm()
|
||||
{
|
||||
if (GlobalFuncs.HasColorsChanged())
|
||||
{
|
||||
|
|
@ -112,10 +112,7 @@ class CharacterCustomizationShared
|
|||
}
|
||||
|
||||
int imgsize = (FormStyle == Settings.Style.Extended) ? 28 : 18;
|
||||
string oldTitle = Parent.Text;
|
||||
Parent.Text = "Please Wait...";
|
||||
await PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, ColorView, imgsize);
|
||||
Parent.Text = oldTitle;
|
||||
PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, ColorView, imgsize);
|
||||
|
||||
//body
|
||||
SelectedPartLabel.Text = SelectedPart;
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@ public class OnlineClothing
|
|||
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ContentProviderXMLName))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(ContentProviders));
|
||||
|
||||
FileStream fs = new FileStream(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ContentProviderXMLName, FileMode.Open);
|
||||
ContentProviders providers;
|
||||
providers = (ContentProviders)serializer.Deserialize(fs);
|
||||
fs.Close();
|
||||
|
||||
using (FileStream fs = new FileStream(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ContentProviderXMLName, FileMode.Open))
|
||||
{
|
||||
providers = (ContentProviders)serializer.Deserialize(fs);
|
||||
}
|
||||
|
||||
return providers.Providers;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,15 +237,15 @@ partial class CharacterCustomizationCompact
|
|||
this.label30.Name = "label30";
|
||||
this.label30.Size = new System.Drawing.Size(271, 15);
|
||||
this.label30.TabIndex = 4;
|
||||
this.label30.Text = "Incompatible colors will show up as grey in-game. ";
|
||||
this.label30.Text = "Some colors may show up as grey in-game.";
|
||||
this.label30.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.HideSelection = false;
|
||||
this.listView1.Location = new System.Drawing.Point(6, 15);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(271, 115);
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public partial class CharacterCustomizationCompact : Form
|
|||
void CharacterCustomizationLoad(object sender, EventArgs e)
|
||||
{
|
||||
characterCustomizationForm.InitForm();
|
||||
CenterToScreen();
|
||||
}
|
||||
|
||||
void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -398,13 +398,12 @@ partial class CharacterCustomizationExtended
|
|||
//
|
||||
this.label30.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label30.ForeColor = System.Drawing.Color.Red;
|
||||
this.label30.Location = new System.Drawing.Point(6, 156);
|
||||
this.label30.Location = new System.Drawing.Point(6, 177);
|
||||
this.label30.Name = "label30";
|
||||
this.label30.Size = new System.Drawing.Size(329, 36);
|
||||
this.label30.Size = new System.Drawing.Size(329, 15);
|
||||
this.label30.TabIndex = 5;
|
||||
this.label30.Text = "Some colors may be incompatible with earlier clients. Incompatible colors will sh" +
|
||||
"ow up as grey in-game. ";
|
||||
this.label30.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.label30.Text = "Some colors may show up as grey in-game.";
|
||||
this.label30.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
|
|
@ -412,7 +411,7 @@ partial class CharacterCustomizationExtended
|
|||
this.listView1.Location = new System.Drawing.Point(6, 16);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(329, 137);
|
||||
this.listView1.Size = new System.Drawing.Size(329, 161);
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public partial class CharacterCustomizationExtended : Form
|
|||
void CharacterCustomizationLoad(object sender, EventArgs e)
|
||||
{
|
||||
characterCustomizationForm.InitForm();
|
||||
CenterToScreen();
|
||||
}
|
||||
|
||||
void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACe
|
||||
OAAAAk1TRnQBSQFMAgEBAwEAAYQBAQGEAQEBQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
OAAAAk1TRnQBSQFMAgEBAwEAAYwBAQGMAQEBQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
BAABAQIAAUADAAEBAQABCAYAAUAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ public class PartColor
|
|||
public string ColorGroup;
|
||||
[XmlIgnore]
|
||||
public string ColorRawName;
|
||||
[XmlIgnore]
|
||||
public Bitmap ColorImage;
|
||||
}
|
||||
|
||||
[XmlRoot("PartColors")]
|
||||
|
|
@ -39,32 +41,34 @@ public class PartColorLoader
|
|||
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(PartColors));
|
||||
|
||||
FileStream fs = new FileStream(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName, FileMode.Open);
|
||||
PartColors colors;
|
||||
colors = (PartColors)serializer.Deserialize(fs);
|
||||
fs.Close();
|
||||
|
||||
for (int i = 0; i < colors.ColorList.Length; i++)
|
||||
using (FileStream fs = new FileStream(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName, FileMode.Open))
|
||||
{
|
||||
string colorFixed = Regex.Replace(colors.ColorList[i].ColorRGB, @"[\[\]\{\}\(\)\<\> ]", "");
|
||||
string[] rgbValues = colorFixed.Split(',');
|
||||
colors.ColorList[i].ColorObject = Color.FromArgb(Convert.ToInt32(rgbValues[0]), Convert.ToInt32(rgbValues[1]), Convert.ToInt32(rgbValues[2]));
|
||||
colors = (PartColors)serializer.Deserialize(fs);
|
||||
}
|
||||
|
||||
if (!(colors.ColorList[i].ColorName.Contains("[") && colors.ColorList[i].ColorName.Contains("]")))
|
||||
foreach (var item in colors.ColorList)
|
||||
{
|
||||
string colorFixed = Regex.Replace(item.ColorRGB, @"[\[\]\{\}\(\)\<\> ]", "");
|
||||
string[] rgbValues = colorFixed.Split(',');
|
||||
item.ColorObject = Color.FromArgb(Convert.ToInt32(rgbValues[0]), Convert.ToInt32(rgbValues[1]), Convert.ToInt32(rgbValues[2]));
|
||||
|
||||
if (!(item.ColorName.Contains("[") && item.ColorName.Contains("]")))
|
||||
{
|
||||
colors.ColorList[i].ColorRawName = colors.ColorList[i].ColorName;
|
||||
colors.ColorList[i].ColorName = "[Uncategorized]" + colors.ColorList[i].ColorName;
|
||||
item.ColorRawName = item.ColorName;
|
||||
item.ColorName = "[Uncategorized]" + item.ColorName;
|
||||
}
|
||||
else
|
||||
{
|
||||
colors.ColorList[i].ColorRawName = colors.ColorList[i].ColorName;
|
||||
item.ColorRawName = item.ColorName;
|
||||
}
|
||||
|
||||
int pFrom = colors.ColorList[i].ColorName.IndexOf("[");
|
||||
int pTo = colors.ColorList[i].ColorName.IndexOf("]");
|
||||
colors.ColorList[i].ColorGroup = colors.ColorList[i].ColorName.Substring(pFrom + 1, pTo - pFrom - 1);
|
||||
colors.ColorList[i].ColorName = colors.ColorList[i].ColorName.Replace(colors.ColorList[i].ColorGroup, "").Replace("[", "").Replace("]", "");
|
||||
int pFrom = item.ColorName.IndexOf("[");
|
||||
int pTo = item.ColorName.IndexOf("]");
|
||||
item.ColorGroup = item.ColorName.Substring(pFrom + 1, pTo - pFrom - 1);
|
||||
item.ColorName = item.ColorName.Replace(item.ColorGroup, "").Replace("[", "").Replace("]", "");
|
||||
item.ColorImage = GeneratePartColorIcon(item, 128);
|
||||
}
|
||||
|
||||
return colors.ColorList;
|
||||
|
|
@ -76,11 +80,7 @@ public class PartColorLoader
|
|||
}
|
||||
|
||||
//make faster
|
||||
#if !BASICLAUNCHER
|
||||
public static async Task AddPartColorsToListView(PartColor[] PartColorList, ListView ColorView, int imgsize, bool showIDs = false)
|
||||
#else
|
||||
public static void AddPartColorsToListView(PartColor[] PartColorList, ListView ColorView, int imgsize, bool showIDs = false)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -110,21 +110,19 @@ public class PartColorLoader
|
|||
|
||||
lvi.Group = group;
|
||||
|
||||
#if !BASICLAUNCHER
|
||||
Bitmap Bmp = await GeneratePartColorIconAsync(item, imgsize);
|
||||
if (Bmp != null)
|
||||
if (item.ColorImage != null)
|
||||
{
|
||||
ColorImageList.Images.Add(item.ColorName, Bmp);
|
||||
ColorImageList.Images.Add(item.ColorName, item.ColorImage);
|
||||
lvi.ImageIndex = ColorImageList.Images.IndexOfKey(item.ColorName);
|
||||
}
|
||||
#endif
|
||||
|
||||
ColorView.Items.Add(lvi);
|
||||
}
|
||||
|
||||
foreach (var group in ColorView.Groups.Cast<ListViewGroup>())
|
||||
/*foreach (var group in ColorView.Groups.Cast<ListViewGroup>())
|
||||
{
|
||||
group.Header = group.Header + " (" + group.Items.Count + ")";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
#if URI || LAUNCHER || CMD
|
||||
catch (Exception ex)
|
||||
|
|
@ -137,15 +135,6 @@ public class PartColorLoader
|
|||
}
|
||||
}
|
||||
|
||||
#if !BASICLAUNCHER
|
||||
public static async Task<Bitmap> GeneratePartColorIconAsync(PartColor color, int imgsize)
|
||||
{
|
||||
Task<Bitmap> task = Task<Bitmap>.Factory.StartNew(() => GeneratePartColorIcon(color, imgsize));
|
||||
await task;
|
||||
return task.Result;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static Bitmap GeneratePartColorIcon(PartColor color, int imgsize)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -269,8 +269,6 @@ public class GlobalFuncs
|
|||
}
|
||||
}
|
||||
|
||||
GlobalVars.ColorsLoaded = InitColors();
|
||||
|
||||
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization))
|
||||
{
|
||||
Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
|
||||
|
|
@ -592,7 +590,7 @@ public class GlobalFuncs
|
|||
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
|
||||
{
|
||||
tempList = PartColorLoader.GetPartColors();
|
||||
if (tempList.Length == GlobalVars.PartColorList.Length)
|
||||
if (tempList.Length != GlobalVars.PartColorList.Length)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -721,6 +719,40 @@ public class GlobalFuncs
|
|||
ChangeGameSettings(ClientName);
|
||||
}
|
||||
|
||||
//Modified from https://stackoverflow.com/questions/4286487/is-there-any-lorem-ipsum-generator-in-c
|
||||
public static string LoremIpsum(int minWords, int maxWords,
|
||||
int minSentences, int maxSentences,
|
||||
int numParagraphs)
|
||||
{
|
||||
|
||||
var words = new[]{"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer",
|
||||
"adipiscing", "elit", "sed", "diam", "nonummy", "nibh", "euismod",
|
||||
"tincidunt", "ut", "laoreet", "dolore", "magna", "aliquam", "erat"};
|
||||
|
||||
var rand = new Random();
|
||||
int numSentences = rand.Next(maxSentences - minSentences)
|
||||
+ minSentences + 1;
|
||||
int numWords = rand.Next(maxWords - minWords) + minWords + 1;
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
for (int p = 0; p < numParagraphs; p++)
|
||||
{
|
||||
result.Append("lorem ipsum ");
|
||||
for (int s = 0; s < numSentences; s++)
|
||||
{
|
||||
for (int w = 0; w < numWords; w++)
|
||||
{
|
||||
if (w > 0) { result.Append(" "); }
|
||||
result.Append(words[rand.Next(words.Length)]);
|
||||
}
|
||||
result.Append(". ");
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
public static void GenerateDefaultClientInfo(string path)
|
||||
{
|
||||
FileFormat.ClientInfo DefaultClientInfo = new FileFormat.ClientInfo();
|
||||
|
|
@ -751,7 +783,7 @@ public class GlobalFuncs
|
|||
}
|
||||
else
|
||||
{
|
||||
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation.");
|
||||
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation. It must be named either RobloxApp.exe or RobloxApp_client.exe in order to function.");
|
||||
throw clientNotFoundEX;
|
||||
}
|
||||
|
||||
|
|
@ -763,12 +795,13 @@ public class GlobalFuncs
|
|||
}
|
||||
else
|
||||
{
|
||||
IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation.");
|
||||
IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation. You must have a CSMPFunctions.lua script in your client's content/scripts folder.");
|
||||
throw clientNotFoundEX;
|
||||
}
|
||||
|
||||
string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient +
|
||||
"' was pre-generated by Novetus for your convienence. You will need to load and save this clientinfo.nov file into the Client SDK.";
|
||||
"' was pre-generated by Novetus for your convienence. You will need to load this clientinfo.nov file into the Client SDK for additional options.\n\n"
|
||||
+ LoremIpsum(1, 128, 1, 6, 1);
|
||||
|
||||
DefaultClientInfo.Description = desc;
|
||||
|
||||
|
|
@ -2189,6 +2222,20 @@ public class GlobalFuncs
|
|||
#if LAUNCHER || URI
|
||||
public static void LaunchCharacterCustomization()
|
||||
{
|
||||
//https://stackoverflow.com/questions/9029351/close-all-open-forms-except-the-main-menu-in-c-sharp
|
||||
FormCollection fc = Application.OpenForms;
|
||||
|
||||
foreach (Form frm in fc)
|
||||
{
|
||||
//iterate through
|
||||
if (frm.Name == "CharacterCustomizationExtended" ||
|
||||
frm.Name == "CharacterCustomizationCompact")
|
||||
{
|
||||
frm.Close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (GlobalVars.UserConfiguration.LauncherStyle)
|
||||
{
|
||||
case Settings.Style.Extended:
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ namespace NovetusLauncher
|
|||
void MainFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
launcherForm.InitForm();
|
||||
CenterToScreen();
|
||||
}
|
||||
|
||||
void MainFormClose(object sender, CancelEventArgs e)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace NovetusLauncher
|
|||
void MainFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
launcherForm.InitForm();
|
||||
CenterToScreen();
|
||||
}
|
||||
|
||||
void MainFormClose(object sender, CancelEventArgs e)
|
||||
|
|
|
|||
|
|
@ -310,20 +310,6 @@ public partial class ItemCreationSDK : Form
|
|||
|
||||
if (LaunchCharCustom == DialogResult.Yes)
|
||||
{
|
||||
//https://stackoverflow.com/questions/9029351/close-all-open-forms-except-the-main-menu-in-c-sharp
|
||||
FormCollection fc = Application.OpenForms;
|
||||
|
||||
foreach (Form frm in fc)
|
||||
{
|
||||
//iterate through
|
||||
if (frm.Name == "CharacterCustomizationExtended" ||
|
||||
frm.Name == "CharacterCustomizationCompact")
|
||||
{
|
||||
frm.Close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GlobalFuncs.LaunchCharacterCustomization();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#region Usings
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
|
|
@ -45,7 +40,7 @@ public partial class ItemCreationSDKColorMenu : Form
|
|||
Close();
|
||||
}
|
||||
|
||||
private async void ItemCreationSDKColorMenu_Load(object sender, EventArgs e)
|
||||
private void ItemCreationSDKColorMenu_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (GlobalFuncs.HasColorsChanged())
|
||||
{
|
||||
|
|
@ -60,10 +55,7 @@ public partial class ItemCreationSDKColorMenu : Form
|
|||
return;
|
||||
}
|
||||
|
||||
string oldTitle = Text;
|
||||
Text = "Please Wait...";
|
||||
await PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, colorMenu, 32, true);
|
||||
Text = oldTitle;
|
||||
PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, colorMenu, 48, true);
|
||||
CenterToScreen();
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ namespace NovetusLauncher
|
|||
|
||||
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
|
||||
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
|
||||
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
|
||||
if (args.Length == 0)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace NovetusURI
|
|||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
|
||||
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
|
||||
if (args.Length == 0)
|
||||
{
|
||||
Application.Run(new InstallForm());
|
||||
|
|
|
|||
Loading…
Reference in New Issue