Beispiel #1
0
        private void DrawAdvancedPanel()
        {
            GUILayout.Space(3);
            EditorGUILayout.BeginVertical(GUI.skin.box);

            foldOutAdvanced.target = EditorGUILayout.Foldout(foldOutAdvanced.target, "   Advanced", true, GUI.skin.label);

            if (foldOutAdvanced.faded > 0)
            {
                EditorGUILayout.BeginFadeGroup(foldOutAdvanced.faded);

                GUILayout.Space(3);

                GUI.backgroundColor = new Color(0f, 0f, 0f, 0.5f);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                GUI.backgroundColor = Color.white;

                bool profilePropertyIdentical = ValuesIsIdentical(GetSelectedItemsValues <TSSProfile>("profile"));

                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "profile");
                if (item.profile == null && profilePropertyIdentical && GUILayout.Button(TSSEditorUtils.addKeyButtonContent, TSSEditorUtils.max18pxWidth))
                {
                    item.profile = TSSProfileEditor.CreateProfileAsset();
                    TSSProfile.ProfileApply(item, item.profile);
                    Selection.SetActiveObjectWithContext(item.gameObject, item);
                }
                if (item.profile != null && profilePropertyIdentical && GUILayout.Button(TSSEditorUtils.delKeyButtonContent, TSSEditorUtils.max18pxWidth))
                {
                    item.profile = null;
                }
                EditorGUILayout.EndHorizontal();

                if (item.profile != null && profilePropertyIdentical)
                {
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button(applyProfileButton))
                    {
                        Undo.RecordObject(item.profile, "[TSS Item] applying profile");
                        TSSProfile.ProfileApply(item, item.profile);
                    }

                    if (GUILayout.Button(revertProfileButton))
                    {
                        foreach (Transform itemTransform in Selection.transforms)
                        {
                            TSSItem item = itemTransform.GetComponent <TSSItem>();
                            if (item == null)
                            {
                                continue;
                            }
                            Undo.RecordObject(item, "[TSS Item] revert profile");
                            TSSProfile.ProfileRevert(item, item.profile);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.EndVertical();

                TSSEditorUtils.BeginBlackVertical();

                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "activationOpen");
                DrawItemProperty(item, "activationClose");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "activationStart");
                EditorGUILayout.BeginVertical();
                DrawItemProperty(item, "loops");
                if (item.loops != 0 && ValuesIsIdentical(GetSelectedItemsValues <int>("loops")))
                {
                    DrawItemProperty(item, "loopMode", null, null, false, true);
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.EndVertical();

                TSSEditorUtils.BeginBlackVertical();
                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "ignoreChilds");
                DrawItemProperty(item, "ignoreParent");
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                TSSEditorUtils.BeginBlackVertical();
                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "rotationMode");
                DrawItemProperty(item, "materialMode");
                EditorGUILayout.EndHorizontal();

                if (ValuesIsIdentical(GetSelectedItemsValues <RotationMode>("rotationMode")) && item.rotationMode == RotationMode.path)
                {
                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField(rotationMaskContent, GUILayout.MaxWidth(98));

                    DrawItemProperty(item, "rotationMaskX", "X", TSSEditorUtils.max18pxWidth);
                    DrawItemProperty(item, "rotationMaskY", "Y", TSSEditorUtils.max18pxWidth);
                    DrawItemProperty(item, "rotationMaskZ", "Z", TSSEditorUtils.max18pxWidth);

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    DrawItemProperty(item, "pathNormal");
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.EndVertical();

                TSSEditorUtils.BeginBlackVertical();
                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "interactions");
                DrawItemProperty(item, "blockRaycasting");
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                TSSEditorUtils.BeginBlackVertical();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginVertical();
                DrawItemProperty(item, "soundControl");
                if (item.soundControl && ValuesIsIdentical(GetSelectedItemsValues <bool>("soundControl")))
                {
                    DrawItemProperty(item, "soundRestart");
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical();
                DrawItemProperty(item, "videoControl");
                if (item.videoControl && ValuesIsIdentical(GetSelectedItemsValues <bool>("videoControl")))
                {
                    DrawItemProperty(item, "videoRestart");
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                if (item.text != null)
                {
                    TSSEditorUtils.BeginBlackVertical();
                    EditorGUILayout.BeginHorizontal();
                    DrawItemProperty(item, "randomWave");
                    string floatFormat = item.floatFormat;
                    DrawItemProperty(item, "floatFormat");
                    if (floatFormat != item.floatFormat)
                    {
                        try { 0f.ToString(item.floatFormat); }
                        catch { Debug.LogWarningFormat("TSS Item \"{0}({1})\" has uncorrect float format!", item.name, item.GetInstanceID()); item.floatFormat = floatFormat; }
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                }

                if (item.button != null || (item.parent != null && item.parent.button != null && item.tweens.Where(t => t.enabled && t.direction == TweenDirection.Button).ToArray().Length > 0))
                {
                    TSSEditorUtils.BeginBlackVertical();

                    EditorGUILayout.BeginHorizontal();
                    DrawItemProperty(item, "buttonDuration");
                    DrawItemProperty(item, "buttonDirection");
                    EditorGUILayout.EndHorizontal();


                    if (item.button != null && Selection.transforms.Length == 1)
                    {
                        TSSEditorUtils.DrawKeyCodeListProperty(item.values.onKeyboard, item, serializedItem.FindProperty("values").FindPropertyRelative("onKeyboard"), false);
                    }

                    EditorGUILayout.EndVertical();
                }

                TSSEditorUtils.BeginBlackVertical();
                EditorGUILayout.BeginHorizontal();
                DrawItemProperty(item, "updatingType");
                DrawItemProperty(item, "timeScaled", null, GUILayout.MaxWidth(80), true);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #2
0
        private bool DrawState(TSSState state, int stateID)
        {
            if (state == null)
            {
                return(false);
            }

            EditorGUILayout.BeginVertical();

            TSSEditorUtils.BeginBlackVertical();

            EditorGUILayout.BeginHorizontal();

            bool isStateEnabled = state.enabled;

            TSSEditorUtils.DrawGenericProperty(ref isStateEnabled, core);
            if (core.currentState == state && state.enabled && !isStateEnabled)
            {
                if (Application.isPlaying)
                {
                    state.Close();
                }
                else
                {
                    state.ActivateManualy(ActivationMode.closeBranchImmediately);
                }
                core.currentState = null;
            }

            state.enabled = isStateEnabled;

            EditorGUI.BeginDisabledGroup(!state.enabled);

            state.editing = EditorGUILayout.Foldout(state.editing, string.Format("   {0} {1}", state.name, state == core.defaultState ? " (default)" : string.Empty), true, stateFoldAutStyle);

            if (state != core.defaultState && GUILayout.Button(stateSetDefault, TSSEditorUtils.max80pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                Undo.RecordObject(core, "[TSS Core] default state");
                core.SetDefaultState(state);
            }

            else if (state == core.defaultState && GUILayout.Button(stateUnsetDefault, TSSEditorUtils.max80pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                Undo.RecordObject(core, "[TSS Core] default state");
                core.SetDefaultState();
            }

            if (core.currentState == state)
            {
                GUI.color = TSSEditorUtils.greenColor;
            }

            if (GUILayout.Button(stateSelect, TSSEditorUtils.max50pxWidth, TSSEditorUtils.fixedLineHeight))
            {
                SelectState(state);
            }

            GUI.color = Color.white;

            EditorGUI.EndDisabledGroup();

            if (DrawStateDeleteButton(state))
            {
                return(false);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!state.enabled);

            if (state.editing)
            {
                TSSEditorUtils.DrawGenericProperty(ref state.name, "State Name", core);

                TSSEditorUtils.DrawSeparator();
                DrawStateItems(state);

                TSSEditorUtils.DrawSeparator();
                TSSEditorUtils.DrawEventProperty(statesProperty.GetArrayElementAtIndex(stateID), "onOpen", state.onOpen.GetPersistentEventCount());
                GUILayout.Space(3);
                TSSEditorUtils.DrawEventProperty(statesProperty.GetArrayElementAtIndex(stateID), "onClose", state.onClose.GetPersistentEventCount());

                if (core.useInput)
                {
                    TSSEditorUtils.DrawSeparator();
                    TSSEditorUtils.DrawKeyCodeListProperty(state.onKeyboard, core, statesProperty.GetArrayElementAtIndex(stateID).FindPropertyRelative("onKeyboard"), false);
                }
            }

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
            GUILayout.Space(3);

            return(true);
        }