//void ShowUnknownGUI() //{ // EditorGUILayout.Space(); // showUnknownFoldout = GUILayoutHelper.Foldout(showUnknownFoldout, new GUIContent("Unknown"), () => // { // EditorGUILayout.Space(); // GUILayoutHelper.Indent(() => // { // EditorGUILayout.LabelField("Unknown1 [1 Bytes]"); // EditorGUILayout.SelectableLabel(selectedCareer.RawData.Unknown1.ToString("X2"), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); // }); // GUILayoutHelper.Indent(() => // { // EditorGUILayout.LabelField("Unknown2 [8 Bytes]"); // string valuesString = string.Empty; // for (int i = 0; i < selectedCareer.RawData.Unknown2.Length; i++) // { // valuesString += selectedCareer.RawData.Unknown2[i].ToString("X2") + " "; // } // EditorGUILayout.SelectableLabel(valuesString, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); // }); // }); //} bool IsReady() { dfUnity = DaggerfallUnity.Instance; if (!dfUnity.IsReady || string.IsNullOrEmpty(dfUnity.Arena2Path)) { return(false); } // Read all CLASS*.CFG files if (classTemplates == null) { string[] files = Directory.GetFiles(dfUnity.Arena2Path, "class*.cfg"); if (files != null && files.Length > 0) { classTemplates = new DFCareer[files.Length - 1]; classNames = new GUIContent[files.Length - 1]; for (int i = 0; i < files.Length - 1; i++) { ClassFile classFile = new ClassFile(files[i]); classTemplates[i] = classFile.Career; classNames[i] = new GUIContent(classTemplates[i].Name); } } } // Read all ENEMY*.CFG files if (monsterTemplates == null) { MonsterFile monsterFile = new MonsterFile(); if (monsterFile.Load(Path.Combine(dfUnity.Arena2Path, MonsterFile.Filename), FileUsage.UseMemory, true)) { // First pass locates CFG record indices List <int> cfgIndices = new List <int>(); for (int i = 0; i < monsterFile.Count; i++) { string recordName = monsterFile.GetRecordName(i); if (recordName.EndsWith(".cfg", StringComparison.InvariantCultureIgnoreCase)) { cfgIndices.Add(i); } } // Second pass populates arrays monsterTemplates = new DFCareer[cfgIndices.Count]; monsterNames = new GUIContent[cfgIndices.Count]; for (int i = 0; i < cfgIndices.Count; i++) { // Read ENEMY.CFG class file from stream ClassFile classFile = new ClassFile(); byte[] data = monsterFile.GetRecordBytes(cfgIndices[i]); MemoryStream stream = new MemoryStream(data); BinaryReader reader = new BinaryReader(stream); classFile.Load(reader); reader.Close(); // Add to arrays monsterTemplates[i] = classFile.Career; monsterNames[i] = new GUIContent(monsterTemplates[i].Name); } } else { return(false); } } return(true); }