示例#1
0
 public void RemoveAnimationEvent(AnimationEventInfo animationEventInfo)
 {
     if (m_eventList.Contains(animationEventInfo))
     {
         m_eventList.Remove(animationEventInfo);
     }
 }
示例#2
0
 public void ConvertAnimationEvents()
 {
     for (int i = 0; i < m_eventList.Count; ++i)
     {
         AnimationEventInfo animationEventInfo = m_eventList[i];
         AnimationEventUtil.Serialize(out animationEventInfo.param, animationEventInfo.attribute);
     }
 }
示例#3
0
        public AnimationEventInfo EditorClone()
        {
            AnimationEventInfo animationEventInfo = new AnimationEventInfo();

            animationEventInfo.Frame        = m_frame;
            animationEventInfo.FunctionName = m_functionName;
            animationEventInfo.param        = param;
            animationEventInfo.NomalizeTime = m_nomalizeTime;
            animationEventInfo.Time         = m_time;
            animationEventInfo.EventOnExit  = m_eventOnExit;

            animationEventInfo.attribute = AnimationEventUtil.CreateAttribute(FunctionName, param);
            return(animationEventInfo);
        }
示例#4
0
        public bool CheckEvent(int frame, string param)
        {
            for (int i = 0; i < m_eventList.Count; ++i)
            {
                AnimationEventInfo animationEventInfo = m_eventList[i];
                if (animationEventInfo.Frame == frame)
                {
                    if (animationEventInfo.param.Equals(param, StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#5
0
        public AnimationEventState Clone()
        {
            AnimationEventState clone = new AnimationEventState(Name);

            clone.Visible       = Visible;
            clone.isLooping     = isLooping;
            clone.AnimationTime = AnimationTime;
            clone.clipName      = clipName;
            //clone.m_eventList = m_eventList;

            for (int i = 0; i < m_eventList.Count; i++)
            {
                AnimationEventInfo animationEventInfo = m_eventList[i];
                clone.AddAnimationEvent(animationEventInfo.Clone());
            }

            return(clone);
        }
        private static void DeserializeAnimationEvent(string line, AnimationEventState eventState)
        {
            string[] tokens = line.Split(charSeparators, System.StringSplitOptions.None);

            if (tokens.Length >= 4)
            {
                string functionName = tokens[0];
                int    frame        = int.Parse(tokens[1]);

                float time = 0.0f;
                if (tokens.Length >= 3)
                {
                    float.TryParse(tokens[2], out time);
                }

                string param = "";
                if (tokens.Length >= 4)
                {
                    param = tokens[3];
                }

                bool eventOnExit = false;
                if (tokens.Length >= 5)
                {
                    bool.TryParse(tokens[4], out eventOnExit);
                }


                AnimationEventInfo animationEventInfo = new AnimationEventInfo();
                animationEventInfo.FunctionName = functionName;

                animationEventInfo.Frame = frame;
                //animationEvent.Param = param;
                animationEventInfo.attribute = AnimationEventUtil.CreateAttribute(functionName, param);
                AnimationEventUtil.Serialize(out param, animationEventInfo.attribute);
                animationEventInfo.param        = param;
                animationEventInfo.Time         = time;
                animationEventInfo.EventOnExit  = eventOnExit;
                animationEventInfo.NomalizeTime = time / eventState.AnimationTime;

                eventState.AddAnimationEvent(animationEventInfo);
            }
        }
示例#7
0
        public static void SetAnimationEventType(AnimationEventInfo animationEventInfo, eAnimationEventType animationEventType)
        {
            if (animationEventInfoList == null)
            {
                //Init();
                Debug.LogError("AnimationEventUtil Init Error");
                return;
            }

            foreach (AnimationEventTypeInfo animationEventTypeInfo in animationEventInfoList)
            {
                if (animationEventTypeInfo.AnimationEventType == animationEventType)
                {
                    animationEventInfo.FunctionName = animationEventTypeInfo.functionName;
                    return;
                }
            }
            animationEventInfo.FunctionName = string.Empty;
        }
示例#8
0
 public AnimationEventInfo AddAnimationEvent(AnimationEventInfo animationEventInfo)
 {
     m_eventList.Add(animationEventInfo);
     return(animationEventInfo);
 }