예제 #1
0
        // -------------------
        static public SuperTouchZoneSpriteAnimator CreateSuperTouchZoneAnimator(
            ControlFreak2.SuperTouchZone target,
            string nameSuffix,
            Sprite sprite,
            float scale,
            string undoLabel = null)
        {
            RectTransform subObj = CreateSubRectTr(target.transform, target.name + nameSuffix, scale);


            // Create Sprite animator...

            SuperTouchZoneSpriteAnimator sprAnimator = subObj.gameObject.AddComponent <SuperTouchZoneSpriteAnimator>();

            sprAnimator.autoConnectToSource = true;
            sprAnimator.SetSourceControl(target);

            sprAnimator.SetStateSprite(SuperTouchZoneSpriteAnimator.ControlState.Neutral, sprite);


            if (undoLabel != null)
            {
                Undo.RegisterCreatedObjectUndo(subObj.gameObject, undoLabel);
            }

            return(sprAnimator);
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            SuperTouchZoneSpriteAnimator target = this.target as SuperTouchZoneSpriteAnimator;

            if ((target == null))
            {
                return;
            }

            if (!TouchControlSpriteAnimatorInspector.DrawSourceGUI(target))
            {
                return;
            }

            //TouchControlSpriteAnimatorInspector.DrawTimingGUI(target);



            InspectorUtils.BeginIndentedSection(new GUIContent("Sprite Settings"));

            if (this.spriteConfigInspArray != null)
            {
                for (SuperTouchZoneSpriteAnimator.ControlState i = SuperTouchZoneSpriteAnimator.ControlStateFirst;
                     i < SuperTouchZoneSpriteAnimator.ControlStateCount; ++i)
                {
                    if (this.spriteConfigInspArray[(int)i] == null)
                    {
                        EditorGUILayout.LabelField("ERROR");
                    }
                    else
                    {
                        this.spriteConfigInspArray[(int)i].Draw(target.GetStateSpriteConfig(i), target, ((int)i == 0), ((int)i != 0));
                    }
                }
            }
//
//			this.spriteNeutral.Draw(target.spriteNeutral, target, true);
//
//			EditorGUILayout.Space();
//			this.spritePressed.Draw(target.spritePressed, target, target.IsIllegallyAttachedToSource());


            InspectorUtils.EndIndentedSection();


            //TouchControlSpriteAnimatorInspector.DrawDefaultTransformGUI(target);
        }