Example #1
0
        static void ReadAni(ModelDef modelDef, ScriptOverlay overlay, string[] strs, ref int newAnis, ref int newJobs)
        {
            string aniName = ExtractString(strs[1]);

            int layer;

            if (!int.TryParse(strs[2], out layer))
            {
                return;
            }

            string nextAni = ExtractString(strs[3]);

            int startFrame;

            if (!int.TryParse(strs[9], out startFrame))
            {
                return;
            }

            int endFrame;

            if (!int.TryParse(strs[10], out endFrame) || endFrame < 0)
            {
                return;
            }

            float fps = 25;

            if (strs.Length > 11)
            {
                float.TryParse(strs[11].Substring("FPS:".Length), out fps);
            }

            ScriptAniJob aniJob;

            if (!modelDef.TryGetAniJob(aniName, out aniJob))
            {
                aniJob = new ScriptAniJob(aniName, aniName);
                if (!modelDef.Catalog.ContainsPropertyForJob(aniJob))
                {
                    return;
                }

                modelDef.AddAniJob(aniJob);
                newJobs++;
            }
            aniJob.Layer = layer;

            ScriptAni ani = new ScriptAni(startFrame, endFrame);

            ani.FPS = fps;
            if (overlay == null)
            {
                aniJob.SetDefaultAni(ani);
            }
            else
            {
                aniJob.AddOverlayAni(ani, overlay);
            }
            newAnis++;
        }