Exemple #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());
        }
        // 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;
            }
        }
Exemple #4
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;
                };
            }
        }