private void OnGUI() { if (AdvGame.GetReferences().settingsManager == null) { EditorGUILayout.HelpBox("A Settings Manager must be assigned before this window can display correctly.", MessageType.Warning); return; } SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; sceneAttributes = settingsManager.sceneAttributes; EditorGUILayout.HelpBox("Values for attributes defined here can be set in the Scene Manager, and checked using the 'Scene: Check attribute' Action.", MessageType.Info); EditorGUILayout.Space(); CreateAttributesGUI(); if (selectedSceneAttribute != null && sceneAttributes.Contains(selectedSceneAttribute)) { EditorGUILayout.Space(); string apiPrefix = "AC.KickStarter.variablesManager.GetProperty (" + selectedSceneAttribute.id + ")"; EditorGUILayout.BeginVertical(CustomStyles.thinBox); EditorGUILayout.LabelField("Inventory property '" + selectedSceneAttribute.label + "' properties", CustomStyles.subHeader); EditorGUILayout.Space(); selectedSceneAttribute.label = CustomGUILayout.TextField("Name:", selectedSceneAttribute.label, apiPrefix + ".label"); selectedSceneAttribute.type = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedSceneAttribute.type, apiPrefix + ".type"); if (selectedSceneAttribute.type == VariableType.PopUp) { selectedSceneAttribute.popUps = VariablesManager.PopupsGUI(selectedSceneAttribute.popUps); } EditorGUILayout.EndVertical(); } settingsManager.sceneAttributes = sceneAttributes; if (GUI.changed) { EditorUtility.SetDirty(settingsManager); } }
private void PropertiesGUI() { List <string> binList = new List <string>(); foreach (InvBin bin in bins) { binList.Add(bin.label); } EditorGUILayout.Space(); CreatePropertiesGUI(); EditorGUILayout.Space(); if (selectedInvVar != null && invVars.Contains(selectedInvVar)) { string apiPrefix = "AC.KickStarter.variablesManager.GetProperty (" + selectedInvVar.id + ")"; EditorGUILayout.BeginVertical(CustomStyles.thinBox); EditorGUILayout.LabelField("Inventory property '" + selectedInvVar.label + "' properties", CustomStyles.subHeader); EditorGUILayout.Space(); selectedInvVar.label = CustomGUILayout.TextField("Name:", selectedInvVar.label, apiPrefix + ".label"); selectedInvVar.type = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedInvVar.type, apiPrefix + ".type"); if (selectedInvVar.type == VariableType.PopUp) { selectedInvVar.popUps = VariablesManager.PopupsGUI(selectedInvVar.popUps); } selectedInvVar.limitToCategories = EditorGUILayout.BeginToggleGroup("Limit to set categories?", selectedInvVar.limitToCategories); if (bins.Count > 0) { List <int> newCategoryIDs = new List <int>(); foreach (InvBin bin in bins) { bool usesCategory = false; if (selectedInvVar.categoryIDs.Contains(bin.id)) { usesCategory = true; } usesCategory = CustomGUILayout.Toggle("Use in '" + bin.label + "'?", usesCategory, apiPrefix + ".categoryIDs"); if (usesCategory) { newCategoryIDs.Add(bin.id); } } selectedInvVar.categoryIDs = newCategoryIDs; } else if (selectedInvVar.limitToCategories) { EditorGUILayout.HelpBox("No categories are defined!", MessageType.Warning); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); } if (GUI.changed) { foreach (InvItem item in items) { RebuildProperties(item); } } }