Commit ab7b6822 authored by mercury233's avatar mercury233

update picture loading

parent a0c8e33c
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using UnityEngine;
using YGOSharp.OCGWrapper.Enums;
......@@ -424,25 +425,15 @@ public class GameField : OCGobject
fieldCode[player] = code;
if (code > 0)
{
Texture2D tex;
if (File.Exists("picture/field/" + code.ToString() + ".png"))
{
tex = UIHelper.getTexture2D("picture/field/" + code.ToString() + ".png");
}
else if (File.Exists("picture/field/" + code.ToString() + ".jpg"))
{
tex = UIHelper.getTexture2D("picture/field/" + code.ToString() + ".jpg");
}
else
{
tex = null;
Texture2D tex = null;
bool found = false;
foreach (ZipFile zip in GameZipManager.Zips)
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (string file in zip.EntryFileNames)
{
string file1 = file.ToLower();
if (file1.EndsWith(code.ToString() + ".jpg") && file1.Contains("field"))
if (Regex.IsMatch(file.ToLower(), "field/" + code.ToString() + "\\.(jpg|png)$"))
{
MemoryStream ms = new MemoryStream();
ZipEntry e = zip[file];
......@@ -456,6 +447,13 @@ public class GameField : OCGobject
if (found)
break;
}
if (tex == null)
{
tex = UIHelper.getTexture2D("picture/field/" + code.ToString() + ".png");
}
if (tex == null)
{
tex = UIHelper.getTexture2D("picture/field/" + code.ToString() + ".jpg");
}
if (tex != null)
{
......
......@@ -324,6 +324,8 @@ public class Program : MonoBehaviour
foreach (ZipFile zip in GameZipManager.Zips)
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (string file in zip.EntryFileNames)
{
if (file.ToLower().EndsWith(".conf"))
......
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