Esempio n. 1
0
 public void Draw(Graphics g, int x, int y, int wp, int hp)
 {
     for (int i = 0; i < Units.Length; i++)
     {
         EffectFrameUnit efu  = Units[i];
         int             ewid = efu.width * wp / 100;
         int             eheg = efu.height * hp / 100;
         var             img  = EffectBook.GetEffectImage(efu.frameid.ToString(), efu.effect, false);
         if (img != null)
         {
             g.DrawImage(img, x + efu.x * wp / 100, y + efu.y * hp / 100, ewid, eheg);
         }
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
        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;
        }