using UnityEditor; using UnityEngine; using Ubisoft.Hotel.Package.Editor; namespace Ubisoft.Hotel.PackageManager.Editor { [CustomEditor(typeof(VersionProperty))] internal sealed class VersionPropertyEditor : PackagePropertyEditor { protected override void ExtendedOnInspectorGUI() { base.ExtendedOnInspectorGUI(); EditorGUI.BeginChangeCheck(); VersionProperty versionProperty = target as VersionProperty; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); float width = Mathf.Min(200, Screen.width / 3.0f); GUILayoutOption buttonOption = GUILayout.Width(width); string tooltip = "Bump major and reset minor and patch. Use it when you want to prepare the build for the next Production stage"; if (GUILayout.Button(new GUIContent("Bump major", tooltip), buttonOption)) { versionProperty.BumpMajor(); } if (GUILayout.Button(new GUIContent("Bump minor", "Bump minor and reset patch. Use it when you want to prepare the next DEV build"), buttonOption)) { versionProperty.BumpMinor(); } if (GUILayout.Button(new GUIContent("Bump patch", "Bump patch and version code. Use it when you want to release a new version to QC"), buttonOption)) { versionProperty.BumpPatch(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(versionProperty); } } } }