Commit e6bc3153 authored by Unicorn's avatar Unicorn

临时解决立绘无法使用问题

parent 286b1a3f
...@@ -273,6 +273,7 @@ public class GameTextureManager ...@@ -273,6 +273,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 //编译器、Windows
BitmapHelper bitmap = new BitmapHelper(path); BitmapHelper bitmap = new BitmapHelper(path);
int left; int left;
int right; int right;
...@@ -303,6 +304,21 @@ public class GameTextureManager ...@@ -303,6 +304,21 @@ public class GameTextureManager
} }
caculateK(pic); caculateK(pic);
/*
* 以上处理其他平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
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)))
{ {
loadedList.Add(hashPic(pic.code, pic.type), pic); loadedList.Add(hashPic(pic.code, pic.type), pic);
...@@ -581,6 +597,7 @@ public class GameTextureManager ...@@ -581,6 +597,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 //编译器、Windows
path = "picture/card/" + pic.code.ToString() + ".png"; path = "picture/card/" + pic.code.ToString() + ".png";
if (!File.Exists(path)) if (!File.Exists(path))
{ {
...@@ -614,9 +631,31 @@ public class GameTextureManager ...@@ -614,9 +631,31 @@ public class GameTextureManager
softVtype(pic, 0.5f); softVtype(pic, 0.5f);
pic.k = 1; pic.k = 1;
//pic.autoMade = true; //pic.autoMade = true;
/*
* 以上处理其他平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
path = "picture/null/" + pic.code.ToString() + ".png";
if (!File.Exists(path))
{
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 UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
BitmapHelper bitmap = new BitmapHelper(path); BitmapHelper bitmap = new BitmapHelper(path);
int left; int left;
int right; int right;
...@@ -668,6 +707,21 @@ public class GameTextureManager ...@@ -668,6 +707,21 @@ public class GameTextureManager
softVtype(pic,0.7f); softVtype(pic,0.7f);
} }
caculateK(pic); caculateK(pic);
/*
* 以上处理其他平台无法正常使用
* 暂时只能直接贴图,以后再处理
*/
#elif UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
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)))
...@@ -708,7 +762,7 @@ public class GameTextureManager ...@@ -708,7 +762,7 @@ public class GameTextureManager
if (a > alpha) if (a > alpha)
a = alpha; a = alpha;
} }
if (w < empWidth) if (w < empWidth)
if (a > ((float)w) / (float)empWidth) if (a > ((float)w) / (float)empWidth)
a = ((float)w) / (float)empWidth; a = ((float)w) / (float)empWidth;
...@@ -755,15 +809,21 @@ public class GameTextureManager ...@@ -755,15 +809,21 @@ public class GameTextureManager
} }
if (!File.Exists(path) && pic.code != 0) if (!File.Exists(path) && pic.code != 0)
{ {
//下载卡图 //下载卡图(177x254)
df.Download("http://update.ygopro.win/ygopro2-data/picture/card/" + pic.code.ToString() + ".jpg", "expansions/pics/" + pic.code.ToString() + ".jpg"); 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"; path = "expansions/pics/" + pic.code.ToString() + ".jpg";
} }
if (!File.Exists(path) && pic.code != 0) if (!File.Exists(path) && pic.code != 0)
{ {
//下载先行卡卡图 //下载卡图(421x614)
df.Download("http://update.ygopro.win/ygopro2-data/expansions/pics/" + pic.code.ToString() + ".jpg", "expansions/pics/" + pic.code.ToString() + ".jpg"); df.Download("http://update.ygopro.win/ygopro2-data/picture/card/" + pic.code.ToString() + ".jpg", "picture/card/" + pic.code.ToString() + ".jpg");
path = "expansions/pics/" + 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";
} }
if (!File.Exists(path)) if (!File.Exists(path))
{ {
......
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