Commit d7e6bca6 authored by mercury233's avatar mercury233

add GetTexture2DFromZip

parent 2b482758
Pipeline #12288 failed with stages
in 29 minutes and 13 seconds
This diff is collapsed.
using System.Collections.Generic; using Ionic.Zip;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
...@@ -88,6 +89,26 @@ public class GameTextureManager ...@@ -88,6 +89,26 @@ public class GameTextureManager
{ {
if (code == 0) return zero; if (code == 0) return zero;
if (loadedPicture.TryGetValue(code, out var cached)) return await cached; if (loadedPicture.TryGetValue(code, out var cached)) return await cached;
foreach (ZipFile zip in GameZipManager.Zips)
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (string file in zip.EntryFileNames)
{
foreach (var extname in new[] { ".png", ".jpg" })
{
var path = $"pics/{code}{extname}";
if (file.ToLower() == path)
{
var result = UIHelper.GetTexture2DFromZipAsync(zip, file);
loadedPicture.Add(code, result);
return await result;
}
}
}
}
foreach (var extname in new[] {".png", ".jpg"}) foreach (var extname in new[] {".png", ".jpg"})
{ {
var path = $"picture/card/{code}{extname}"; var path = $"picture/card/{code}{extname}";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment