Exemplo n.º 1
0
        private void DrawOptions(Rect rect)
        {
            EditorGUILayout.BeginHorizontal();

            // Add Menu
            if (GUILayout.Button(StratusGUIStyles.addIcon, StratusGUIStyles.smallLayout))
            {
                var menu = new GenericMenu();
                menu.AddPopup("Add Trigger", triggerTypes.displayedOptions, (int index) =>
                {
                    target.gameObject.AddComponent(triggerTypes.AtIndex(index));
                    UpdateConnections();
                });
                menu.AddPopup("Add Triggerable", triggerableTypes.displayedOptions, (int index) =>
                {
                    target.gameObject.AddComponent(triggerableTypes.AtIndex(index));
                    UpdateConnections();
                });
                menu.ShowAsContext();
            }

            //if (GUILayout.Button(new GUIContent($"{messages.Count}", StratusGUIStyles.messageTexture), StratusGUIStyles.smallLayout))
            //{
            //}

            // Validation
            if (GUILayout.Button(StratusGUIStyles.validateIcon, StratusGUIStyles.smallLayout))
            {
                var menu = new GenericMenu();
                menu.AddItem(new GUIContent("Validate All"), false, () => Validate(ValidateAll));
                menu.AddItem(new GUIContent("Validate Trigger Persistence"), false, () => Validate(ValidatePersistence));
                menu.AddItem(new GUIContent("Validate Connections"), false, () => Validate(ValidateConnections));
                menu.AddItem(new GUIContent("Validate Null"), false, () => Validate(ValidateNull));
                menu.ShowAsContext();
            }

            // Options Menu
            if (GUILayout.Button(StratusGUIStyles.optionsIcon, StratusGUIStyles.smallLayout))
            {
                var menu = new GenericMenu();
                menu.AddEnumToggle <StratusTriggerSystem.ConnectionDisplay>(propertyMap[nameof(StratusTriggerSystem.connectionDisplay)]);
                menu.AddBooleanToggle(propertyMap[nameof(StratusTriggerSystem.showDescriptions)]);
                menu.AddBooleanToggle(propertyMap[nameof(StratusTriggerSystem.outlines)]);
                menu.ShowAsContext();
            }

            EditorGUILayout.EndHorizontal();
        }