You need to sign in or sign up before continuing.
Commit ba1f7611 authored by hex's avatar hex

MC 匹配安全更新;增加开局默认全时点设置;1月表更新

parent d8a993a6
Pipeline #42289 failed
...@@ -172,6 +172,7 @@ public class gameInfo : MonoBehaviour ...@@ -172,6 +172,7 @@ public class gameInfo : MonoBehaviour
public void on_toggle_smart() public void on_toggle_smart()
{ {
// Debug.Log("on_toggle_smart:");
SetExclusiveToggle(toggle_smart); SetExclusiveToggle(toggle_smart);
} }
......
...@@ -202,6 +202,7 @@ public class UIPopupList : UIWidgetContainer ...@@ -202,6 +202,7 @@ public class UIPopupList : UIWidgetContainer
[System.NonSerialized] protected GameObject mSelection; [System.NonSerialized] protected GameObject mSelection;
[System.NonSerialized] protected int mOpenFrame = 0; [System.NonSerialized] protected int mOpenFrame = 0;
[System.NonSerialized] protected float mInitialY = 0f;
// Deprecated functionality // Deprecated functionality
[HideInInspector][SerializeField] GameObject eventReceiver; [HideInInspector][SerializeField] GameObject eventReceiver;
...@@ -1095,6 +1096,7 @@ public class UIPopupList : UIWidgetContainer ...@@ -1095,6 +1096,7 @@ public class UIPopupList : UIWidgetContainer
pos.x = Mathf.Round(pos.x); pos.x = Mathf.Round(pos.x);
pos.y = Mathf.Round(pos.y); pos.y = Mathf.Round(pos.y);
t.localPosition = pos; t.localPosition = pos;
mInitialY = pos.y;
} }
else OnSelect(false); else OnSelect(false);
if (mChild != null) if (mChild != null)
...@@ -1161,9 +1163,9 @@ public class UIPopupList : UIWidgetContainer ...@@ -1161,9 +1163,9 @@ public class UIPopupList : UIWidgetContainer
a.y += l; a.y += l;
a.z = 0; a.z = 0;
timeScroller = Program.TimePassed(); timeScroller = Program.TimePassed();
if (a.y > whole) if (a.y > mInitialY)
{ {
a.y = whole; a.y = mInitialY;
} }
if (a.y < 0) if (a.y < 0)
{ {
......
...@@ -13,9 +13,7 @@ public class MyCard : WindowServantSP ...@@ -13,9 +13,7 @@ public class MyCard : WindowServantSP
//const string mycardTiramisuAthleticPort = "8911"; //const string mycardTiramisuAthleticPort = "8911";
//const string mycardTiramisuEntertainPort = "7911"; //const string mycardTiramisuEntertainPort = "7911";
// 不再需要显式的 Thread 对象 private Coroutine requestCoroutine = null;
// Thread requestThread = null;
private Coroutine requestCoroutine = null; // 用 Coroutine 对象来跟踪
MyCardHelper mycardHelper; MyCardHelper mycardHelper;
UIInput inputUsername; UIInput inputUsername;
UIInput inputPsw; UIInput inputPsw;
...@@ -31,33 +29,24 @@ public class MyCard : WindowServantSP ...@@ -31,33 +29,24 @@ public class MyCard : WindowServantSP
inputUsername = UIHelper.getByName<UIInput>(gameObject, "name_"); inputUsername = UIHelper.getByName<UIInput>(gameObject, "name_");
inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_"); inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_");
mycardHelper = new MyCardHelper(); mycardHelper = new MyCardHelper();
loadUser(); LoadUser();
SetActiveFalse(); SetActiveFalse();
} }
void saveUser() void SaveUser()
{ {
Config.Set("mycard_username", inputUsername.value); Config.Set("mycard_username", inputUsername.value);
Config.Set("mycard_password", inputPsw.value); Config.Set("mycard_password", inputPsw.value);
Program.I().selectServer.name = inputUsername.value; Program.I().selectServer.name = inputUsername.value;
} }
void loadUser() void LoadUser()
{ {
inputUsername.value = Config.Get("mycard_username", "MyCard"); inputUsername.value = Config.Get("mycard_username", "MyCard");
inputPsw.value = Config.Get("mycard_password", ""); inputPsw.value = Config.Get("mycard_password", "");
} }
// public void terminateThread() public void TerminateRequest()
// {
// if (!isRequesting && requestThread == null)
// {
// return;
// }
// requestThread.Abort();
// requestThread = null;
// }
public void terminateRequest()
{ {
if (requestCoroutine != null) if (requestCoroutine != null)
{ {
...@@ -68,27 +57,12 @@ public class MyCard : WindowServantSP ...@@ -68,27 +57,12 @@ public class MyCard : WindowServantSP
} }
} }
// void onClickExit()
// {
// Program.I().shiftToServant(Program.I().menu);
// if (TcpHelper.tcpClient != null)
// {
// if (isRequesting) {
// terminateThread();
// }
// if (TcpHelper.tcpClient.Connected)
// {
// TcpHelper.tcpClient.Close();
// }
// }
// }
void onClickExit() void onClickExit()
{ {
Program.I().shiftToServant(Program.I().menu); Program.I().shiftToServant(Program.I().menu);
if (isRequesting) if (isRequesting)
{ {
terminateRequest(); TerminateRequest();
} }
if (TcpHelper.tcpClient != null && TcpHelper.tcpClient.Connected) if (TcpHelper.tcpClient != null && TcpHelper.tcpClient.Connected)
{ {
...@@ -106,75 +80,13 @@ public class MyCard : WindowServantSP ...@@ -106,75 +80,13 @@ public class MyCard : WindowServantSP
Application.OpenURL("https://ygobbs.com/"); Application.OpenURL("https://ygobbs.com/");
} }
// void matchThread(string username, string password, string matchType) { IEnumerator MatchCoroutine(string username, string password, string matchType) {
// try {
// Program.PrintToChat(InterString.Get("正在登录至 MyCard。"));
// string failReason = "";
// bool res = mycardHelper.login(username, password, out failReason);
// if (!res) {
// Program.PrintToChat(InterString.Get("MyCard 登录失败。原因: ") + failReason);
// isRequesting = false;
// return;
// }
// Program.PrintToChat(InterString.Get("MyCard 登录成功,用户名: ") + mycardHelper.username);
// Program.PrintToChat(InterString.Get("正在请求匹配。匹配类型: ") + matchType);
// MatchResultObject matchResultObject = mycardHelper.requestMatch(matchType, out failReason);
// if (matchResultObject == null) {
// Program.PrintToChat(InterString.Get("匹配请求失败。原因: ") + failReason);
// isRequesting = false;
// return;
// }
// Program.PrintToChat(InterString.Get("匹配成功。正在进入房间。"));
// this.isMatching = true;
// (new Thread(() => { TcpHelper.join(matchResultObject.address, mycardHelper.username, matchResultObject.port.ToString(), matchResultObject.password, "0x" + String.Format("{0:X}", Config.ClientVersion)); })).Start();
// isRequesting = false;
// } catch (Exception e) {
// if (e.GetType() != typeof(ThreadAbortException)) {
// Program.PrintToChat(InterString.Get("未知错误: ") + e.Message);
// } else {
// Program.PrintToChat(InterString.Get("匹配已中断。"));
// }
// isRequesting = false;
// }
// }
// void startMatch(string matchType) {
// string username = inputUsername.value;
// string password = inputPsw.value;
// if (username == "" || password == "")
// {
// RMSshow_onlyYes("", InterString.Get("用户名或密码为空。"), null);
// return;
// }
// if (isRequesting)
// {
// terminateThread();
// }
// saveUser();
// isRequesting = true;
// Program.PrintToChat(InterString.Get("已开始匹配。"));
// requestThread = new Thread(() =>
// {
// matchThread(username, password, matchType);
// });
// requestThread.Start();
// }
// void onClickJoinAthletic() {
// startMatch("athletic");
// }
// void onClickJoinEntertain() {
// startMatch("entertain");
// }
IEnumerator matchCoroutine(string username, string password, string matchType) {
isRequesting = true; isRequesting = true;
Program.PrintToChat(InterString.Get("正在登录至 MyCard。")); Program.PrintToChat(InterString.Get("正在登录至 MyCard。"));
bool loginSuccess = false; bool loginSuccess = false;
string failReason = ""; string failReason = "";
// 启动并等待登录协程完成 // 启动并等待登录协程完成
yield return Program.I().StartCoroutine(mycardHelper.login(username, password, (success, reason) => { yield return Program.I().StartCoroutine(mycardHelper.Login(username, password, (success, reason) => {
loginSuccess = success; loginSuccess = success;
failReason = reason; failReason = reason;
})); }));
...@@ -184,11 +96,23 @@ public class MyCard : WindowServantSP ...@@ -184,11 +96,23 @@ public class MyCard : WindowServantSP
yield break; // 结束协程 yield break; // 结束协程
} }
Program.PrintToChat(InterString.Get("MyCard 登录成功,用户名: ") + mycardHelper.username); Program.PrintToChat(InterString.Get("MyCard 登录成功,用户名: ") + mycardHelper.username);
// Program.PrintToChat(InterString.Get("正在获取匹配秘钥。"));
yield return Program.I().StartCoroutine(mycardHelper.GetUserU16Secret((success, reason) =>
{
loginSuccess = success;
failReason = reason;
}));
if (!loginSuccess)
{
Program.PrintToChat(InterString.Get("获取用户密钥失败。请重新登录。原因: ") + failReason);
isRequesting = false;
yield break; // 结束协程
}
// Program.PrintToChat(InterString.Get("获取匹配秘钥成功。"));
Program.PrintToChat(InterString.Get("正在请求匹配。匹配类型: ") + matchType); Program.PrintToChat(InterString.Get("正在请求匹配。匹配类型: ") + matchType);
MatchResultObject matchResultObject = null; MatchResultObject matchResultObject = null;
// 启动并等待匹配协程完成 // 启动并等待匹配协程完成
yield return Program.I().StartCoroutine(mycardHelper.requestMatch(matchType, (result, reason) => { yield return Program.I().StartCoroutine(mycardHelper.RequestMatch(matchType, (result, reason) => {
matchResultObject = result; matchResultObject = result;
failReason = reason; failReason = reason;
})); }));
...@@ -206,7 +130,8 @@ public class MyCard : WindowServantSP ...@@ -206,7 +130,8 @@ public class MyCard : WindowServantSP
isRequesting = false; isRequesting = false;
requestCoroutine = null; requestCoroutine = null;
} }
void startMatch(string matchType) { void StartMatch(string matchType)
{
string username = inputUsername.value; string username = inputUsername.value;
string password = inputPsw.value; string password = inputPsw.value;
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
...@@ -214,19 +139,20 @@ public class MyCard : WindowServantSP ...@@ -214,19 +139,20 @@ public class MyCard : WindowServantSP
RMSshow_onlyYes("", InterString.Get("用户名或密码为空。"), null); RMSshow_onlyYes("", InterString.Get("用户名或密码为空。"), null);
return; return;
} }
if (isRequesting) if (isRequesting)
{ {
terminateRequest(); TerminateRequest();
} }
saveUser(); SaveUser();
Program.PrintToChat(InterString.Get("已开始匹配。")); Program.PrintToChat(InterString.Get("已开始匹配。"));
// 启动协程,而不是线程 // 启动协程,而不是线程
requestCoroutine = Program.I().StartCoroutine(matchCoroutine(username, password, matchType)); requestCoroutine = Program.I().StartCoroutine(MatchCoroutine(username, password, matchType));
} }
void onClickJoinAthletic() { void onClickJoinAthletic() {
startMatch("athletic"); StartMatch("athletic");
} }
void onClickJoinEntertain() { void onClickJoinEntertain() {
startMatch("entertain"); StartMatch("entertain");
} }
} }
This diff is collapsed.
...@@ -469,6 +469,13 @@ public class Ocgcore : ServantWithCardDescription ...@@ -469,6 +469,13 @@ public class Ocgcore : ServantWithCardDescription
UIHelper.getByName<UIToggle>(gameInfo.gameObject, "ignore_").value = false; UIHelper.getByName<UIToggle>(gameInfo.gameObject, "ignore_").value = false;
UIHelper.getByName<UIToggle>(gameInfo.gameObject, "watch_").value = false; UIHelper.getByName<UIToggle>(gameInfo.gameObject, "watch_").value = false;
} }
if (UIHelper.fromStringToBool(Config.Get("full_", "0"))) {
Program.go(1, () =>
{
gameInfo.set_condition(gameInfo.chainCondition.all);
});
}
} }
public void shiftCondition(Condition condition) public void shiftCondition(Condition condition)
...@@ -987,19 +994,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -987,19 +994,6 @@ public class Ocgcore : ServantWithCardDescription
gameInfo.set_condition(gameInfo.chainCondition.no); gameInfo.set_condition(gameInfo.chainCondition.no);
} }
if (Input.GetKeyUp(KeyCode.C) == true)
{
gameInfo.set_condition(gameInfo.chainCondition.standard);
}
if (Input.GetKeyUp(KeyCode.A) == true)
{
gameInfo.set_condition(gameInfo.chainCondition.standard);
}
if (Input.GetKeyUp(KeyCode.S) == true)
{
gameInfo.set_condition(gameInfo.chainCondition.standard);
}
if (Input.GetMouseButtonDown(2)) if (Input.GetMouseButtonDown(2))
{ {
if (Program.I().book.isShowed) if (Program.I().book.isShowed)
......
...@@ -1352,7 +1352,7 @@ public class Program : MonoBehaviour ...@@ -1352,7 +1352,7 @@ public class Program : MonoBehaviour
FPS = FPS.Substring(0, 5); FPS = FPS.Substring(0, 5);
} }
catch { } catch { }
GUI.Label(new Rect(Screen.safeArea.x + 10, 5, 400, 200), "[Ver 1.036.2-TCube 2510] " + "FPS: " + FPS); GUI.Label(new Rect(Screen.safeArea.x + 10, 5, 400, 200), "[Ver 1.036.2-TCube 2601] " + "FPS: " + FPS);
} }
......
...@@ -128,6 +128,11 @@ public static class GameStringManager ...@@ -128,6 +128,11 @@ public static class GameStringManager
Program.DEBUGLOG(e); Program.DEBUGLOG(e);
} }
} }
if (a == "")
{
a = "???";
}
return a; return a;
} }
......
...@@ -13,9 +13,9 @@ public class Setting : WindowServant2D ...@@ -13,9 +13,9 @@ public class Setting : WindowServant2D
setting = gameObject.GetComponentInChildren<LAZYsetting>(); setting = gameObject.GetComponentInChildren<LAZYsetting>();
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "screen_", resizeScreen); UIHelper.registEvent(gameObject, "screen_", resizeScreen);
UIHelper.registEvent(gameObject, "full_", resizeScreen); UIHelper.registEvent(gameObject, "full_", save);
UIHelper.registEvent(gameObject, "resize_", resizeScreen); UIHelper.registEvent(gameObject, "resize_", resizeScreen);
UIHelper.getByName<UIToggle>(gameObject, "full_").value = Screen.fullScreen; UIHelper.getByName<UIToggle>(gameObject, "full_").value = UIHelper.fromStringToBool(Config.Get("full_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "ignoreWatcher_").value = UIHelper.getByName<UIToggle>(gameObject, "ignoreWatcher_").value =
UIHelper.fromStringToBool(Config.Get("ignoreWatcher_", "0")); UIHelper.fromStringToBool(Config.Get("ignoreWatcher_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "ignoreOP_").value = UIHelper.fromStringToBool( UIHelper.getByName<UIToggle>(gameObject, "ignoreOP_").value = UIHelper.fromStringToBool(
...@@ -277,7 +277,7 @@ public class Setting : WindowServant2D ...@@ -277,7 +277,7 @@ public class Setting : WindowServant2D
Screen.SetResolution( Screen.SetResolution(
int.Parse(mats[0]), int.Parse(mats[0]),
int.Parse(mats[1]), int.Parse(mats[1]),
UIHelper.getByName<UIToggle>(gameObject, "full_").value Screen.fullScreen
); );
} }
Program.go( Program.go(
...@@ -329,6 +329,12 @@ public class Setting : WindowServant2D ...@@ -329,6 +329,12 @@ public class Setting : WindowServant2D
public void save() public void save()
{ {
Config.Set(
"full_",
UIHelper.fromBoolToString(
UIHelper.getByName<UIToggle>(gameObject, "full_").value
)
);
Config.Set( Config.Set(
"ignoreWatcher_", "ignoreWatcher_",
UIHelper.fromBoolToString( UIHelper.fromBoolToString(
......
...@@ -17712,7 +17712,7 @@ MonoBehaviour: ...@@ -17712,7 +17712,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1 keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3} mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3}
mFont: {fileID: 0} mFont: {fileID: 0}
mText: "\u5168\u5C4F\u6E38\u620F" mText: "\u5f00\u5c40\u9ed8\u8ba4\u5168\u65f6\u70b9"
mFontSize: 18 mFontSize: 18
mFontStyle: 0 mFontStyle: 0
mAlignment: 0 mAlignment: 0
......
This diff is collapsed.
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