コード例 #1
0
        private static Effect GetEffectFromFile(string path, string name)
        {
            StreamReader sr     = new StreamReader(DataLoader.Read(path, name));
            Effect       effect = new Effect(name);
            var          datas  = sr.ReadLine().Split('\t');

            effect.SoundName = datas[0];
            if (datas.Length > 1)
            {
                effect.SpeedDown = int.Parse(datas[1]);
            }
            int frameCount = int.Parse(sr.ReadLine());

            effect.Frames = new EffectFrame[frameCount];
            for (int i = 0; i < frameCount; i++)
            {
                int         frameUnitCount = int.Parse(sr.ReadLine());
                EffectFrame frame          = new EffectFrame();
                frame.Units = new EffectFrameUnit[frameUnitCount];
                for (int j = 0; j < frameUnitCount; j++)
                {
                    string          read   = sr.ReadLine();
                    string[]        arrays = read.Split('\t');
                    EffectFrameUnit fu     = new EffectFrameUnit();
                    fu.frameid = int.Parse(arrays[0]);
                    fu.x       = int.Parse(arrays[1]);
                    fu.y       = int.Parse(arrays[2]);
                    fu.width   = int.Parse(arrays[3]);
                    fu.height  = int.Parse(arrays[4]);
                    if (arrays.Length >= 6)
                    {
                        fu.effect = int.Parse(arrays[5]);
                    }
                    frame.Units[j] = fu;
                }
                effect.Frames[i] = frame;
            }
            sr.Close();
            return(effect);
        }
コード例 #2
0
ファイル: EffectBook.cs プロジェクト: narlon/TOMClassic
        static private Effect GetEffectFromFile(string path, string name)
        {
            StreamReader sr = new StreamReader(DataLoader.Read(path, name));
            Effect effect = new Effect(name);
            var datas = sr.ReadLine().Split('\t');
            effect.SoundName = datas[0];
            if (datas.Length > 1)
                effect.SpeedDown = int.Parse(datas[1]);
            int frameCount = int.Parse(sr.ReadLine());
            effect.Frames = new EffectFrame[frameCount];
            for (int i = 0; i < frameCount; i++)
            {
                int frameUnitCount = int.Parse(sr.ReadLine());
                EffectFrame frame = new EffectFrame();
                frame.Units = new EffectFrameUnit[frameUnitCount];
                for (int j = 0; j < frameUnitCount; j++)
                {
                    string read = sr.ReadLine();
                    string[] arrays = read.Split('\t');
                    EffectFrameUnit fu = new EffectFrameUnit();
                    fu.frameid = int.Parse(arrays[0]);
                    fu.x = int.Parse(arrays[1]);
                    fu.y = int.Parse(arrays[2]);
                    fu.width = int.Parse(arrays[3]);
                    fu.height = int.Parse(arrays[4]);
                    if (arrays.Length >= 6)
                    {
                        fu.effect = int.Parse(arrays[5]);
                    }
                    frame.Units[j] = fu;
                }
                effect.Frames[i] = frame;
            }
			sr.Close();
            return effect;
        }