Beispiel #1
0
 // Picture
 public static void DrawTexturePreview(Rect rect, Texture tex)
 {
     DrawTileTexture(rect, HTGUILayout.GetCheckerTexture());
     if (tex != null)
     {
         GUI.DrawTexture(rect, tex, ScaleMode.ScaleToFit);
     }
 }
Beispiel #2
0
 public override void OnInspectorGUI()
 {
     if (HTGUILayout.Button("Open map editor", Color.green, Screen.width - 25))
     {
         TileMapEditor win = EditorWindow.GetWindow <TileMapEditor>(false, "Tile Map editor", true);
         win.map = (TileMap)target;
     }
 }
Beispiel #3
0
    public static void DrawTexturePreviewB(Rect rect, Texture tex, Color color)
    {
        GUI.color = color;
        GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture);
        GUI.color = Color.white;

        rect = new Rect(rect.x + 3, rect.y + 3, rect.width - 6, rect.height - 6);
        DrawTileTexture(rect, HTGUILayout.GetCheckerTexture());

        if (tex != null)
        {
            GUI.DrawTexture(rect, tex, ScaleMode.ScaleToFit);
        }
    }
Beispiel #4
0
    public static bool ChildFoldOut(bool foldOut, string text, Color color, int width)
    {
        string label = "[+] " + text;

        if (foldOut)
        {
            label = "[-] " + text;
        }
        if (HTGUILayout.Button(label, color, width, true))
        {
            foldOut = !foldOut;
        }

        return(foldOut);
    }
Beispiel #5
0
    public static void DrawTextureRectPreview(Rect rect, Rect textureRect, Texture2D tex, Color color)
    {
        GUI.color = color;
        GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture);
        GUI.color = Color.white;

        rect = new Rect(rect.x + 3, rect.y + 3, rect.width - 6, rect.height - 6);
        DrawTileTexture(rect, HTGUILayout.GetCheckerTexture());



        if (tex != null)
        {
            GUI.DrawTextureWithTexCoords(rect, tex, textureRect);
        }
    }
    public override void OnInspectorGUI()
    {
        EasyTouch t = (EasyTouch)target;

        HTGUILayout.FoldOut(ref t.showGeneral, "General properties", false);
        if (t.showGeneral)
        {
            if (t.enable)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enable = EditorGUILayout.Toggle("Enable EasyTouch", t.enable);
            if (t.enableRemote)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableRemote = EditorGUILayout.Toggle("Enable unity remote", t.enableRemote);


            if (t.useBroadcastMessage)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.useBroadcastMessage = EditorGUILayout.BeginToggleGroup("Broadcast messages", t.useBroadcastMessage);
            GUI.backgroundColor   = Color.white;
            if (t.useBroadcastMessage)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.receiverObject = (GameObject)EditorGUILayout.ObjectField("Other receiver", t.receiverObject, typeof(GameObject), true);
                if (t.isExtension)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.isExtension       = EditorGUILayout.Toggle("Joysticks & buttons", t.isExtension);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndToggleGroup();
            EditorGUILayout.Space();

            if (t.enableReservedArea)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableReservedArea = EditorGUILayout.Toggle("Enable reserved area", t.enableReservedArea);
            EditorGUILayout.Space();
            if (t.enabledNGuiMode)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enabledNGuiMode   = EditorGUILayout.Toggle("Enable NGUI compatibilty", t.enabledNGuiMode);
            GUI.backgroundColor = Color.white;
            if (t.enabledNGuiMode)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);

                // Camera
                serializedObject.Update();
                EditorGUIUtility.LookLikeInspector();
                SerializedProperty cameras = serializedObject.FindProperty("nGUICameras");
                EditorGUILayout.PropertyField(cameras, true);
                serializedObject.ApplyModifiedProperties();
                EditorGUIUtility.LookLikeControls();

                EditorGUILayout.Space();

                // layers
                serializedObject.Update();
                EditorGUIUtility.LookLikeInspector();
                SerializedProperty layers = serializedObject.FindProperty("nGUILayers");
                EditorGUILayout.PropertyField(layers, false);
                serializedObject.ApplyModifiedProperties();
                EditorGUIUtility.LookLikeControls();

                EditorGUILayout.EndVertical();
            }
        }

        if (t.enable)
        {
            // Auto select porperties
            HTGUILayout.FoldOut(ref t.showSelect, "Auto-select properties", false);
            if (t.showSelect)
            {
                t.easyTouchCamera = (Camera)EditorGUILayout.ObjectField("Camera", t.easyTouchCamera, typeof(Camera), true);
                if (t.autoSelect)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.autoSelect        = EditorGUILayout.Toggle("Enable auto-select", t.autoSelect);
                GUI.backgroundColor = Color.white;
                if (t.autoSelect)
                {
                    serializedObject.Update();
                    EditorGUIUtility.LookLikeInspector();
                    SerializedProperty layers = serializedObject.FindProperty("pickableLayers");
                    EditorGUILayout.PropertyField(layers, true);
                    serializedObject.ApplyModifiedProperties();
                    EditorGUIUtility.LookLikeControls();
                }
            }

            // General gesture properties
            HTGUILayout.FoldOut(ref t.showGesture, "General gesture properties", false);
            if (t.showGesture)
            {
                t.StationnaryTolerance = EditorGUILayout.FloatField("Stationary tolerance", t.StationnaryTolerance);
                t.longTapTime          = EditorGUILayout.FloatField("Long tap time", t.longTapTime);
                t.swipeTolerance       = EditorGUILayout.FloatField("Swipe tolerance", t.swipeTolerance);
            }

            // Two fingers gesture
            HTGUILayout.FoldOut(ref t.showTwoFinger, "Two fingers gesture properties", false);
            if (t.showTwoFinger)
            {
                if (t.enable2FingersGesture)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.enable2FingersGesture = EditorGUILayout.Toggle("2 fingers gesture", t.enable2FingersGesture);
                GUI.backgroundColor     = Color.white;
                if (t.enable2FingersGesture)
                {
                    EditorGUILayout.Separator();
                    if (t.enablePinch)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    else
                    {
                        GUI.backgroundColor = Color.red;
                    }
                    t.enablePinch       = EditorGUILayout.Toggle("Enable Pinch", t.enablePinch);
                    GUI.backgroundColor = Color.white;
                    if (t.enablePinch)
                    {
                        t.minPinchLength = EditorGUILayout.FloatField("Min pinch length", t.minPinchLength);
                    }
                    EditorGUILayout.Separator();
                    if (t.enableTwist)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    else
                    {
                        GUI.backgroundColor = Color.red;
                    }
                    t.enableTwist       = EditorGUILayout.Toggle("Enable twist", t.enableTwist);
                    GUI.backgroundColor = Color.white;
                    if (t.enableTwist)
                    {
                        t.minTwistAngle = EditorGUILayout.FloatField("Min twist angle", t.minTwistAngle);
                    }

                    EditorGUILayout.Separator();
                }
            }

            // Second Finger simulation
            HTGUILayout.FoldOut(ref t.showSecondFinger, "Second finger simulation", false);
            if (t.showSecondFinger)
            {
                if (t.secondFingerTexture == null)
                {
                    t.secondFingerTexture = Resources.Load("secondFinger") as Texture;
                }

                t.secondFingerTexture = (Texture)EditorGUILayout.ObjectField("Texture", t.secondFingerTexture, typeof(Texture), true);
                EditorGUILayout.HelpBox("Change the keys settings for a fash compilation, or if you want to change the keys", MessageType.Info);
                t.twistKey = (KeyCode)EditorGUILayout.EnumPopup("Twist & pinch key", t.twistKey);
                t.swipeKey = (KeyCode)EditorGUILayout.EnumPopup("Swipe key", t.swipeKey);
            }
        }
    }
Beispiel #7
0
    public override void OnInspectorGUI()
    {
        EasyJoystick t = (EasyJoystick)target;

        // Joystick Properties
        HTGUILayout.FoldOut(ref t.showProperties, "Joystick properties", false);
        if (t.showProperties)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);

            t.name = EditorGUILayout.TextField("Joystick name", t.name);
            if (t.enable)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enable = EditorGUILayout.Toggle("Enable joystick", t.enable);
            if (t.isActivated)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isActivated = EditorGUILayout.Toggle("Activated", t.isActivated);
            if (t.visible)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.visible = EditorGUILayout.Toggle("Visible", t.visible);
            if (t.showDebugRadius)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.showDebugRadius   = EditorGUILayout.Toggle("Show debug area", t.showDebugRadius);
            GUI.backgroundColor = Color.white;

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);
            EditorGUILayout.Separator();

            if (t.useFixedUpdate)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.useFixedUpdate = EditorGUILayout.Toggle("Use fixed update", t.useFixedUpdate);
            if (t.isUseGuiLayout)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isUseGuiLayout    = EditorGUILayout.Toggle("Use GUI Layout", t.isUseGuiLayout);
            GUI.backgroundColor = Color.white;
            if (!t.isUseGuiLayout)
            {
                EditorGUILayout.HelpBox("This lets you skip the GUI layout phase (Increase GUI performance). It can only be used if you do not use GUI.Window and GUILayout inside of this OnGUI call.", MessageType.Warning);
            }
            EditorGUILayout.EndVertical();
        }

        HTGUILayout.FoldOut(ref t.showPosition, "Joystick position & size", false);
        if (t.showPosition)
        {
            // Dynamic joystick
            if (t.DynamicJoystick)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.DynamicJoystick   = EditorGUILayout.Toggle("Dynamic joystick", t.DynamicJoystick);
            GUI.backgroundColor = Color.white;
            if (t.DynamicJoystick)
            {
                GUI.backgroundColor = Color.cyan;
                t.area = (EasyJoystick.DynamicArea)EditorGUILayout.EnumPopup("Free area", t.area);
                GUI.backgroundColor = Color.white;
            }
            else
            {
                GUI.backgroundColor      = Color.cyan;
                t.JoyAnchor              = (EasyJoystick.JoystickAnchor)EditorGUILayout.EnumPopup("Anchor", t.JoyAnchor);
                GUI.backgroundColor      = Color.white;
                t.JoystickPositionOffset = EditorGUILayout.Vector2Field("Offset", t.JoystickPositionOffset);
            }

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);
            EditorGUILayout.Separator();

            t.ZoneRadius = EditorGUILayout.FloatField("Area radius", t.ZoneRadius);
            t.TouchSize  = EditorGUILayout.FloatField("Touch radius", t.TouchSize);
            if (t.RestrictArea)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.RestrictArea = EditorGUILayout.Toggle("    Restrict to area", t.RestrictArea);
            if (t.resetFingerExit)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.resetFingerExit   = EditorGUILayout.Toggle("    Reset  finger exit", t.resetFingerExit);
            GUI.backgroundColor = Color.white;
            t.deadZone          = EditorGUILayout.FloatField("Dead zone radius", t.deadZone);
        }

        // Joystick axes properties
        HTGUILayout.FoldOut(ref t.showInteraction, "Joystick axes properties & events", false);
        if (t.showInteraction)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);

            // Interaction
            GUI.backgroundColor = Color.cyan;
            t.Interaction       = (EasyJoystick.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.Interaction);
            GUI.backgroundColor = Color.white;

            if (t.Interaction == EasyJoystick.InteractionType.EventNotification || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent)
            {
                if (t.useBroadcast)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.useBroadcast      = EditorGUILayout.Toggle("Broadcast messages", t.useBroadcast);
                GUI.backgroundColor = Color.white;
                if (t.useBroadcast)
                {
                    t.receiverGameObject = (GameObject)EditorGUILayout.ObjectField("    Receiver gameobject", t.receiverGameObject, typeof(GameObject), true);
                    GUI.backgroundColor  = Color.cyan;
                    t.messageMode        = (EasyJoystick.Broadcast)EditorGUILayout.EnumPopup("    Sending mode", t.messageMode);
                    GUI.backgroundColor  = Color.white;
                }
            }

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);

            // X axis
            GUI.color     = new Color(255f / 255f, 69f / 255f, 40f / 255f);
            t.enableXaxis = EditorGUILayout.BeginToggleGroup("Enable X axis", t.enableXaxis);
            GUI.color     = Color.white;
            if (t.enableXaxis)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.speed.x = EditorGUILayout.FloatField("Speed", t.speed.x);
                if (t.inverseXAxis)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.inverseXAxis      = EditorGUILayout.Toggle("Inverse axis", t.inverseXAxis);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.Separator();

                if (t.Interaction == EasyJoystick.InteractionType.Direct || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent)
                {
                    t.XAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick X to", t.XAxisTransform, typeof(Transform), true);
                    if (t.XAxisTransform != null)
                    {
                        // characterCollider
                        if (t.XAxisTransform.GetComponent <CharacterController>() && (t.XTI == EasyJoystick.PropertiesInfluenced.Translate || t.XTI == EasyJoystick.PropertiesInfluenced.TranslateLocal))
                        {
                            EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info);
                            t.xAxisGravity = EditorGUILayout.FloatField("Gravity", t.xAxisGravity);
                        }
                        else
                        {
                            t.xAxisGravity = 0;
                        }
                        GUI.backgroundColor = Color.cyan;
                        t.XTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.XTI);
                        GUI.backgroundColor = Color.white;

                        switch (t.xAI)
                        {
                        case EasyJoystick.AxisInfluenced.X:
                            GUI.color = new Color(255f / 255f, 69f / 255f, 40f / 255f);
                            break;

                        case EasyJoystick.AxisInfluenced.Y:
                            GUI.color = Color.green;
                            break;

                        case EasyJoystick.AxisInfluenced.Z:
                            GUI.color = new Color(63f / 255f, 131f / 255f, 245f / 255f);
                            break;
                        }
                        GUI.backgroundColor = Color.cyan;
                        t.xAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.xAI);
                        GUI.backgroundColor = Color.white;
                        GUI.color           = Color.white;

                        EditorGUILayout.Separator();



                        if (t.XTI == EasyJoystick.PropertiesInfluenced.RotateLocal)
                        {
                            // auto stab
                            if (t.enableXAutoStab)
                            {
                                GUI.backgroundColor = Color.green;
                            }
                            else
                            {
                                GUI.backgroundColor = Color.red;
                            }
                            t.enableXAutoStab   = EditorGUILayout.Toggle("AutoStab", t.enableXAutoStab);
                            GUI.backgroundColor = Color.white;
                            if (t.enableXAutoStab)
                            {
                                EditorGUILayout.BeginVertical(paddingStyle1);
                                t.ThresholdX = EditorGUILayout.FloatField("Threshold ", t.ThresholdX);
                                t.StabSpeedX = EditorGUILayout.FloatField("Speed", t.StabSpeedX);
                                EditorGUILayout.EndVertical();
                            }

                            EditorGUILayout.Separator();

                            // Clamp
                            if (t.enableXClamp)
                            {
                                GUI.backgroundColor = Color.green;
                            }
                            else
                            {
                                GUI.backgroundColor = Color.red;
                            }
                            t.enableXClamp      = EditorGUILayout.Toggle("Clamp rotation", t.enableXClamp);
                            GUI.backgroundColor = Color.white;
                            if (t.enableXClamp)
                            {
                                EditorGUILayout.BeginVertical(paddingStyle1);
                                t.clampXMax = EditorGUILayout.FloatField("Max angle value", t.clampXMax);
                                t.clampXMin = EditorGUILayout.FloatField("Min angle value", t.clampXMin);
                                EditorGUILayout.EndVertical();
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndToggleGroup();

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);

            // Y axis
            GUI.color     = Color.green;
            t.enableYaxis = EditorGUILayout.BeginToggleGroup("Enable Y axis", t.enableYaxis);
            GUI.color     = Color.white;
            if (t.enableYaxis)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.speed.y = EditorGUILayout.FloatField("Speed", t.speed.y);
                if (t.inverseYAxis)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.inverseYAxis      = EditorGUILayout.Toggle("Inverse axis", t.inverseYAxis);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.Separator();

                if (t.Interaction == EasyJoystick.InteractionType.Direct || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent)
                {
                    t.YAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick Y to", t.YAxisTransform, typeof(Transform), true);
                    if (t.YAxisTransform != null)
                    {
                        // characterCollider
                        if (t.YAxisTransform.GetComponent <CharacterController>() && (t.YTI == EasyJoystick.PropertiesInfluenced.Translate || t.YTI == EasyJoystick.PropertiesInfluenced.TranslateLocal))
                        {
                            EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info);
                            t.yAxisGravity = EditorGUILayout.FloatField("Gravity", t.yAxisGravity);
                        }
                        else
                        {
                            t.yAxisGravity = 0;
                        }
                        GUI.backgroundColor = Color.cyan;
                        t.YTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.YTI);
                        GUI.backgroundColor = Color.white;
                        switch (t.yAI)
                        {
                        case EasyJoystick.AxisInfluenced.X:
                            GUI.color = new Color(255f / 255f, 69f / 255f, 40f / 255f);
                            break;

                        case EasyJoystick.AxisInfluenced.Y:
                            GUI.color = Color.green;
                            break;

                        case EasyJoystick.AxisInfluenced.Z:
                            GUI.color = new Color(63f / 255f, 131f / 255f, 245f / 255f);
                            break;
                        }
                        GUI.backgroundColor = Color.cyan;
                        t.yAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.yAI);
                        GUI.backgroundColor = Color.white;

                        GUI.color = Color.white;
                        EditorGUILayout.Separator();



                        if (t.YTI == EasyJoystick.PropertiesInfluenced.RotateLocal)
                        {
                            // auto stab
                            if (t.enableYAutoStab)
                            {
                                GUI.backgroundColor = Color.green;
                            }
                            else
                            {
                                GUI.backgroundColor = Color.red;
                            }
                            t.enableYAutoStab   = EditorGUILayout.Toggle("AutoStab", t.enableYAutoStab);
                            GUI.backgroundColor = Color.white;
                            if (t.enableYAutoStab)
                            {
                                EditorGUILayout.BeginVertical(paddingStyle1);
                                t.ThresholdY = EditorGUILayout.FloatField("Threshold ", t.ThresholdY);
                                t.StabSpeedY = EditorGUILayout.FloatField("Speed", t.StabSpeedY);
                                EditorGUILayout.EndVertical();
                            }

                            EditorGUILayout.Separator();

                            // Clamp
                            if (t.enableYClamp)
                            {
                                GUI.backgroundColor = Color.green;
                            }
                            else
                            {
                                GUI.backgroundColor = Color.red;
                            }
                            t.enableYClamp      = EditorGUILayout.Toggle("Clamp rotation", t.enableYClamp);
                            GUI.backgroundColor = Color.white;
                            if (t.enableYClamp)
                            {
                                EditorGUILayout.BeginVertical(paddingStyle1);
                                t.clampYMax = EditorGUILayout.FloatField("Max angle value", t.clampYMax);
                                t.clampYMin = EditorGUILayout.FloatField("Min angle value", t.clampYMin);
                                EditorGUILayout.EndVertical();
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndToggleGroup();

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);
            EditorGUILayout.Separator();

            // Smoothing return
            if (t.enableSmoothing)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableSmoothing   = EditorGUILayout.BeginToggleGroup("Smoothing return", t.enableSmoothing);
            GUI.backgroundColor = Color.white;
            if (t.enableSmoothing)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.Smoothing = EditorGUILayout.Vector2Field("Smoothing", t.Smoothing);
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndToggleGroup();

            if (t.enableInertia)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enableInertia     = EditorGUILayout.BeginToggleGroup("Enable inertia", t.enableInertia);
            GUI.backgroundColor = Color.white;
            if (t.enableInertia)
            {
                EditorGUILayout.BeginVertical(paddingStyle1);
                t.Inertia = EditorGUILayout.Vector2Field("Inertia", t.Inertia);
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.EndVertical();
        }

        // Joystick Texture
        HTGUILayout.FoldOut(ref t.showAppearance, "Joystick textures", false);
        if (t.showAppearance)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);

            t.guiDepth = EditorGUILayout.IntField("Gui depth", t.guiDepth);
            EditorGUILayout.Separator();

            if (t.showZone)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.showZone          = EditorGUILayout.Toggle("Show area", t.showZone);
            GUI.backgroundColor = Color.white;
            if (t.showZone)
            {
                t.areaColor   = EditorGUILayout.ColorField("Color", t.areaColor);
                t.areaTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.areaTexture, typeof(Texture), true);
            }
            EditorGUILayout.Separator();

            if (t.showTouch)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.showTouch         = EditorGUILayout.Toggle("Show touch", t.showTouch);
            GUI.backgroundColor = Color.white;
            if (t.showTouch)
            {
                t.touchColor   = EditorGUILayout.ColorField("Color", t.touchColor);
                t.touchTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.touchTexture, typeof(Texture), true);
            }
            EditorGUILayout.Separator();

            if (t.showDeadZone)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.showDeadZone      = EditorGUILayout.Toggle("Show dead", t.showDeadZone);
            GUI.backgroundColor = Color.white;
            if (t.showDeadZone)
            {
                t.deadTexture = (Texture)EditorGUILayout.ObjectField("Dead zone texture", t.deadTexture, typeof(Texture), true);
            }

            EditorGUILayout.EndVertical();
        }

        // Refresh
        if (GUI.changed)
        {
            EditorUtility.SetDirty(t);
        }
    }
    public override void OnInspectorGUI()
    {
        EasyButton t = (EasyButton)target;

        // Button Properties
        HTGUILayout.FoldOut(ref t.showInspectorProperties, "Button properties", false);
        if (t.showInspectorProperties)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);

            t.name = EditorGUILayout.TextField("Button name", t.name);

            if (t.enable)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.enable = EditorGUILayout.Toggle("Enable button", t.enable);
            if (t.isActivated)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isActivated = EditorGUILayout.Toggle("Activated", t.isActivated);
            if (t.showDebugArea)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.showDebugArea     = EditorGUILayout.Toggle("Show debug area", t.showDebugArea);
            GUI.backgroundColor = Color.white;

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);
            EditorGUILayout.Separator();

            if (t.isUseGuiLayout)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isUseGuiLayout    = EditorGUILayout.Toggle("Use GUI Layout", t.isUseGuiLayout);
            GUI.backgroundColor = Color.white;
            if (!t.isUseGuiLayout)
            {
                EditorGUILayout.HelpBox("This lets you skip the GUI layout phase (Increase GUI performance). It can only be used if you do not use GUI.Window and GUILayout inside of this OnGUI call.", MessageType.Warning);
            }
            EditorGUILayout.EndVertical();
        }

        // Button position and size
        HTGUILayout.FoldOut(ref t.showInspectorPosition, "Button position & size", false);
        if (t.showInspectorPosition)
        {
            GUI.backgroundColor = Color.cyan;
            t.Anchor            = (EasyButton.ButtonAnchor)EditorGUILayout.EnumPopup("Anchor", t.Anchor);
            GUI.backgroundColor = Color.white;
            t.Offset            = EditorGUILayout.Vector2Field("Offset", t.Offset);
            t.Scale             = EditorGUILayout.Vector2Field("Scale", t.Scale);

            HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left);
            EditorGUILayout.Separator();

            if (t.isSwipeIn)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isSwipeIn = EditorGUILayout.Toggle("Swipe in", t.isSwipeIn);
            if (t.isSwipeOut)
            {
                GUI.backgroundColor = Color.green;
            }
            else
            {
                GUI.backgroundColor = Color.red;
            }
            t.isSwipeOut        = EditorGUILayout.Toggle("Swipe out", t.isSwipeOut);
            GUI.backgroundColor = Color.white;
        }

        // Event
        HTGUILayout.FoldOut(ref t.showInspectorEvent, "Button Interaction & Events", false);
        if (t.showInspectorEvent)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);

            GUI.backgroundColor = Color.cyan;
            t.interaction       = (EasyButton.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.interaction);
            GUI.backgroundColor = Color.white;
            if (t.interaction == EasyButton.InteractionType.Event)
            {
                if (t.useBroadcast)
                {
                    GUI.backgroundColor = Color.green;
                }
                else
                {
                    GUI.backgroundColor = Color.red;
                }
                t.useBroadcast      = EditorGUILayout.Toggle("Broadcast messages", t.useBroadcast);
                GUI.backgroundColor = Color.white;
                if (t.useBroadcast)
                {
                    EditorGUILayout.BeginVertical(paddingStyle1);
                    t.receiverGameObject = (GameObject)EditorGUILayout.ObjectField("Receiver object", t.receiverGameObject, typeof(GameObject), true);
                    GUI.backgroundColor  = Color.cyan;
                    t.messageMode        = (EasyButton.Broadcast)EditorGUILayout.EnumPopup("Sending mode", t.messageMode);
                    GUI.backgroundColor  = Color.white;
                    EditorGUILayout.Separator();

                    if (t.useSpecificalMethod)
                    {
                        GUI.backgroundColor = Color.green;
                    }
                    else
                    {
                        GUI.backgroundColor = Color.red;
                    }
                    t.useSpecificalMethod = EditorGUILayout.Toggle("Use specific method", t.useSpecificalMethod);
                    GUI.backgroundColor   = Color.white;
                    if (t.useSpecificalMethod)
                    {
                        t.downMethodName  = EditorGUILayout.TextField("   Down method name", t.downMethodName);
                        t.pressMethodName = EditorGUILayout.TextField("   Press method name", t.pressMethodName);
                        t.upMethodName    = EditorGUILayout.TextField("   Up method name", t.upMethodName);
                    }
                    EditorGUILayout.EndVertical();
                }
            }
            EditorGUILayout.EndVertical();
        }

        // Button texture
        HTGUILayout.FoldOut(ref t.showInspectorTexture, "Button textures", false);
        if (t.showInspectorTexture)
        {
            EditorGUILayout.BeginVertical(paddingStyle1);
            t.guiDepth = EditorGUILayout.IntField("Gui depth", t.guiDepth);
            EditorGUILayout.Separator();
            t.buttonNormalColor = EditorGUILayout.ColorField("Color", t.buttonNormalColor);
            t.NormalTexture     = (Texture2D)EditorGUILayout.ObjectField("Normal texture", t.NormalTexture, typeof(Texture), true);
            EditorGUILayout.Separator();
            t.buttonActiveColor = EditorGUILayout.ColorField("Color", t.buttonActiveColor);
            t.ActiveTexture     = (Texture2D)EditorGUILayout.ObjectField("Active texture", t.ActiveTexture, typeof(Texture), true);
            EditorGUILayout.EndVertical();
        }



        // Refresh
        if (GUI.changed)
        {
            EditorUtility.SetDirty(t);
        }
    }