Example #1
0
 private static void WriteBackgrounds(IList <KeyValuePair <string, GMBackground> > _data, Stream _s, IFF _iff)
 {
     WriteDataKVP(_data, _s, _iff, delegate(KeyValuePair <string, GMBackground> _kvp, Stream __s, IFF __iff, long __index)
     {
         __s.PatchOffset(__index);
         __iff.AddString(__s, _kvp.Key);
         GMBackground value = _kvp.Value;
         __s.WriteBoolean(value.Transparent);
         __s.WriteBoolean(value.Smooth);
         __s.WriteBoolean(value.Preload);
         if (value.Bitmap != null && value.Bitmap.Width * value.Bitmap.Height > 0)
         {
             ms_tpageSprites.BeginGroup(_kvp.Key);
             TexturePageEntry texturePageEntry = ms_tpageSprites.AddImage(value.Bitmap.Bitmap, true, false);
             ms_tpageSprites.EndGroup();
             texturePageEntry.OriginalRepeatBorder = true;
             texturePageEntry.RepeatX = 2;
             texturePageEntry.RepeatY = 2;
             TextureOptions.SetTextureOptions(_kvp.Key, texturePageEntry);
             __iff.AddPatch(__s, texturePageEntry);
         }
         else
         {
             __s.WriteInteger(0);
         }
     });
 }
Example #2
0
        public void Background_Load(Stream _s)
        {
            int num  = _s.ReadInteger();
            int num2 = _s.ReadInteger();

            for (int i = 0; i < num2; i++)
            {
                Stream s = _s;
                if (num == 800)
                {
                    s = _s.ReadStreamC();
                }
                bool flag = s.ReadBoolean();
                KeyValuePair <string, GMBackground> item = default(KeyValuePair <string, GMBackground>);
                if (flag)
                {
                    string       key   = s.ReadString();
                    GMBackground value = new GMBackground(this, s);
                    item = new KeyValuePair <string, GMBackground>(key, value);
                }
                Backgrounds.Add(item);
            }
        }