Esempio n. 1
0
    private void AssignMinimapTexture(GameObject MinimapObject, string minimapName)
    {
        string path          = @"world\minimaps\" + minimapName + @"\" + MinimapObject.name + ".blp";
        string extractedPath = Casc.GetFile(path);
        Stream stream        = File.Open(extractedPath, FileMode.Open);

        byte[]    data = BLP.GetUncompressed(stream, false);
        BLPinfo   info = BLP.Info();
        Texture2D tex  = new Texture2D(info.width, info.height, BLP.TxFormat(), false);

        tex.LoadRawTextureData(data);
        MinimapObject.GetComponent <RawImage>().texture = tex;
        MinimapObject.GetComponent <RawImage>().uvRect  = new Rect(0, 0, 1, -1);
        tex.Apply();
        stream.Close();
        BLP.Close();
    }