public void updateActiveCharaList(Chara[] list, int totalProfiles, int[] active) { lstActiveChara.Items.Clear(); for (int a = 0; a < active.Length; a++) { if (active[a] >= 0) { for (int c = 0; c < totalProfiles; c++) { if(list[c].getID() == active[a]) { lstActiveChara.Items.Add("Slot " + a + ": " + list[c].getName() + " | " + list[c].getID()); } } } else { lstActiveChara.Items.Add("Slot " + a + ":"); } } }
Color universalColor = Color.White; // Sets the color for all charas #endregion Fields #region Constructors // Constructor for manager. public CharaManager(ContentManager contentmanager, bool EnableDebugging) { // Get Content Manager contentManager = contentmanager; bDebugging = EnableDebugging; // create debugger window string stamp = Convert.ToString(System.DateTime.Today); stamp = stamp.Remove(10); stamp = stamp.Replace('/', '_'); stamp = stamp.Replace('/', '_'); cManWin.runStamp = stamp; if (bDebugging) cManWin.Show(); // Write Info about CharaManager to debug: Console.WriteLine("======================================================================="); Console.WriteLine("=== CharaManager - Importing All Chara data ==="); Console.WriteLine("======================================================================="); // Look at the asset directory and look chara folders directoryList = Directory.GetDirectories("Content/assets/chara"); // go through directories and bring in .xnb assets ([chara folder, chara pose]) for (int i = 0; i < directoryList.Length; i++) { charaProfiles++; // Store directory in temp array string[] tempList = Directory.GetFiles(directoryList[i]); // See if there is a settings.chara file and send it to the chara object string fileSettingsDir = "0"; for (int u = 0; u < tempList.Length; u++) { if (tempList[u].Contains("settings.chara")) { fileSettingsDir = tempList[u]; } } // Figure out the current chara's name int pos = directoryList[i].LastIndexOf('\\'); string charName = directoryList[i].Substring(pos); charName = charName.Remove(0, 1); // Rip out full path of chara poses to better file them. for (int b = 0; b < tempList.Length; b++) { // Remove up to pose name pos = tempList[b].LastIndexOf('\\'); tempList[b] = tempList[b].Remove(0, pos + 1); // Remove file extension (.png) pos = tempList[b].LastIndexOf('.'); tempList[b] = tempList[b].Remove(pos, 4); //Console.WriteLine(pos + " " + tempList[b]); } // Write temp array to new chara object charaArray[i] = new Chara(tempList, charName, i, fileSettingsDir, contentmanager); // write temp array to master for (int x = 0; x < tempList.Length; x++) { charaList[i, x] = tempList[x]; //Console.WriteLine("CharaPose Found: " + charaList[i, x]); charaPoses++; } } // Init activeChara List for (int i = 0; i < activeCharas.Length; i++) { activeCharas[i] = -1; } // output the amount of profiles and poses. Console.WriteLine("There are " + charaProfiles + " chara profiles, and " + charaPoses + " Chara poses."); Console.WriteLine("======================================================================="); }