Commit a0c8e33c authored by mercury233's avatar mercury233

update loading datas

parent c44377fc
...@@ -288,45 +288,52 @@ public class Program : MonoBehaviour ...@@ -288,45 +288,52 @@ public class Program : MonoBehaviour
go(300, () => go(300, () =>
{ {
InterString.initialize("config/translation.conf"); InterString.initialize("config/translation.conf");
GameTextureManager.initialize();
Config.initialize("config/config.conf");
var fileInfos = (new DirectoryInfo("data")).GetFiles(); if (!Directory.Exists("expansions"))
for (int i = 0; i < fileInfos.Length; i++)
{ {
if (fileInfos[i].Name.Length > 4) Directory.CreateDirectory("expansions");
}
var fileInfos = (new DirectoryInfo("expansions")).GetFiles();
foreach (FileInfo file in fileInfos)
{ {
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".zip") if (file.Name.ToLower().EndsWith(".ypk"))
{ {
GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("data/" + fileInfos[i].Name)); GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + file.Name));
}
} }
if (file.Name.ToLower().EndsWith(".conf"))
{
GameStringManager.initialize("expansions/" + file.Name);
} }
fileInfos = (new DirectoryInfo("expansions")).GetFiles(); if (file.Name.ToLower().EndsWith(".cdb"))
for (int i = 0; i < fileInfos.Length; i++)
{ {
if (fileInfos[i].Name.Length > 4) YGOSharp.CardsManager.initialize("expansions/" + file.Name);
}
}
fileInfos = (new DirectoryInfo("data")).GetFiles();
foreach (FileInfo file in fileInfos)
{ {
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".ypk") if (file.Name.ToLower().EndsWith(".zip"))
{ {
GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + fileInfos[i].Name)); GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("data/" + file.Name));
}
} }
} }
GameTextureManager.initialize();
Config.initialize("config/config.conf");
foreach (ZipFile zip in GameZipManager.Zips) foreach (ZipFile zip in GameZipManager.Zips)
{ {
foreach (string file in zip.EntryFileNames) foreach (string file in zip.EntryFileNames)
{ {
if (file.EndsWith(".conf")) if (file.ToLower().EndsWith(".conf"))
{ {
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
ZipEntry e = zip[file]; ZipEntry e = zip[file];
e.Extract(ms); e.Extract(ms);
GameStringManager.initializeContent(Encoding.UTF8.GetString(ms.ToArray())); GameStringManager.initializeContent(Encoding.UTF8.GetString(ms.ToArray()));
} }
if (file.EndsWith(".cdb")) if (file.ToLower().EndsWith(".cdb"))
{ {
ZipEntry e = zip[file]; ZipEntry e = zip[file];
string tempfile = Path.Combine(Path.GetTempPath(), file); string tempfile = Path.Combine(Path.GetTempPath(), file);
...@@ -337,56 +344,18 @@ public class Program : MonoBehaviour ...@@ -337,56 +344,18 @@ public class Program : MonoBehaviour
} }
} }
GameStringManager.initialize("config/strings.conf"); GameStringManager.initialize("data/strings.conf");
if (File.Exists("cdb/strings.conf")) YGOSharp.CardsManager.initialize("data/cards.cdb");
{ YGOSharp.BanlistManager.initialize("data/lflist.conf");
GameStringManager.initialize("cdb/strings.conf");
}
if (File.Exists("diy/strings.conf"))
{
GameStringManager.initialize("diy/strings.conf");
}
YGOSharp.BanlistManager.initialize("config/lflist.conf");
fileInfos = (new DirectoryInfo("cdb")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name);
}
}
}
if (Directory.Exists("diy"))
{
fileInfos = (new DirectoryInfo("diy")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("diy/" + fileInfos[i].Name);
}
}
}
}
if (Directory.Exists("pack")) if (Directory.Exists("pack"))
{ {
fileInfos = (new DirectoryInfo("pack")).GetFiles(); fileInfos = (new DirectoryInfo("pack")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++) foreach (FileInfo file in fileInfos)
{
if (fileInfos[i].Name.Length > 3)
{ {
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") if (file.Name.ToLower().EndsWith(".db"))
{ {
YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("pack/" + file.Name);
}
} }
} }
YGOSharp.PacksManager.initializeSec(); YGOSharp.PacksManager.initializeSec();
...@@ -1039,6 +1008,10 @@ public class Program : MonoBehaviour ...@@ -1039,6 +1008,10 @@ public class Program : MonoBehaviour
//adeUnityEngine.Debug.Log(e); //adeUnityEngine.Debug.Log(e);
} }
Menu.deleteShell(); Menu.deleteShell();
foreach (ZipFile zip in GameZipManager.Zips)
{
zip.Dispose();
}
} }
public void quit() public void quit()
......
...@@ -67,6 +67,8 @@ public static class GameStringManager ...@@ -67,6 +67,8 @@ public static class GameStringManager
a.content += mats[i] + " "; a.content += mats[i] + " ";
} }
a.content = a.content.Substring(0, a.content.Length - 1); a.content = a.content.Substring(0, a.content.Length - 1);
if (get(a.region, a.hashCode) == "")
{
hashedStrings.Add(a); hashedStrings.Add(a);
if (a.region == "setname") if (a.region == "setname")
{ {
...@@ -76,6 +78,7 @@ public static class GameStringManager ...@@ -76,6 +78,7 @@ public static class GameStringManager
} }
} }
} }
}
public static string get(string region, int hashCode) public static string get(string region, int hashCode)
{ {
......
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