Example #1
0
        // return true when need next line
        void parseData(string key, string line)
        {
            string nline = "";

            string[] ss = null;
            switch (key)
            {
            case "SHADOW":
                Shadow = line.Trim().ToBool();
                break;

            case "LOOP":
                Loop = line.Trim().ToBool();
                break;

            case "FRAME MAX":
                Frames = new AnimeFrame[line.Trim().ToInt()];
                for (int i = 0; i < Frames.Length; i++)
                {
                    Frames[i] = new AnimeFrame();
                }
                break;

            // frame
            case "IMAGE":
                current_frame.Image = line.RemoveQuotes().ToLower();
                nline = current_reader.ReadLine();
                current_frame.ImageIdx = nline.ToShort();
                break;

            case "IMAGE POS":
                if (current_frame.Image.valid())       // is valid image
                {
                    ss = line.Trim().Split('\t');
                    current_frame.ImagePos = new Pos2D(ss);
                }
                break;

            case "GRAPHIC EFFECT":
                current_frame.GraphicEffect = (GraphicEffect)Enum.Parse(typeof(GraphicEffect), line.RemoveQuotes());
                if (current_frame.GraphicEffect == GraphicEffect.MONOCHROME ||
                    current_frame.GraphicEffect == GraphicEffect.SPACEDISTORT)
                {
                    nline = current_reader.ReadLine();
                    current_frame.GraphicColor = new Color3D(nline.Trim().Split('\t'));
                }
                break;

            case "DELAY":
                current_frame.Delay = line.Trim().ToShort();
                break;

            case "RGBA":
                ss = line.Trim().Split('\t');
                current_frame.RGBA = new Color4D(ss);
                break;

            case "INTERPOLATION":
                current_frame.Interpolation = line.Trim().ToBool();
                break;

            case "DAMAGE BOX":
                if (current_frame.DamageBox == null)
                {
                    current_frame.DamageBox = new List <Box6D>();
                }
                current_frame.DamageBox.Add(new Box6D(line.Trim().Split('\t')));
                break;

            case "IMAGE RATE":
                current_frame.ImageRate = new Pos2f(line.Trim().Split('\t'));
                break;

            case "ATTACK BOX":
                current_frame.AttackBox = new Box6D(line.Trim().Split('\t'));
                break;

            case "DAMAGE TYPE":
                current_frame.DamageType = line.RemoveQuotes().ToEnum <DamageType>();
                break;

            case "PLAY SOUND":
                current_frame.SoundType = line.RemoveQuotes().ToEnum <SoundType>();
                break;

            case "IMAGE ROTATE":
                current_frame.ImageRotate = line.Trim().ToFloat();
                break;

            case "PRELOAD":
                current_frame.Preload = line.Trim().ToBool();
                break;

            case "SET FLAG":     // aicharacter/gunner/bomb_man/animation/c4remoteexthrow.ani at 1
                current_frame.SetFlag = int.Parse(line.Trim());
                break;

            case "FLIP TYPE":     // aicharacter/gunner/cypher_man/animation/earthbreakout3.ani at `ALL`
                current_frame.FlipType = line.RemoveQuotes().ToEnum <FlipType>();
                break;

            case "COORD":     // character/common/animation/booster_particle_0.ani at 1
                Coord = line.Trim().ToBool();
                break;

            case "CLIP":     // character/fighter/atanimation/blockbusterready.ani at -99	-200	200	200
                current_frame.Clip = new Box4D(line.Trim().Split('\t'));
                break;

            case "LOOP END":     // character/fighter/atanimation/chargespearrecharge.ani at 999
                current_frame.LoopMax = int.Parse(line.Trim());
                break;

            case "OPERATION":     // character/thief/effect/animation/silverstream/finishslasheffectback.ani at 1
                Operation = line.Trim().ToBool();
                break;

            // spectrum
            case "SPECTRUM":     // aicharacter/_jojochan/swordman/godsword/animation/dash.ani at 1
                Spectrum        = new Spectrum();
                Spectrum.Enable = line.Trim().ToBool();
                break;

            case "SPECTRUM TERM":     // aicharacter/_jojochan/swordman/godsword/animation/move.ani at 100
                Spectrum.Term = short.Parse(line.Trim());
                break;

            case "SPECTRUM LIFE TIME":     // aicharacter/_jojochan/swordman/soldoros/animation/dash.ani at 500
                Spectrum.LifeTime = short.Parse(line.Trim());
                break;

            case "SPECTRUM COLOR":     // aicharacter/_jojochan/swordman/soldoros/animation/move.ani at 10	10	155	100
                Spectrum.Color = new Color4D(line.Trim().Split('\t'));
                break;

            case "SPECTRUM EFFECT":     // character/priest/animation/highspeedslashattack1.ani at `DARK`
                Spectrum.Effect = line.RemoveQuotes().ToEnum <GraphicEffect>();
                break;

            default:
                ConfigUtils.RecordMiss(typeof(AnimeConfig), key, line.Trim());
                break;
                //throw new Exception(("unkown key: " + key));
                //("unkown key: " + key).warning();
            }
        }