Commit 990b8ff8 authored by 独角兽's avatar 独角兽

Android

parent d5abaa79
......@@ -196,7 +196,9 @@ static void buffreplace (LexState *ls, char from, char to) {
while (n--)
if (p[n] == from) p[n] = to;
}
#if __ANDROID__
#define getlocaledecpoint() ('.')
#endif
#if !defined(getlocaledecpoint)
#define getlocaledecpoint() (localeconv()->decimal_point[0])
......
......@@ -7,7 +7,9 @@
#ifndef OCGAPI_H_
#define OCGAPI_H_
#ifdef _MSC_VER
#define WIN32
#endif
#include "common.h"
#ifdef WIN32
#include <windows.h>
......
......@@ -20,7 +20,7 @@ public class barPngLoader : MonoBehaviour {
api_timeBar.mainTexture = GameTextureManager.time;
try
{
string[] allLines = (File.ReadAllText("texture\\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("=");
......
......@@ -191,7 +191,7 @@ static public class NGUITools
while (obj.transform.parent != null)
{
obj = obj.transform.parent.gameObject;
path = obj.name + "\\" + path;
path = obj.name + "/" + path;
}
return path;
}
......
fileFormatVersion: 2
guid: bd5fc617bb9912548a9d9a92d6b10299
folderAsset: yes
timeCreated: 1526547436
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4288e383ed17c8c4a93d8d3a1395dafd
folderAsset: yes
timeCreated: 1526538476
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 08b2651045c57a441975bfde798f2859
folderAsset: yes
timeCreated: 1445131378
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3b05a04df74654c4ea15aa7d74ca65b8
timeCreated: 1526547438
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a00620409803a41f598cabed0c2ecf9f
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Android:
enabled: 1
settings:
CPU: ARMv7
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
Linux:
enabled: 0
settings:
CPU: x86
Linux64:
enabled: 0
settings:
CPU: x86_64
OSXIntel:
enabled: 0
settings:
CPU: AnyCPU
OSXIntel64:
enabled: 0
settings:
CPU: AnyCPU
SamsungTV:
enabled: 0
settings:
STV_MODEL: STANDARD_13
WP8:
enabled: 0
settings:
CPU: AnyCPU
DontProcess: False
PlaceholderPath:
Win:
enabled: 0
settings:
CPU: AnyCPU
Win64:
enabled: 0
settings:
CPU: AnyCPU
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
DontProcess: False
PlaceholderPath:
SDK: AnySDK
iOS:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:
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:
......@@ -51,7 +51,7 @@ public static class Config
if (loaded == false)
{
loaded = true;
string[] lines = File.ReadAllText("texture\\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("=");
......
......@@ -6,19 +6,19 @@ using System.Runtime.InteropServices;
using UnityEngine;
public static class UIHelper
{
[DllImport("user32.dll")]
[DllImport("user32")]
static extern bool FlashWindow(IntPtr handle, bool invert);
public delegate bool WNDENUMPROC(IntPtr hwnd, uint lParam);
[DllImport("user32.dll", SetLastError = true)]
[DllImport("user32", SetLastError = true)]
static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, uint lParam);
[DllImport("user32.dll", SetLastError = true)]
[DllImport("user32", SetLastError = true)]
static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll")]
[DllImport("user32")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref uint lpdwProcessId);
[DllImport("kernel32.dll")]
[DllImport("kernel32")]
static extern void SetLastError(uint dwErrCode);
static IntPtr GetProcessWnd()
......
......@@ -2263,7 +2263,7 @@ public class gameCard : OCGobject
}
else if (show_off_shokewave)
{
if (Program.I().setting.setting.showoff.value == false || File.Exists("picture\\closeup\\" + data.Id.ToString() + ".png") == false || (data.Attack < Program.I().setting.atk && data.Level < Program.I().setting.star))
if (Program.I().setting.setting.showoff.value == false || File.Exists("picture/closeup/" + data.Id.ToString() + ".png") == false || (data.Attack < Program.I().setting.atk && data.Level < Program.I().setting.star))
{
refreshFunctions.Add(SOH_nSum);
Program.I().ocgcore.Sleep(30);
......@@ -2276,7 +2276,7 @@ public class gameCard : OCGobject
}
else
{
if (Program.I().setting.setting.showoffWhenActived.value == false || File.Exists("picture\\closeup\\" + data.Id.ToString() + ".png") == false)
if (Program.I().setting.setting.showoffWhenActived.value == false || File.Exists("picture/closeup/" + data.Id.ToString() + ".png") == false)
{
refreshFunctions.Add(SOH_nAct);
Program.I().ocgcore.Sleep(42);
......
......@@ -1788,6 +1788,17 @@ public class Ocgcore : ServantWithCardDescription
printDuelLog(InterString.Get("骰子结果:[?]", data.ToString()));
}
break;
case GameMessage.HandResult:
data = r.ReadByte();
int data1 = data & 0x3;
int data2 = (data >> 2) & 0x3;
string res1 = (data1 == 1 ? "剪刀" : (data1 == 2 ? "布" : "石头"));
string res2 = (data2 == 1 ? "剪刀" : (data2 == 2 ? "布" : "石头"));
if (isFirst)
printDuelLog("猜拳结果:你好像出了" + res2 + data2.ToString() + ",对方好像出了" + res1 + data1.ToString());
else
printDuelLog("猜拳结果:你好像出了" + data1.ToString() + res1 + ",对方好像出了" + res2 + data2.ToString());
break;
case GameMessage.Attack:
game_card = GCS_cardGet(r.ReadGPS(), false);
string derectattack = "";
......@@ -2301,6 +2312,7 @@ public class Ocgcore : ServantWithCardDescription
}
break;
case GameMessage.ShuffleSetCard:
location = r.ReadByte();
count = r.ReadByte();
List<GPS> gpss = new List<GPS>();
for (int i = 0; i < count; i++)
......@@ -3384,11 +3396,11 @@ public class Ocgcore : ServantWithCardDescription
}
destroy(waitObject, 0, false, true);
player = localPlayer(r.ReadByte());
bool finish = (r.ReadByte() != 0);
cancalable = (r.ReadByte() != 0);
bool finishable = (r.ReadByte() != 0);
cancalable = (r.ReadByte() != 0) || finishable;
ES_min = r.ReadByte();
ES_max = r.ReadByte();
ES_min = finish ? 0 : 1; // SelectUnselectCard can actually always select 1 card
ES_min = finishable ? 0 : 1; // SelectUnselectCard can actually always select 1 card
ES_max = 1; // SelectUnselectCard can actually always select 1 card
ES_level = 0;
count = r.ReadByte();
......@@ -3421,14 +3433,10 @@ public class Ocgcore : ServantWithCardDescription
allCardsInSelectMessage.Add(card);
}*/
}
if (cancalable)
if (cancalable && !finishable)
{
gameInfo.addHashedButton("cancleSelected", -1, superButtonType.no, InterString.Get("取消选择@ui"));
}
else if (finish)
{
gameInfo.addHashedButton("cancleSelected", -1, superButtonType.no, "完成选择");
}
realizeCardsForSelect();
if (ES_selectHint != "")
{
......@@ -3706,6 +3714,10 @@ public class Ocgcore : ServantWithCardDescription
}
if ((positions & 0x8) > 0)
{
if ((positions & 0x4) > 0)
{
op1 = 0x4;
}
op2 = 0x8;
}
RMSshow_position("return", code, new messageSystemValue { value = op1.ToString(), hint = "atk" }, new messageSystemValue { value = op2.ToString(), hint = "def" });
......@@ -3915,7 +3927,7 @@ public class Ocgcore : ServantWithCardDescription
binaryMaster = new BinaryMaster();
player = r.ReadByte();
min = r.ReadByte();
int field = ~r.ReadInt32();
int _field = ~r.ReadInt32();
if (Program.I().setting.setting.hand.value == true || Program.I().setting.setting.handm.value == true)
{
......@@ -3926,7 +3938,7 @@ public class Ocgcore : ServantWithCardDescription
bool pendulumZone = false;
int filter;
if ((field & 0x7f0000) != 0)
/*if ((field & 0x7f0000) != 0)
{
resp[0] = (byte)(1 - player);
resp[1] = 0x4;
......@@ -3944,27 +3956,45 @@ public class Ocgcore : ServantWithCardDescription
resp[1] = 0x8;
filter = (field >> 30) & 0x3;
pendulumZone = true;
}
else if ((field & 0x7f) != 0)
}*/
for (int j=0; j<2; j++)
{
resp = new byte[3];
pendulumZone = false;
filter = 0;
int field;
if (j==0)
{
resp[0] = (byte)player;
field = _field & 0xffff;
}
else
{
resp[0] = (byte)(1 - player);
field = _field >> 16;
}
if ((field & 0x7f) != 0)
{
resp[1] = 0x4;
filter = field & 0x7f;
}
else if ((field & 0x1f00) != 0)
{
resp[0] = (byte)player;
resp[1] = 0x8;
filter = (field >> 8) & 0x1f;
}
else
else if ((field & 0xc000) != 0)
{
resp[0] = (byte)player;
resp[1] = 0x8;
filter = (field >> 14) & 0x3;
pendulumZone = true;
}
if (filter == 0)
continue;
if (!pendulumZone)
{
if ((filter & 0x4) != 0)
......@@ -4019,6 +4049,9 @@ public class Ocgcore : ServantWithCardDescription
createPlaceSelector(resp);
}
}
}
}
if (Es_selectMSGHintType == 3)
{
......@@ -4034,6 +4067,7 @@ public class Ocgcore : ServantWithCardDescription
}
else
{
int field = _field;
for (int i = 0; i < min; i++)
{
byte[] resp = new byte[3];
......@@ -4105,6 +4139,11 @@ public class Ocgcore : ServantWithCardDescription
sendReturn(binaryMaster.get());
}
break;
case GameMessage.RockPaperScissors:
binaryMaster = new BinaryMaster();
binaryMaster.writer.Write(UnityEngine.Random.Range(0, 2));
sendReturn(binaryMaster.get());
break;
case GameMessage.ConfirmDecktop:
player = localPlayer(r.ReadByte());
count = r.ReadByte();
......@@ -6203,6 +6242,12 @@ public class Ocgcore : ServantWithCardDescription
case GameMessage.SelectTribute:
case GameMessage.SelectSum:
m = new BinaryMaster();
if (currentMessage == GameMessage.SelectUnselectCard && cardsSelected.Count == 0)
{
m.writer.Write((Int32)(-1));
sendReturn(m.get());
break;
}
m.writer.Write((byte)(cardsMustBeSelected.Count + cardsSelected.Count));
for (int i = 0; i < cardsMustBeSelected.Count; i++)
{
......@@ -6216,7 +6261,6 @@ public class Ocgcore : ServantWithCardDescription
}
sendReturn(m.get());
break;
}
}
......
......@@ -273,7 +273,23 @@ public class Program : MonoBehaviour
void initialize()
{
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
//Environment.CurrentDirectory = System.Windows.Forms.Application.StartupPath;
//System.IO.Directory.SetCurrentDirectory(System.Windows.Forms.Application.StartupPath);
#elif UNITY_ANDROID //Android
//保持唤醒
Screen.sleepTimeout = SleepTimeout.NeverSleep;
//创建资源目录
if (!Directory.Exists("/storage/emulated/0/ygopro2"))
{
Directory.CreateDirectory("/storage/emulated/0/ygopro2");
}
Environment.CurrentDirectory = "/storage/emulated/0/ygopro2";
System.IO.Directory.SetCurrentDirectory("/storage/emulated/0/ygopro2");
#elif UNITY_IPHONE //iPhone
Environment.CurrentDirectory = Application.persistentDataPath;
System.IO.Directory.SetCurrentDirectory(Application.persistentDataPath);
#endif
go(1, () =>
{
UIHelper.iniFaces();
......@@ -285,19 +301,19 @@ public class Program : MonoBehaviour
});
go(300, () =>
{
InterString.initialize("config\\translation.conf");
InterString.initialize("config/translation.conf");
GameTextureManager.initialize();
Config.initialize("config\\config.conf");
GameStringManager.initialize("config\\strings.conf");
if (File.Exists("cdb\\strings.conf"))
Config.initialize("config/config.conf");
GameStringManager.initialize("config/strings.conf");
if (File.Exists("cdb/strings.conf"))
{
GameStringManager.initialize("cdb\\strings.conf");
GameStringManager.initialize("cdb/strings.conf");
}
if (File.Exists("diy\\strings.conf"))
if (File.Exists("expansions/strings.conf"))
{
GameStringManager.initialize("diy\\strings.conf");
GameStringManager.initialize("expansions/strings.conf");
}
YGOSharp.BanlistManager.initialize("config\\lflist.conf");
YGOSharp.BanlistManager.initialize("config/lflist.conf");
var fileInfos = (new DirectoryInfo("cdb")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
......@@ -306,21 +322,21 @@ public class Program : MonoBehaviour
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("cdb\\" + fileInfos[i].Name);
YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name);
}
}
}
if (Directory.Exists("diy"))
if (Directory.Exists("expansions"))
{
fileInfos = (new DirectoryInfo("diy")).GetFiles();
fileInfos = (new DirectoryInfo("expansions")).GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("diy\\" + fileInfos[i].Name);
YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name);
}
}
}
......@@ -334,7 +350,7 @@ public class Program : MonoBehaviour
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db")
{
YGOSharp.PacksManager.initialize("pack\\" + fileInfos[i].Name);
YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name);
}
}
}
......@@ -825,11 +841,17 @@ public class Program : MonoBehaviour
void Start()
{
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
if (Screen.width < 100 || Screen.height < 100)
{
Screen.SetResolution(1300, 700, false);
}
Application.targetFrameRate = 120;
#elif UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
Screen.SetResolution(1280, 720, true);
Application.targetFrameRate = -1;
#endif
mouseParticle = Instantiate(new_mouse);
instance = this;
initialize();
......
......@@ -268,9 +268,9 @@ public class GameTextureManager
private static void ProcessingCardFeature(PictureResource pic)
{
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";
BitmapHelper bitmap = new BitmapHelper(path);
int left;
int right;
......@@ -308,16 +308,16 @@ public class GameTextureManager
}
else
{
string path = "picture\\card\\" + pic.code.ToString() + ".png";
string path = "picture/card/" + pic.code.ToString() + ".png";
if (!File.Exists(path))
{
path = "picture\\card\\" + pic.code.ToString() + ".jpg";
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
bool Iam8 = false;
if (!File.Exists(path))
{
Iam8 = true;
path = "picture\\cardIn8thEdition\\" + pic.code.ToString() + ".jpg";
path = "pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
......@@ -566,19 +566,19 @@ public class GameTextureManager
private static void ProcessingVerticleDrawing(PictureResource pic)
{
string path = "picture\\closeup\\" + pic.code.ToString() + ".png";
string path = "picture/closeup/" + pic.code.ToString() + ".png";
if (!File.Exists(path))
{
path = "picture\\card\\" + pic.code.ToString() + ".png";
path = "picture/card/" + pic.code.ToString() + ".png";
if (!File.Exists(path))
{
path = "picture\\card\\" + pic.code.ToString() + ".jpg";
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
bool Iam8 = false;
if (!File.Exists(path))
{
Iam8 = true;
path = "picture\\cardIn8thEdition\\" + pic.code.ToString() + ".jpg";
path = "pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
......@@ -706,14 +706,14 @@ public class GameTextureManager
private static void ProcessingCardPicture(PictureResource pic)
{
string path = "picture\\card\\" + pic.code.ToString() + ".png";
string path = "picture/card/" + pic.code.ToString() + ".png";
if (!File.Exists(path))
{
path = "picture\\card\\" + pic.code.ToString() + ".jpg";
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
path = "picture\\cardIn8thEdition\\" + pic.code.ToString() + ".jpg";
path = "pics/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
......@@ -873,30 +873,30 @@ public class GameTextureManager
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");
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++)
......@@ -909,7 +909,7 @@ public class GameTextureManager
N.Apply();
try
{
ColorUtility.TryParseHtmlString(File.ReadAllText("texture\\duel\\chainColor.txt"), out chainColor);
ColorUtility.TryParseHtmlString(File.ReadAllText("texture/duel/chainColor.txt"), out chainColor);
}
catch (Exception)
{
......
......@@ -95,7 +95,7 @@ public class Room : WindowServantSP
if (val != "")
{
TcpHelper.CtosMessage_Chat(val);
AddChatMsg(val, -1);
//AddChatMsg(val, -1);
}
}
......@@ -506,13 +506,39 @@ public class Room : WindowServantSP
r.ReadByte();
r.ReadByte();
code = r.ReadInt32();
switch (code)
int flag = code >> 28;
code = code & 0xFFFFFFF;
switch (flag)
{
case 1:
RMSshow_onlyYes("", GameStringManager.get_unsafe(1406), null);
case 1: // DECKERROR_LFLIST
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(数量不符合禁限卡表)", null);
break;
case 2: // DECKERROR_OCGONLY
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(OCG独有卡,不能在当前设置使用)", null);
break;
case 3: // DECKERROR_TCGONLY
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(TCG独有卡,不能在当前设置使用)", null);
break;
case 4: // DECKERROR_UNKNOWNCARD
if (code < 100000000)
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(服务器无法识别此卡,可能是服务器未更新)", null);
else
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(服务器无法识别此卡,可能是服务器不支持先行卡或此先行卡已正式更新)", null);
break;
case 5: // DECKERROR_CARDCOUNT
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name) + "(数量过多)", null);
break;
case 6: // DECKERROR_MAINCOUNT
RMSshow_onlyYes("", "主卡组数量应为40-60张", null);
break;
case 7: // DECKERROR_EXTRACOUNT
RMSshow_onlyYes("", "额外卡组数量应为0-15张", null);
break;
case 8: // DECKERROR_SIDECOUNT
RMSshow_onlyYes("", "副卡组数量应为0-15", null);
break;
default:
RMSshow_onlyYes("", InterString.Get("卡组非法,请检查:[?]", YGOSharp.CardsManager.Get(code).Name), null);
RMSshow_onlyYes("", GameStringManager.get_unsafe(1406), null);
break;
}
break;
......
......@@ -696,7 +696,10 @@ public class Servant
cardPicLoader_.code = code;
cardPicLoader_.uiTexture = UIHelper.getByName<UITexture>(currentMSwindow, "atkPic_");
cardPicLoader_ = currentMSwindow.AddComponent<cardPicLoader>();
cardPicLoader_.code = code;
if (Int32.Parse(def.value) != 8)
cardPicLoader_.code = code;
else
cardPicLoader_.code = 0;
cardPicLoader_.uiTexture = UIHelper.getByName<UITexture>(currentMSwindow, "defPic_");
}
......
......@@ -95,11 +95,11 @@ public class SelectServer : WindowServantSP
void printFile(bool first)
{
list.Clear();
if (File.Exists("config\\hosts.conf") == false)
if (File.Exists("config/hosts.conf") == false)
{
File.Create("config\\hosts.conf").Close();
File.Create("config/hosts.conf").Close();
}
string txtString = File.ReadAllText("config\\hosts.conf");
string txtString = File.ReadAllText("config/hosts.conf");
string[] lines = txtString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
{
......@@ -175,7 +175,7 @@ public class SelectServer : WindowServantSP
{
all += list.items[i] + "\r\n";
}
File.WriteAllText("config\\hosts.conf", all);
File.WriteAllText("config/hosts.conf", all);
printFile(false);
(new Thread(() => { TcpHelper.join(ipString, name, portString, pswString,versionString); })).Start();
}
......
fileFormatVersion: 2
guid: 874a0c923ab9f3648a0b5bf2830ee874
timeCreated: 1523709019
guid: b4bba7c2184d6614e82044252cc03043
timeCreated: 1547530703
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
......
......@@ -4,13 +4,13 @@ public var framesPerSecond = 10.0;
public var loop:boolean;
public var play:boolean = true;
private var index:int;
private var offsettime;
private var offsettime:float;
public var Hidewhenstopplaying:boolean;
function Start(){
offsettime = Time.time;
}
function Update () {
index = (Time.time - offsettime) * framesPerSecond;
var index = (Time.time - offsettime) * framesPerSecond;
if(play){
index = index % (uvAnimationTileX * uvAnimationTileY);
var size = Vector2 (1.0 / uvAnimationTileX, 1.0 / uvAnimationTileY);
......@@ -25,7 +25,7 @@ function Update () {
if(index >= (uvAnimationTileX * uvAnimationTileY)-1){
play = false;
if(Hidewhenstopplaying){
GetComponent.<Renderer>().active = false;
(GetComponent.<Renderer>() as Renderer).enabled = false;
}
}
}
......
......@@ -3,7 +3,7 @@ var LifeTime:float = 1;
var RandomRotation:boolean = false;
var PositionOffset:Vector3;
var SpawnEnd:GameObject;
private var timetemp;
private var timetemp:float;
function Start(){
timetemp = Time.time;
if(RandomRotation){
......@@ -14,7 +14,7 @@ function Start(){
}
function Update () {
if(Time.time > timetemp + LifeTime){
if(Time.time > (timetemp + LifeTime)){
if(SpawnEnd){
var obj = GameObject.Instantiate(SpawnEnd,this.transform.position,this.transform.rotation);
}
......
......@@ -2,7 +2,7 @@ var ObjectSpawn:GameObject;
var SpawnRate:float;
var LifeTimeObject:float = 1;
var LimitObject:int = 3;
private var timetemp;
private var timetemp:float;
private var objcount:int;
var PositionRandomSize:Vector3;
var PositionOffset:Vector3;
......
......@@ -25,14 +25,15 @@ private var sections = new Array();
function LateUpdate () {
var position = transform.position;
var now = Time.time;
var tmp : ExtrudedTrailSection = sections[sections.length - 1];
// Remove old sections
while (sections.length > 0 && now > sections[sections.length - 1].time + time) {
while (sections.length > 0 && now > (tmp.time + time)) {
sections.Pop();
tmp = sections[sections.length - 1];
}
tmp = sections[0];
// Add a new trail section to beginning of array
if (sections.length == 0 || (sections[0].point - position).sqrMagnitude > minDistance * minDistance)
if (sections.length == 0 || (tmp.point - position).sqrMagnitude > minDistance * minDistance)
{
var section = ExtrudedTrailSection ();
section.point = position;
......@@ -48,14 +49,16 @@ function LateUpdate () {
var worldToLocal = transform.worldToLocalMatrix;
var finalSections = new Matrix4x4[sections.length];
var previousRotation : Quaternion;
var fsection : ExtrudedTrailSection = sections[0];
var ssection : ExtrudedTrailSection = sections[1];
for (var i=0;i<sections.length;i++)
{
if (autoCalculateOrientation)
{
if (i == 0)
{
var direction = sections[0].point - sections[1].point;
var direction = fsection.point - ssection.point;
var rotation = Quaternion.LookRotation(direction, Vector3.up);
previousRotation = rotation;
finalSections[i] = worldToLocal * Matrix4x4.TRS(position, rotation, Vector3.one);
......@@ -63,7 +66,9 @@ function LateUpdate () {
// all elements get the direction by looking up the next section
else if (i != sections.length - 1)
{
direction = sections[i].point - sections[i+1].point;
var ftmp : ExtrudedTrailSection = sections[i];
var stmp : ExtrudedTrailSection = sections[i+1];
direction = ftmp.point - stmp.point;
rotation = Quaternion.LookRotation(direction, Vector3.up);
// When the angle of the rotation compared to the last segment is too high
......@@ -72,7 +77,7 @@ function LateUpdate () {
rotation = Quaternion.Slerp(previousRotation, rotation, 0.5);
previousRotation = rotation;
finalSections[i] = worldToLocal * Matrix4x4.TRS(sections[i].point, rotation, Vector3.one);
finalSections[i] = worldToLocal * Matrix4x4.TRS(ftmp.point, rotation, Vector3.one);
}
// except the last one, which just copies the previous one
else
......@@ -88,7 +93,8 @@ function LateUpdate () {
}
else
{
finalSections[i] = worldToLocal * sections[i].matrix;
tmp = sections[i];
finalSections[i] = worldToLocal * tmp.matrix;
}
}
}
......
......@@ -106,7 +106,7 @@ function Update () {
function ApplyMeshCollider () {
if (unappliedMesh && unappliedMesh.GetComponent(MeshCollider)) {
unappliedMesh.GetComponent(MeshCollider).mesh = unappliedMesh.mesh;
unappliedMesh.GetComponent(MeshCollider).sharedMesh = unappliedMesh.mesh;
}
unappliedMesh = null;
}
\ No newline at end of file
......@@ -26,14 +26,15 @@ private var sections = new Array();
function LateUpdate () {
var position = transform.position;
var now = Time.time;
var cur_section : TronTrailSection = sections[sections.length - 1];
// Remove old sections
while (sections.length > 0 && now > sections[sections.length - 1].time + time) {
while (sections.length > 0 && now > (cur_section.time + time)) {
sections.Pop();
cur_section = sections[sections.length - 1];
}
var section0 : TronTrailSection = sections[0];
// Add a new trail section
if (sections.length == 0 || (sections[0].point - position).sqrMagnitude > minDistance * minDistance)
if (sections.length == 0 || (section0.point - position).sqrMagnitude > minDistance * minDistance)
{
var section = TronTrailSection ();
section.point = position;
......
......@@ -39,7 +39,7 @@ function DoTwist( pos : Vector3, t : float )
{
var st = Mathf.Sin(t);
var ct = Mathf.Cos(t);
new_pos = Vector3.zero;
var new_pos = Vector3.zero;
new_pos.x = pos.x*ct - pos.z*st;
new_pos.z = pos.x*st + pos.z*ct;
......
......@@ -6,12 +6,12 @@ PlayerSettings:
serializedVersion: 11
productGUID: 23639be819f24d044ae93a28448a771b
AndroidProfiler: 0
defaultScreenOrientation: 4
defaultScreenOrientation: 3
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: YGOPro2
productName: YGOPro2
companyName: "YGOPro2\uFF08Beta\uFF09"
productName: "YGOPro2\uFF08Beta\uFF09"
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1}
......@@ -49,7 +49,7 @@ PlayerSettings:
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
m_MTRendering: 1
m_MobileMTRendering: 0
m_MobileMTRendering: 1
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
......@@ -62,7 +62,7 @@ PlayerSettings:
allowedAutorotateToLandscapeRight: 1
allowedAutorotateToLandscapeLeft: 1
useOSAutorotation: 1
use32BitDisplayBuffer: 1
use32BitDisplayBuffer: 0
disableDepthAndStencilBuffers: 0
defaultIsFullScreen: 0
defaultIsNativeResolution: 1
......@@ -123,7 +123,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0
bundleVersion: 1.034.3
preloadedAssets: []
metroInputSource: 0
m_HolographicPauseOnTrackingLoss: 1
......@@ -141,23 +141,23 @@ PlayerSettings:
protectGraphicsMemory: 0
useHDRDisplay: 0
applicationIdentifier:
Android: com.YGOPro2.YGOPro2
Standalone: unity.YGOPro2.YGOPro2
Tizen: com.YGOPro2.YGOPro2
iOS: com.YGOPro2.YGOPro2
tvOS: com.YGOPro2.YGOPro2
Android: cn.ygopro2.ygopro2android
Standalone: cn.ygopro2.ygopro2android
Tizen: cn.ygopro2.ygopro2android
iOS: cn.ygopro2.ygopro2android
tvOS: cn.ygopro2.ygopro2android
buildNumber:
iOS:
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
AndroidPreferredInstallLocation: 0
aotOptions:
stripEngineCode: 1
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0
ForceSDCardPermission: 0
ForceInternetPermission: 1
ForceSDCardPermission: 1
CreateWallpaper: 0
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
......@@ -228,10 +228,10 @@ PlayerSettings:
AndroidTargetDevice: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeystoreName: ygopro.jks
AndroidKeyaliasName:
AndroidTVCompatibility: 1
AndroidIsGame: 1
AndroidTVCompatibility: 0
AndroidIsGame: 0
androidEnableBanner: 1
m_AndroidBanners:
- width: 320
......@@ -243,47 +243,10 @@ PlayerSettings:
- m_BuildTarget:
m_Icons:
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Icon: {fileID: 2800000, guid: 92d79efb33a455e48990f4a79c142aa9, type: 3}
m_Width: 128
m_Height: 128
m_Kind: 0
- m_BuildTarget: Standalone
m_Icons:
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Width: 1024
m_Height: 1024
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Width: 512
m_Height: 512
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Width: 256
m_Height: 256
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 2800000, guid: 874a0c923ab9f3648a0b5bf2830ee874, type: 3}
m_Width: 128
m_Height: 128
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 2800000, guid: 874a0c923ab9f3648a0b5bf2830ee874, type: 3}
m_Width: 48
m_Height: 48
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Width: 32
m_Height: 32
m_Kind: 0
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Width: 16
m_Height: 16
m_Kind: 0
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
m_BuildTargetVRSettings: []
......
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