Ejemplo n.º 1
0
        void Init()
        {
            headerStyle = new GUIStyle("ShurikenModuleTitle")
            {
                border        = new RectOffset(15, 7, 4, 4),
                fixedHeight   = 22,
                contentOffset = new Vector2(20f, -2f)
            };

            action = (ThryAction)target;

            AutoAddComponents();

            Transform t = action.transform.parent;

            while (t != null)
            {
                if (t.GetComponent <Thry.Clapper.Clapper>() != null)
                {
                    showClapperGUI = true;
                }
                t = t.parent;
            }

            isNotInit = false;
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            // Draws the default convert to UdonBehaviour button, program asset field, sync settings, etc.
            //if (UdonSharpGUI.DrawDefaultUdonSharpBehaviourHeader(target)) return;

            serializedObject.Update();

            action = (ThryAction)target;
            if (ThryActionEditor.MakeSureItsAnUdonBehaviour(action) == false)
            {
                return;
            }

            if (isNotInit)
            {
                Init();
            }

            EditorGUILayout.LabelField("<size=30><color=#f542da>Thry's Action Script</color></size>", new GUIStyle(EditorStyles.label)
            {
                richText = true, alignment = TextAnchor.MiddleCenter
            }, GUILayout.Height(50));

            //____________Behaviour__________
            EditorGUILayout.LabelField("Behaviour", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();

            behaviourType = (SpecialBehaviourType)EditorGUILayout.EnumPopup("Special Behaviour", (SpecialBehaviourType)action.specialActionType);
            if (behaviourType == SpecialBehaviourType.Normal)
            {
                actionType = (ActionType)EditorGUILayout.EnumPopup("Type", (ActionType)action.actionType);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(action, "Modify Type");
                action.actionType        = (int)actionType;
                action.specialActionType = (int)behaviourType;
            }

            if (behaviourType == SpecialBehaviourType.Normal)
            {
                if (actionType == ActionType.Bool)
                {
                    action.local_bool = EditorGUILayout.Toggle("Boolean", action.local_bool);
                }
                else if (actionType == ActionType.Float)
                {
                    action.local_float = EditorGUILayout.FloatField("Float", action.local_float);
                }
            }

            if (showClapperGUI)
            {
                ClapperGUI();
            }

            GUISyncing();

            //__________Other UI____________
            if (behaviourType == SpecialBehaviourType.MirrorManager)
            {
                MirrorMangerGUI();
            }
            else
            {
                NormalGUI();
            }

            UdonSharpEditorUtility.CopyProxyToUdon(action);
            serializedObject.ApplyModifiedProperties();
        }