private void DrawUpgradeBottomPanel() { if (GUILayout.Button("Delete", GUILayout.MinHeight(30))) { UpgradesUtility.DeleteSelectedUpgrade(); } }
private void DrawPriceSettings(UpgradePriceSettings priceSettings) { SerializedObject serializedObject = new SerializedObject(priceSettings); serializedObject.Update(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(serializedObject.FindProperty("pricePrefix")); EditorGUILayout.PropertyField(serializedObject.FindProperty("priceSuffix")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); var existingType = priceSettings.PriceProgression.GetType() == typeof(ArithmeticProgression) ? ProgressionType.Arithmetic : ProgressionType.Geometric; progressionType = existingType; SerializedObject serializedProgression = new SerializedObject(priceSettings.PriceProgression); serializedProgression.Update(); DrawDefaultInspector(serializedProgression); serializedProgression.ApplyModifiedProperties(); progressionType = (ProgressionType)EditorGUILayout.EnumPopup(progressionType); if (existingType != progressionType) { UpgradesUtility.ChangeProgressionType(priceSettings, progressionType); } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }
private void DrawAddUpgradeButton() { EditorGUILayout.BeginVertical(GUILayout.MinHeight(70)); newWeaponName = GUILayout.TextField(newWeaponName); if (GUILayout.Button("Add Upgrade", GUILayout.MinHeight(30))) { UpgradesUtility.CreateUpgradeSetting(newWeaponName); } EditorGUILayout.EndVertical(); }
private void DrawValueSettings(UpgradeValueSettings valueSettings, int index) { if (valueSettings == null) { return; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(index.ToString()); if (GUILayout.Button("X", GUILayout.MaxWidth(24))) { UpgradesUtility.RemoveValueSettings(valueSettings); UpgradesUtility.RemoveMissingValueSettings(); return; } EditorGUILayout.EndHorizontal(); SerializedObject serializedObject = new SerializedObject(valueSettings); serializedObject.Update(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(serializedObject.FindProperty("valueName")); EditorGUILayout.PropertyField(serializedObject.FindProperty("prefix")); EditorGUILayout.PropertyField(serializedObject.FindProperty("suffix")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); var existingType = valueSettings.ValueProgression.GetType() == typeof(ArithmeticProgression) ? ProgressionType.Arithmetic : ProgressionType.Geometric; progressionType = existingType; SerializedObject serializedProgression = new SerializedObject(valueSettings.ValueProgression); serializedProgression.Update(); DrawDefaultInspector(serializedProgression); serializedProgression.ApplyModifiedProperties(); progressionType = (ProgressionType)EditorGUILayout.EnumPopup(progressionType); if (existingType != progressionType) { UpgradesUtility.ChangeProgressionType(valueSettings, progressionType); } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }
private void DrawUpgradeValuesSettings() { EditorGUILayout.LabelField("Value Settings"); EditorGUILayout.BeginVertical("box"); for (int i = 0; i < UpgradesUtility.SelectedSetting.UpgradeValueProgressions.Length; i++) { DrawValueSettings(UpgradesUtility.SelectedSetting.UpgradeValueProgressions[i], i); } if (GUILayout.Button("Add Value")) { UpgradesUtility.AddValueSettings(UpgradesUtility.SelectedSetting); } EditorGUILayout.EndVertical(); }
private void OnFocus() { UpgradesUtility.Initialize(); UpgradesUtility.UpdateUpgradeSettingsList(); }