Commit 68130274 authored by hex's avatar hex

fix and optimized

parent 7be44462
Pipeline #39619 failed
...@@ -15,11 +15,11 @@ public class OpenCardOnClick : MonoBehaviour ...@@ -15,11 +15,11 @@ public class OpenCardOnClick : MonoBehaviour
return; return;
} }
int code = int.Parse(s); int code = int.Parse(s);
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true); ((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack, "", true);
} }
catch (System.Exception e) catch (System.Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
} }
......
using UnityEngine; using System.Collections;
using System.Collections;
using System.IO; using System.IO;
using UnityEngine;
public class barPngLoader : MonoBehaviour { public class barPngLoader : MonoBehaviour
{
public UITexture under; public UITexture under;
public UIPanel healthBarCC; public UIPanel healthBarCC;
public UIPanel timeBarCC; public UIPanel timeBarCC;
public UIPanel faceCC; public UIPanel faceCC;
public UITexture api_healthBar; public UITexture api_healthBar;
public UITexture api_timeBar; public UITexture api_timeBar;
public UITexture api_face; public UITexture api_face;
...@@ -14,7 +15,8 @@ public class barPngLoader : MonoBehaviour { ...@@ -14,7 +15,8 @@ public class barPngLoader : MonoBehaviour {
public UILabel api_timeHint; public UILabel api_timeHint;
public UILabel api_healthHint; public UILabel api_healthHint;
// Use this for initialization // Use this for initialization
void Start () { void Start()
{
under.mainTexture = GameTextureManager.bar; under.mainTexture = GameTextureManager.bar;
api_healthBar.mainTexture = GameTextureManager.lp; api_healthBar.mainTexture = GameTextureManager.lp;
api_timeBar.mainTexture = GameTextureManager.time; api_timeBar.mainTexture = GameTextureManager.time;
...@@ -62,7 +64,7 @@ public class barPngLoader : MonoBehaviour { ...@@ -62,7 +64,7 @@ public class barPngLoader : MonoBehaviour {
api_name.height = int.Parse(mats[1]); api_name.height = int.Parse(mats[1]);
break; break;
case "playerNameLable.color": case "playerNameLable.color":
ColorUtility.TryParseHtmlString(mats[1],out c); ColorUtility.TryParseHtmlString(mats[1], out c);
api_name.color = c; api_name.color = c;
api_name.gradientTop = api_name.color; api_name.gradientTop = api_name.color;
break; break;
...@@ -243,14 +245,15 @@ public class barPngLoader : MonoBehaviour { ...@@ -243,14 +245,15 @@ public class barPngLoader : MonoBehaviour {
} }
} }
} }
catch (System.Exception e) catch (System.Exception e)
{ {
Debug.LogError(e); // Debug.LogError(e);
} }
} }
// Update is called once per frame // Update is called once per frame
void Update () { void Update()
{
}
}
} }
This diff is collapsed.
...@@ -65,9 +65,9 @@ public class Menu : WindowServantSP ...@@ -65,9 +65,9 @@ public class Menu : WindowServantSP
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
...@@ -231,9 +231,9 @@ public class Menu : WindowServantSP ...@@ -231,9 +231,9 @@ public class Menu : WindowServantSP
File.Create("commamd.shell").Close(); File.Create("commamd.shell").Close();
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
string all = ""; string all = "";
try try
...@@ -291,9 +291,9 @@ public class Menu : WindowServantSP ...@@ -291,9 +291,9 @@ public class Menu : WindowServantSP
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
try try
{ {
...@@ -305,9 +305,9 @@ public class Menu : WindowServantSP ...@@ -305,9 +305,9 @@ public class Menu : WindowServantSP
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
} }
......
...@@ -96,7 +96,7 @@ public static class TcpHelper ...@@ -96,7 +96,7 @@ public static class TcpHelper
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
Monitor.Exit(datas); Monitor.Exit(datas);
} }
...@@ -224,7 +224,7 @@ public static class TcpHelper ...@@ -224,7 +224,7 @@ public static class TcpHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogWarning("Socket cleanup failed: " + e.Message); // Debug.LogWarning("Socket cleanup failed: " + e.Message);
} }
tcpClient = null; tcpClient = null;
...@@ -475,16 +475,16 @@ public static class TcpHelper ...@@ -475,16 +475,16 @@ public static class TcpHelper
public static List<Package> readPackagesInRecord(string path) public static List<Package> readPackagesInRecord(string path)
{ {
UnityEngine.Debug.Log(path); // UnityEngine.Debug.Log(path);
List<Package> re = null; List<Package> re = null;
try try
{ {
re = getPackages(File.ReadAllBytes(path)); re = getPackages(File.ReadAllBytes(path));
} }
catch (System.Exception e) catch (Exception e)
{ {
re = new List<Package>(); re = new List<Package>();
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
return re; return re;
} }
...@@ -506,9 +506,9 @@ public static class TcpHelper ...@@ -506,9 +506,9 @@ public static class TcpHelper
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
return re; return re;
} }
...@@ -542,7 +542,7 @@ public static class TcpHelper ...@@ -542,7 +542,7 @@ public static class TcpHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
if (write) if (write)
...@@ -570,7 +570,7 @@ public static class TcpHelper ...@@ -570,7 +570,7 @@ public static class TcpHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -665,9 +665,9 @@ public static class BinaryExtensions ...@@ -665,9 +665,9 @@ public static class BinaryExtensions
result[unicode.Length + 1] = 0; result[unicode.Length + 1] = 0;
writer.Write(result); writer.Write(result);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -898,86 +898,12 @@ public class SocketMaster ...@@ -898,86 +898,12 @@ public class SocketMaster
} }
} }
// public class TcpClientWithTimeout
// {
// protected string _hostname;
// protected int _port;
// protected int _timeout_milliseconds;
// protected TcpClient connection;
// protected bool connected;
// protected Exception exception;
// public TcpClientWithTimeout(string hostname, int port, int timeout_milliseconds)
// {
// _hostname = hostname;
// _port = port;
// _timeout_milliseconds = timeout_milliseconds;
// }
// public TcpClient Connect()
// {
// // kick off the thread that tries to connect
// connected = false;
// exception = null;
// Thread thread = new Thread(new ThreadStart(BeginConnect));
// thread.IsBackground = true; // 作为后台线程处理
// // 不会占用机器太长的时间
// thread.Start();
// // 等待如下的时间
// thread.Join(_timeout_milliseconds);
// if (connected == true)
// {
// // 如果成功就返回TcpClient对象
// thread.Abort();
// return connection;
// }
// if (exception != null)
// {
// // 如果失败就抛出错误
// thread.Abort();
// TcpHelper.onDisConnected = true;
// Program.DEBUGLOG("onDisConnected 7");
// throw exception;
// }
// else
// {
// // 同样地抛出错误
// thread.Abort();
// string message = string.Format(
// "TcpClient connection to {0}:{1} timed out",
// _hostname,
// _port
// );
// TcpHelper.onDisConnected = true;
// Program.DEBUGLOG("onDisConnected 8");
// throw new TimeoutException(message);
// }
// }
// protected void BeginConnect()
// {
// try
// {
// connection = new TcpClient(_hostname, _port);
// // 标记成功,返回调用者
// connected = true;
// }
// catch (Exception ex)
// {
// // 标记失败
// exception = ex;
// }
// }
// }
public class TcpClientWithTimeout public class TcpClientWithTimeout
{ {
protected string _hostname; protected string _hostname;
protected int _port; protected int _port;
protected int _timeout_milliseconds; protected int _timeout_milliseconds;
// --- State variables --- // --- State variables ---
protected TcpClient connection; protected TcpClient connection;
protected bool connected; protected bool connected;
...@@ -986,7 +912,7 @@ public class TcpClientWithTimeout ...@@ -986,7 +912,7 @@ public class TcpClientWithTimeout
// --- Cooperative Cancellation Flag --- // --- Cooperative Cancellation Flag ---
// Use 'volatile' to ensure the latest value is read across threads. // Use 'volatile' to ensure the latest value is read across threads.
private volatile bool _isCancelled = false; private volatile bool _isCancelled = false;
public TcpClientWithTimeout(string hostname, int port, int timeout_milliseconds) public TcpClientWithTimeout(string hostname, int port, int timeout_milliseconds)
{ {
_hostname = hostname; _hostname = hostname;
...@@ -999,7 +925,7 @@ public class TcpClientWithTimeout ...@@ -999,7 +925,7 @@ public class TcpClientWithTimeout
connected = false; connected = false;
exception = null; exception = null;
_isCancelled = false; _isCancelled = false;
Thread thread = new Thread(new ThreadStart(BeginConnect)); Thread thread = new Thread(new ThreadStart(BeginConnect));
thread.IsBackground = true; thread.IsBackground = true;
thread.Start(); thread.Start();
...@@ -1023,16 +949,11 @@ public class TcpClientWithTimeout ...@@ -1023,16 +949,11 @@ public class TcpClientWithTimeout
{ {
// The thread did NOT finish in time (timeout occurred). // The thread did NOT finish in time (timeout occurred).
// This is where we AVOID Thread.Abort() // This is where we AVOID Thread.Abort()
// 1. Signal the thread to cancel itself. // 1. Signal the thread to cancel itself.
_isCancelled = true; _isCancelled = true;
// 2. The background thread still exists and is trying to connect. // 2. The background thread still exists and is trying to connect.
// If we just throw a TimeoutException, the background thread
// might eventually connect and leave a lingering, unused socket.
// The best we can do is "let it go" and let the garbage collector
// clean it up eventually since it's a background thread.
string message = string.Format("TcpClient connection to {0}:{1} timed out", _hostname, _port); string message = string.Format("TcpClient connection to {0}:{1} timed out", _hostname, _port);
throw new TimeoutException(message); throw new TimeoutException(message);
} }
...@@ -1052,11 +973,11 @@ public class TcpClientWithTimeout ...@@ -1052,11 +973,11 @@ public class TcpClientWithTimeout
client.Close(); // Clean up the partially created client. client.Close(); // Clean up the partially created client.
return; // Exit gracefully. return; // Exit gracefully.
} }
// Now, use the async pattern available even in older .NET to check for cancellation // Now, use the async pattern available even in older .NET to check for cancellation
// while connecting. This gives us a chance to abort more cleanly. // while connecting. This gives us a chance to abort more cleanly.
IAsyncResult result = client.BeginConnect(_hostname, _port, null, null); IAsyncResult result = client.BeginConnect(_hostname, _port, null, null);
// Wait for the connection to complete OR for the main thread to signal a timeout. // Wait for the connection to complete OR for the main thread to signal a timeout.
WaitHandle handle = result.AsyncWaitHandle; WaitHandle handle = result.AsyncWaitHandle;
if (handle.WaitOne(_timeout_milliseconds)) if (handle.WaitOne(_timeout_milliseconds))
...@@ -1068,7 +989,7 @@ public class TcpClientWithTimeout ...@@ -1068,7 +989,7 @@ public class TcpClientWithTimeout
client.Close(); client.Close();
return; return;
} }
// Finalize the connection. This will re-throw any connection exception. // Finalize the connection. This will re-throw any connection exception.
client.EndConnect(result); client.EndConnect(result);
connection = client; connection = client;
...@@ -1076,9 +997,6 @@ public class TcpClientWithTimeout ...@@ -1076,9 +997,6 @@ public class TcpClientWithTimeout
} }
else else
{ {
// This 'else' block inside BeginConnect will rarely be hit because the
// main thread's Join timeout is usually what triggers first. But it's
// good practice for robustness.
client.Close(); client.Close();
if (!_isCancelled) // If it wasn't the main thread that timed out if (!_isCancelled) // If it wasn't the main thread that timed out
{ {
...@@ -1088,8 +1006,6 @@ public class TcpClientWithTimeout ...@@ -1088,8 +1006,6 @@ public class TcpClientWithTimeout
} }
catch (Exception ex) catch (Exception ex)
{ {
// A real connection error occurred (e.g., host not found, connection refused).
// Store the exception so the main thread can throw it.
exception = ex; exception = ex;
} }
} }
......
...@@ -805,7 +805,7 @@ public static class UIHelper ...@@ -805,7 +805,7 @@ public static class UIHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
} }
...@@ -814,7 +814,7 @@ public static class UIHelper ...@@ -814,7 +814,7 @@ public static class UIHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -859,7 +859,7 @@ public static class UIHelper ...@@ -859,7 +859,7 @@ public static class UIHelper
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
return pic; return pic;
} }
......
...@@ -178,7 +178,7 @@ public class gameCard : OCGobject ...@@ -178,7 +178,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
gameObject.SetActive(false); gameObject.SetActive(false);
} }
...@@ -226,7 +226,7 @@ public class gameCard : OCGobject ...@@ -226,7 +226,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
} }
...@@ -969,7 +969,7 @@ public class gameCard : OCGobject ...@@ -969,7 +969,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
destroy(game_object_monster_cloude); destroy(game_object_monster_cloude);
destroy(game_object_verticle_drawing); destroy(game_object_verticle_drawing);
...@@ -996,7 +996,7 @@ public class gameCard : OCGobject ...@@ -996,7 +996,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
destroy(game_object_monster_cloude); destroy(game_object_monster_cloude);
destroy(game_object_verticle_drawing); destroy(game_object_verticle_drawing);
...@@ -1022,7 +1022,7 @@ public class gameCard : OCGobject ...@@ -1022,7 +1022,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
loaded_verticalDrawingCode = 0; loaded_verticalDrawingCode = 0;
loaded_verticalDrawingNumber = -1; loaded_verticalDrawingNumber = -1;
...@@ -1719,7 +1719,7 @@ public class gameCard : OCGobject ...@@ -1719,7 +1719,7 @@ public class gameCard : OCGobject
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
int special_hint = 0; int special_hint = 0;
...@@ -2377,7 +2377,7 @@ public class gameCard : OCGobject ...@@ -2377,7 +2377,7 @@ public class gameCard : OCGobject
{ {
return; return;
} }
show_off_disabled = disabled; show_off_disabled = disabled;
show_off_begin_time = Program.TimePassed(); show_off_begin_time = Program.TimePassed();
show_off_shokewave = summon; show_off_shokewave = summon;
......
...@@ -587,9 +587,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -587,9 +587,9 @@ public class Ocgcore : ServantWithCardDescription
{ {
logicalizeMessage(Packages_ALL[i]); logicalizeMessage(Packages_ALL[i]);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
if (needSwap) if (needSwap)
{ {
...@@ -599,9 +599,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -599,9 +599,9 @@ public class Ocgcore : ServantWithCardDescription
{ {
practicalizeMessage(Packages_ALL[i]); practicalizeMessage(Packages_ALL[i]);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
clearResponse(); clearResponse();
} }
...@@ -612,9 +612,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -612,9 +612,9 @@ public class Ocgcore : ServantWithCardDescription
{ {
logicalizeMessage(Packages_ALL[i]); logicalizeMessage(Packages_ALL[i]);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
} }
...@@ -652,7 +652,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -652,7 +652,7 @@ public class Ocgcore : ServantWithCardDescription
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -672,17 +672,17 @@ public class Ocgcore : ServantWithCardDescription ...@@ -672,17 +672,17 @@ public class Ocgcore : ServantWithCardDescription
{ {
logicalizeMessage(currentPackage); logicalizeMessage(currentPackage);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
try try
{ {
practicalizeMessage(currentPackage); practicalizeMessage(currentPackage);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
Packages.Dequeue(); Packages.Dequeue();
} }
...@@ -702,9 +702,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -702,9 +702,9 @@ public class Ocgcore : ServantWithCardDescription
{ {
logicalizeMessage(currentPackage); logicalizeMessage(currentPackage);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
if (Packages.Count == 1) if (Packages.Count == 1)
{ {
...@@ -714,9 +714,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -714,9 +714,9 @@ public class Ocgcore : ServantWithCardDescription
realize(); realize();
toNearest(); toNearest();
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
Packages.Dequeue(); Packages.Dequeue();
...@@ -1070,17 +1070,17 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1070,17 +1070,17 @@ public class Ocgcore : ServantWithCardDescription
{ {
logicalizeMessage(currentPackage); logicalizeMessage(currentPackage);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
try try
{ {
practicalizeMessage(currentPackage); practicalizeMessage(currentPackage);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
Packages.Dequeue(); Packages.Dequeue();
} }
...@@ -1099,9 +1099,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1099,9 +1099,9 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -1655,9 +1655,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1655,9 +1655,9 @@ public class Ocgcore : ServantWithCardDescription
r.BaseStream.Position = pos + len - 4; r.BaseStream.Position = pos + len - 4;
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
// UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
break; break;
case GameMessage.UpdateCard: case GameMessage.UpdateCard:
...@@ -3010,7 +3010,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3010,7 +3010,7 @@ public class Ocgcore : ServantWithCardDescription
showCaculator(); showCaculator();
break; break;
case GameMessage.Retry: case GameMessage.Retry:
Debug.Log("Retry"); // Debug.Log("Retry");
break; break;
//case GameMessage.sibyl_delay: //case GameMessage.sibyl_delay:
// if (inIgnoranceReplay()) // if (inIgnoranceReplay())
...@@ -6252,9 +6252,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -6252,9 +6252,9 @@ public class Ocgcore : ServantWithCardDescription
cardsInSelectAnimation[i].del_all_decoration_by_string("selected"); cardsInSelectAnimation[i].del_all_decoration_by_string("selected");
cardsInSelectAnimation[i].currentKuang = gameCard.kuangType.none; cardsInSelectAnimation[i].currentKuang = gameCard.kuangType.none;
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
cardsInSelectAnimation.Clear(); cardsInSelectAnimation.Clear();
...@@ -7975,7 +7975,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7975,7 +7975,6 @@ public class Ocgcore : ServantWithCardDescription
{ {
if (my_p_cards.Count == 2) if (my_p_cards.Count == 2)
{ {
Debug.Log("oh");
gameField gameField
.me_left_p_num.GetComponent<number_loader>() .me_left_p_num.GetComponent<number_loader>()
.set_number((int)my_p_cards[0].get_data().LScale, 3); .set_number((int)my_p_cards[0].get_data().LScale, 3);
...@@ -8296,7 +8295,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8296,7 +8295,6 @@ public class Ocgcore : ServantWithCardDescription
{ {
gameInfo.removeHashedButton("swap"); gameInfo.removeHashedButton("swap");
} }
animation_count(gameField.LOCATION_DECK_0, CardLocation.Deck, 0); animation_count(gameField.LOCATION_DECK_0, CardLocation.Deck, 0);
animation_count(gameField.LOCATION_EXTRA_0, CardLocation.Extra, 0); animation_count(gameField.LOCATION_EXTRA_0, CardLocation.Extra, 0);
animation_count(gameField.LOCATION_GRAVE_0, CardLocation.Grave, 0); animation_count(gameField.LOCATION_GRAVE_0, CardLocation.Grave, 0);
...@@ -8751,9 +8749,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8751,9 +8749,9 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
//to card //to card
...@@ -9778,9 +9776,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -9778,9 +9776,9 @@ public class Ocgcore : ServantWithCardDescription
binaryMaster.writer.Write(Int32.Parse(result[0].value)); binaryMaster.writer.Write(Int32.Parse(result[0].value));
sendReturn(binaryMaster.get()); sendReturn(binaryMaster.get());
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
break; break;
...@@ -9811,9 +9809,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -9811,9 +9809,9 @@ public class Ocgcore : ServantWithCardDescription
binaryMaster.writer.Write(answer >= 0 ? answer : 0); binaryMaster.writer.Write(answer >= 0 ? answer : 0);
sendReturn(binaryMaster.get()); sendReturn(binaryMaster.get());
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
if (result[0].value == "no") if (result[0].value == "no")
...@@ -9831,9 +9829,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -9831,9 +9829,9 @@ public class Ocgcore : ServantWithCardDescription
{ {
res |= UInt32.Parse(item.value); res |= UInt32.Parse(item.value);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
binaryMaster.writer.Write(res); binaryMaster.writer.Write(res);
...@@ -9922,7 +9920,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -9922,7 +9920,7 @@ public class Ocgcore : ServantWithCardDescription
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
break; break;
......
...@@ -169,9 +169,9 @@ public class Program : MonoBehaviour ...@@ -169,9 +169,9 @@ public class Program : MonoBehaviour
obj.SetActive(false); obj.SetActive(false);
allObjects.Add(obj); allObjects.Add(obj);
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
...@@ -672,9 +672,9 @@ public class Program : MonoBehaviour ...@@ -672,9 +672,9 @@ public class Program : MonoBehaviour
Resources.UnloadUnusedAssets(); Resources.UnloadUnusedAssets();
GC.Collect(); GC.Collect();
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
} }
...@@ -977,9 +977,9 @@ public class Program : MonoBehaviour ...@@ -977,9 +977,9 @@ public class Program : MonoBehaviour
} }
} }
} }
catch (System.Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // Debug.Log(e);
} }
} }
...@@ -1413,7 +1413,7 @@ public class Program : MonoBehaviour ...@@ -1413,7 +1413,7 @@ public class Program : MonoBehaviour
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
processedTasks++; processedTasks++;
break; break;
...@@ -1521,9 +1521,9 @@ public class Program : MonoBehaviour ...@@ -1521,9 +1521,9 @@ public class Program : MonoBehaviour
{ {
TcpHelper.tcpClient.Close(); TcpHelper.tcpClient.Close();
} }
catch (System.Exception e) catch (Exception e)
{ {
//adeUnityEngine.Debug.Log(e); // Debug.Log(e);
} }
Menu.deleteShell(); Menu.deleteShell();
} }
......
...@@ -214,7 +214,7 @@ public class GameTextureManager ...@@ -214,7 +214,7 @@ public class GameTextureManager
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogWarning("Get card type failed for code " + resourceToProcess.code + ": " + e.Message); // Debug.LogWarning("Get card type failed for code " + resourceToProcess.code + ": " + e.Message);
} }
ProcessResourceRequest(resourceToProcess); ProcessResourceRequest(resourceToProcess);
......
...@@ -962,7 +962,7 @@ public class Servant ...@@ -962,7 +962,7 @@ public class Servant
{ {
url = inputUrl.value; url = inputUrl.value;
} }
Debug.Log("开始异步下载头像: " + url); // Debug.Log("开始异步下载头像: " + url);
// [核心修改] 使用我们新的、异步的 UnityFileDownloader // [核心修改] 使用我们新的、异步的 UnityFileDownloader
// 启动一个协程来执行异步下载任务 // 启动一个协程来执行异步下载任务
Program Program
...@@ -976,7 +976,7 @@ public class Servant ...@@ -976,7 +976,7 @@ public class Servant
// 这个部分是回调函数,只会在下载完成后执行 // 这个部分是回调函数,只会在下载完成后执行
if (success) if (success)
{ {
Debug.Log("头像下载成功,路径: " + facePath); // Debug.Log("头像下载成功,路径: " + facePath);
Program.PrintToChat("头像下载成功!"); Program.PrintToChat("头像下载成功!");
// 将原来同步执行的刷新逻辑移动到这里 // 将原来同步执行的刷新逻辑移动到这里
// 确保文件确实存在并且已经被下载完毕 // 确保文件确实存在并且已经被下载完毕
......
...@@ -136,7 +136,7 @@ public class Setting : WindowServant2D ...@@ -136,7 +136,7 @@ public class Setting : WindowServant2D
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
......
...@@ -444,7 +444,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -444,7 +444,7 @@ public class DeckManager : ServantWithCardDescription
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
} }
deckDirty = true; deckDirty = true;
...@@ -2087,7 +2087,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2087,7 +2087,7 @@ public class DeckManager : ServantWithCardDescription
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
...@@ -2304,7 +2304,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2304,7 +2304,7 @@ public class DeckManager : ServantWithCardDescription
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
if (side) if (side)
{ {
...@@ -2338,7 +2338,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2338,7 +2338,7 @@ public class DeckManager : ServantWithCardDescription
else else
{ {
UIInput_search.value = ""; UIInput_search.value = "";
UIInput_search.isSelected = true; UIInput_search.isSelected = false;
} }
} }
} }
...@@ -154,7 +154,7 @@ public class selectReplay : WindowServantSP ...@@ -154,7 +154,7 @@ public class selectReplay : WindowServantSP
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
// Debug.Log(returnValue); // Debug.Log(returnValue);
return returnValue; return returnValue;
...@@ -264,7 +264,7 @@ public class selectReplay : WindowServantSP ...@@ -264,7 +264,7 @@ public class selectReplay : WindowServantSP
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e); // Debug.Log(e);
} }
return returnValue; return returnValue;
} }
...@@ -310,7 +310,7 @@ public class selectReplay : WindowServantSP ...@@ -310,7 +310,7 @@ public class selectReplay : WindowServantSP
} }
catch (Exception e) catch (Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
RMSshow_none(InterString.Get("录像没有录制完整。")); RMSshow_none(InterString.Get("录像没有录制完整。"));
} }
} }
......
...@@ -33,24 +33,29 @@ namespace YGOSharp ...@@ -33,24 +33,29 @@ namespace YGOSharp
continue; continue;
if (current == null) if (current == null)
continue; continue;
string[] data = line.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries); string[] data = line.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries);
int id = int.Parse(data[0]); int id = int.Parse(data[0]);
int count = int.Parse(data[1]); int count = int.Parse(data[1]);
current.Add(id, count); current.Add(id, count);
} }
catch (System.Exception e) catch (System.Exception e)
{ {
success = false; success = false;
UnityEngine.Debug.Log(line); // UnityEngine.Debug.Log(line);
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
reader.Close(); reader.Close();
if(!test) { if (!test)
if (Banlists == null) { {
if (Banlists == null)
{
Banlists = new_list; Banlists = new_list;
} else { }
foreach (var item in new_list) { else
{
foreach (var item in new_list)
{
Banlists.Add(item); Banlists.Add(item);
} }
} }
...@@ -58,7 +63,8 @@ namespace YGOSharp ...@@ -58,7 +63,8 @@ namespace YGOSharp
return (success && new_list.Count > 1); return (success && new_list.Count > 1);
} }
public static void initializeComplete() { public static void initializeComplete()
{
Banlist blank = new Banlist(); Banlist blank = new Banlist();
blank.Name = "N/A"; blank.Name = "N/A";
Banlists.Add(blank); Banlists.Add(blank);
...@@ -71,7 +77,7 @@ namespace YGOSharp ...@@ -71,7 +77,7 @@ namespace YGOSharp
return 0; return 0;
} }
public static string GetName(uint hash) public static string GetName(uint hash)
{ {
for (int i = 0; i < Banlists.Count; i++) for (int i = 0; i < Banlists.Count; i++)
if (Banlists[i].Hash == hash) if (Banlists[i].Hash == hash)
......
...@@ -109,7 +109,7 @@ namespace YGOSharp ...@@ -109,7 +109,7 @@ namespace YGOSharp
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(e); // UnityEngine.Debug.Log(e);
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"com.unity.2d.tilemap": "1.0.0", "com.unity.2d.tilemap": "1.0.0",
"com.unity.analytics": "3.6.12", "com.unity.analytics": "3.6.12",
"com.unity.burst": "1.8.18", "com.unity.burst": "1.8.18",
"com.unity.ide.vscode": "1.2.5",
"com.unity.postprocessing": "3.4.0", "com.unity.postprocessing": "3.4.0",
"com.unity.test-framework": "1.1.33", "com.unity.test-framework": "1.1.33",
"com.unity.timeline": "1.6.5", "com.unity.timeline": "1.6.5",
......
...@@ -38,6 +38,13 @@ ...@@ -38,6 +38,13 @@
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.ide.vscode": {
"version": "1.2.5",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.mathematics": { "com.unity.mathematics": {
"version": "1.2.6", "version": "1.2.6",
"depth": 1, "depth": 1,
......
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