From e3c80e66041000286a1de7d9acc2c6db3cc70f98 Mon Sep 17 00:00:00 2001 From: JC Snider Date: Thu, 30 Aug 2018 01:38:59 -0400 Subject: [PATCH] Simplifying a bit. --- Intersect Character Generator/Layer.cs | 20 ++++++------- Intersect Character Generator/frmGenerator.cs | 30 +++++++++---------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Intersect Character Generator/Layer.cs b/Intersect Character Generator/Layer.cs index ec80ef7..46d7bad 100644 --- a/Intersect Character Generator/Layer.cs +++ b/Intersect Character Generator/Layer.cs @@ -16,7 +16,7 @@ public class Layer public Dictionary MaleParts = new Dictionary(); public Dictionary FemaleParts = new Dictionary(); - private List directories = new List(); + private string directory; private DarkComboBox cmbItems; private DarkButton colorBtn; private frmGenerator frmGenerator; @@ -30,7 +30,7 @@ public class Layer private Bitmap alteredGraphic; public string graphicPath = ""; - public Layer(string[] folderNames, DarkComboBox itemList, DarkButton colorButton, ColorDialog colorD, TrackBar intBar, TrackBar aBar,PictureBox lockPic, frmGenerator form) + public Layer(string folderName, DarkComboBox itemList, DarkButton colorButton, ColorDialog colorD, TrackBar intBar, TrackBar aBar,PictureBox lockPic, frmGenerator form) { if (!Directory.Exists("assets")) Directory.CreateDirectory("assets"); frmGenerator = form; @@ -38,7 +38,7 @@ public Layer(string[] folderNames, DarkComboBox itemList, DarkButton colorButton intensityBar = intBar; lockBox = lockPic; alphaBar = aBar; - directories.AddRange(folderNames); + directory = folderName; cmbItems = itemList; colorBtn = colorButton; LoadItems(); @@ -296,14 +296,12 @@ private void LoadItems() { MaleParts.Clear(); FemaleParts.Clear(); - foreach (var folder in directories) - { - if (!Directory.Exists(Path.Combine("assets", folder))) Directory.CreateDirectory(Path.Combine("assets", folder)); - AddImagesToList(Path.Combine("assets", folder, "male"), MaleParts); - AddImagesToList(Path.Combine("assets", folder, "female"), FemaleParts); - AddImagesToList(Path.Combine("assets", folder, "unisex"), MaleParts); - AddImagesToList(Path.Combine("assets", folder, "unisex"), FemaleParts); - } + var folder = directory; + if (!Directory.Exists(Path.Combine("assets", folder))) Directory.CreateDirectory(Path.Combine("assets", folder)); + AddImagesToList(Path.Combine("assets", folder, "male"), MaleParts); + AddImagesToList(Path.Combine("assets", folder, "female"), FemaleParts); + AddImagesToList(Path.Combine("assets", folder, "unisex"), MaleParts); + AddImagesToList(Path.Combine("assets", folder, "unisex"), FemaleParts); MaleParts = SortDictionary(MaleParts); FemaleParts = SortDictionary(FemaleParts); } diff --git a/Intersect Character Generator/frmGenerator.cs b/Intersect Character Generator/frmGenerator.cs index 0742164..0a592c9 100644 --- a/Intersect Character Generator/frmGenerator.cs +++ b/Intersect Character Generator/frmGenerator.cs @@ -33,21 +33,21 @@ public frmGenerator() private void frmGenerator_Load(object sender, EventArgs e) { - _layers.Add(new Layer(new string[] { "charbase", "bodies" }, cmbBody, btnBodyHue, colorDialog, trkBodyHueIntensity, trkBodyAlpha, picBodyLock, this)); - _layers.Add(new Layer(new string[] { "eyes" }, cmbEyes, btnEyesHue, colorDialog, trkEyesHueIntensity, trkEyesAlpha, picEyesLock, this)); - _layers.Add(new Layer(new string[] { "hair" }, cmbHair, btnHairHue, colorDialog, trkHairHueIntensity, trkHairAlpha, picHairLock, this)); - _layers.Add(new Layer(new string[] { "facialhair" }, cmbFacialHair, btnFacialHairHue, colorDialog, trkFacialHairHueIntensity, trkFacialHairAlpha, picFacialHairLock, this)); - _layers.Add(new Layer(new string[] { "headwear" }, cmbHeadwear, btnHeadwearHue, colorDialog, trkHeadwearHueIntensity, trkHeadwearAlpha, picHeadwearLock, this)); - _layers.Add(new Layer(new string[] { "shirt" }, cmbShirt, btnShirtHue, colorDialog, trkShirtHueIntensity, trkShirtAlpha, picShirtLock, this)); - _layers.Add(new Layer(new string[] { "shoulders" }, cmbShoulders, btnShouldersHue, colorDialog, trkShouldersHueIntensity, trkShouldersAlpha, picShouldersLock, this)); - _layers.Add(new Layer(new string[] { "gloves" }, cmbGloves, btnGlovesHue, colorDialog, trkGlovesHueIntensity, trkGlovesAlpha, picGlovesLock, this)); - _layers.Add(new Layer(new string[] { "pants" }, cmbPants, btnPantsHue, colorDialog, trkPantsHueIntensity, trkPantsAlpha, picPantsLock, this)); - _layers.Add(new Layer(new string[] { "waist" }, cmbWaist, btnWaistHue, colorDialog, trkWaistHueIntensity, trkWaistAlpha, picWaistLock, this)); - _layers.Add(new Layer(new string[] { "boots" }, cmbBoots, btnBootsHue, colorDialog, trkBootsHueIntensity, trkBootsAlpha, picBootsLock, this)); - _layers.Add(new Layer(new string[] { "accessories" }, cmbAccessory1, btnBootsHue, colorDialog, trkAccessory1HueIntensity, trkAccessory1Alpha, picAccessory1Lock, this)); - _layers.Add(new Layer(new string[] { "accessories" }, cmbAccessory2, btnBootsHue, colorDialog, trkAccessory2HueIntensity, trkAccessory2Alpha, picAccessory2Lock, this)); - _layers.Add(new Layer(new string[] { "accessories" }, cmbAccessory3, btnBootsHue, colorDialog, trkAccessory3HueIntensity, trkAccessory3Alpha, picAccessory3Lock, this)); - _layers.Add(new Layer(new string[] { "accessories" }, cmbAccessory4, btnBootsHue, colorDialog, trkAccessory4HueIntensity, trkAccessory4Alpha, picAccessory4Lock, this)); + _layers.Add(new Layer("bodies", cmbBody, btnBodyHue, colorDialog, trkBodyHueIntensity, trkBodyAlpha, picBodyLock, this)); + _layers.Add(new Layer("eyes", cmbEyes, btnEyesHue, colorDialog, trkEyesHueIntensity, trkEyesAlpha, picEyesLock, this)); + _layers.Add(new Layer("hair", cmbHair, btnHairHue, colorDialog, trkHairHueIntensity, trkHairAlpha, picHairLock, this)); + _layers.Add(new Layer("facialhair", cmbFacialHair, btnFacialHairHue, colorDialog, trkFacialHairHueIntensity, trkFacialHairAlpha, picFacialHairLock, this)); + _layers.Add(new Layer("headwear", cmbHeadwear, btnHeadwearHue, colorDialog, trkHeadwearHueIntensity, trkHeadwearAlpha, picHeadwearLock, this)); + _layers.Add(new Layer("shirt", cmbShirt, btnShirtHue, colorDialog, trkShirtHueIntensity, trkShirtAlpha, picShirtLock, this)); + _layers.Add(new Layer("shoulders", cmbShoulders, btnShouldersHue, colorDialog, trkShouldersHueIntensity, trkShouldersAlpha, picShouldersLock, this)); + _layers.Add(new Layer("gloves", cmbGloves, btnGlovesHue, colorDialog, trkGlovesHueIntensity, trkGlovesAlpha, picGlovesLock, this)); + _layers.Add(new Layer("pants", cmbPants, btnPantsHue, colorDialog, trkPantsHueIntensity, trkPantsAlpha, picPantsLock, this)); + _layers.Add(new Layer("waist", cmbWaist, btnWaistHue, colorDialog, trkWaistHueIntensity, trkWaistAlpha, picWaistLock, this)); + _layers.Add(new Layer("boots", cmbBoots, btnBootsHue, colorDialog, trkBootsHueIntensity, trkBootsAlpha, picBootsLock, this)); + _layers.Add(new Layer("accessories", cmbAccessory1, btnBootsHue, colorDialog, trkAccessory1HueIntensity, trkAccessory1Alpha, picAccessory1Lock, this)); + _layers.Add(new Layer("accessories", cmbAccessory2, btnBootsHue, colorDialog, trkAccessory2HueIntensity, trkAccessory2Alpha, picAccessory2Lock, this)); + _layers.Add(new Layer("accessories", cmbAccessory3, btnBootsHue, colorDialog, trkAccessory3HueIntensity, trkAccessory3Alpha, picAccessory3Lock, this)); + _layers.Add(new Layer("accessories", cmbAccessory4, btnBootsHue, colorDialog, trkAccessory4HueIntensity, trkAccessory4Alpha, picAccessory4Lock, this)); _saveSpriteDialog = new SaveFileDialog(); _saveSpriteDialog.Filter = "PNG Image|*.png";