private static void DeserializeState(string line, AnimationEventStates animationEventStates)
        {
            if (line.StartsWith("[") && line.EndsWith("]"))
            {
                int    start     = line.IndexOf('[');
                int    last      = line.LastIndexOf(']');
                string stateName = line.Substring(start + 1, last - start - 1);

                m_currentAnimationEventState = animationEventStates.GetState(stateName);
                if (m_currentAnimationEventState == null)
                {
                    m_currentAnimationEventState = new AnimationEventState(stateName);
                    animationEventStates.AddState(m_currentAnimationEventState);
                }
            }
            else if (line.StartsWith("!"))
            {
                string animationEvent = line.Substring(1);
                DeserializeAnimationEvent(animationEvent, m_currentAnimationEventState);
            }
            else
            {
                string[] tokens      = line.Split(charSeparators, System.StringSplitOptions.None);
                string   tokenoption = tokens[0].Trim();

                if (m_currentAnimationEventState == null || tokens.Length != 2)
                {
                    return;
                }

                if (tokenoption == "clipTime")
                {
                    float AnimationTime;
                    StringConverter.TryConvert(tokens[1], out AnimationTime);
                    m_currentAnimationEventState.AnimationTime = AnimationTime;
                }
                else if (tokenoption == "isLooping")
                {
                    bool isLooping;
                    StringConverter.TryConvert(tokens[1], out isLooping);
                    m_currentAnimationEventState.isLooping = isLooping;
                }
                else if (tokenoption == "visible")
                {
                    bool Visible;
                    StringConverter.TryConvert <bool>(tokens[1], out Visible);
                    m_currentAnimationEventState.Visible = Visible;
                }
                else if (tokenoption == "clipName")
                {
                    m_currentAnimationEventState.clipName = tokens[1];
                }
            }
        }
Exemple #2
0
        public AnimationEventStates Clone(/*ReleaseStates releaseStates*/)
        {
            AnimationEventStates cloneAnimationEventStates = new AnimationEventStates();

            cloneAnimationEventStates.Init(m_releaseStates);
            for (int i = 0; i < m_stateList.Count; i++)
            {
                cloneAnimationEventStates.AddState(m_stateList[i].Clone());
            }
            cloneAnimationEventStates.StateSort();
            cloneAnimationEventStates.GraphName = m_graphName;

            //m_releaseStates = releaseStates;

            return(cloneAnimationEventStates);
        }