// DoLayout Axes
        private void DrawAxes()
        {
            TCKEditorHelper.LargeFoldout(axesLagProp, "Axes", () =>
            {
                for (int i = 0; i < endAxisIndexToDraw; i++)
                {
                    DrawAxisData(axisSPData[i]);
                }

                EditorGUILayout.Space();

                using (TCKEditorLayout.Horizontal())
                {
                    GUILayout.Space(10f);
                    GUI.enabled = AnyAxisEnabled();

                    bool axesLag          = axesLagProp.boolValue;
                    axesLag               = EditorGUILayout.Toggle(axesLag, GUILayout.Width(15f));
                    axesLagProp.boolValue = axesLag;

                    GUILayout.Label(axesLagProp.GetLabel(), GUILayout.Width(25f));
                    GUI.enabled &= axesLag;

                    EditorGUILayout.PropertyField(axesLagSpeedProp, GUIContent.none);
                    GUI.enabled = true;
                }
            });
        }
        // Draw IdentProp
        protected void DrawIdentProp()
        {
            GUILayout.Space(5f);

            if (target.name != identifierProp.stringValue)
            {
                identifierProp.stringValue = target.name;
            }

            using (var ecc = new TCKEditorChangeCheck())
            {
                using (TCKEditorLayout.Horizontal())
                {
                    GUILayout.Label(identifierProp.displayName, GUILayout.Width(TCKEditorLayout.STANDARD_SIZE));
                    EditorGUILayout.PropertyField(identifierProp, GUIContent.none);
                }

                ecc.OnChangeCheck = () =>
                {
                    string nextName = identifierProp.stringValue;

                    if (string.IsNullOrEmpty(nextName))
                    {
                        Debug.LogError("Controller name for cant be empty");
                        nextName = target.GetType().Name.Substring(3) + UnityEngine.Random.value.ToString().Substring(2);
                    }

                    target.name = nextName;
                    identifierProp.stringValue = nextName;
                };
            }
        }
        // Draw TouchZone
        protected void DrawTouchZone()
        {
            GUILayout.Space(5f);

            using (TCKEditorLayout.Horizontal())
            {
                GUI.enabled = eavIsOk;

                using (new TCKEditorChangeCheck(() => AddApplyMethod(showTouchZoneProp.name)))
                {
                    EditorGUILayout.PropertyField(showTouchZoneProp, GUIContent.none, GUILayout.Width(15f));
                }
                GUI.enabled &= showTouchZoneProp.boolValue;

                using (var ecc = new TCKEditorChangeCheck())
                {
                    baseImageObj.Update();
                    GUILayout.Label("Touch Zone", GUILayout.Width(95f));
                    SerializedProperty colorProp = baseImageObj.FindProperty("m_Color");
                    EditorGUILayout.PropertyField(colorProp, GUIContent.none, GUILayout.Width(TCKEditorLayout.STANDARD_SIZE / 2f));
                    EditorGUILayout.PropertyField(baseImageObj.FindProperty("m_Sprite"), GUIContent.none);
                    baseImageObj.ApplyModifiedProperties();

                    ecc.OnChangeCheck = () =>
                    {
                        baseImageColorProp.colorValue = colorProp.colorValue;
                    };
                }

                GUI.enabled = true;
            }
        }
Пример #4
0
        // OnGUI
        void OnGUI()
        {
            GUILayout.Space(5f);

            using (TCKEditorLayout.Horizontal())
            {
                TCKAboutTab.OnTabGUI();
            }
        }
 // ShowSensitivity
 protected void DrawUpdateMode()
 {
     GUILayout.Space(5f);
     using (TCKEditorLayout.Horizontal())
     {
         GUILayout.Label(updateModeProp.displayName, GUILayout.Width(TCKEditorLayout.STANDARD_SIZE));
         TCKEditorHelper.DrawEnumAsToolbar(updateModeProp, false);
     }
 }
        // OnInspectorGUI
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            eavIsOk = (enableProp.boolValue && activeProp.boolValue && visibleProp.boolValue);

            using (TCKEditorLayout.Vertical("box"))
            {
                TCKEditorHelper.LargeFoldout(enableProp, "Parameters", ShowParameters);
                PostParametersDraw();
            }

            serializedObject.ApplyModifiedProperties();
            PostAppliedModifiedProperties();
        }
Пример #7
0
        // ShowParameters
        protected override void ShowParameters()
        {
            base.ShowParameters();

            DrawIdentProp();

            GUILayout.Space(5f);
            using (TCKEditorLayout.Horizontal())
            {
                GUILayout.Label(isStaticProp.GetLabel(), GUILayout.Width(TCKEditorLayout.STANDARD_SIZE));
                isStaticProp.boolValue = Convert.ToBoolean(GUILayout.Toolbar(Convert.ToInt32(isStaticProp.boolValue), modNames, EditorStyles.miniButton, GUILayout.Height(16f)));
            }

            DrawSensitivityProp();

            GUILayout.Space(5f);
            TCKEditorHelper.DrawPropertyField(borderSizeProp);

            GUILayout.Space(5f);
            using (TCKEditorLayout.Horizontal())
            {
                EditorGUILayout.PropertyField(smoothReturnProp, GUIContent.none, GUILayout.Width(15f));
                GUILayout.Label(smoothReturnProp.GetLogicLabel(), GUILayout.Width(TCKEditorLayout.STANDARD_SIZE - 20f));
                GUI.enabled = smoothReturnProp.boolValue;
                EditorGUILayout.PropertyField(smoothFactorProp, GUIContent.none);
                GUI.enabled = true;
            }

            DrawTouchZone();

            GUILayout.Space(5f);
            using (var ecc = new TCKEditorChangeCheck())
            {
                GUI.enabled = eavIsOk;
                TCKEditorHelper.DrawSpriteAndColor(joystickImageObj, "Joystick");
                TCKEditorHelper.DrawSpriteAndColor(backgroundImageObj, "Background");
                GUI.enabled = true;

                ecc.OnChangeCheck = () =>
                {
                    joystickImageColorProp.colorValue   = joystickImageObj.FindProperty("m_Color").colorValue;
                    backgroundImageColorProp.colorValue = backgroundImageObj.FindProperty("m_Color").colorValue;
                };
            }
        }
        // Draw AxisData
        static void DrawAxisData(AxisSPData axisData)
        {
            using (TCKEditorLayout.Horizontal())
            {
                bool enabled = axisData.enabledProp.boolValue;
                enabled = EditorGUILayout.Toggle(enabled, GUILayout.Width(15f));
                axisData.enabledProp.boolValue = enabled;
                GUI.enabled = enabled;

                GUILayout.Label(axisData.label);

                bool inverse = axisData.inverseProp.boolValue;
                inverse = EditorGUILayout.Toggle(inverse, GUILayout.Width(15f));
                axisData.inverseProp.boolValue = inverse;
                GUILayout.Label(axisData.inverseProp.displayName, GUILayout.Width(55f));
                GUI.enabled = true;
            }
        }
        // OnTabGUI
        public static void OnTabGUI()
        {
            var style = TCKEditorStyle.Get;

            // LINK's
            using (TCKEditorLayout.Vertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                GUILayout.Space(5f);

                using (TCKEditorLayout.Vertical(style.area))
                {
                    GUILayout.Label("Documentation", style.headLabel);

                    GUILayout.BeginVertical(style.area);
                    TCKEditorHelper.DrawLink("Online Manual", MANUAL_URL);
                    GUILayout.EndVertical();
                }

                using (TCKEditorLayout.Vertical(style.area))
                {
                    GUILayout.Label("Support, News, More Assets", style.headLabel);

                    GUILayout.BeginVertical(style.area);
                    TCKEditorHelper.DrawLink("Support", SUPPORT_URL);
                    GUILayout.Space(10f);
                    TCKEditorHelper.DrawLink("Forum", FORUM_URL);
                    GUILayout.Space(25f);
                    TCKEditorHelper.DrawLink("Get Pro", "http://u3d.as/5NP");
                    GUILayout.Space(10f);
                    TCKEditorHelper.DrawLink("More Assets", PABLISHER_URL);
                    GUILayout.EndVertical();
                }

                using (TCKEditorLayout.Vertical(style.area))
                {
                    GUILayout.Label("Release Notes", style.headLabel);

                    GUILayout.BeginVertical(style.area);
                    TCKEditorHelper.DrawLink("Full Changelog", CHANGELOG_URL);
                    GUILayout.EndVertical();
                }
            }

            // LOGO
            using (TCKEditorLayout.Vertical("box", GUILayout.Width(280f), GUILayout.ExpandHeight(true)))
            {
                GUILayout.Space(5f);
                GUILayout.Label("<size=18>Touch Controls Kit - Lite</size>", style.centeredLabel);

                GUILayout.Space(5f);
                GUILayout.Label("<size=16> Developed by Victor Klepikov\n" +
                                "Version <b>" + VERSION + "</b> </size>", style.centeredLabel);

                EditorGUILayout.Space();
                TCKEditorHelper.Separator();

                if (logo != null)
                {
                    GUILayout.FlexibleSpace();

                    using (TCKEditorLayout.Horizontal())
                    {
                        GUILayout.FlexibleSpace();

                        Rect logoRect = EditorGUILayout.GetControlRect(GUILayout.Width(logo.width), GUILayout.Height(logo.height));

                        if (GUI.Button(logoRect, new GUIContent(logo, "Open AssetStore Page"), EditorStyles.label))
                        {
                            Application.OpenURL(ASSET_URL);
                        }

                        EditorGUIUtility.AddCursorRect(logoRect, MouseCursor.Link);

                        GUILayout.FlexibleSpace();
                    }

                    GUILayout.FlexibleSpace();
                }
                else
                {
                    GUILayout.Label("<size=15>Logo not found</size> \n" + LOGO_NAME, style.centeredLabel);
                }
            }
        }