Example #1
0
        // ShowParameters
        protected override void ShowParameters()
        {
            base.ShowParameters();

            DrawIdentProp();

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

            GUILayout.Space(5f);

            using (var ecc = new TCKEditorChangeCheck())
            {
                GUI.enabled = activeProp.boolValue && visibleProp.boolValue;
                TCKEditorHelper.DrawSpriteAndColor(baseImageObj, normalSpriteProp.GetLabel());
                GUI.enabled = true;

                ecc.OnChangeCheck = () =>
                {
                    normalSpriteProp.objectReferenceValue = baseImageObj.FindProperty("m_Sprite").objectReferenceValue;
                    baseImageColorProp.colorValue         = baseImageObj.FindProperty("m_Color").colorValue;
                };
            }

            TCKEditorHelper.DrawSpriteAndColor(pressedSpriteProp, pressedColorProp, pressedSpriteProp.GetLabel());
        }
 // DrawProperty WithApply
 protected void DrawPropertyWithApply(SerializedProperty property, float space = 0f)
 {
     using (new TCKEditorChangeCheck(() => AddApplyMethod(property.name)))
     {
         TCKEditorHelper.DrawPropertyField(property, space);
     }
 }
        // 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;
                }
            });
        }
 // 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();
        }
Example #6
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 Sensitivity
 protected void DrawSensitivityProp()
 {
     GUILayout.Space(5f);
     TCKEditorHelper.DrawPropertyField(sensitivityProp);
 }
        // 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);
                }
            }
        }