// Render item element signals fields
        private void RenderListItemSignals(List <UiLayoutPreset> list, UiLayoutPreset item, ItemType type)
        {
            InternalLayout.ButtonSignals
            (
                "Show on signals",
                "Select signals to show " + GetItemPrefabName(item),
                item.SignalsShow,
                (string[] result) =>
            {
                item.SignalsShow = result;
                Repaint();
            }
            );

            InternalLayout.ButtonSignals
            (
                "Hide on signals",
                "Select signals to hide " + GetItemPrefabName(item),
                item.SignalsHide,
                (string[] result) =>
            {
                item.SignalsHide = result;
                Repaint();
            }
            );
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            UiButton button = target as UiButton;

            button.IsEnabled = EditorGUILayout.Toggle(new GUIContent("Enabled", "Is button interactable"), button.IsEnabled);

            button._transitionType = (UiButton.TransitionType)EditorGUILayout.EnumPopup("Transition Type", button._transitionType);

            switch (button._transitionType)
            {
            case UiButton.TransitionType.None:
                break;

            case UiButton.TransitionType.ObjectsSwap:
                button._objectNormal   = (GameObject)EditorGUILayout.ObjectField("    Normal", button._objectNormal, typeof(GameObject), allowSceneObjects: true);
                button._objectHover    = (GameObject)EditorGUILayout.ObjectField("    Hover", button._objectHover, typeof(GameObject), allowSceneObjects: true);
                button._objectPressed  = (GameObject)EditorGUILayout.ObjectField("    Pressed", button._objectPressed, typeof(GameObject), allowSceneObjects: true);
                button._objectDisabled = (GameObject)EditorGUILayout.ObjectField("    Disabled", button._objectDisabled, typeof(GameObject), allowSceneObjects: true);

                button._transitionTime = EditorGUILayout.FloatField(new GUIContent("    Transition Time", ""), button._transitionTime);

                break;
            }

            EditorGUILayout.PropertyField(serializedObject.FindProperty("_captions"), new GUIContent("Captions [?]", "Array of text fields that can be changed dynamically"), includeChildren: true);

            button._interactionDelay = EditorGUILayout.FloatField(new GUIContent("Interaction Delay [?]", "Time in seconds to prevent undesirable interactions repeat like double click"), button._interactionDelay);

            InternalLayout.ButtonSignals
            (
                "Signals on click",
                "Select signals to dispatch on button click",
                button._signalsClick,
                (string[] result) =>
            {
                button._signalsClick = result;
                Repaint();
            }
            );

            serializedObject.ApplyModifiedProperties();
        }
        private static void RenderAnimationClip(UiAnimationClip clip)
        {
            clip.Name = InternalUiAnimationEditorGUI.InspectorTextField
                        (
                "Name",
                clip.Name
                        );

            clip.Loop = InternalUiAnimationEditorGUI.InspectorBooleanField
                        (
                new GUIContent("Loop animation"),
                clip.Loop
                        );

            List <string> triggers = new List <string>();

            if (clip.PlayOnAwake)
            {
                triggers.Add("Awake");
            }

            if (clip.PlayOnLayoutElementShow)
            {
                triggers.Add("Element Show");
            }

            if (clip.PlayOnLayoutElementHide)
            {
                triggers.Add("Element Hide");
            }

            if (clip.PlayOnSignals.Length > 0)
            {
                triggers.Add("Signals");
            }

            string playon = "";

            if (triggers.Count > 1)
            {
                playon += " " + triggers.Count + " triggers";
            }
            else if (triggers.Count > 0)
            {
                playon += " " + triggers[0];
            }
            else
            {
                playon = " ...";
            }

            _expandPlayOnBlock = EditorGUILayout.Foldout(_expandPlayOnBlock, "Play on" + playon, true);

            if (_expandPlayOnBlock)
            {
                clip.PlayOnAwake = InternalUiAnimationEditorGUI.InspectorBooleanField
                                   (
                    new GUIContent("   Awake"),
                    clip.PlayOnAwake
                                   );

                clip.PlayOnLayoutElementShow = InternalUiAnimationEditorGUI.InspectorBooleanField
                                               (
                    new GUIContent("   Element show"),
                    clip.PlayOnLayoutElementShow
                                               );

                clip.PlayOnLayoutElementHide = InternalUiAnimationEditorGUI.InspectorBooleanField
                                               (
                    new GUIContent("   Element hide"),
                    clip.PlayOnLayoutElementHide
                                               );

                InternalLayout.ButtonSignals
                (
                    "   Signals",
                    "Select signals to play animation clip",
                    clip.PlayOnSignals,
                    (string[] result) =>
                {
                    clip.PlayOnSignals = result;
                },
                    15
                );
            }
        }