private void ResetLocationSection() { locationFoldouts = new AssetFoldouts(); locationAssetList = null; locationReorderableList = null; locationListSelectedIndex = -1; }
private void DrawAssets <T>(string label, List <T> assets, AssetFoldouts foldouts) where T : Asset { EditorWindowTools.StartIndentedSection(); showStateFieldAsQuest = false; DrawAssetSpecificFoldoutProperties <T>(assets); T assetToRemove = null; for (int index = 0; index < assets.Count; index++) { T asset = assets[index]; EditorGUILayout.BeginHorizontal(); if (!foldouts.properties.ContainsKey(index)) { foldouts.properties.Add(index, false); } foldouts.properties[index] = EditorGUILayout.Foldout(foldouts.properties[index], GetAssetName(asset)); if (GUILayout.Button(new GUIContent(" ", string.Format("Delete {0}.", GetAssetName(asset))), "OL Minus", GUILayout.Width(16))) { assetToRemove = asset; } EditorGUILayout.EndHorizontal(); if (foldouts.properties[index]) { DrawAsset <T>(asset, index, foldouts); } } if (assetToRemove != null) { if (EditorUtility.DisplayDialog(string.Format("Delete '{0}'?", GetAssetName(assetToRemove)), "Are you sure you want to delete this?", "Delete", "Cancel")) { assets.Remove(assetToRemove); } } EditorWindowTools.EndIndentedSection(); }
private void ResetActorSection() { actorFoldouts = new AssetFoldouts(); actorAssetList = null; actorReorderableList = null; actorListSelectedIndex = -1; }
public void DrawAssetSpecificPropertiesSecondPart(Asset asset, int index, AssetFoldouts foldouts) { if (asset is Item) { DrawItemSpecificPropertiesSecondPart(asset as Item, index, foldouts); } }
private void DrawAssetSection <T>(string label, List <T> assets, AssetFoldouts foldouts, Action menuDelegate, Action syncDatabaseDelegate, ref string filter) where T : Asset, new() { DrawFilterMenuBar(label, menuDelegate, ref filter); if (syncDatabaseDelegate != null) { syncDatabaseDelegate(); } DrawAssets <T>(label, assets, foldouts, filter); }
private void ResetItemSection() { itemFoldouts = new AssetFoldouts(); itemAssetList = null; UpdateTreatItemsAsQuests(template.treatItemsAsQuests); needToBuildLanguageListFromItems = true; itemReorderableList = null; itemListSelectedIndex = -1; }
private void DrawAsset <T>(T asset, int index, AssetFoldouts foldouts) where T : Asset { EditorWindowTools.StartIndentedSection(); EditorGUILayout.BeginVertical("button"); DrawAssetSpecificPropertiesFirstPart(asset); DrawFieldsFoldout <T>(asset, index, foldouts); DrawAssetSpecificPropertiesSecondPart(asset, index, foldouts); EditorGUILayout.EndVertical(); EditorWindowTools.EndIndentedSection(); }
private void DrawAssetSection <T>(string label, List <T> assets, AssetFoldouts foldouts, Action menuDelegate, Action syncDatabaseDelegate) where T : Asset, new() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(label + "s", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (menuDelegate != null) { menuDelegate(); } EditorGUILayout.EndHorizontal(); if (syncDatabaseDelegate != null) { syncDatabaseDelegate(); } DrawAssets <T>(label, assets, foldouts); }
public void DrawFieldsFoldout <T>(T asset, int index, AssetFoldouts foldouts) where T : Asset { EditorGUI.BeginChangeCheck(); if (!foldouts.fields.ContainsKey(index)) { foldouts.fields.Add(index, false); } EditorGUILayout.BeginHorizontal(); foldouts.fields[index] = EditorGUILayout.Foldout(foldouts.fields[index], "All Fields"); if (foldouts.fields[index]) { GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Template", "Add any missing fields from the template."), EditorStyles.miniButton, GUILayout.Width(60))) { ApplyTemplate(asset.fields, GetTemplateFields(asset)); } if (GUILayout.Button(new GUIContent("Copy", "Copy these fields to the clipboard."), EditorStyles.miniButton, GUILayout.Width(60))) { CopyFields(asset.fields); } EditorGUI.BeginDisabledGroup(clipboardFields == null); if (GUILayout.Button(new GUIContent("Paste", "Paste the clipboard into these fields."), EditorStyles.miniButton, GUILayout.Width(60))) { PasteFields(asset.fields); } EditorGUI.EndDisabledGroup(); } if (GUILayout.Button(new GUIContent(" ", "Add new field."), "OL Plus", GUILayout.Width(16))) { asset.fields.Add(new Field()); foldouts.fields[index] = true; SetDatabaseDirty("Add Field"); } EditorGUILayout.EndHorizontal(); if (foldouts.fields[index]) { DrawFieldsSection(asset.fields); } if (EditorGUI.EndChangeCheck()) { if (asset is Item) { BuildLanguageListFromFields(asset.fields); } } }
private void DrawVariable(Variable asset, int index, AssetFoldouts foldouts) { EditorWindowTools.StartIndentedSection(); EditorGUILayout.BeginVertical("button"); List<Field> fields = asset.fields; for (int i = 0; i < fields.Count; i++) { EditorGUILayout.BeginHorizontal(); if (IsTextAreaField(fields[i])) { DrawTextAreaFirstPart(fields[i], false); DrawTextAreaSecondPart(fields[i]); } else { DrawField(fields[i], false); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorWindowTools.EndIndentedSection(); }
private void DrawVariable(Variable asset, int index, AssetFoldouts foldouts) { EditorWindowTools.StartIndentedSection(); EditorGUILayout.BeginVertical("button"); List <Field> fields = asset.fields; for (int i = 0; i < fields.Count; i++) { EditorGUILayout.BeginHorizontal(); if (IsTextAreaField(fields[i])) { DrawTextAreaFirstPart(fields[i], false); DrawTextAreaSecondPart(fields[i]); } else { DrawField(fields[i], false); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorWindowTools.EndIndentedSection(); }
private void DrawVariables() { List <Variable> assets = database.variables; AssetFoldouts foldouts = variableFoldouts; EditorWindowTools.StartIndentedSection(); Variable assetToRemove = null; for (int index = 0; index < assets.Count; index++) { Variable asset = assets[index]; EditorGUILayout.BeginHorizontal(); if (!foldouts.properties.ContainsKey(index)) { foldouts.properties.Add(index, false); } foldouts.properties[index] = EditorGUILayout.Foldout(foldouts.properties[index], GetAssetName(asset)); if (GUILayout.Button(new GUIContent(" ", string.Format("Delete {0}.", GetAssetName(asset))), "OL Minus", GUILayout.Width(16))) { assetToRemove = asset; } EditorGUILayout.EndHorizontal(); if (foldouts.properties[index]) { DrawVariable(asset, index, foldouts); } } if (assetToRemove != null) { if (EditorUtility.DisplayDialog(string.Format("Delete '{0}'?", GetAssetName(assetToRemove)), "Are you sure you want to delete this?", "Delete", "Cancel")) { assets.Remove(assetToRemove); } } EditorWindowTools.EndIndentedSection(); }
private void DrawVariablesTraditional() { List <Variable> assets = database.variables; AssetFoldouts foldouts = variableFoldouts; EditorWindowTools.StartIndentedSection(); Variable assetToRemove = null; int indexToMoveUp = -1; int indexToMoveDown = -1; for (int index = 0; index < assets.Count; index++) { Variable asset = assets[index]; EditorGUILayout.BeginHorizontal(); if (!foldouts.properties.ContainsKey(index)) { foldouts.properties.Add(index, false); } foldouts.properties[index] = EditorGUILayout.Foldout(foldouts.properties[index], GetAssetName(asset)); EditorGUI.BeginDisabledGroup(index >= (assets.Count - 1)); if (GUILayout.Button(new GUIContent("↓", "Move down"), GUILayout.Width(16))) { indexToMoveDown = index; } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(index == 0); if (GUILayout.Button(new GUIContent("↑", "Move up"), GUILayout.Width(16))) { indexToMoveUp = index; } EditorGUI.EndDisabledGroup(); if (GUILayout.Button(new GUIContent(" ", string.Format("Delete {0}.", GetAssetName(asset))), "OL Minus", GUILayout.Width(16))) { assetToRemove = asset; } EditorGUILayout.EndHorizontal(); if (foldouts.properties[index]) { DrawVariable(asset, index, foldouts); } } if (indexToMoveDown >= 0) { Variable asset = assets[indexToMoveDown]; assets.RemoveAt(indexToMoveDown); assets.Insert(indexToMoveDown + 1, asset); SetDatabaseDirty("Move Variable Down"); } else if (indexToMoveUp >= 0) { Variable asset = assets[indexToMoveUp]; assets.RemoveAt(indexToMoveUp); assets.Insert(indexToMoveUp - 1, asset); SetDatabaseDirty("Move Variable Up"); } else if (assetToRemove != null) { if (EditorUtility.DisplayDialog(string.Format("Delete '{0}'?", GetAssetName(assetToRemove)), "Are you sure you want to delete this?", "Delete", "Cancel")) { assets.Remove(assetToRemove); SetDatabaseDirty("Delete Variable"); } } EditorWindowTools.EndIndentedSection(); }
private void ResetVariableSection() { variableFoldouts = new AssetFoldouts(); }
//private void RemoveQuestEntryFields(Item item, int entryNumber) { // item.fields.Remove(item.fields.Find(field => string.Equals(field.title, string.Format("Entry {0}", entryNumber)))); // string entryPrefix = string.Format("Entry {0} ", entryNumber); // item.fields.RemoveAll(field => field.title.StartsWith(entryPrefix)); //} private void DrawItemSpecificPropertiesSecondPart(Item item, int index, AssetFoldouts foldouts) { }
private void DrawAssetSection <T>(string label, List <T> assets, AssetFoldouts foldouts, Action menuDelegate, ref string filter) where T : Asset, new() { DrawAssetSection <T>(label, assets, foldouts, menuDelegate, null, ref filter); }
//private void RemoveQuestEntryFields(Item item, int entryNumber) { // item.fields.Remove(item.fields.Find(field => string.Equals(field.title, string.Format("Entry {0}", entryNumber)))); // string entryPrefix = string.Format("Entry {0} ", entryNumber); // item.fields.RemoveAll(field => field.title.StartsWith(entryPrefix)); //} private void DrawItemSpecificPropertiesSecondPart(Item item, int index, AssetFoldouts foldouts) { }
private void DrawAssets <T>(string label, List <T> assets, AssetFoldouts foldouts, string filter) where T : Asset { EditorWindowTools.StartIndentedSection(); showStateFieldAsQuest = false; DrawAssetSpecificFoldoutProperties <T>(assets); T assetToRemove = null; int indexToMoveUp = -1; int indexToMoveDown = -1; for (int index = 0; index < assets.Count; index++) { T asset = assets[index]; if (!IsAssetInFilter(asset, filter)) { continue; } EditorGUILayout.BeginHorizontal(); if (!foldouts.properties.ContainsKey(index)) { foldouts.properties.Add(index, false); } foldouts.properties[index] = EditorGUILayout.Foldout(foldouts.properties[index], GetAssetName(asset)); EditorGUI.BeginDisabledGroup(index >= (assets.Count - 1)); if (GUILayout.Button(new GUIContent("↓", "Move down"), GUILayout.Width(16))) { indexToMoveDown = index; } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(index == 0); if (GUILayout.Button(new GUIContent("↑", "Move up"), GUILayout.Width(16))) { indexToMoveUp = index; } EditorGUI.EndDisabledGroup(); if (GUILayout.Button(new GUIContent(" ", string.Format("Delete {0}.", GetAssetName(asset))), "OL Minus", GUILayout.Width(16))) { assetToRemove = asset; } EditorGUILayout.EndHorizontal(); if (foldouts.properties[index]) { DrawAsset <T>(asset, index, foldouts); } } if (indexToMoveDown >= 0) { T asset = assets[indexToMoveDown]; assets.RemoveAt(indexToMoveDown); assets.Insert(indexToMoveDown + 1, asset); SetDatabaseDirty("Move Down"); } else if (indexToMoveUp >= 0) { T asset = assets[indexToMoveUp]; assets.RemoveAt(indexToMoveUp); assets.Insert(indexToMoveUp - 1, asset); SetDatabaseDirty("Move Up"); } else if (assetToRemove != null) { if (EditorUtility.DisplayDialog(string.Format("Delete '{0}'?", GetAssetName(assetToRemove)), "Are you sure you want to delete this?", "Delete", "Cancel")) { assets.Remove(assetToRemove); SetDatabaseDirty("Delete"); } } EditorWindowTools.EndIndentedSection(); }
private void ResetVariableSection() { variableFoldouts = new AssetFoldouts(); }
private void ResetActorSection() { actorFoldouts = new AssetFoldouts(); }
private void ResetActorSection() { actorFoldouts = new AssetFoldouts(); }
private void DrawItemSpecificPropertiesSecondPart(Item item, int index, AssetFoldouts foldouts) { // Doesn't do anything right now. }
private void DrawAssetSection <T>(string label, List <T> assets, AssetFoldouts foldouts) where T : Asset, new() { DrawAssetSection <T>(label, assets, foldouts, null, null); }
private void ResetLocationSection() { locationFoldouts = new AssetFoldouts(); }
private void ResetItemSection() { itemFoldouts = new AssetFoldouts(); UpdateTreatItemsAsQuests(template.treatItemsAsQuests); needToBuildLanguageListFromItems = true; }
private void ResetLocationSection() { locationFoldouts = new AssetFoldouts(); }
private void ResetItemSection() { itemFoldouts = new AssetFoldouts(); UpdateTreatItemsAsQuests(template.treatItemsAsQuests); needToBuildLanguageListFromItems = true; }