예제 #1
0
 private static System.Drawing.Image LoadCollectibleIcon(SimPe.PackedFiles.Wrapper.Picture pic, UInt32 g, UInt32 i)
 {
     SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = SimPe.FileTable.FileIndex.FindFileByGroupAndInstance(g, i);
     if (items.Length > 0)
     {
         pic.ProcessData(items[0]);
         System.Drawing.Bitmap   bmp = new System.Drawing.Bitmap(pic.Image.Width / 4, pic.Image.Height);
         System.Drawing.Graphics gr  = System.Drawing.Graphics.FromImage(bmp);
         gr.DrawImage(pic.Image, new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.GraphicsUnit.Pixel);
         gr.Dispose();
         return(bmp);
     }
     return(null);
 }
예제 #2
0
        private int CreateCollectibleAlias(SimPe.PackedFiles.Wrapper.StrItemList strs, SimPe.PackedFiles.Wrapper.Picture pic, string line, int index)
        {
            index--;
            string image = GetUIListAttribute(line, "image");
            string id    = GetUIAttribute(line, "id");
            int    nr    = Helper.StringToInt32(id, 0, 16) / 2 - 1;

            string[] stgi = image.Split(new char[] { ',' });
            UInt32   g    = Helper.StringToUInt32(stgi[0], 0, 16);
            UInt32   i    = Helper.StringToUInt32(stgi[1], 0, 16);
            string   name = GetUITextAttribute(line, "tiptext");

            if (index < strs.Count)
            {
                name = strs[index].Title;
            }

            System.Drawing.Image img = null;

            img = LoadCollectibleIcon(pic, g, i);

            collectibles[nr] = new CollectibleAlias((ulong)Math.Pow(2, nr), nr, name, img);
            return(index);
        }