Example #1
0
        public ObjectBankList Load()
        {
            ObjectBankList bankList = new ObjectBankList();

            /*foreach(string b in baseProfiles.Split(' ')) {
            *  foreach(Profile p in Profile.Profiles) {
            *   if(p.ID == b) bankList.Merge(p.Load());
            *  }
            *  }
            *
            *  ObjectBankList newList = new ObjectBankList();*/
            foreach (BankDef def in banks)
            {
                List <Tuple <int, Bitmap> > objects = new List <Tuple <int, Bitmap> >();
                for (int i = 0; i < def.Paths.Length; i++)
                {
                    List <int> bounds   = new List <int>();
                    string[]   unparsed = def.Indices[i].Split(new char[] { ' ', '-' });
                    foreach (string s in unparsed)
                    {
                        bounds.Add(int.Parse(s));
                    }
                    for (int r = 0; r < bounds.Count; r += 2)
                    {
                        for (int j = bounds[r]; j <= bounds[r + 1]; j++)
                        {
                            Bitmap b = Program.LoadBitmap(def.Paths[i] + @"\Object" + j + ".png");
                            b.MakeTransparent(Color.Magenta);
                            objects.Add(Tuple.Create <int, Bitmap>(j, b));
                        }
                    }
                }
                bankList.Add(new ObjectBank(def.Index, def.Name, objects));
            }
            bankList.SortBanks();
            //bankList.Merge(newList);

            return(bankList);
        }