Commit 81cca36a authored by Unicorn's avatar Unicorn

YGOPro2 Paths

parent 98996656
......@@ -20,7 +20,7 @@ public class barPngLoader : MonoBehaviour {
api_timeBar.mainTexture = GameTextureManager.time;
try
{
string[] allLines = (File.ReadAllText("textures/duel/healthBar/config.txt").Replace("\r", "").Replace(" ", "").Split("\n"));
string[] allLines = (File.ReadAllText("texture/duel/healthBar/config.txt").Replace("\r", "").Replace(" ", "").Split("\n"));
foreach (var item in allLines)
{
string[] mats = item.Split("=");
......
......@@ -33,7 +33,7 @@ public class UITextureInspector : UIBasicSpriteEditor
startPath = sp2.stringValue;
if (startPath != "")
{
mTex.mainTexture = UIHelper.getTexture2D("textures/ui/" + startPath + ".png");
mTex.mainTexture = UIHelper.getTexture2D("texture/ui/" + startPath + ".png");
}
Debug.Log("force delay read");
}
......
......@@ -7,7 +7,7 @@ public class BackGroundPic : Servant
public override void initialize()
{
backGround = create(Program.I().mod_simple_ngui_background_texture, Vector3.zero, Vector3.zero, false, Program.ui_back_ground_2d);
FileStream file = new FileStream("textures/bg.jpg", FileMode.Open, FileAccess.Read);
FileStream file = new FileStream("texture/common/desk.jpg", FileMode.Open, FileAccess.Read);
file.Seek(0, SeekOrigin.Begin);
byte[] data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
......
......@@ -51,7 +51,7 @@ public static class Config
if (loaded == false)
{
loaded = true;
string[] lines = File.ReadAllText("textures/ui/config.txt").Replace("\r", "").Replace(" ", "").Split("\n");
string[] lines = File.ReadAllText("texture/ui/config.txt").Replace("\r", "").Replace(" ", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
{
string[] mats = lines[i].Split("=");
......
......@@ -736,7 +736,7 @@ public static class UIHelper
{
try
{
FileInfo[] fileInfos = (new DirectoryInfo("textures/face")).GetFiles();
FileInfo[] fileInfos = (new DirectoryInfo("texture/face")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
......@@ -748,7 +748,7 @@ public static class UIHelper
{
try
{
faces.Add(name, UIHelper.getTexture2D("textures/face/" + fileInfos[i].Name));
faces.Add(name, UIHelper.getTexture2D("texture/face/" + fileInfos[i].Name));
}
catch (Exception e)
{
......
......@@ -130,9 +130,9 @@ public class GameField : OCGobject
public void loadOldField()
{
if (File.Exists("textures/field2.png"))
if (File.Exists("texture/duel/field"))
{
Texture2D textureField = UIHelper.getTexture2D("textures/field2.png");
Texture2D textureField = UIHelper.getTexture2D("texture/duel/field.png");
Texture2D[] textureFieldSliced = UIHelper.sliceField(textureField);
leftT.mainTexture = textureFieldSliced[0];
midT.mainTexture = textureFieldSliced[1];
......@@ -150,9 +150,9 @@ public class GameField : OCGobject
public void loadNewField()
{
if (File.Exists("textures/field3.png"))
if (File.Exists("texture/duel/newfield.png"))
{
Texture2D textureField = UIHelper.getTexture2D("textures/field3.png");
Texture2D textureField = UIHelper.getTexture2D("texture/duel/newfield.png");
Texture2D[] textureFieldSliced = UIHelper.sliceField(textureField);
leftT.mainTexture = textureFieldSliced[0];
midT.mainTexture = textureFieldSliced[1];
......
......@@ -280,32 +280,36 @@ public class Program : MonoBehaviour
//System.IO.Directory.SetCurrentDirectory(System.Windows.Forms.Application.StartupPath);
#elif UNITY_ANDROID //Android
//保持唤醒
Screen.sleepTimeout = SleepTimeout.NeverSleep;
//创建资源目录
if (!Directory.Exists("/storage/emulated/0/ygocore/updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath);
while (!www.isDone) { }
byte[] bytes = www.bytes;
ExtractZipFile(bytes, "/storage/emulated/0/");
File.Create("/storage/emulated/0/ygocore/.nomedia");
}
//YGOMobile Paths (https://github.com/Unicorn369/YGOPro2_Droid)
//string GamePaths = "/storage/emulated/0/ygocore";
//YGOPro2 Paths (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test)
string GamePaths = "/storage/emulated/0/ygopro2/";
Environment.CurrentDirectory = "/storage/emulated/0/ygocore";
System.IO.Directory.SetCurrentDirectory("/storage/emulated/0/ygocore");
if(!File.Exists(GamePaths + "updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "ygocore.zip";
var www = new WWW(filePath);
while (!www.isDone) { }
byte[] bytes = www.bytes;
ExtractZipFile(bytes, GamePaths);
//File.Create(GamePaths + ".nomedia");
}
Environment.CurrentDirectory = GamePaths;
System.IO.Directory.SetCurrentDirectory(GamePaths);
#elif UNITY_IPHONE //iPhone
if (!Directory.Exists(Application.persistentDataPath +"/ygocore/updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath);
while (!www.isDone) { }
byte[] bytes = www.bytes;
ExtractZipFile(System.IO.File.ReadAllBytes (bytes), Application.persistentDataPath + "/");
}
Environment.CurrentDirectory = Application.persistentDataPath+"/ygocore";
System.IO.Directory.SetCurrentDirectory(Application.persistentDataPath+"/ygocore");
string GamePaths = Application.persistentDataPath + "/ygopro2/";
if(!File.Exists(GamePaths + "updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath);
while (!www.isDone) { }
byte[] bytes = www.bytes;
ExtractZipFile(System.IO.File.ReadAllBytes(bytes), GamePaths);
}
Environment.CurrentDirectory = GamePaths;
System.IO.Directory.SetCurrentDirectory(GamePaths);
#endif
go(1, () =>
{
......@@ -323,20 +327,19 @@ public class Program : MonoBehaviour
//InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language
GameTextureManager.initialize();
Config.initialize("config/config.conf");
//GameStringManager.initialize("config/strings.conf");
GameStringManager.initialize("strings.conf");
if (File.Exists("config/strings.conf"))
GameStringManager.initialize("config/strings.conf");
if (File.Exists("cdb/strings.conf"))
{
GameStringManager.initialize("config/strings.conf");
GameStringManager.initialize("cdb/strings.conf");
}
if (File.Exists("expansions/strings.conf"))
{
GameStringManager.initialize("expansions/strings.conf");
}
//YGOSharp.BanlistManager.initialize("config/lflist.conf");
YGOSharp.BanlistManager.initialize("lflist.conf");
YGOSharp.BanlistManager.initialize("config/lflist.conf");
FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray();
//FileInfo[] fileInfos = (new DirectoryInfo("cdb" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();//System Language
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
......@@ -352,8 +355,8 @@ public class Program : MonoBehaviour
if (Directory.Exists("expansions"))
//if (Directory.Exists("expansions" + AppLanguage.LanguageDir()))
{
fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray(); ;
//fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles();
fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();
//fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
......@@ -451,6 +454,7 @@ public class Program : MonoBehaviour
List<ApiFile> apiFromGit = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<ApiFile>>(w.text);
if (!File.Exists("updates/SHAs.txt"))
{
Directory.CreateDirectory("updates");
toDownload.AddRange(apiFromGit);
}
......@@ -485,11 +489,11 @@ public class Program : MonoBehaviour
{
if (Path.GetExtension(dl.name)== ".cdb" && !(Application.internetReachability == NetworkReachability.NotReachable))
{
httpDldFile.Download(dl.download_url, Path.Combine("cdb", dl.name));
httpDldFile.Download(dl.download_url, Path.Combine("cdb/", dl.name));
}
if (Path.GetExtension(dl.name) == ".conf" && !(Application.internetReachability == NetworkReachability.NotReachable))
{
httpDldFile.Download(dl.download_url, Path.Combine("config", dl.name));
httpDldFile.Download(dl.download_url, Path.Combine("config/", dl.name));
}
}
File.WriteAllText("updates/SHAs.txt", w.text);
......
......@@ -332,10 +332,14 @@ public class GameTextureManager
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
bool Iam8 = false;
//if (!File.Exists(path))
//{
// Iam8 = true;
// path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
//}
if (!File.Exists(path))
{
Iam8 = true;
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
path = "expansions/pics/" + pic.code.ToString() + ".png";
}
if (!File.Exists(path))
{
......@@ -343,6 +347,10 @@ public class GameTextureManager
path = "expansions/pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
path = "pics/" + pic.code.ToString() + ".png";
}
if (!File.Exists(path))
{
Iam8 = true;
path = "pics/" + pic.code.ToString() + ".jpg";
......@@ -604,10 +612,14 @@ public class GameTextureManager
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
bool Iam8 = false;
//if (!File.Exists(path))
//{
// Iam8 = true;
// path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
//}
if (!File.Exists(path))
{
Iam8 = true;
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
path = "expansions/pics/" + pic.code.ToString() + ".png";
}
if (!File.Exists(path))
{
......@@ -615,13 +627,17 @@ public class GameTextureManager
path = "expansions/pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
path = "pics/" + pic.code.ToString() + ".png";
}
if (!File.Exists(path))
{
Iam8 = true;
path = "pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
path = "textures/unknown.jpg";
path = "texture/duel/unknown.jpg";
}
if (!File.Exists(path))
{
......@@ -787,10 +803,10 @@ public class GameTextureManager
{
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
}
//if (!File.Exists(path))
//{
// path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
//}
if (!File.Exists(path))
{
path = "expansions/pics/" + pic.code.ToString() + ".png";
......@@ -807,23 +823,25 @@ public class GameTextureManager
{
path = "pics/" + pic.code.ToString() + ".jpg";
}
#if UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
if (!File.Exists(path) && pic.code != 0)
{
//下载卡图(177x254)
//YGOMobile (177x254)
df.Download("http://android.ygopro.win/YGOMobile/pics/" + pic.code.ToString() + ".jpg", "expansions/pics/" + pic.code.ToString() + ".jpg");
path = "expansions/pics/" + pic.code.ToString() + ".jpg";
}
#endif
if (!File.Exists(path) && pic.code != 0)
{
//下载卡图(421x614)
//YGOPro2 (421x614)
df.Download("http://update.ygopro.win/ygopro2-data/picture/card/" + pic.code.ToString() + ".jpg", "picture/card/" + pic.code.ToString() + ".jpg");
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path) && pic.code != 0)
{
//下载先行卡卡图(336x490)
df.Download("http://update.ygopro.win/ygopro2-data/expansions/pics/" + pic.code.ToString() + ".jpg", "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg");
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
//YGOPro2 pre(336x490)
df.Download("http://update.ygopro.win/ygopro2-data/expansions/pics/" + pic.code.ToString() + ".jpg", "picture/card/" + pic.code.ToString() + ".jpg");
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
......@@ -944,7 +962,7 @@ public class GameTextureManager
if (uiLoaded == false)
{
uiLoaded = true;
FileInfo[] fileInfos = (new DirectoryInfo("textures/ui")).GetFiles();
FileInfo[] fileInfos = (new DirectoryInfo("texture/ui")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
......@@ -953,7 +971,7 @@ public class GameTextureManager
{
UIPictureResource r = new UIPictureResource();
r.name = fileInfos[i].Name.Substring(0, fileInfos[i].Name.Length - 4);
r.data = UIHelper.getTexture2D("textures/ui/" + fileInfos[i].Name);
r.data = UIHelper.getTexture2D("texture/ui/" + fileInfos[i].Name);
allUI.Add(r);
}
}
......@@ -978,35 +996,35 @@ public class GameTextureManager
internal static void initialize()
{
attack = UIHelper.getTexture2D("textures/attack.png");
myBack = UIHelper.getTexture2D("textures/cover.jpg");
opBack = UIHelper.getTexture2D("textures/cover2.jpg");
unknown = UIHelper.getTexture2D("textures/unknown.jpg");
negated = UIHelper.getTexture2D("textures/negated.png");
bar = UIHelper.getTexture2D("textures/duel/healthBar/bg.png");
exBar = UIHelper.getTexture2D("textures/duel/healthBar/excited.png");
time = UIHelper.getTexture2D("textures/duel/healthBar/t.png");
lp = UIHelper.getTexture2D("textures/duel/healthBar/lp.png");
L = UIHelper.getTexture2D("textures/duel/L.png");
R = UIHelper.getTexture2D("textures/duel/R.png");
LINK = UIHelper.getTexture2D("textures/duel/link.png");
LINKm = UIHelper.getTexture2D("textures/duel/linkMask.png");
Chain = UIHelper.getTexture2D("textures/chain.png");
Mask = UIHelper.getTexture2D("textures/mask.png");
nt = UIHelper.getTexture2D("textures/duel/phase/nt.png");
bp = UIHelper.getTexture2D("textures/duel/phase/bp.png");
ep = UIHelper.getTexture2D("textures/duel/phase/ep.png");
mp1 = UIHelper.getTexture2D("textures/duel/phase/mp1.png");
mp2 = UIHelper.getTexture2D("textures/duel/phase/mp2.png");
dp = UIHelper.getTexture2D("textures/duel/phase/dp.png");
sp = UIHelper.getTexture2D("textures/duel/phase/sp.png");
phase = UIHelper.getTexture2D("textures/duel/phase/phase.png");
rs = UIHelper.getTexture2D("textures/duel/phase/rs.png");
ts = UIHelper.getTexture2D("textures/duel/phase/ts.png");
attack = UIHelper.getTexture2D("texture/duel/attack.png");
myBack = UIHelper.getTexture2D("texture/duel/me.jpg");
opBack = UIHelper.getTexture2D("texture/duel/opponent.jpg");
unknown = UIHelper.getTexture2D("texture/duel/unknown.jpg");
negated = UIHelper.getTexture2D("texture/duel/negated.png");
bar = UIHelper.getTexture2D("texture/duel/healthBar/bg.png");
exBar = UIHelper.getTexture2D("texture/duel/healthBar/excited.png");
time = UIHelper.getTexture2D("texture/duel/healthBar/t.png");
lp = UIHelper.getTexture2D("texture/duel/healthBar/lp.png");
L = UIHelper.getTexture2D("texture/duel/L.png");
R = UIHelper.getTexture2D("texture/duel/R.png");
LINK = UIHelper.getTexture2D("texture/duel/link.png");
LINKm = UIHelper.getTexture2D("texture/duel/linkMask.png");
Chain = UIHelper.getTexture2D("texture/duel/chain.png");
Mask = UIHelper.getTexture2D("texture/duel/mask.png");
nt = UIHelper.getTexture2D("texture/duel/phase/nt.png");
bp = UIHelper.getTexture2D("texture/duel/phase/bp.png");
ep = UIHelper.getTexture2D("texture/duel/phase/ep.png");
mp1 = UIHelper.getTexture2D("texture/duel/phase/mp1.png");
mp2 = UIHelper.getTexture2D("texture/duel/phase/mp2.png");
dp = UIHelper.getTexture2D("texture/duel/phase/dp.png");
sp = UIHelper.getTexture2D("texture/duel/phase/sp.png");
phase = UIHelper.getTexture2D("texture/duel/phase/phase.png");
rs = UIHelper.getTexture2D("texture/duel/phase/rs.png");
ts = UIHelper.getTexture2D("texture/duel/phase/ts.png");
N = new Texture2D(10,10);
for (int i = 0; i < 10; i++)
......@@ -1019,7 +1037,7 @@ public class GameTextureManager
N.Apply();
try
{
ColorUtility.TryParseHtmlString(File.ReadAllText("textures/duel/chainColor.txt"), out chainColor);
ColorUtility.TryParseHtmlString(File.ReadAllText("texture/duel/chainColor.txt"), out chainColor);
}
catch (Exception)
{
......
......@@ -6,6 +6,7 @@ using System.IO;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using UnityEngine;
public class HttpDldFile
{
......
......@@ -1084,7 +1084,7 @@ public class DeckManager : ServantWithCardDescription
gameObjectDesk.transform.position = new Vector3(0, 0, 0);
gameObjectDesk.transform.eulerAngles = new Vector3(90, 0, 0);
gameObjectDesk.transform.localScale = new Vector3(30, 30, 1);
gameObjectDesk.GetComponent<Renderer>().material.mainTexture = Program.GetTextureViaPath("textures/duel/deckTable.png");
gameObjectDesk.GetComponent<Renderer>().material.mainTexture = Program.GetTextureViaPath("texture/duel/deckTable.png");
//UIHelper.SetMaterialRenderingMode(gameObjectDesk.GetComponent<Renderer>().material, UIHelper.RenderingMode.Transparent);
Rigidbody rigidbody = gameObjectDesk.AddComponent<Rigidbody>();
rigidbody.useGravity = false;
......
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