Beispiel #1
0
        static public void LoadDS1()
        {
            var assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);

            if (!Application.isPlaying)
            {
                DT1.ResetCache();
                DS1.ResetCache();
            }
            var ds1   = DS1.Load(assetPath, mpq: false);
            var level = new LevelBuilder(ds1);

            level.Instantiate(new Vector2i(0, 0));
        }
Beispiel #2
0
        static public void ConvertDT1ToPNG()
        {
            var assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);

            if (!Application.isPlaying)
            {
                DT1.ResetCache();
            }

            var lowerPath = assetPath.ToLower();

            Color32[] palette;
            if (lowerPath.Contains("act2"))
            {
                palette = Palette.GetPalette(PaletteType.Act2);
            }
            else if (lowerPath.Contains("act3"))
            {
                palette = Palette.GetPalette(PaletteType.Act3);
            }
            else if (lowerPath.Contains("act4"))
            {
                palette = Palette.GetPalette(PaletteType.Act4);
            }
            else if (lowerPath.Contains("act5"))
            {
                palette = Palette.GetPalette(PaletteType.Act5);
            }
            else
            {
                palette = Palette.GetPalette(PaletteType.Act1);
            }
            var dt1 = DT1.Load(assetPath, palette, mpq: false);
            int i   = 0;

            foreach (var texture in dt1.textures)
            {
                var pngData = texture.EncodeToPNG();
                Object.DestroyImmediate(texture);
                var pngPath = assetPath + "." + i + ".png";
                File.WriteAllBytes(pngPath, pngData);
                AssetDatabase.ImportAsset(pngPath);
                ++i;
            }
        }