Ejemplo n.º 1
0
        public float GetMaxActionEndTime()
        {
            GetAllAction();
            if (Actions == null || Actions.Count == 0)
            {
                return(-1);
            }
            float maxTime = -Mathf.Infinity;

            for (int i = 0; i < Actions.Count; i++)
            {
                ClipAction action = Actions[i];
                if (action == null)
                {
                    continue;
                }
                if (action.EndTime > maxTime)
                {
                    maxTime = action.EndTime;
                }
            }
            if (maxTime < 0)
            {
                maxTime = 0;
            }
            return(maxTime);
        }
Ejemplo n.º 2
0
 public virtual void OnUpdate(GTAnimator animator)
 {
     if (animator == null)
     {
         return;
     }
     if (OnUpdateDelegate != null)
     {
         OnUpdateDelegate(this);
     }
     if (ActiveActions != null && ActiveActions.Count > 0)
     {
         for (int i = 0; i < ActiveActions.Count; i++)
         {
             ClipAction action = ActiveActions[i];
             if (action == null)
             {
                 ActiveActions.RemoveAt(i);
                 i--;
                 continue;
             }
             if (action.EndTime <= animator.CurrentTime)
             {
                 action.OnEnd(this);
                 ActiveActions.Remove(action);
                 i--;
             }
             else if (action.m_Status == ClipAction.Status.Error || action.m_Status == ClipAction.Status.StopOnNextFrame)
             {
                 action.OnEnd(this);
                 ActiveActions.Remove(action);
                 i--;
             }
             else
             {
                 action.OnUpdate(this);
             }
         }
     }
     if (WaittingProcessActions != null && WaittingProcessActions.Count > 0)
     {
         for (int i = 0; i < WaittingProcessActions.Count; i++)
         {
             ClipAction action = WaittingProcessActions[i];
             if (action == null)
             {
                 WaittingProcessActions.RemoveAt(i);
                 i--;
                 continue;
             }
             if (action.BeginTime <= animator.CurrentTime && action.m_Status == ClipAction.Status.UnAction)
             {
                 action.OnBegin(this);
                 ActiveActions.Add(action);
                 WaittingProcessActions.Remove(action);
                 i--;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public float GetMinActionBeginTime()
        {
            GetAllAction();
            if (Actions == null || Actions.Count == 0)
            {
                return(-1);
            }
            float minTime = Mathf.Infinity;

            for (int i = 0; i < Actions.Count; i++)
            {
                ClipAction action = Actions[i];
                if (action == null)
                {
                    continue;
                }
                if (action.BeginTime < minTime)
                {
                    minTime = action.BeginTime;
                }
            }
            if (minTime < 0)
            {
                minTime = 0;
            }
            return(minTime);
        }
Ejemplo n.º 4
0
 public bool IsActionNameLegal(string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         return(false);
     }
     if (CurrentSelectedClip == null)
     {
         return(false);
     }
     if (CurrentSelectedClip.GetAllAction() == null || CurrentSelectedClip.GetAllAction().Count == 0)
     {
         return(true);
     }
     for (int i = 0; i < CurrentSelectedClip.Actions.Count; i++)
     {
         ClipAction action = CurrentSelectedClip.Actions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == name)
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 5
0
        public void Clone(Clip obj)
        {
            if (obj == null)
            {
                return;
            }

            BeginTime          = obj.BeginTime;
            EndTime            = obj.EndTime;
            AnimateObj         = obj.AnimateObj;
            ActiveObjOperation = obj.ActiveObjOperation;

            obj.GetAllAction();
            if (obj.Actions != null && obj.Actions.Count > 0)
            {
                for (int i = 0; i < obj.Actions.Count; i++)
                {
                    ClipAction action = obj.Actions[i];
                    if (action == null)
                    {
                        continue;
                    }
                    ClipAction newAction = AddAction(action.GetType());
                    if (newAction != null)
                    {
                        newAction.Clone(action);
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public virtual void Clone(ClipAction obj)
 {
     if (obj != null)
     {
         BeginTime    = obj.BeginTime;
         EndTime      = obj.EndTime;
         IdentifyName = obj.IdentifyName;
     }
 }
Ejemplo n.º 7
0
        public override void Clone(ClipAction obj)
        {
            base.Clone(obj);
            ActiveObjAction action = obj as ActiveObjAction;

            if (action != null)
            {
                ActiveObjOperation = action.ActiveObjOperation;
                OperationObj       = action.OperationObj;
            }
        }
        public override void Clone(ClipAction obj)
        {
            base.Clone(obj);
            UITweenRotationAction action = obj as UITweenRotationAction;

            if (action != null)
            {
                Reset   = action.Reset;
                Tweener = action.Tweener;
            }
        }
Ejemplo n.º 9
0
        public override void Clone(ClipAction obj)
        {
            base.Clone(obj);
            PlayAnimAction action = obj as PlayAnimAction;

            if (obj != null)
            {
                AnimationObj = action.AnimationObj;
                ClipName     = action.ClipName;
                CrossFade    = action.CrossFade;
                Speed        = action.Speed;
                Loop         = action.Loop;
            }
        }
Ejemplo n.º 10
0
        public override void Clone(ClipAction obj)
        {
            base.Clone(obj);
            PlayEffectAction action = obj as PlayEffectAction;

            if (action != null)
            {
                EffectObj           = action.EffectObj;
                Parent              = action.Parent;
                DontChangeTransform = action.DontChangeTransform;
                LocalScale          = action.LocalScale;
                Position            = action.Position;
                EulerAngles         = action.EulerAngles;
            }
        }
Ejemplo n.º 11
0
 public ClipAction AddAction(ClipAction action)
 {
     if (action == null)
     {
         return(null);
     }
     if (action.GetType() == typeof(MoveAction))
     {
         MoveActions.Add(action as MoveAction);
     }
     else if (action.GetType() == typeof(RotateAction))
     {
         RotateActions.Add(action as RotateAction);
     }
     else if (action.GetType() == typeof(ScaleAction))
     {
         ScaleActions.Add(action as ScaleAction);
     }
     else if (action.GetType() == typeof(UITweenPositionAction))
     {
         UITweenPositionActions.Add(action as UITweenPositionAction);
     }
     else if (action.GetType() == typeof(UITweenRotationAction))
     {
         UITweenRotationActions.Add(action as UITweenRotationAction);
     }
     else if (action.GetType() == typeof(UITweenPositionAction))
     {
         UITweenPositionActions.Add(action as UITweenPositionAction);
     }
     else if (action.GetType() == typeof(ActiveObjAction))
     {
         ActiveObjActions.Add(action as ActiveObjAction);
     }
     else if (action.GetType() == typeof(PlayEffectAction))
     {
         PlayEffectActions.Add(action as PlayEffectAction);
     }
     else if (action.GetType() == typeof(PlayAnimAction))
     {
         PlayAnimActions.Add(action as PlayAnimAction);
     }
     else if (action.GetType() == typeof(PlaySoundAction))
     {
         PlaySoundActions.Add(action as PlaySoundAction);
     }
     return(action);
 }
Ejemplo n.º 12
0
 public virtual void OnAnimatorInited(GTAnimator animator)
 {
     GetAllAction();
     if (Actions != null && Actions.Count > 0)
     {
         for (int i = 0; i < Actions.Count; i++)
         {
             ClipAction action = Actions[i];
             if (action == null)
             {
                 continue;
             }
             action.OnClipInited(this);
         }
     }
 }
Ejemplo n.º 13
0
        public virtual void OnEnd(GTAnimator animator)
        {
            if (ActiveActions != null || ActiveActions.Count > 0)
            {
                for (int i = 0; i < ActiveActions.Count; i++)
                {
                    ClipAction action = ActiveActions[i];
                    if (action == null)
                    {
                        continue;
                    }
                    action.OnEnd(this);
                }
            }
            if (AnimateObj != null)
            {
                switch (ActiveObjOperation)
                {
                case GameObjectActiveOperation.AlwaysChangeStatus:
                    if (AnimateObj.activeSelf == true)
                    {
                        AnimateObj.SetActive(false);
                    }
                    break;

                case GameObjectActiveOperation.OnlyActiveOnBegin:
                    break;

                case GameObjectActiveOperation.DontOperate:
                    break;

                default:
                    break;
                }
            }
            if (OnEndDelegate != null)
            {
                OnEndDelegate(this);
            }
            m_Status = Status.UnAction;
        }
Ejemplo n.º 14
0
 public override void Clone(ClipAction obj)
 {
     base.Clone(obj);
     if (obj != null)
     {
         if (obj.GetType() == typeof(MoveAction))
         {
             MoveAction action = obj as MoveAction;
             AnimateObj = action.AnimateObj;
             EaseTime   = action.EaseTime;
             EaseType   = action.EaseType;
             HowToReset = action.HowToReset;
             Target     = action.Target;
             Vec3Target = action.Vec3Target;
         }
         else if (obj.GetType() == typeof(ScaleAction))
         {
             ScaleAction action = obj as ScaleAction;
             AnimateObj = action.AnimateObj;
             EaseTime   = action.EaseTime;
             EaseType   = action.EaseType;
             HowToReset = action.HowToReset;
             Target     = action.Target;
             Vec3Target = action.Vec3Target;
         }
         else if (obj.GetType() == typeof(RotateAction))
         {
             RotateAction action = obj as RotateAction;
             AnimateObj = action.AnimateObj;
             EaseTime   = action.EaseTime;
             EaseType   = action.EaseType;
             HowToReset = action.HowToReset;
             Target     = action.Target;
             Vec3Target = action.Vec3Target;
         }
     }
 }
Ejemplo n.º 15
0
        public override void OnInspectorGUI()
        {
            try
            {
                if (Instance == null)
                {
                    return;
                }
                base.OnInspectorGUI();

                #region Debug view
                if (Application.isPlaying)
                {
                    if (EditorUtility.DrawHeader("Debug", true))
                    {
                        EditorUtility.BeginContents();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("EnableQueue", GUILayout.Width(100));
                        EnableQueue = EditorGUILayout.Toggle(EnableQueue);
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("PlayAllClip", GUILayout.Width(100));
                        PlayAllClip = EditorGUILayout.Toggle(PlayAllClip);
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("PlayImmediately", GUILayout.Width(100));
                        PlayImmediately = EditorGUILayout.Toggle(PlayImmediately);
                        GUILayout.EndHorizontal();

                        #region animation clip pop view
                        GUILayout.Space(4.0f);
                        AllClipNames = new List <string>();
                        if (Instance.Clips != null && Instance.Clips.Count > 0)
                        {
                            for (int i = 0; i < Instance.Clips.Count; i++)
                            {
                                Clip clip = Instance.Clips[i];
                                if (clip == null)
                                {
                                    Instance.Clips.RemoveAt(i); i--; continue;
                                }
                                AllClipNames.Add("From " + clip.BeginTime + "s to " + clip.EndTime + "s || Name: " + clip.Name);
                            }
                        }
                        CurrentSelectedDebugClipIndex = EditorGUILayout.Popup(CurrentSelectedDebugClipIndex, AllClipNames.ToArray());
                        if (CurrentSelectedDebugClipIndex < Instance.Clips.Count && CurrentSelectedClipIndex >= 0)
                        {
                            CurrentSelectedDebugClip = Instance.Clips[CurrentSelectedDebugClipIndex];
                        }
                        else
                        {
                            CurrentSelectedDebugClip = null;
                        }
                        #endregion

                        GUILayout.BeginHorizontal();

                        if (GUILayout.Button("Play"))
                        {
                            if (Application.isPlaying == false)
                            {
                                return;
                            }
                            if (CurrentSelectedDebugClip == null)
                            {
                                return;
                            }

                            GTAnimator.PlayTask task = new GTAnimator.PlayTask();
                            task.PlayAllClip = PlayAllClip;
                            if (PlayAllClip == false)
                            {
                                task.WannaPlayClips = new string[] { CurrentSelectedDebugClip.Name };
                            }
                            if (EnableQueue)
                            {
                                task.PlayMode = GTAnimator.PlayMode.Waitting;
                            }
                            else
                            {
                                task.PlayMode = GTAnimator.PlayMode.StopPrevious;
                            }
                            GTAnimator.Handler handler = new GTAnimator.Handler();
                            handler.Callback = HandlerCallback;
                            task.Handler     = handler;
                            Instance.Play(task);
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("Pause"))
                        {
                            if (Application.isPlaying == false)
                            {
                                return;
                            }
                            Instance.Pause();
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("UnPause"))
                        {
                            if (Application.isPlaying == false)
                            {
                                return;
                            }
                            Instance.UnPause();
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("Stop"))
                        {
                            if (Application.isPlaying == false)
                            {
                                return;
                            }
                            Instance.Stop(true);
                        }
                        GUILayout.EndHorizontal();
                        EditorUtility.EndContents();
                    }
                }
                #endregion

                #region animator property view
                //GUILayout.Space(5.0f);
                //if (GTAnimatorEditorUtility.DrawHeader("Animator Property", true))
                //{
                //    GTAnimatorEditorUtility.BeginContents();

                //    GUILayout.BeginHorizontal();
                //    if (GUILayout.Button("Preview", GUILayout.Width(100))) { }
                //    if (GUILayout.Button("Clear", GUILayout.Width(100))) { }
                //    GUILayout.EndHorizontal();

                //    GTAnimatorEditorUtility.EndContents();
                //}
                #endregion

                #region animation clip view
                GUILayout.Space(5.0f);
                if (CurrentSelectedClip != null)
                {
                    OpenClipHeader = EditorUtility.DrawHeader("Clip - " + CurrentSelectedClip.Name + " || From " + CurrentSelectedClip.BeginTime + "s to " + CurrentSelectedClip.EndTime + "s", true);
                }
                else
                {
                    OpenClipHeader = EditorUtility.DrawHeader("Clip", true);
                }
                if (OpenClipHeader)
                {
                    #region animation clip operation
                    EditorUtility.BeginContents();
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Name: ");
                    GonnaCreateClipName = EditorGUILayout.TextField(GonnaCreateClipName);
                    if (GUILayout.Button("Add", GUILayout.Width(60), GUILayout.Height(15)))
                    {
                        if (Instance.Clips == null)
                        {
                            Instance.Clips = new List <Clip>();
                        }
                        if (IsClipNameLegal(GonnaCreateClipName) == false)
                        {
                            Utility.LogError("clip name is illegal,please try another one"); return;
                        }
                        Instance.Clips.Add(new Clip()
                        {
                            Name = GonnaCreateClipName
                        });
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(4.0f);
                    if (GUILayout.Button("Clear", GUILayout.Width(80)))
                    {
                        if (Instance.Clips != null)
                        {
                            Instance.Clips.Clear();
                        }
                    }
                    if (GUILayout.Button("Delete", GUILayout.Width(80)))
                    {
                        if (CurrentSelectedClip == null)
                        {
                            return;
                        }
                        if (Instance.Clips == null)
                        {
                            return;
                        }
                        Instance.Clips.Remove(CurrentSelectedClip);
                    }
                    if (GUILayout.Button("Clone", GUILayout.Width(80)))
                    {
                        if (Instance.Clips == null)
                        {
                            Instance.Clips = new List <Clip>();
                        }
                        if (IsClipNameLegal(GonnaCreateClipName) == false)
                        {
                            Utility.LogError("clip name is illegal,please try another one"); return;
                        }
                        Clip clip = new Clip();
                        clip.Name = GonnaCreateClipName;
                        clip.Clone(CurrentSelectedClip);
                        Instance.Clips.Add(clip);
                    }
                    GUILayout.EndHorizontal();
                    #endregion

                    #region animation clip pop view
                    GUILayout.Space(4.0f);
                    AllClipNames = new List <string>();
                    if (Instance.Clips != null && Instance.Clips.Count > 0)
                    {
                        for (int i = 0; i < Instance.Clips.Count; i++)
                        {
                            Clip clip = Instance.Clips[i];
                            if (clip == null)
                            {
                                Instance.Clips.RemoveAt(i); i--; continue;
                            }
                            clip.ClampTime();
                            AllClipNames.Add("From " + clip.BeginTime + "s to " + clip.EndTime + "s || Name: " + clip.Name);
                        }
                    }
                    CurrentSelectedClipIndex = EditorGUILayout.Popup(CurrentSelectedClipIndex, AllClipNames.ToArray());
                    if (CurrentSelectedClipIndex < Instance.Clips.Count && CurrentSelectedClipIndex >= 0)
                    {
                        CurrentSelectedClip = Instance.Clips[CurrentSelectedClipIndex];
                    }
                    else
                    {
                        CurrentSelectedClip = null;
                    }
                    #endregion

                    #region display clip property
                    GUILayout.Space(4.0f);
                    if (CurrentSelectedClip != null)
                    {
                        CurrentSelectedClip.DiaplayEditorView();
                    }
                    #endregion

                    EditorUtility.EndContents();
                }
                #endregion

                #region animation clip actions view
                GUILayout.Space(5.0f);
                if (EditorUtility.DrawHeader("Action", true))
                {
                    if (CurrentSelectedClip == null)
                    {
                        EditorGUILayout.HelpBox("Please select an animation clip", MessageType.Warning);
                    }
                    else
                    {
                        #region header
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Clip: " + CurrentSelectedClip.Name);
                        GUILayout.Space(2.0f);
                        GUILayout.Label("Time from " + CurrentSelectedClip.BeginTime + "s to " + CurrentSelectedClip.EndTime + "s");
                        GUILayout.EndHorizontal();
                        #endregion

                        #region add action
                        EditorUtility.BeginContents();
                        GUILayout.Space(2.0f);
                        GUILayout.BeginHorizontal();
                        if (AllActionType == null || AllActionType.Count == 0 || AllActionTypeName == null || AllActionTypeName.Count == 0)
                        {
                            AllActionType = EditorUtility.GetAllSubClass(typeof(ClipAction), null);
                            if (AllActionType != null && AllActionType.Count > 0)
                            {
                                AllActionTypeName = new List <string>();
                                for (int i = 0; i < AllActionType.Count; i++)
                                {
                                    Type type = AllActionType[i];
                                    if (type == null)
                                    {
                                        continue;
                                    }
                                    string typeName = EditorUtility.GetTypeNameWithoutNamespcae(type.FullName);
                                    AllActionTypeName.Add(typeName);
                                }
                            }
                        }
                        if (AllActionTypeName != null && AllActionTypeName.Count > 0)
                        {
                            GonnaAddActionIndex = EditorGUILayout.Popup(GonnaAddActionIndex, AllActionTypeName.ToArray());
                            if (GonnaAddActionIndex >= 0 && GonnaAddActionIndex < AllActionTypeName.Count)
                            {
                                GonnaCreateActionType = AllActionType[GonnaAddActionIndex];
                            }
                        }
                        GUILayout.FlexibleSpace();
                        GonnaCreateActionName = EditorGUILayout.TextField(GonnaCreateActionName);
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Add", GUILayout.Width(60), GUILayout.Height(15)))
                        {
                            if (CurrentSelectedClip == null)
                            {
                                return;
                            }
                            if (GonnaCreateActionType == null)
                            {
                                return;
                            }
                            if (IsActionNameLegal(GonnaCreateActionName) == false)
                            {
                                Utility.LogError("action identify name is illegal,please try another one"); return;
                            }
                            ClipAction action = CurrentSelectedClip.AddAction(GonnaCreateActionType);
                            if (action != null)
                            {
                                action.IdentifyName = GonnaCreateActionName;
                            }
                        }
                        GUILayout.EndHorizontal();
                        #endregion

                        #region operation of action collection

                        GUILayout.Space(3.0f);
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("Clear", GUILayout.Width(60)))
                        {
                            if (CurrentSelectedClip == null)
                            {
                                return;
                            }
                            CurrentSelectedClip.ClearAction();
                        }
                        if (GUILayout.Button("Delete", GUILayout.Width(60)))
                        {
                            if (CurrentSelectedAction == null)
                            {
                                return;
                            }
                            if (CurrentSelectedClip == null)
                            {
                                return;
                            }
                            CurrentSelectedClip.RemoveAction(CurrentSelectedAction);
                        }
                        if (GUILayout.Button("Clone", GUILayout.Width(60)))
                        {
                        }
                        GUILayout.FlexibleSpace();
                        if (BoolDisplayAllAction)
                        {
                            if (GUILayout.Button("Display-Single"))
                            {
                                BoolDisplayAllAction = !BoolDisplayAllAction;
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("    Display-All  "))
                            {
                                BoolDisplayAllAction = !BoolDisplayAllAction;
                            }
                        }
                        GUILayout.EndHorizontal();
                        EditorUtility.EndContents();
                        #endregion

                        #region display view
                        EditorUtility.BeginContents();
                        GUILayout.Space(6.0f);
                        if (BoolDisplayAllAction == true)
                        {
                            #region all view
                            if (CurrentSelectedClip == null || CurrentSelectedClip.GetAllAction() == null || CurrentSelectedClip.GetAllAction().Count == null)
                            {
                                return;
                            }
                            for (int i = 0; i < CurrentSelectedClip.GetAllAction().Count; i++)
                            {
                                ClipAction action = CurrentSelectedClip.GetAllAction()[i];
                                if (action == null)
                                {
                                    continue;
                                }
                                EditorUtility.BeginContents();
                                GUILayout.Space(2.0f);
                                action.DisplayEditorView();
                                GUILayout.Space(2.0f);
                                EditorUtility.EndContents();
                            }
                            #endregion
                        }
                        else
                        {
                            #region single view
                            AllActionNames = new List <string>();
                            if (CurrentSelectedClip.GetAllAction() != null && CurrentSelectedClip.GetAllAction().Count > 0)
                            {
                                for (int i = 0; i < CurrentSelectedClip.GetAllAction().Count; i++)
                                {
                                    ClipAction action = CurrentSelectedClip.GetAllAction()[i];
                                    if (action == null)
                                    {
                                        continue;
                                    }
                                    AllActionNames.Add("From " + action.BeginTime + " to " + action.EndTime + " || " + action.DisplayName);
                                }
                            }
                            CurrentSelectedActionIndex = EditorGUILayout.Popup(CurrentSelectedActionIndex, AllActionNames.ToArray());
                            if (CurrentSelectedActionIndex >= 0 && CurrentSelectedActionIndex < CurrentSelectedClip.GetAllAction().Count)
                            {
                                CurrentSelectedAction = CurrentSelectedClip.GetAllAction()[CurrentSelectedActionIndex];
                            }
                            #endregion

                            #region detail property
                            GUILayout.Space(6.0f);
                            if (CurrentSelectedAction != null)
                            {
                                CurrentSelectedAction.DisplayEditorView();
                            }
                            #endregion
                        }
                        EditorUtility.EndContents();
                        #endregion
                    }
                }
                #endregion
                GUILayout.Space(5.0f);
            }
            catch { }
        }
Ejemplo n.º 16
0
 public ClipAction GetAction(string actionName)
 {
     if (string.IsNullOrEmpty(actionName))
     {
         Utility.LogError("GetAction error caused by null action name"); return(null);
     }
     for (int i = 0; i < MoveActions.Count; i++)
     {
         ClipAction action = MoveActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < RotateActions.Count; i++)
     {
         ClipAction action = RotateActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < ScaleActions.Count; i++)
     {
         ClipAction action = ScaleActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < UITweenPositionActions.Count; i++)
     {
         ClipAction action = UITweenPositionActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < UITweenRotationActions.Count; i++)
     {
         ClipAction action = UITweenRotationActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < UITweenScaleActions.Count; i++)
     {
         ClipAction action = UITweenScaleActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < ActiveObjActions.Count; i++)
     {
         ActiveObjAction action = ActiveObjActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < PlayEffectActions.Count; i++)
     {
         PlayEffectAction action = PlayEffectActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < PlayAnimActions.Count; i++)
     {
         PlayAnimAction action = PlayAnimActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     for (int i = 0; i < PlaySoundActions.Count; i++)
     {
         PlaySoundAction action = PlaySoundActions[i];
         if (action == null)
         {
             continue;
         }
         if (action.IdentifyName == actionName)
         {
             return(action);
         }
     }
     return(null);
 }
Ejemplo n.º 17
0
 public List <ClipAction> GetAllAction()
 {
     if (Actions == null)
     {
         Actions = new List <ClipAction>();
     }
     Actions.Clear();
     if (RotateActions != null && RotateActions.Count > 0)
     {
         for (int i = 0; i < RotateActions.Count; i++)
         {
             ClipAction action = RotateActions[i];
             if (action == null)
             {
                 RotateActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (MoveActions != null && MoveActions.Count > 0)
     {
         for (int i = 0; i < MoveActions.Count; i++)
         {
             ClipAction action = MoveActions[i];
             if (action == null)
             {
                 MoveActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (ScaleActions != null && ScaleActions.Count > 0)
     {
         for (int i = 0; i < ScaleActions.Count; i++)
         {
             ClipAction action = ScaleActions[i];
             if (action == null)
             {
                 ScaleActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (UITweenPositionActions != null && UITweenPositionActions.Count > 0)
     {
         for (int i = 0; i < UITweenPositionActions.Count; i++)
         {
             ClipAction action = UITweenPositionActions[i];
             if (action == null)
             {
                 UITweenPositionActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (UITweenRotationActions != null && UITweenRotationActions.Count > 0)
     {
         for (int i = 0; i < UITweenRotationActions.Count; i++)
         {
             ClipAction action = UITweenRotationActions[i];
             if (action == null)
             {
                 UITweenRotationActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (UITweenScaleActions != null && UITweenScaleActions.Count > 0)
     {
         for (int i = 0; i < UITweenScaleActions.Count; i++)
         {
             ClipAction action = UITweenScaleActions[i];
             if (action == null)
             {
                 UITweenScaleActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (ActiveObjActions != null && ActiveObjActions.Count > 0)
     {
         for (int i = 0; i < ActiveObjActions.Count; i++)
         {
             ActiveObjAction action = ActiveObjActions[i];
             if (action == null)
             {
                 ActiveObjActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (PlayEffectActions != null && PlayEffectActions.Count > 0)
     {
         for (int i = 0; i < PlayEffectActions.Count; i++)
         {
             PlayEffectAction action = PlayEffectActions[i];
             if (action == null)
             {
                 PlayEffectActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (PlayAnimActions != null && PlayAnimActions.Count > 0)
     {
         for (int i = 0; i < PlayAnimActions.Count; i++)
         {
             PlayAnimAction action = PlayAnimActions[i];
             if (action == null)
             {
                 PlayAnimActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     if (PlaySoundActions != null && PlaySoundActions.Count > 0)
     {
         for (int i = 0; i < PlaySoundActions.Count; i++)
         {
             PlaySoundAction action = PlaySoundActions[i];
             if (action == null)
             {
                 PlaySoundActions.RemoveAt(i); i--; continue;
             }
             Actions.Add(action);
         }
     }
     return(Actions);
 }
Ejemplo n.º 18
0
        public ClipAction AddAction(Type type)
        {
            if (type == null)
            {
                return(null);
            }
            ClipAction action = null;

            if (type == typeof(MoveAction))
            {
                action = new MoveAction();
                MoveActions.Add(action as MoveAction);
            }
            else if (type == typeof(RotateAction))
            {
                action = new RotateAction();
                RotateActions.Add(action as RotateAction);
            }
            else if (type == typeof(ScaleAction))
            {
                action = new ScaleAction();
                ScaleActions.Add(action as ScaleAction);
            }
            else if (type == typeof(UITweenPositionAction))
            {
                action = new UITweenPositionAction();
                UITweenPositionActions.Add(action as UITweenPositionAction);
            }
            else if (type == typeof(UITweenRotationAction))
            {
                action = new UITweenRotationAction();
                UITweenRotationActions.Add(action as UITweenRotationAction);
            }
            else if (type == typeof(UITweenScaleAction))
            {
                action = new UITweenScaleAction();
                UITweenScaleActions.Add(action as UITweenScaleAction);
            }

            else if (type == typeof(ActiveObjAction))
            {
                action = new ActiveObjAction();
                ActiveObjActions.Add(action as ActiveObjAction);
            }
            else if (type == typeof(PlayEffectAction))
            {
                action = new PlayEffectAction();
                PlayEffectActions.Add(action as PlayEffectAction);
            }
            else if (type == typeof(PlayAnimAction))
            {
                action = new PlayAnimAction();
                PlayAnimActions.Add(action as PlayAnimAction);
            }
            else if (type == typeof(PlaySoundAction))
            {
                action = new PlaySoundAction();
                PlaySoundActions.Add(action as PlaySoundAction);
            }
            return(action);
        }