Esempio n. 1
0
        protected virtual void InitTextures <T>(ArchiveWorker aw = null) where T : Texture_Base, new()
        {
            int count = (int)Props.Sum(x => x.Count);

            if (Textures == null)
            {
                Textures = new List <TextureHandler>(count);
            }
            if (Textures.Count <= 0)
            {
                if (aw == null)
                {
                    aw = new ArchiveWorker(ArchiveString);
                }
                T tex;
                Scale = new Dictionary <uint, Vector2>(count);
                int b = 0;
                for (int j = 0; j < Props.Count; j++)
                {
                    for (uint i = 0; i < Props[j].Count; i++)
                    {
                        tex = new T();
                        byte[] buffer = aw.GetBinaryFile(string.Format(Props[j].Filename, i + TextureStartOffset));
                        if (buffer != null)
                        {
                            tex.Load(buffer);

                            if (Props[j].Big != null && FORCE_ORIGINAL == false && b < Props[j].Big.Count)
                            {
                                TextureHandler th = TextureHandler.Create(Props[j].Big[b].Filename, tex, 2, Props[j].Big[b++].Split / 2);

                                Textures.Add(th);
                                Scale[i] = Vector2.One;
                            }
                            else
                            {
                                TextureHandler th = TextureHandler.Create(Props[j].Filename, tex);
                                Textures.Add(th);
                                Scale[i] = th.GetScale(); //scale might not be used outside of texturehandler.
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        protected virtual void InitTextures(ArchiveWorker aw = null)
        {
            int count = (int)Props.Sum(x => x.Count);

            if (Textures == null)
            {
                Textures = new List <TextureHandler>(count);
            }
            if (Textures.Count <= 0)
            {
                if (aw == null)
                {
                    aw = new ArchiveWorker(ArchiveString);
                }
                TEX tex;
                Scale = new Dictionary <uint, Vector2>(count);
                int b = 0;
                for (int j = 0; j < Props.Count; j++)
                {
                    for (uint i = 0; i < Props[j].Count; i++)
                    {
                        string path = aw.GetListOfFiles().First(x => x.ToLower().Contains(string.Format(Props[j].Filename, i + TextureStartOffset)));
                        tex = new TEX(aw.GetBinaryFile(path));
                        if (Props[j].Big != null && FORCE_ORIGINAL == false && b < Props[j].Big.Count)
                        {
                            TextureHandler th = new TextureHandler(Props[j].Big[b].Filename, tex, 2, Props[j].Big[b++].Split / 2);

                            Textures.Add(th);
                            Scale[i] = Vector2.One;
                        }
                        else
                        {
                            TextureHandler th = new TextureHandler(path, tex);
                            Textures.Add(th);
                            Scale[i] = th.GetScale(); //scale might not be used outside of texturehandler.
                        }
                    }
                }
            }
        }