예제 #1
0
        public void ActionAnimSpineGUI(ActionAnimSpine action, List <ActionParameter> parameters)
        {
                        #if UNITY_EDITOR
            action.methodMecanim = (AnimMethodMecanim)EditorGUILayout.EnumPopup("Method:", action.methodMecanim);

            if (action.methodMecanim == AnimMethodMecanim.PlayCustom)
            {
                action.parameterID = AC.Action.ChooseParameterGUI("Skeleton Animation:", parameters, action.parameterID, ParameterType.GameObject);
                if (action.parameterID >= 0)
                {
                    action.constantID        = 0;
                    action.skeletonAnimation = null;
                }
                else
                {
                    action.skeletonAnimation = (SkeletonAnimation)EditorGUILayout.ObjectField("Skeleton Animation:", action.skeletonAnimation, typeof(SkeletonAnimation), true);

                    action.constantID        = action.FieldToID <SkeletonAnimation> (action.skeletonAnimation, action.constantID);
                    action.skeletonAnimation = action.IDToField <SkeletonAnimation> (action.skeletonAnimation, action.constantID, false);
                }
            }

            if (action.methodMecanim == AnimMethodMecanim.PlayCustom)
            {
                action.clip2D = EditorGUILayout.TextField("Clip:", action.clip2D);

                action.loop = EditorGUILayout.Toggle("Loop?", action.loop);
                if (action.loop)
                {
                    action.parameterID2 = AC.Action.ChooseParameterGUI("Looping times:", parameters, action.parameterID2, ParameterType.Integer);
                    if (action.parameterID2 >= 0)
                    {
                        action.loopTimes = 0;
                    }
                    else
                    {
                        action.loopTimes = EditorGUILayout.IntField("Looping times:", action.loopTimes);
                    }
                }

                action.willWait = EditorGUILayout.Toggle("Wait until finish?", action.willWait);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(action);
            }
                        #endif
        }
예제 #2
0
        public string ActionAnimSpineLabel(ActionAnimSpine action)
        {
            string label = "";

            if (action.skeletonAnimation)
            {
                label = action.skeletonAnimation.name;

                if (action.methodMecanim == AnimMethodMecanim.ChangeParameterValue && action.parameterName != "")
                {
                    label += " - " + action.parameterName;
                }
            }

            return(label);
        }
예제 #3
0
        public float ActionAnimSpineRun(ActionAnimSpine action)
        {
            if (!action.isRunning)
            {
                action.isRunning = true;

                if (action.methodMecanim == AnimMethodMecanim.PlayCustom && action.skeletonAnimation && action.clip2D != "")
                {
                    action.animationComplete = false;

                    action.skeletonAnimation.state.Complete += action.HandleAnimComplete;

                    SetAnimation(action.clip2D, action.loop, action.skeletonAnimation);

                    if (action.willWait)
                    {
                        return(action.defaultPauseTime);
                    }
                }
            }
            else
            {
                if (action.methodMecanim == AnimMethodMecanim.PlayCustom)
                {
                    if (action.skeletonAnimation && action.clip2D != "")
                    {
                        if (action.animationComplete)
                        {
                            action.skeletonAnimation.state.Complete -= action.HandleAnimComplete;

                            action.isRunning = false;
                            return(0f);
                        }
                        return(action.defaultPauseTime / 6f);
                    }
                }
            }

            return(0f);
        }
예제 #4
0
 public void ActionAnimSpineSkip(ActionAnimSpine action)
 {
     ActionAnimSpineRun(action);
 }