public override void OnInspectorGUI() { // Update serializedObject.Update(); // Get properties var propArena2Path = Prop("Arena2Path"); // Browse for Arena2 path EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Arena2 Path", "The local Arena2 path used for development only."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfUnity.Arena2Path, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); if (GUILayout.Button("Browse...")) { string path = EditorUtility.OpenFolderPanel("Locate Arena2 Path", "", ""); if (!string.IsNullOrEmpty(path)) { if (!DaggerfallUnity.ValidateArena2Path(path)) { EditorUtility.DisplayDialog("Invalid Path", "The selected Arena2 path is invalid", "Close"); } else { dfUnity.Arena2Path = path; propArena2Path.stringValue = path; dfUnity.EditorResetArena2Path(); } } } if (GUILayout.Button("Clear")) { dfUnity.EditorClearArena2Path(); EditorUtility.SetDirty(target); } }); // Prompt user to set Arena2 path if (string.IsNullOrEmpty(dfUnity.Arena2Path)) { EditorGUILayout.HelpBox("Please set the Arena2 path of your Daggerfall installation.", MessageType.Info); return; } // Display other GUI items DisplayOptionsGUI(); DisplayImporterGUI(); // Save modified properties serializedObject.ApplyModifiedProperties(); if (GUI.changed) EditorUtility.SetDirty(target); }
private void DisplayGUI() { DaggerfallUnity dfUnity = DaggerfallUnity.Instance; if (dfUnity == null || string.IsNullOrEmpty(dfUnity.Arena2Path)) { EditorGUILayout.HelpBox("Requires DaggerfallUnity singleton with Arena2 path set.", MessageType.Info); return; } DrawTravelMap(); DrawDefaultInspector(); if (!streamingWorld.LocalPlayerGPS) { EditorGUILayout.HelpBox("Requires player object with PlayerGPS component.", MessageType.Info); var propLocalPlayerGPS = Prop("LocalPlayerGPS"); propLocalPlayerGPS.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("", ""), propLocalPlayerGPS.objectReferenceValue, typeof(PlayerGPS), true); return; } EditorGUILayout.Space(); var propFindLocationString = Prop("EditorFindLocationString"); EditorGUILayout.LabelField(new GUIContent("Find Location", "Enter exact city name in format RegionName/CityName. Case-sensitive.")); GUILayoutHelper.Horizontal(() => { propFindLocationString.stringValue = EditorGUILayout.TextField(propFindLocationString.stringValue.Trim()); if (GUILayout.Button("Find")) { streamingWorld.__EditorFindLocation(); } }); EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Get From PlayerGPS")) { streamingWorld.__EditorGetFromPlayerGPS(); EditorUtility.SetDirty(streamingWorld.LocalPlayerGPS); } if (GUILayout.Button("Apply To PlayerGPS")) { streamingWorld.__EditorApplyToPlayerGPS(); EditorUtility.SetDirty(streamingWorld.LocalPlayerGPS); } }); //if (GUILayout.Button("Refresh Preview")) //{ // streamingWorld.__EditorRefreshPreview(); //} }
void DisplayGUI() { var runtimeInternalStrings = Prop("runtimeInternalStrings"); var runtimeRSCStrings = Prop("runtimeRSCStrings"); var runtimeBOKStrings = Prop("runtimeBOKStrings"); var runtimeFlatStrings = Prop("runtimeFlatStrings"); var tableCopyOverwriteTargetStringTables = Prop("tableCopyOverwriteTargetStringTables"); var tableCopyTargetInternalStrings = Prop("tableCopyTargetInternalStrings"); var tableCopyTargetRSCStrings = Prop("tableCopyTargetRSCStrings"); var tableCopyTargetBOKStrings = Prop("tableCopyTargetBOKStrings"); var tableCopyTargetFlatStrings = Prop("tableCopyTargetFlatStrings"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Live String Tables", EditorStyles.boldLabel); GUILayoutHelper.Indent(() => { runtimeInternalStrings.stringValue = EditorGUILayout.TextField("Internal Strings", runtimeInternalStrings.stringValue); runtimeRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings", runtimeRSCStrings.stringValue); runtimeBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings", runtimeBOKStrings.stringValue); runtimeFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings", runtimeFlatStrings.stringValue); }); EditorGUILayout.Space(); EditorGUILayout.LabelField("Copy String Tables", EditorStyles.boldLabel); GUILayoutHelper.Indent(() => { tableCopyTargetInternalStrings.stringValue = EditorGUILayout.TextField("Internal Strings > ", tableCopyTargetInternalStrings.stringValue); tableCopyTargetRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings > ", tableCopyTargetRSCStrings.stringValue); tableCopyTargetBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings > ", tableCopyTargetBOKStrings.stringValue); tableCopyTargetFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings > ", tableCopyTargetFlatStrings.stringValue); tableCopyOverwriteTargetStringTables.boolValue = EditorGUILayout.Toggle(new GUIContent("Overwrite String Tables?", "When enabled will copy over existing strings in target string tables."), tableCopyOverwriteTargetStringTables.boolValue); }); if (tableCopyOverwriteTargetStringTables.boolValue) { EditorGUILayout.HelpBox("Warning: Existing keys in the target string tables will be replaced by source.", MessageType.Warning); } else { EditorGUILayout.HelpBox("Copy will create all missing keys in target string tables from source. Existing keys will not be overwritten.", MessageType.Info); } EditorGUILayout.Space(); if (GUILayout.Button("Copy All")) { DaggerfallStringTableImporter.CopyInternalStringTable(tableCopyTargetInternalStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); DaggerfallStringTableImporter.CopyTextRSCToStringTable(tableCopyTargetRSCStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); //DaggerfallStringTableImporter.CopyTextBOKToStringTable(tableCopyTargetBOKStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); DaggerfallStringTableImporter.CopyTextFlatsToStringTable(tableCopyTargetFlatStrings.stringValue, tableCopyOverwriteTargetStringTables.boolValue); } }
void DisplaySaveImageGUI() { if (saveTextures[selectedSave] != null) { showImageFoldout = GUILayoutHelper.Foldout(showImageFoldout, new GUIContent("Image"), () => { EditorGUILayout.Space(); int height = (int)(((float)Screen.width / (float)saveTextures[selectedSave].width) * (float)saveTextures[selectedSave].height); Rect rect = EditorGUILayout.GetControlRect(false, height); EditorGUI.DrawTextureTransparent(rect, saveTextures[selectedSave], ScaleMode.StretchToFill); }); } }
void ShowAttributesGUI() { EditorGUILayout.Space(); showAttributesFoldout = GUILayoutHelper.Foldout(showAttributesFoldout, new GUIContent("Attributes"), () => { GUILayoutHelper.Indent(() => { EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Strength"); EditorGUILayout.SelectableLabel(selectedCareer.Strength.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Intelligence"); EditorGUILayout.SelectableLabel(selectedCareer.Intelligence.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Willpower"); EditorGUILayout.SelectableLabel(selectedCareer.Willpower.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Agility"); EditorGUILayout.SelectableLabel(selectedCareer.Agility.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Endurance"); EditorGUILayout.SelectableLabel(selectedCareer.Endurance.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Personality"); EditorGUILayout.SelectableLabel(selectedCareer.Personality.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Speed"); EditorGUILayout.SelectableLabel(selectedCareer.Speed.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Luck"); EditorGUILayout.SelectableLabel(selectedCareer.Luck.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
public void DisplayGUI() { DrawDefaultInspector(); GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Clear")) { dfBillboardBatch.__EditorClearBillboards(); } if (GUILayout.Button("Random")) { dfBillboardBatch.__EditorRandomLayout(); } }); }
void DisplaySaveTree(SaveTreeBaseRecord parent) { for (int i = 0; i < parent.Children.Count; i++) { RecordTypes recordType = parent.Children[i].RecordType; if (recordType == RecordTypes.Door || recordType == RecordTypes.Goods) { continue; } string textLabel = recordType.ToString(); if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell) { textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i])); } // Check if item equipped if (recordType == RecordTypes.Item) { //ItemRecord itemRecord = (ItemRecord)parent.Children[i]; //textLabel += string.Format(" [id={0}]", itemRecord.RecordRoot.RecordID); int equippedIndex = GetEquippedIndex(parent.Children[i] as ItemRecord); if (equippedIndex != -1) { //textLabel = string.Format("(*={0:00}) {1}", equippedIndex, textLabel); } } // Tag container types if (recordType == RecordTypes.Container && parent.RecordType == RecordTypes.Character) { string[] tags = { " [Weapons & Armor]", " [Magic Items]", " [Clothing & Misc]", " [Ingredients]", " [Wagon]", " [House]", " [Ship]", " [Tavern Rooms]", " [Item Repairers]" }; ContainerRecord containerRecord = (ContainerRecord)parent.Children[i]; textLabel += tags[containerRecord.RecordRoot.SpriteIndex]; } EditorGUILayout.LabelField(textLabel); GUILayoutHelper.Indent(() => { DisplaySaveTree(parent.Children[i]); }); } }
void DisplaySaveTree(SaveTreeBaseRecord parent) { for (int i = 0; i < parent.Children.Count; i++) { RecordTypes recordType = parent.Children[i].RecordType; if (recordType == RecordTypes.Door || recordType == RecordTypes.UnknownItemRecord) { continue; } string textLabel = recordType.ToString(); if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell) { textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i])); } // Check if item equipped if (recordType == RecordTypes.Item) { //ItemRecord itemRecord = (ItemRecord)parent.Children[i]; //textLabel += string.Format(" [id={0}]", itemRecord.RecordRoot.RecordID); int equippedIndex = GetEquippedIndex(parent.Children[i] as ItemRecord); if (equippedIndex != -1) { //textLabel = string.Format("(*={0:00}) {1}", equippedIndex, textLabel); } } // Tag wagon container if (recordType == RecordTypes.Container && parent.RecordType == RecordTypes.Character) { ContainerRecord containerRecord = (ContainerRecord)parent.Children[i]; if (containerRecord.IsWagon) { textLabel += " [Wagon]"; } } EditorGUILayout.LabelField(textLabel); GUILayoutHelper.Indent(() => { DisplaySaveTree(parent.Children[i]); }); } }
void ShowTolerancesGUI() { EditorGUILayout.Space(); showTolerancesFoldout = GUILayoutHelper.Foldout(showTolerancesFoldout, new GUIContent("Tolerances"), () => { EditorGUILayout.Space(); GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Paralysis"); EditorGUILayout.SelectableLabel(selectedCareer.Paralysis.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Magic"); EditorGUILayout.SelectableLabel(selectedCareer.Magic.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Poison"); EditorGUILayout.SelectableLabel(selectedCareer.Poison.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Fire"); EditorGUILayout.SelectableLabel(selectedCareer.Fire.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Frost"); EditorGUILayout.SelectableLabel(selectedCareer.Frost.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Shock"); EditorGUILayout.SelectableLabel(selectedCareer.Shock.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Disease"); EditorGUILayout.SelectableLabel(selectedCareer.Disease.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
private void DisplayEditorGUI() { var propPreset = Prop("Preset"); EditorGUILayout.Space(); propPreset.enumValueIndex = (int)(AudioPresets)EditorGUILayout.EnumPopup(new GUIContent("Preset"), (AudioPresets)propPreset.enumValueIndex); dfAudioSource.SoundIndex = EditorGUILayout.IntField(new GUIContent("Index", "Index of sound to apply. Valid range is 0-458."), dfAudioSource.SoundIndex); //EditorGUILayout.Space(); //if (GUILayout.Button("Apply")) // dfAudioSource.Apply(); EditorGUILayout.Space(); ShowPreviewSoundFoldout = GUILayoutHelper.Foldout(ShowPreviewSoundFoldout, new GUIContent("Sound Finder"), () => { GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { dfAudioSource.PreviewIndex = EditorGUILayout.IntField(new GUIContent("Preview Index", "Preview sound by index. Valid range is 0-458."), dfAudioSource.PreviewIndex); if (GUILayout.Button("Preview")) { dfAudioSource.EditorPreviewByIndex(); } }); GUILayoutHelper.Horizontal(() => { dfAudioSource.PreviewID = EditorGUILayout.IntField(new GUIContent("Preview ID", "Preview sound by ID."), dfAudioSource.PreviewID); if (GUILayout.Button("Preview")) { dfAudioSource.EditorPreviewByID(); } }); GUILayoutHelper.Horizontal(() => { dfAudioSource.PreviewClip = (SoundClips)EditorGUILayout.EnumPopup(new GUIContent("Preview Clip", "Preview sound by clip enum."), dfAudioSource.PreviewClip); if (GUILayout.Button("Preview")) { dfAudioSource.EditorPreviewBySoundClip(); } }); }); }); }
void DisplayGUI() { DrawDefaultInspector(); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("String Importer", "Import classic text data into named String Table Collections.\nNOTE: You must create collections manually.\nWARNING: Existing collections will be cleared."), EditorStyles.boldLabel); GUILayoutHelper.Horizontal(() => { var rscCollectionName = Prop("textRSCCollection"); if (GUILayout.Button("Import All")) { DaggerfallStringTableImporter.ImportTextRSCToStringTables(rscCollectionName.stringValue); } if (GUILayout.Button("Clear All")) { DaggerfallStringTableImporter.ClearStringTables(rscCollectionName.stringValue); } }); }
private void DisplayGUI() { DrawDefaultInspector(); if (Application.isPlaying) { GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Play")) { dfSongPlayer.Play(); } if (GUILayout.Button("Stop")) { dfSongPlayer.Stop(); } }); } }
private void DisplayDungeonTexturesGUI() { var propDungeonTextureUse = Prop("DungeonTextureUse"); EditorGUILayout.Space(); ShowDungeonTexturesFoldout = GUILayoutHelper.Foldout(ShowDungeonTexturesFoldout, new GUIContent("Dungeon Textures (Beta)"), () => { GUILayoutHelper.Indent(() => { propDungeonTextureUse.enumValueIndex = (int)(DungeonTextureUse)EditorGUILayout.EnumPopup(new GUIContent("Usage"), (DungeonTextureUse)propDungeonTextureUse.enumValueIndex); if (propDungeonTextureUse.enumValueIndex == (int)DungeonTextureUse.Disabled || propDungeonTextureUse.enumValueIndex == (int)DungeonTextureUse.UseLocation_PartiallyImplemented) { return; } dfDungeon.DungeonTextureTable[0] = EditorGUILayout.IntField("119 is ->", dfDungeon.DungeonTextureTable[0]); dfDungeon.DungeonTextureTable[1] = EditorGUILayout.IntField("120 is ->", dfDungeon.DungeonTextureTable[1]); dfDungeon.DungeonTextureTable[2] = EditorGUILayout.IntField("122 is ->", dfDungeon.DungeonTextureTable[2]); dfDungeon.DungeonTextureTable[3] = EditorGUILayout.IntField("123 is ->", dfDungeon.DungeonTextureTable[3]); dfDungeon.DungeonTextureTable[4] = EditorGUILayout.IntField("124 is ->", dfDungeon.DungeonTextureTable[4]); dfDungeon.DungeonTextureTable[5] = EditorGUILayout.IntField("168 is ->", dfDungeon.DungeonTextureTable[5]); GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Reset")) { dfDungeon.ResetDungeonTextureTable(); } if (GUILayout.Button("Random")) { dfDungeon.RandomiseDungeonTextureTable(); } if (GUILayout.Button("Apply")) { dfDungeon.ApplyDungeonTextureTable(); } }); }); }); }
void ShowProficienciesGUI() { EditorGUILayout.Space(); showProficienciesFoldout = GUILayoutHelper.Foldout(showProficienciesFoldout, new GUIContent("Proficiencies"), () => { EditorGUILayout.Space(); GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Short Blades"); EditorGUILayout.SelectableLabel(selectedCareer.ShortBlades.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Long Blades"); EditorGUILayout.SelectableLabel(selectedCareer.LongBlades.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Hand To Hand"); EditorGUILayout.SelectableLabel(selectedCareer.HandToHand.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Axes"); EditorGUILayout.SelectableLabel(selectedCareer.Axes.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Blunt Weapons"); EditorGUILayout.SelectableLabel(selectedCareer.BluntWeapons.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Missile Weapons"); EditorGUILayout.SelectableLabel(selectedCareer.MissileWeapons.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
void ShowAdvancementGUI() { EditorGUILayout.Space(); showAdvancementFoldout = GUILayoutHelper.Foldout(showAdvancementFoldout, new GUIContent("Advancement"), () => { EditorGUILayout.Space(); GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Max HP Per Class Level / Number of Monster HP Die Rolls"); EditorGUILayout.SelectableLabel(selectedCareer.HitPointsPerLevel.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Difficulty Multiplier"); EditorGUILayout.SelectableLabel(selectedCareer.AdvancementMultiplier.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
void DisplaySaveStatsGUI() { EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Version"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(currentSaveTree.Header.Version.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { string positionText = string.Format("X={0}, Y={1}, Z={2}", currentSaveTree.Header.CharacterPosition.Position.WorldX, currentSaveTree.Header.CharacterPosition.Position.YBase - currentSaveTree.Header.CharacterPosition.Position.YOffset, currentSaveTree.Header.CharacterPosition.Position.YBase, currentSaveTree.Header.CharacterPosition.Position.WorldZ); EditorGUILayout.LabelField(new GUIContent("Player Position", "Position of player in the world."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(positionText, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("LocationDetail records"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(currentSaveTree.LocationDetail.RecordCount.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("RecordElement records"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(currentSaveTree.RecordDictionary.Count.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); //GUILayoutHelper.Horizontal(() => //{ // EditorGUILayout.LabelField(new GUIContent("Header.Unknown"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); // EditorGUILayout.SelectableLabel(currentSaveTree.Header.Unknown.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); //}); //GUILayoutHelper.Horizontal(() => //{ // EditorGUILayout.LabelField(new GUIContent("CharacterPosition.Unknown"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); // EditorGUILayout.SelectableLabel(currentSaveTree.Header.CharacterPosition.Unknown.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); //}); }
public void DisplayGUI() { if (dfBillboardBatch.IsCustom) { EditorGUILayout.HelpBox("Cannot set properties of a custom batch material from editor at this time.", MessageType.Info); return; } DrawDefaultInspector(); GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Clear")) { dfBillboardBatch.__EditorClearBillboards(); } if (GUILayout.Button("Random")) { dfBillboardBatch.__EditorRandomLayout(); } }); }
void DisplaySaveTree(SaveTreeBaseRecord parent) { for (int i = 0; i < parent.Children.Count; i++) { RecordTypes recordType = parent.Children[i].RecordType; if (recordType == RecordTypes.UnknownTownLink || recordType == RecordTypes.UnknownItemRecord) { continue; } string textLabel = recordType.ToString(); if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell) { textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i])); } EditorGUILayout.LabelField(textLabel); GUILayoutHelper.Indent(() => { DisplaySaveTree(parent.Children[i]); }); } }
void ShowSkillsGUI() { EditorGUILayout.Space(); showSkillsFoldout = GUILayoutHelper.Foldout(showSkillsFoldout, new GUIContent("Skills"), () => { EditorGUILayout.Space(); EditorGUILayout.LabelField("Primary"); GUILayoutHelper.Indent(() => { EditorGUILayout.SelectableLabel(selectedCareer.PrimarySkill1.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.PrimarySkill2.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.PrimarySkill3.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); EditorGUILayout.Space(); EditorGUILayout.LabelField("Major"); GUILayoutHelper.Indent(() => { EditorGUILayout.SelectableLabel(selectedCareer.MajorSkill1.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MajorSkill2.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MajorSkill3.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); EditorGUILayout.Space(); EditorGUILayout.LabelField("Minor"); GUILayoutHelper.Indent(() => { EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill1.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill2.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill3.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill4.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill5.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); EditorGUILayout.SelectableLabel(selectedCareer.MinorSkill6.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }
void DisplaySaveCharacterGUI() { if (currentSaveTree == null) { return; } // Get character record List <SaveTreeBaseRecord> records = currentSaveTree.FindRecords(RecordTypes.Character); if (records.Count != 1) { return; } characterRecord = (CharacterRecord)records[0]; //CharacterSheet characterSheet = characterRecord.ToCharacterSheet(); EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Name"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(characterRecord.ParsedData.characterName, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Gender"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(((int)characterRecord.ParsedData.gender).ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { string health = string.Format("{0} / {1}", characterRecord.ParsedData.currentHealth, characterRecord.ParsedData.maxHealth); EditorGUILayout.LabelField(new GUIContent("Health"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(health, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }
void ShowMagickaGUI() { EditorGUILayout.Space(); showMagickaFoldout = GUILayoutHelper.Foldout(showMagickaFoldout, new GUIContent("Magicka"), () => { EditorGUILayout.Space(); GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Increased Magery"); EditorGUILayout.SelectableLabel(selectedCareer.SpellPointMultiplierValue.ToString("0.00 * INT"), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Darkness Powered Magery"); EditorGUILayout.SelectableLabel(selectedCareer.DarknessPoweredMagery.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Light Powered Magery"); EditorGUILayout.SelectableLabel(selectedCareer.LightPoweredMagery.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Spell Absorption"); EditorGUILayout.SelectableLabel(selectedCareer.SpellAbsorption.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Unable to regenerate spell points"); EditorGUILayout.SelectableLabel(selectedCareer.NoRegenSpellPoints.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
void DisplaySaveStatsGUI() { if (currentSaveTree == null) { return; } SaveTreeBaseRecord positionRecord = currentSaveTree.FindRecord(RecordTypes.CharacterPositionRecord); EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Version"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(currentSaveTree.Header.Version.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { string positionText = string.Format("X={0}, Y={1}, Z={2}", positionRecord.RecordRoot.Position.WorldX, positionRecord.RecordRoot.Position.WorldY, positionRecord.RecordRoot.Position.WorldZ); EditorGUILayout.LabelField(new GUIContent("Player Position", "Position of player in the world."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(positionText, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { DFPosition mapPixel = MapsFile.WorldCoordToMapPixel(positionRecord.RecordRoot.Position.WorldX, positionRecord.RecordRoot.Position.WorldZ); string mapPixelText = string.Format("X={0}, Y={1}", mapPixel.X, mapPixel.Y); EditorGUILayout.LabelField(new GUIContent("Player Map Pixel", "Position of player on small map."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(mapPixelText, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { DaggerfallDateTime time = new DaggerfallDateTime(); time.FromClassicDaggerfallTime(currentSaveVars.GameTime); EditorGUILayout.LabelField(new GUIContent("Player Time", "World time of this save."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(time.LongDateTimeString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Player Environment"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(((Environments)currentSaveTree.Header.Environment).ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("RecordElement records"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(currentSaveTree.RecordDictionary.Count.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); //GUILayoutHelper.Horizontal(() => //{ // EditorGUILayout.LabelField(new GUIContent("Header.Unknown"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); // EditorGUILayout.SelectableLabel(currentSaveTree.Header.Unknown.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); //}); //GUILayoutHelper.Horizontal(() => //{ // EditorGUILayout.LabelField(new GUIContent("CharacterPosition.Unknown"), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); // EditorGUILayout.SelectableLabel(currentSaveTree.Header.CharacterPosition.Unknown.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); //}); }
private void DisplayOptionsGUI() { EditorGUILayout.Space(); ShowOptionsFoldout = GUILayoutHelper.Foldout(ShowOptionsFoldout, new GUIContent("Options"), () => { // Performance options var propSetStaticFlags = Prop("Option_SetStaticFlags"); var propCombineRMB = Prop("Option_CombineRMB"); var propCombineRDB = Prop("Option_CombineRDB"); var propBatchBillboards = Prop("Option_BatchBillboards"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Performance"); if (!propSetStaticFlags.boolValue || !propCombineRMB.boolValue || !propCombineRDB.boolValue || !propBatchBillboards.boolValue) { EditorGUILayout.HelpBox("Performance options should only be disabled for testing.", MessageType.Warning); } GUILayoutHelper.Indent(() => { propSetStaticFlags.boolValue = EditorGUILayout.Toggle(new GUIContent("Set Static Flags", "Apply static flag where appropriate when building scenes. Billboards and dynamic objects are not marked static."), propSetStaticFlags.boolValue); propCombineRMB.boolValue = EditorGUILayout.Toggle(new GUIContent("Combine RMB", "Combine city-block meshes together."), propCombineRMB.boolValue); propCombineRDB.boolValue = EditorGUILayout.Toggle(new GUIContent("Combine RDB", "Combine dungeon-block meshes together."), propCombineRDB.boolValue); propBatchBillboards.boolValue = EditorGUILayout.Toggle(new GUIContent("Batch Billboards", "Combine billboards into batches. Some billboards are never batched, such as editor markers."), propBatchBillboards.boolValue); }); // Import options var propAddMeshColliders = Prop("Option_AddMeshColliders"); var propRMBGroundPlane = Prop("Option_RMBGroundPlane"); var propCloseCityGates = Prop("Option_CloseCityGates"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Import Options"); GUILayoutHelper.Indent(() => { propAddMeshColliders.boolValue = EditorGUILayout.Toggle(new GUIContent("Add Colliders", "Add colliders where appropriate when building scenes. Decorative billboards will not receive colliders."), propAddMeshColliders.boolValue); propRMBGroundPlane.boolValue = EditorGUILayout.Toggle(new GUIContent("RMB Ground Plane", "Adds RMB ground plane to imported city block (ignored by terrain system)."), propRMBGroundPlane.boolValue); propCloseCityGates.boolValue = EditorGUILayout.Toggle(new GUIContent("Close City Gates", "In walled cities use this flag to start city gates in closed position."), propCloseCityGates.boolValue); }); // Prefab options EditorGUILayout.Space(); EditorGUILayout.LabelField("Prefabs"); GUILayoutHelper.Indent(() => { // Lights var propImportLightPrefabs = Prop("Option_ImportLightPrefabs"); var propCityLightPrefab = Prop("Option_CityLightPrefab"); var propDungeonLightPrefab = Prop("Option_DungeonLightPrefab"); var propInteriorLightPrefab = Prop("Option_InteriorLightPrefab"); propImportLightPrefabs.boolValue = EditorGUILayout.Toggle(new GUIContent("Import Light Prefabs", "Import light prefabs into scene."), propImportLightPrefabs.boolValue); GUILayoutHelper.EnableGroup(propImportLightPrefabs.boolValue, () => { GUILayoutHelper.Indent(() => { propCityLightPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("City Lights", "Prefab for city lights."), propCityLightPrefab.objectReferenceValue, typeof(Light), false); propDungeonLightPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Dungeon Lights", "Prefab for dungeon lights."), propDungeonLightPrefab.objectReferenceValue, typeof(Light), false); propInteriorLightPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Interior Lights", "Prefab for building interior lights."), propInteriorLightPrefab.objectReferenceValue, typeof(Light), false); }); }); // Doors var propImportDoorPrefabs = Prop("Option_ImportDoorPrefabs"); var propDungeonDoorPrefab = Prop("Option_DungeonDoorPrefab"); var propInteriorDoorPrefab = Prop("Option_InteriorDoorPrefab"); EditorGUILayout.Space(); propImportDoorPrefabs.boolValue = EditorGUILayout.Toggle(new GUIContent("Import Door Prefabs", "Import door prefabs into scene."), propImportDoorPrefabs.boolValue); GUILayoutHelper.EnableGroup(propImportDoorPrefabs.boolValue, () => { GUILayoutHelper.Indent(() => { propDungeonDoorPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Dungeon Doors", "Prefab for dungeon doors."), propDungeonDoorPrefab.objectReferenceValue, typeof(DaggerfallActionDoor), false); propInteriorDoorPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Interior Doors", "Prefab for building interior doors."), propInteriorDoorPrefab.objectReferenceValue, typeof(DaggerfallActionDoor), false); }); }); // Enemies var propImportEnemyPrefabs = Prop("Option_ImportEnemyPrefabs"); var propEnemyPrefab = Prop("Option_EnemyPrefab"); EditorGUILayout.Space(); propImportEnemyPrefabs.boolValue = EditorGUILayout.Toggle(new GUIContent("Import Enemy Prefabs", "Import enemy prefabs into scene."), propImportEnemyPrefabs.boolValue); GUILayoutHelper.EnableGroup(propImportEnemyPrefabs.boolValue, () => { GUILayoutHelper.Indent(() => { propEnemyPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Enemies", "Prefab for enemies."), propEnemyPrefab.objectReferenceValue, typeof(DaggerfallEnemy), false); }); }); // Optional var propCityBlockPrefab = Prop("Option_CityBlockPrefab"); var propDungeonBlockPrefab = Prop("Option_DungeonBlockPrefab"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Optional"); GUILayoutHelper.Indent(() => { propCityBlockPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("City Blocks", "Prefab for city blocks."), propCityBlockPrefab.objectReferenceValue, typeof(DaggerfallRMBBlock), false); propDungeonBlockPrefab.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent("Dungeon Blocks", "Prefab for dungeon blocks."), propDungeonBlockPrefab.objectReferenceValue, typeof(DaggerfallRDBBlock), false); }); }); // Time & Space options var propAutomateTextureSwaps = Prop("Option_AutomateTextureSwaps"); var propAutomateSky = Prop("Option_AutomateSky"); var propAutomateCityLights = Prop("Option_AutomateCityLights"); //var propAutomateCityGates = Prop("Option_AutomateCityGates"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Time & Space"); GUILayoutHelper.Indent(() => { propAutomateTextureSwaps.boolValue = EditorGUILayout.Toggle(new GUIContent("Automate Textures", "Assign textures for climate, season, and windows at runtime based on player world position and world time."), propAutomateTextureSwaps.boolValue); propAutomateSky.boolValue = EditorGUILayout.Toggle(new GUIContent("Automate Sky", "Assign seasonal skies and full day/night cycle based on player world position and world time."), propAutomateSky.boolValue); propAutomateCityLights.boolValue = EditorGUILayout.Toggle(new GUIContent("Automate City Lights", "Turn city lights on/off based on world time."), propAutomateCityLights.boolValue); //propAutomateCityGates.boolValue = EditorGUILayout.Toggle(new GUIContent("Automate City Gates", "Open/close city gates based on world time. Not implemented."), propAutomateCityGates.boolValue); }); }); }
public override void OnInspectorGUI() { // Update serializedObject.Update(); #if UNITY_EDITOR_LINUX string message = string.Empty; message += "Linux users please set your Daggerfall installation path (i.e. parent folder of complete Daggerfall install) in Resources/fallback.ini then click 'Update Path' below."; message += " This is a temporary limitation to work around Inspector bugs in experimental Linux build."; EditorGUILayout.HelpBox(message, MessageType.Info); EditorGUILayout.SelectableLabel(dfUnity.Arena2Path, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); if (GUILayout.Button("Update Path")) { dfUnity.Arena2Path = string.Empty; dfUnity.EditorResetArena2Path(); } #else // Get properties var propArena2Path = Prop("Arena2Path"); // Browse for Arena2 path EditorGUILayout.Space(); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField(new GUIContent("Arena2 Path", "The local Arena2 path used for development only."), GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfUnity.Arena2Path, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); if (GUILayout.Button("Browse...")) { string path = EditorUtility.OpenFolderPanel("Locate Arena2 Path", "", ""); if (!string.IsNullOrEmpty(path)) { if (!DaggerfallUnity.ValidateArena2Path(path)) { EditorUtility.DisplayDialog("Invalid Path", "The selected Arena2 path is invalid", "Close"); } else { dfUnity.Arena2Path = path; propArena2Path.stringValue = path; dfUnity.EditorResetArena2Path(); } } } if (GUILayout.Button("Clear")) { dfUnity.EditorClearArena2Path(); EditorUtility.SetDirty(target); } }); // Prompt user to set Arena2 path if (string.IsNullOrEmpty(dfUnity.Arena2Path)) { EditorGUILayout.HelpBox("Please set the Arena2 path of your Daggerfall installation.", MessageType.Info); return; } #endif // Display other GUI items DisplayOptionsGUI(); DisplayImporterGUI(); // Save modified properties serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
private void DisplayAboutGUI() { EditorGUILayout.Space(); ShowAboutLocationFoldout = GUILayoutHelper.Foldout(ShowAboutLocationFoldout, new GUIContent("About"), () => { GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("ID", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.ID.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Longitude", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.Longitude.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Latitude", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.Latitude.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Map Pixel X", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.MapPixelX.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Map Pixel Y", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.MapPixelY.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("World Coord X", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.WorldCoordX.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("World Coord Z", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.WorldCoordZ.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("World Climate", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.WorldClimate.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Sky Base", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.SkyBase.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Region Name", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.RegionName, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Location Name", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.LocationName, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Has Dungeon", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.HasDungeon.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Climate Base", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.Climate.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Nature Flats", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfLocation.Summary.Nature.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }
private void DisplayImporterGUI() { // Hide importer GUI when not active in hierarchy if (!dfUnity.gameObject.activeInHierarchy) { return; } EditorGUILayout.Space(); ShowImportFoldout = GUILayoutHelper.Foldout(ShowImportFoldout, new GUIContent("Importer"), () => { GUILayoutHelper.Indent(() => { EditorGUILayout.Space(); var propModelID = Prop("ModelImporter_ModelID"); EditorGUILayout.LabelField(new GUIContent("ModelID", "Enter numeric ID of model.")); GUILayoutHelper.Horizontal(() => { propModelID.intValue = EditorGUILayout.IntField(propModelID.intValue); if (GUILayout.Button("Import")) { GameObjectHelper.CreateDaggerfallMeshGameObject((uint)propModelID.intValue, null); } }); EditorGUILayout.Space(); var propBlockName = Prop("BlockImporter_BlockName"); EditorGUILayout.LabelField(new GUIContent("Block Name", "Enter name of block. Accepts .RMB and .RDB blocks.")); GUILayoutHelper.Horizontal(() => { propBlockName.stringValue = EditorGUILayout.TextField(propBlockName.stringValue.Trim().ToUpper()); if (GUILayout.Button("Import")) { // Create block if (propBlockName.stringValue.EndsWith(".RMB")) { GameObjectHelper.CreateRMBBlockGameObject(propBlockName.stringValue, dfUnity.Option_RMBGroundPlane, dfUnity.Option_CityBlockPrefab); } else if (propBlockName.stringValue.EndsWith(".RDB")) { GameObjectHelper.CreateRDBBlockGameObject( propBlockName.stringValue, null, true, DFRegion.DungeonTypes.HumanStronghold, 0.5f, 4, (int)DateTime.Now.Ticks, dfUnity.Option_DungeonBlockPrefab); } } }); EditorGUILayout.Space(); var propCityName = Prop("CityImporter_CityName"); EditorGUILayout.LabelField(new GUIContent("City Name", "Enter exact city name in format RegionName/CityName. Case-sensitive.")); GUILayoutHelper.Horizontal(() => { propCityName.stringValue = EditorGUILayout.TextField(propCityName.stringValue.Trim()); if (GUILayout.Button("Import")) { GameObjectHelper.CreateDaggerfallLocationGameObject(propCityName.stringValue, null); } }); EditorGUILayout.Space(); var propDungeonName = Prop("DungeonImporter_DungeonName"); EditorGUILayout.LabelField(new GUIContent("Dungeon Name", "Enter exact dungeon name in format RegionName/DungeonName. Case-sensitive.")); GUILayoutHelper.Horizontal(() => { propDungeonName.stringValue = EditorGUILayout.TextField(propDungeonName.stringValue.Trim()); if (GUILayout.Button("Import")) { GameObjectHelper.CreateDaggerfallDungeonGameObject(propDungeonName.stringValue, null); } }); }); }); }
void DisplayFactionsFoldout() { if (factionDict.Count == 0) { return; } foreach (var kvp in factionDict) { FactionFile.FactionData faction = kvp.Value; string textLabel = faction.name; if (!factionFoldoutDict.ContainsKey(faction.id)) { factionFoldoutDict.Add(faction.id, false); } factionFoldoutDict[faction.id] = GUILayoutHelper.Foldout(factionFoldoutDict[faction.id], new GUIContent(textLabel), () => { GUILayoutHelper.Indent(() => { int parentid = faction.parent; string parentText = "None"; if (parentid > 0) { parentText = factionDict[parentid].name; } EditorGUILayout.LabelField(string.Format("Parent: {0}", parentText)); EditorGUILayout.LabelField(string.Format("Type: {0}", (FactionFile.FactionTypes)faction.type)); EditorGUILayout.LabelField(string.Format("Reputation: {0}", faction.rep)); int region = faction.region; string regionText = "None"; if (region > 0) { regionText = dfUnity.ContentReader.MapFileReader.GetRegionName(region); } EditorGUILayout.LabelField(string.Format("Region: {0}", regionText)); int ruler = faction.ruler; if (ruler > 0) { EditorGUILayout.LabelField(string.Format("Ruler: {0}", factionDict[ruler].name)); } int ally1 = faction.ally1; int ally2 = faction.ally2; int ally3 = faction.ally3; if (ally1 > 0) { EditorGUILayout.LabelField(string.Format("Ally1: {0}", factionDict[ally1].name)); } if (ally2 > 0) { EditorGUILayout.LabelField(string.Format("Ally2: {0}", factionDict[ally2].name)); } if (ally3 > 0) { EditorGUILayout.LabelField(string.Format("Ally2: {0}", factionDict[ally3].name)); } int enemy1 = faction.enemy1; int enemy2 = faction.enemy2; int enemy3 = faction.enemy3; if (enemy1 > 0) { EditorGUILayout.LabelField(string.Format("Enemy1: {0}", factionDict[enemy1].name)); } if (enemy2 > 0) { EditorGUILayout.LabelField(string.Format("Enemy2: {0}", factionDict[enemy2].name)); } if (enemy3 > 0) { EditorGUILayout.LabelField(string.Format("Enemy3: {0}", factionDict[enemy3].name)); } int sgroup = faction.sgroup; if (sgroup > 0) { EditorGUILayout.LabelField(string.Format("SocialGroup: {0}", (FactionFile.SocialGroups)sgroup)); } int ggroup = faction.ggroup; if (ggroup > 0) { EditorGUILayout.LabelField(string.Format("GuildGroup: {0}", (FactionFile.GuildGroups)ggroup)); } int vam = faction.vam; if (vam > 0) { EditorGUILayout.LabelField(string.Format("VampireClan: {0}", factionDict[vam].name)); } }); }); } }
void OnGUI() { if (!IsReady()) { EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info); return; } EditorGUILayout.Space(); selectedRegion = EditorGUILayout.Popup(selectedRegion, regionNames); if (selectedRegion != lastSelectedRegion) { locationNames.Clear(); ReloadCurrentRegion(); } // Search bar GUILayout.BeginHorizontal(GUI.skin.FindStyle("Toolbar")); searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField")); if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton"))) { // Remove focus if cleared searchString = ""; GUI.FocusControl(null); } GUILayout.EndHorizontal(); bool search = false; if (string.IsNullOrEmpty(searchString)) { if (locationNames.Count == regionData.LocationCount) { locationNames.Clear(); } GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Cities")) { EnumerateLocationsByType(SearchPatterns.Cities); } if (GUILayout.Button("Dungeons")) { EnumerateLocationsByType(SearchPatterns.Dungeons); } if (GUILayout.Button("Graveyards")) { EnumerateLocationsByType(SearchPatterns.Graveyards); } if (GUILayout.Button("Homes")) { EnumerateLocationsByType(SearchPatterns.Homes); } if (GUILayout.Button("Taverns")) { EnumerateLocationsByType(SearchPatterns.Taverns); } if (GUILayout.Button("Temples")) { EnumerateLocationsByType(SearchPatterns.Temples); } }); } else { if (locationNames.Count != regionData.LocationCount) { EnumerateLocationsByType(SearchPatterns.All); } search = true; } int totalLocations = 0; string regionSlash = regionNames[selectedRegion] + "/"; scrollPos = GUILayoutHelper.ScrollView(scrollPos, () => { for (int i = 0; i < locationNames.Count; i++) { string multiName = regionSlash + locationNames[i]; if (search) { int index = locationNames[i].IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase); if (index != -1) { ShowLocationItem(multiName); totalLocations++; } } else { ShowLocationItem(multiName); totalLocations++; } } }); EditorGUILayout.LabelField("Total locations found: " + totalLocations); }
void OnGUI() { if (!IsReady()) { EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info); return; } if (selectedSave != lastSelectedSave || currentSaveTree == null) { currentSaveTree = saveTrees[selectedSave]; currentSaveVars = saveVars[selectedSave]; if (currentSaveTree == null || currentSaveVars == null) { return; } currentItems = currentSaveTree.FindRecords(RecordTypes.Item).ToArray(); // Merge savetree faction data factionDict = factionFile.Merge(currentSaveVars); lastSelectedSave = selectedSave; } if (saveTrees != null && saveTrees.Length > 0) { DisplaySaveSelectGUI(); DisplaySaveImageGUI(); DisplaySaveStatsGUI(); DisplaySaveCharacterGUI(); scrollPos = GUILayoutHelper.ScrollView(scrollPos, () => { EditorGUILayout.Space(); showFactionsFoldout = GUILayoutHelper.Foldout(showFactionsFoldout, new GUIContent("Factions"), () => { GUILayoutHelper.Indent(() => { DisplayFactionsFoldout(); }); }); EditorGUILayout.Space(); showItemsFoldout = GUILayoutHelper.Foldout(showItemsFoldout, new GUIContent("Items"), () => { GUILayoutHelper.Indent(() => { DisplayItemsFoldout(); }); }); EditorGUILayout.Space(); showSaveTreeFoldout = GUILayoutHelper.Foldout(showSaveTreeFoldout, new GUIContent("SaveTree"), () => { EditorGUILayout.HelpBox("Temporarily Filtering out records of type Door and UnknownItemRecord to keep list manageable.", MessageType.Info); DisplaySaveTree(currentSaveTree.RootRecord); }); }); } }
private void DisplayAboutGUI() { EditorGUILayout.Space(); ShowCustomBillboardFoldout = GUILayoutHelper.Foldout(ShowCustomBillboardFoldout, new GUIContent("Custom"), () => { var propCustomArchive = Prop("customArchive"); var propCustomRecord = Prop("customRecord"); GUILayoutHelper.Indent(() => { propCustomArchive.intValue = EditorGUILayout.IntField(new GUIContent("Archive", "Set texture archive index (e.g. TEXTURE.210 is 210)"), propCustomArchive.intValue); propCustomRecord.intValue = EditorGUILayout.IntField(new GUIContent("Record", "Set texture record index (between 0-n)"), propCustomRecord.intValue); if (GUILayout.Button("Set Billboard Texture")) { try { dfBillboard.SetMaterial(propCustomArchive.intValue, propCustomRecord.intValue); } catch (Exception ex) { Debug.Log("Failed to set custom billboard texture. Exception: " + ex.Message); } } if (GUILayout.Button("Align To Surface")) { GameObjectHelper.AlignBillboardToGround(dfBillboard.gameObject, dfBillboard.Summary.Size, 4); } }); }); EditorGUILayout.Space(); ShowAboutBillboardFoldout = GUILayoutHelper.Foldout(ShowAboutBillboardFoldout, new GUIContent("About"), () => { GUILayoutHelper.Indent(() => { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("File", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(TextureFile.IndexToFileName(dfBillboard.Summary.Archive), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Index", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.Record.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); //GUILayoutHelper.Horizontal(() => //{ // EditorGUILayout.LabelField("In Dungeon", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); // EditorGUILayout.SelectableLabel(dfBillboard.Summary.InDungeon.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); //}); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Is Mobile", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.IsMobile.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); if (dfBillboard.Summary.IsMobile) { GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Flags", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.Flags.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Type", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.FixedEnemyType.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); } GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Is Atlased", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.AtlasedMaterial.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Is Animated", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.AnimatedMaterial.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); GUILayoutHelper.Horizontal(() => { EditorGUILayout.LabelField("Current Frame", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.SelectableLabel(dfBillboard.Summary.CurrentFrame.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); }); }); }); }