using UnityEditor; using UnityEngine; namespace Ubisoft.Hotel.Package.Editor { [CustomEditor(typeof(PackageSuite), true)] public sealed class PackageSuiteEditor : PackagePropertyCompositeEditor { public string GetSetupSelectedValuesAsString() { string returnValue = null; PackageSuite packageSuite = target as PackageSuite; if (packageSuite != null && packageSuite.PackageSuiteSetup != null) { returnValue = packageSuite.PackageSuiteSetup.GetSelectedValuesAsString(true); } return returnValue; } public override void OnInspectorGUI() { Draw(true); } public void Draw(bool fullMode) { PackageSuite packageSuite = target as PackageSuite; GUIStyle titleStyle = EditorStyles.whiteLabel; if (fullMode) { EditorGUILayout.LabelField("3.1) Setup", titleStyle); } if (packageSuite.PackageSuiteSetup != null) { if (packageSuite.PackageSuiteSetup.Keys != null) { string[] options; foreach (string key in packageSuite.PackageSuiteSetup.Keys) { options = packageSuite.PackageSuiteSetup.GetValuesByKeyAsString(key); if (options != null) { int latestIndex = packageSuite.PackageSuiteSetup.GetSelectedValueByKey(key); int newIndex = EditorGUILayout.Popup(packageSuite.PackageSuiteSetup.GetShortKeyByKey(key), latestIndex, options); if (newIndex != latestIndex) { packageSuite.PackageSuiteSetup.SetSelectedValueByKeyAsString(key, options[newIndex]); } } } } } if (fullMode) { DrawSectionSeparator(); EditorGUILayout.LabelField("3.2) Properties", titleStyle); base.OnInspectorGUI(); } } private void DrawSectionSeparator() { EditorGUILayout.Space(); EditorGUILayout.Space(); } } }