Commit a8515cc4 authored by Unicorn369's avatar Unicorn369

Update

parent 71daa4ce
...@@ -144,9 +144,12 @@ public class Menu : WindowServantSP ...@@ -144,9 +144,12 @@ public class Menu : WindowServantSP
Application.OpenURL("https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip"); Application.OpenURL("https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip");
#elif UNITY_ANDROID //Android #elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API"); AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
if (!File.Exists("updates/closeup_version1.0.txt"))//用于检查更新 if (!File.Exists("updates/closeup_version1.0.txt")) {//用于检查更新
{ if (File.Exists("closeup_version1.0.zip")) {//如果有则直接解压
jo.Call("doDownloadZipFile", "https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip");//下载并解压 jo.Call("doExtractZipFile", "closeup_version1.0.zip", Program.ANDROID_GAME_PATH);
} else {//否则下载并解压,锁定目录:/ygocore
jo.Call("doDownloadZipFile", "https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip");
}
} else { } else {
jo.Call("showToast", "已下载,无需再次下载!"); jo.Call("showToast", "已下载,无需再次下载!");
} }
......
...@@ -274,6 +274,9 @@ public class Program : MonoBehaviour ...@@ -274,6 +274,9 @@ public class Program : MonoBehaviour
public static float verticleScale = 5f; public static float verticleScale = 5f;
//YGOPro2 Path (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test)
public static string ANDROID_GAME_PATH = "/storage/emulated/0/ygocore/";//YGOMobile Path
void initialize() void initialize()
{ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows #if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
...@@ -282,23 +285,18 @@ public class Program : MonoBehaviour ...@@ -282,23 +285,18 @@ public class Program : MonoBehaviour
#elif UNITY_ANDROID //Android #elif UNITY_ANDROID //Android
Screen.sleepTimeout = SleepTimeout.NeverSleep; Screen.sleepTimeout = SleepTimeout.NeverSleep;
//YGOMobile Paths (https://github.com/Unicorn369/YGOPro2_Droid) if (!File.Exists(ANDROID_GAME_PATH + "updates/version1.0.txt"))
string GamePaths = "/storage/emulated/0/ygocore/";
//YGOPro2 Paths (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test)
//string GamePaths = "/storage/emulated/0/ygopro2/";
if (!File.Exists(GamePaths + "updates/version1.0.txt"))
{ {
string filePath = Application.streamingAssetsPath + "/ygocore.zip"; string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath); var www = new WWW(filePath);
while (!www.isDone) { } while (!www.isDone) { }
byte[] bytes = www.bytes; byte[] bytes = www.bytes;
ExtractZipFile(bytes, GamePaths); ExtractZipFile(bytes, ANDROID_GAME_PATH);
//File.Create(GamePaths + ".nomedia"); //File.Create(ANDROID_GAME_PATH + ".nomedia");
} }
Environment.CurrentDirectory = GamePaths; Environment.CurrentDirectory = ANDROID_GAME_PATH;
System.IO.Directory.SetCurrentDirectory(GamePaths); System.IO.Directory.SetCurrentDirectory(ANDROID_GAME_PATH);
#elif UNITY_IPHONE //iPhone #elif UNITY_IPHONE //iPhone
string GamePaths = Application.persistentDataPath + "/ygopro2/"; string GamePaths = Application.persistentDataPath + "/ygopro2/";
if (!File.Exists(GamePaths + "updates/version1.0.txt")) if (!File.Exists(GamePaths + "updates/version1.0.txt"))
...@@ -399,8 +397,10 @@ public class Program : MonoBehaviour ...@@ -399,8 +397,10 @@ public class Program : MonoBehaviour
{ {
if (File.Exists("pics.zip"))//YGOMobile内置的卡图包 if (File.Exists("pics.zip"))//YGOMobile内置的卡图包
{ {
jo.Call("doExtractZipFile", "pics.zip", "./"); jo.Call("doExtractZipFile", "pics.zip", ANDROID_GAME_PATH);
File.Create("updates/image_version1.0.txt"); File.Create("updates/image_version1.0.txt");
} else {
jo.Call("showToast", "没有发现卡图包,是否未安装YGOMobile");
} }
} }
#endif #endif
......
...@@ -247,9 +247,9 @@ public class selectDeck : WindowServantSP ...@@ -247,9 +247,9 @@ public class selectDeck : WindowServantSP
System.Diagnostics.Process.Start("open", "-e " + path); System.Diagnostics.Process.Start("open", "-e " + path);
#elif UNITY_STANDALONE_LINUX //Linux #elif UNITY_STANDALONE_LINUX //Linux
System.Diagnostics.Process.Start("gedit", path); System.Diagnostics.Process.Start("gedit", path);
#elif UNITY_ANDROID //Android (https://github.com/Unicorn369/Unity_Android_Library) #elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API"); AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("openFile", "/storage/emulated/0/ygocore/" + path); jo.Call("openFile", Program.ANDROID_GAME_PATH + path);
//#elif UNITY_IPHONE //iPhone //#elif UNITY_IPHONE //iPhone
#endif #endif
} }
......
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