Commit 068d74e7 authored by 無名の凝泪's avatar 無名の凝泪

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

parent af0f2863
...@@ -40,7 +40,6 @@ AI_core_vs2017solution/bin/ ...@@ -40,7 +40,6 @@ AI_core_vs2017solution/bin/
AI_core_vs2017solution/obj/ AI_core_vs2017solution/obj/
AI_core_vs2017solution/build/android/libs/ AI_core_vs2017solution/build/android/libs/
AI_core_vs2017solution/build/android/obj/ AI_core_vs2017solution/build/android/obj/
Assets/Plugins/Android/libs/x86*
# ygopro # ygopro
cdb/ cdb/
......
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
//YGOMobile Paths (https://github.com/Unicorn369/YGOPro2_Droid) //YGOMobile Paths (https://github.com/Unicorn369/YGOPro2_Droid)
public static string ANDROID_GAME_PATH = "/storage/emulated/0/ygopro2/"; public static string ANDROID_GAME_PATH = "/storage/emulated/0/ygopro2/";
#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
...@@ -395,6 +401,17 @@ public class Program : MonoBehaviour ...@@ -395,6 +401,17 @@ public class Program : MonoBehaviour
jo.Call("showToast", "没有发现卡图包,是否未安装YGOMobile"); 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
}); });
......
...@@ -254,55 +254,46 @@ public class GameTextureManager ...@@ -254,55 +254,46 @@ 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 (Program.ANDROID_SDK_M) {
* Nonsupport Android x86、Only Support Android 5.0+ BitmapHelper bitmap = new BitmapHelper(path);
* https://github.com/Unicorn369/libgdiplus-Android int left;
*/ int right;
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android int up;
BitmapHelper bitmap = new BitmapHelper(path); int down;
int left; CutTop(bitmap, out left, out right, out up, out down);
int right; up = CutLeft(bitmap, up);
int up; down = CutRight(bitmap, down);
int down; right = CutButton(bitmap, right);
CutTop(bitmap, out left, out right, out up, out down); int width = right - left;
up = CutLeft(bitmap, up); int height = down - up;
down = CutRight(bitmap, down); pic.hashed_data = new float[width, height, 4];
right = CutButton(bitmap, right); for (int w = 0; w < width; w++)
int width = right - left;
int height = down - up;
pic.hashed_data = new float[width, height, 4];
for (int w = 0; w < width; w++)
{
for (int h = 0; h < height; h++)
{ {
System.Drawing.Color color = bitmap.GetPixel(left + w, up + h); for (int h = 0; h < height; h++)
float a = (float)color.A / 255f; {
if (w < 40) if (a > (float)w / (float)40) a = (float)w / (float)40; System.Drawing.Color color = bitmap.GetPixel(left + w, up + h);
if (w > (width - 40)) if (a > 1f - (float)(w - (width - 40)) / (float)40) a = 1f - (float)(w - (width - 40)) / (float)40; float a = (float)color.A / 255f;
if (h < 40) if (a > (float)h / (float)40) a = (float)h / (float)40; if (w < 40) if (a > (float)w / (float)40) a = (float)w / (float)40;
if (h > (height - 40)) if (a > 1f - (float)(h - (height - 40)) / (float)40) a = 1f - (float)(h - (height - 40)) / (float)40; if (w > (width - 40)) if (a > 1f - (float)(w - (width - 40)) / (float)40) a = 1f - (float)(w - (width - 40)) / (float)40;
pic.hashed_data[w, height - h - 1, 0] = (float)color.R / 255f; if (h < 40) if (a > (float)h / (float)40) a = (float)h / (float)40;
pic.hashed_data[w, height - h - 1, 1] = (float)color.G / 255f; if (h > (height - 40)) if (a > 1f - (float)(h - (height - 40)) / (float)40) a = 1f - (float)(h - (height - 40)) / (float)40;
pic.hashed_data[w, height - h - 1, 2] = (float)color.B / 255f; pic.hashed_data[w, height - h - 1, 0] = (float)color.R / 255f;
pic.hashed_data[w, height - h - 1, 3] = a; pic.hashed_data[w, height - h - 1, 1] = (float)color.G / 255f;
pic.hashed_data[w, height - h - 1, 2] = (float)color.B / 255f;
pic.hashed_data[w, height - h - 1, 3] = a;
}
} }
caculateK(pic);
} else {
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{
file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
}
pic.data = data;
} }
caculateK(pic);
/*
* 以上处理移动平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_IPHONE //|| UNITY_ANDROID //Mobile Platform
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{
file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
}
pic.data = data;
#endif
if (!loadedList.ContainsKey(hashPic(pic.code, pic.type))) if (!loadedList.ContainsKey(hashPic(pic.code, pic.type)))
{ {
...@@ -589,135 +580,115 @@ public class GameTextureManager ...@@ -589,135 +580,115 @@ 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 (Program.ANDROID_SDK_M) {
* Nonsupport Android x86、Only Support Android 5.0+ path = "picture/card/" + pic.code.ToString() + ".png";
* https://github.com/Unicorn369/libgdiplus-Android if (!File.Exists(path))
*/ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android path = "picture/card/" + pic.code.ToString() + ".jpg";
path = "picture/card/" + pic.code.ToString() + ".png"; }
if (!File.Exists(path)) bool Iam8 = false;
{ if (!File.Exists(path))
path = "picture/card/" + pic.code.ToString() + ".jpg"; {
} Iam8 = true;
bool Iam8 = false; path = "expansions/pics/" + pic.code.ToString() + ".jpg";
if (!File.Exists(path)) }
{ if (!File.Exists(path))
Iam8 = true; {
path = "expansions/pics/" + pic.code.ToString() + ".jpg"; Iam8 = true;
} path = "pics/" + pic.code.ToString() + ".jpg";
if (!File.Exists(path)) }
{ if (!File.Exists(path))
Iam8 = true; {
path = "pics/" + pic.code.ToString() + ".jpg"; Iam8 = true;
} path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
if (!File.Exists(path)) }
{ if (!File.Exists(path))
Iam8 = true; {
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg"; path = "texture/duel/unknown.jpg";
} }
if (!File.Exists(path)) if (!File.Exists(path))
{ {
path = "texture/duel/unknown.jpg"; path = "picture/null.png";
} }
if (!File.Exists(path)) pic.hashed_data = getCuttedPic(path, pic.pCard, Iam8);
{ softVtype(pic, 0.5f);
pic.k = 1;
} else {
path = "picture/null.png"; path = "picture/null.png";
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{
file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
}
pic.data = data;
} }
pic.hashed_data = getCuttedPic(path, pic.pCard, Iam8);
softVtype(pic, 0.5f);
pic.k = 1;
//pic.autoMade = true;
/*
* 以上处理移动平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_IPHONE //|| UNITY_ANDROID //Mobile Platform
path = "picture/null.png";
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{
file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
}
pic.data = data;
#endif
} }
else else
{ {
/* if (Program.ANDROID_SDK_M) {
* Nonsupport Android x86、Only Support Android 5.0+ BitmapHelper bitmap = new BitmapHelper(path);
* https://github.com/Unicorn369/libgdiplus-Android int left;
*/ int right;
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_ANDROID //编译器、Windows、Android int up;
BitmapHelper bitmap = new BitmapHelper(path); int down;
int left; CutTop(bitmap, out left, out right, out up, out down);
int right; up = CutLeft(bitmap, up);
int up; down = CutRight(bitmap, down);
int down; right = CutButton(bitmap, right);
CutTop(bitmap, out left, out right, out up, out down); int width = right - left;
up = CutLeft(bitmap, up); int height = down - up;
down = CutRight(bitmap, down); pic.hashed_data = new float[width, height, 4];
right = CutButton(bitmap, right); for (int w = 0; w < width; w++)
int width = right - left;
int height = down - up;
pic.hashed_data = new float[width, height, 4];
for (int w = 0; w < width; w++)
{
for (int h = 0; h < height; h++)
{ {
System.Drawing.Color color = bitmap.GetPixel(left + w, up + h); for (int h = 0; h < height; h++)
pic.hashed_data[w, height - h - 1, 0] = (float)color.R / 255f; {
pic.hashed_data[w, height - h - 1, 1] = (float)color.G / 255f; System.Drawing.Color color = bitmap.GetPixel(left + w, up + h);
pic.hashed_data[w, height - h - 1, 2] = (float)color.B / 255f; pic.hashed_data[w, height - h - 1, 0] = (float)color.R / 255f;
pic.hashed_data[w, height - h - 1, 3] = (float)color.A / 255f; pic.hashed_data[w, height - h - 1, 1] = (float)color.G / 255f;
pic.hashed_data[w, height - h - 1, 2] = (float)color.B / 255f;
pic.hashed_data[w, height - h - 1, 3] = (float)color.A / 255f;
}
} }
} float wholeUNalpha = 0;
float wholeUNalpha = 0; for (int w = 0; w < width; w++)
for (int w = 0; w < width; w++)
{
if (pic.hashed_data[w, 0, 3] > 0.1f)
{ {
wholeUNalpha += ((float)Math.Abs(w - width / 2)) / ((float)(width / 2)); if (pic.hashed_data[w, 0, 3] > 0.1f)
{
wholeUNalpha += ((float)Math.Abs(w - width / 2)) / ((float)(width / 2));
}
if (pic.hashed_data[w, height - 1, 3] > 0.1f)
{
wholeUNalpha += 1;
}
} }
if (pic.hashed_data[w, height - 1, 3] > 0.1f) for (int h = 0; h < height; h++)
{ {
wholeUNalpha += 1; if (pic.hashed_data[0, h, 3] > 0.1f)
{
wholeUNalpha += 1;
}
if (pic.hashed_data[width - 1, h, 3] > 0.1f)
{
wholeUNalpha += 1;
}
} }
} if (wholeUNalpha >= ((width + height) * 0.5f * 0.12f))
for (int h = 0; h < height; h++)
{
if (pic.hashed_data[0, h, 3] > 0.1f)
{ {
wholeUNalpha += 1; softVtype(pic, 0.7f);
} }
if (pic.hashed_data[width - 1, h, 3] > 0.1f) caculateK(pic);
} else {
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{ {
wholeUNalpha += 1; file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
} }
pic.data = data;
} }
if (wholeUNalpha >= ((width + height) * 0.5f * 0.12f))
{
softVtype(pic, 0.7f);
}
caculateK(pic);
/*
* 以上处理移动平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_IPHONE //|| UNITY_ANDROID //Mobile Platform
byte[] data;
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
{
file.Seek(0, SeekOrigin.Begin);
data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
}
pic.data = data;
#endif
} }
if (!loadedList.ContainsKey(hashPic(pic.code, pic.type))) if (!loadedList.ContainsKey(hashPic(pic.code, pic.type)))
......
...@@ -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