Commit e44c70e9 authored by 無名の凝泪's avatar 無名の凝泪

Update library-release.aar(libgdiplus.so)、add x86 | (完整立绘功能只支持Android M以上)

parent 1e33917e
#APP_BUILD_SCRIPT := Android.mk #APP_BUILD_SCRIPT := Android.mk
APP_PLATFORM :=android-14 APP_PLATFORM :=android-14
APP_ABI := armeabi-v7a APP_ABI := armeabi-v7a x86
APP_STL := gnustl_static APP_STL := gnustl_static
APP_CPPFLAGS := -Wno-error=format-security -std=gnu++11 -fpermissive -fexceptions APP_CPPFLAGS := -Wno-error=format-security -std=gnu++11 -fpermissive -fexceptions
APP_OPTIM := release APP_OPTIM := release
fileFormatVersion: 2
guid: 450e0a9c89bf4a040b26f1fef13f5655
folderAsset: yes
timeCreated: 1445131378
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 53795d48a20b9524180c4bf4481385f1
timeCreated: 1526547438
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fa9cbdc3a67e5fd4baeb5d0dd3f4cf71
timeCreated: 1445131383
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
...@@ -277,6 +277,12 @@ public class Program : MonoBehaviour ...@@ -277,6 +277,12 @@ public class Program : MonoBehaviour
//YGOPro2 Path (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test) //Multi-language support //YGOPro2 Path (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test) //Multi-language support
public static string ANDROID_GAME_PATH = "/storage/emulated/0/ygocore/";//YGOMobile Path public static string ANDROID_GAME_PATH = "/storage/emulated/0/ygocore/";//YGOMobile Path
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
public static bool ANDROID_SDK_M = true;
#elif UNITY_ANDROID || UNITY_IPHONE //Mobile Platform
public static bool ANDROID_SDK_M = false;
#endif
void initialize() void initialize()
{ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows #if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
...@@ -285,7 +291,7 @@ public class Program : MonoBehaviour ...@@ -285,7 +291,7 @@ public class Program : MonoBehaviour
#elif UNITY_ANDROID //Android #elif UNITY_ANDROID //Android
Screen.sleepTimeout = SleepTimeout.NeverSleep; Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!File.Exists(ANDROID_GAME_PATH + "updates/version1.1.txt")) if (!File.Exists(ANDROID_GAME_PATH + "updates/version2.0.txt"))
{ {
string filePath = Application.streamingAssetsPath + "/ygocore.zip"; string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath); var www = new WWW(filePath);
...@@ -299,7 +305,7 @@ public class Program : MonoBehaviour ...@@ -299,7 +305,7 @@ public class Program : MonoBehaviour
#elif UNITY_IPHONE //iPhone #elif UNITY_IPHONE //iPhone
string GamePaths = Application.persistentDataPath + "/ygopro2/"; string GamePaths = Application.persistentDataPath + "/ygopro2/";
if (!File.Exists(GamePaths + "updates/version1.1.txt")) if (!File.Exists(GamePaths + "updates/version2.0.txt"))
{ {
string filePath = Application.streamingAssetsPath + "/ygocore.zip"; string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath); var www = new WWW(filePath);
...@@ -376,11 +382,22 @@ public class Program : MonoBehaviour ...@@ -376,11 +382,22 @@ public class Program : MonoBehaviour
{ {
if (File.Exists("pics.zip")) {//YGOMobile内置的卡图包 if (File.Exists("pics.zip")) {//YGOMobile内置的卡图包
jo.Call("doExtractZipFile", "pics.zip", ANDROID_GAME_PATH); jo.Call("doExtractZipFile", "pics.zip", ANDROID_GAME_PATH);
File.Create("updates/image_version1.1.txt"); File.Copy("updates/version2.0.txt", "updates/image_version1.1.txt", true);
} else { } else {
jo.Call("showToast", "没有发现卡图包,是否未安装YGOMobile");
Application.OpenURL("https://www.taptap.com/app/37972"); Application.OpenURL("https://www.taptap.com/app/37972");
jo.Call("showToast", "没有发现卡图包,是否未安装YGOMobile");
}
} }
/*
* 使用Termux编译生成的:libgdiplus.so (https://github.com/Unicorn369/libgdiplus-Android)
* 经测试,只有Android M以上才能正常使用。为了让Android M以下的也能使用,只好多做一下判断
*/
bool SDK = jo.Call<bool>("SdkInt");
if (SDK == true) { //Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
ANDROID_SDK_M = true;
} else {
ANDROID_SDK_M = false;
} }
#endif #endif
}); });
......
...@@ -25,7 +25,6 @@ public class GameTextureManager ...@@ -25,7 +25,6 @@ public class GameTextureManager
static HttpDldFile df = new HttpDldFile(); static HttpDldFile df = new HttpDldFile();
private static readonly Semaphore _sem = new Semaphore(30, 30);
public class BitmapHelper public class BitmapHelper
{ {
public System.Drawing.Color[,] colors = null; public System.Drawing.Color[,] colors = null;
...@@ -228,18 +227,15 @@ public class GameTextureManager ...@@ -228,18 +227,15 @@ public class GameTextureManager
} }
if (pic.type == GameTextureType.card_feature) if (pic.type == GameTextureType.card_feature)
{ {
_sem.WaitOne(); ProcessingCardFeature(pic);
new Thread(() => ProcessingCardFeature(pic)).Start();
} }
if (pic.type == GameTextureType.card_picture) if (pic.type == GameTextureType.card_picture)
{ {
_sem.WaitOne(); ProcessingCardPicture(pic);
new Thread(() => ProcessingCardPicture(pic)).Start();
} }
if (pic.type == GameTextureType.card_verticle_drawing) if (pic.type == GameTextureType.card_verticle_drawing)
{ {
_sem.WaitOne(); ProcessingVerticleDrawing(pic);
new Thread(() => ProcessingVerticleDrawing(pic)).Start();
} }
} }
} }
...@@ -258,7 +254,7 @@ public class GameTextureManager ...@@ -258,7 +254,7 @@ public class GameTextureManager
if (File.Exists("picture/closeup/" + pic.code.ToString() + ".png")) if (File.Exists("picture/closeup/" + pic.code.ToString() + ".png"))
{ {
string path = "picture/closeup/" + pic.code.ToString() + ".png"; string path = "picture/closeup/" + pic.code.ToString() + ".png";
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android if (Program.ANDROID_SDK_M) {
BitmapHelper bitmap = new BitmapHelper(path); BitmapHelper bitmap = new BitmapHelper(path);
int left; int left;
int right; int right;
...@@ -288,13 +284,7 @@ public class GameTextureManager ...@@ -288,13 +284,7 @@ public class GameTextureManager
} }
} }
caculateK(pic); caculateK(pic);
} else {
/*
* 以上处理iOS平台无法正常使用
* Android已成功编译 libgdiplus.so (https://github.com/Unicorn369/libgdiplus-Android.git)
* 暂时只能直接贴图,以后再处理
**/
#elif UNITY_IPHONE //iPhone
byte[] data; byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{ {
...@@ -303,7 +293,7 @@ public class GameTextureManager ...@@ -303,7 +293,7 @@ public class GameTextureManager
file.Read(data, 0, (int)file.Length); file.Read(data, 0, (int)file.Length);
} }
pic.data = data; pic.data = data;
#endif }
if (!loadedList.ContainsKey(hashPic(pic.code, pic.type))) if (!loadedList.ContainsKey(hashPic(pic.code, pic.type)))
{ {
...@@ -392,10 +382,6 @@ public class GameTextureManager ...@@ -392,10 +382,6 @@ public class GameTextureManager
{ {
Debug.Log("e 1" + e.ToString()); Debug.Log("e 1" + e.ToString());
} }
finally
{
_sem.Release();
}
} }
private static void caculateK(PictureResource pic) private static void caculateK(PictureResource pic)
...@@ -594,7 +580,7 @@ public class GameTextureManager ...@@ -594,7 +580,7 @@ public class GameTextureManager
string path = "picture/closeup/" + pic.code.ToString() + ".png"; string path = "picture/closeup/" + pic.code.ToString() + ".png";
if (!File.Exists(path)) if (!File.Exists(path))
{ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android if (Program.ANDROID_SDK_M) {
path = "picture/card/" + pic.code.ToString() + ".png"; path = "picture/card/" + pic.code.ToString() + ".png";
if (!File.Exists(path)) if (!File.Exists(path))
{ {
...@@ -627,16 +613,8 @@ public class GameTextureManager ...@@ -627,16 +613,8 @@ public class GameTextureManager
pic.hashed_data = getCuttedPic(path, pic.pCard, Iam8); pic.hashed_data = getCuttedPic(path, pic.pCard, Iam8);
softVtype(pic, 0.5f); softVtype(pic, 0.5f);
pic.k = 1; pic.k = 1;
//pic.autoMade = true; } else {
/*
* 以上处理iOS平台无法正常使用
* Android已成功编译libgdiplus.so (https://github.com/Unicorn369/libgdiplus-Android.git)
* 暂时只能直接贴图,以后再处理
**/
#elif UNITY_IPHONE //iPhone
path = "picture/null.png"; path = "picture/null.png";
byte[] data; byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{ {
...@@ -645,11 +623,11 @@ public class GameTextureManager ...@@ -645,11 +623,11 @@ public class GameTextureManager
file.Read(data, 0, (int)file.Length); file.Read(data, 0, (int)file.Length);
} }
pic.data = data; pic.data = data;
#endif }
} }
else else
{ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android if (Program.ANDROID_SDK_M) {
BitmapHelper bitmap = new BitmapHelper(path); BitmapHelper bitmap = new BitmapHelper(path);
int left; int left;
int right; int right;
...@@ -701,13 +679,7 @@ public class GameTextureManager ...@@ -701,13 +679,7 @@ public class GameTextureManager
softVtype(pic, 0.7f); softVtype(pic, 0.7f);
} }
caculateK(pic); caculateK(pic);
} else {
/*
* 以上处理iOS平台无法正常使用
* Android已成功编译libgdiplus.so (https://github.com/Unicorn369/libgdiplus-Android.git)
* 暂时只能直接贴图,以后再处理
**/
#elif UNITY_IPHONE //iPhone
byte[] data; byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{ {
...@@ -716,7 +688,7 @@ public class GameTextureManager ...@@ -716,7 +688,7 @@ public class GameTextureManager
file.Read(data, 0, (int)file.Length); file.Read(data, 0, (int)file.Length);
} }
pic.data = data; pic.data = data;
#endif }
} }
if (!loadedList.ContainsKey(hashPic(pic.code, pic.type))) if (!loadedList.ContainsKey(hashPic(pic.code, pic.type)))
...@@ -728,10 +700,6 @@ public class GameTextureManager ...@@ -728,10 +700,6 @@ public class GameTextureManager
{ {
Debug.Log("e 3" + e.ToString()); Debug.Log("e 3" + e.ToString());
} }
finally
{
_sem.Release();
}
} }
private static void softVtype(PictureResource pic, float si) private static void softVtype(PictureResource pic, float si)
...@@ -851,10 +819,6 @@ public class GameTextureManager ...@@ -851,10 +819,6 @@ public class GameTextureManager
catch (Exception e) catch (Exception e)
{ {
Debug.Log("e 2" + e.ToString()); Debug.Log("e 2" + e.ToString());
}
finally
{
_sem.Release();
} }
} }
......
...@@ -10,7 +10,6 @@ using UnityEngine; ...@@ -10,7 +10,6 @@ using UnityEngine;
public class HttpDldFile public class HttpDldFile
{ {
private readonly System.Threading.Semaphore semaphore = new System.Threading.Semaphore(6, 6);
public bool Download(string url, string filename) public bool Download(string url, string filename)
{ {
bool flag = false; bool flag = false;
...@@ -25,17 +24,14 @@ public class HttpDldFile ...@@ -25,17 +24,14 @@ public class HttpDldFile
{ {
ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
//authorization needed to acces github
if (Path.GetExtension(filename).Contains("png")) if (Path.GetExtension(filename).Contains("png"))
{ {
//client.Headers.Add(HttpRequestHeader.Authorization, string.Concat("token ", RepoData.GetToken()));
client.Timeout = 6500; client.Timeout = 6500;
} }
if (Path.GetExtension(filename).Contains("jpg")) if (Path.GetExtension(filename).Contains("jpg"))
{ {
client.Timeout = 3500; client.Timeout = 3500;
} }
semaphore.WaitOne();
client.DownloadFile(new Uri(url), filename + ".tmp"); client.DownloadFile(new Uri(url), filename + ".tmp");
} }
flag = true; flag = true;
...@@ -49,10 +45,6 @@ public class HttpDldFile ...@@ -49,10 +45,6 @@ public class HttpDldFile
{ {
flag = false; flag = false;
} }
finally
{
semaphore.Release();
}
return flag; return flag;
} }
public static bool MyRemoteCertificateValidationCallback(System.Object sender, public static bool MyRemoteCertificateValidationCallback(System.Object sender,
......
...@@ -149,7 +149,7 @@ PlayerSettings: ...@@ -149,7 +149,7 @@ PlayerSettings:
buildNumber: buildNumber:
iOS: iOS:
AndroidBundleVersionCode: 2 AndroidBundleVersionCode: 2
AndroidMinSdkVersion: 21 AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 0 AndroidPreferredInstallLocation: 0
aotOptions: aotOptions:
...@@ -225,7 +225,7 @@ PlayerSettings: ...@@ -225,7 +225,7 @@ PlayerSettings:
iOSManualSigningProvisioningProfileID: iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID:
appleEnableAutomaticSigning: 0 appleEnableAutomaticSigning: 0
AndroidTargetDevice: 3 AndroidTargetDevice: 0
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
AndroidKeystoreName: ygopro.jks AndroidKeystoreName: ygopro.jks
......
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