Commit a770eb41 authored by lllyasviel's avatar lllyasviel

fix 21 bugs

parent c3760814
...@@ -15,7 +15,7 @@ public class OpenCardOnClick : MonoBehaviour ...@@ -15,7 +15,7 @@ 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); ((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
} }
catch (System.Exception e) catch (System.Exception e)
{ {
......
...@@ -13,8 +13,29 @@ public class gameInfo : MonoBehaviour ...@@ -13,8 +13,29 @@ public class gameInfo : MonoBehaviour
{ {
public UITexture instance_btnPan; public UITexture instance_btnPan;
public UITextList instance_lab; public UITextList instance_lab;
public UIToggle toggle_ignore;
public UIToggle toggle_all;
public UIToggle toggle_smart;
public GameObject line; public GameObject line;
public void on_toggle_ignore()
{
toggle_all.value = false;
toggle_smart.value = false;
}
public void on_toggle_all()
{
toggle_ignore.value = false;
toggle_smart.value = false;
}
public void on_toggle_smart()
{
toggle_ignore.value = false;
toggle_all.value = false;
}
//public UITextList hinter; //public UITextList hinter;
barPngLoader me; barPngLoader me;
...@@ -63,6 +84,7 @@ public class gameInfo : MonoBehaviour ...@@ -63,6 +84,7 @@ public class gameInfo : MonoBehaviour
UnityEngine.Color.TryParseHexString(Config.Getui("gameChainCheckArea.color"), out c); UnityEngine.Color.TryParseHexString(Config.Getui("gameChainCheckArea.color"), out c);
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "ignore_").gameObject, "Background").color = c; UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "ignore_").gameObject, "Background").color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "watch_").gameObject, "Background").color = c; UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "watch_").gameObject, "Background").color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "use_").gameObject, "Background").color = c;
} }
float k = ((float)(Screen.width - Program.I().cardDescription.width)) / 1200f; float k = ((float)(Screen.width - Program.I().cardDescription.width)) / 1200f;
if (k > 1.2f) if (k > 1.2f)
...@@ -98,10 +120,10 @@ public class gameInfo : MonoBehaviour ...@@ -98,10 +120,10 @@ public class gameInfo : MonoBehaviour
opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14 - k * (float)(opponent.under.height)); opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14 - k * (float)(opponent.under.height));
} }
float height = 100 + 50 * (HashedButtons.Count); float height = 132 + 50 * (HashedButtons.Count);
if (HashedButtons.Count==0) if (HashedButtons.Count==0)
{ {
height = 80; height = 116;
} }
width = (150 * kb) + 15f; width = (150 * kb) + 15f;
float localPositionPanX = (((float)Screen.width - 150 * kb) / 2) - 15f; float localPositionPanX = (((float)Screen.width - 150 * kb) / 2) - 15f;
...@@ -114,7 +136,7 @@ public class gameInfo : MonoBehaviour ...@@ -114,7 +136,7 @@ public class gameInfo : MonoBehaviour
{ {
if (HashedButtons[i].gameObject != null) if (HashedButtons[i].gameObject != null)
{ {
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, height / 2 - 110 - i * 50, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 10f; HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, height / 2 - 142 - i * 50, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 10f;
} }
} }
if (Program.TimePassed() - lastTickTime > 1000) if (Program.TimePassed() - lastTickTime > 1000)
...@@ -375,45 +397,53 @@ public class gameInfo : MonoBehaviour ...@@ -375,45 +397,53 @@ public class gameInfo : MonoBehaviour
} }
} }
public bool ignoreChain() public enum chainCondition
{ {
return UIHelper.getByName<UIToggle>(gameObject, "ignore_").value; standard,no,all,smart
} }
public bool keepChain() public void set_condition(chainCondition c)
{ {
return UIHelper.getByName<UIToggle>(gameObject, "watch_").value; switch (c)
}
public void ignoreChain_set(bool val)
{
try
{
UIHelper.getByName<UIToggle>(gameObject, "ignore_").value = val;
}
catch (Exception)
{ {
case chainCondition.standard:
toggle_all.value = false;
toggle_smart.value = false;
toggle_ignore.value = false;
break;
case chainCondition.no:
toggle_all.value = false;
toggle_smart.value = false;
toggle_ignore.value = true;
break;
case chainCondition.all:
toggle_all.value = true;
toggle_smart.value = false;
toggle_ignore.value = false;
break;
case chainCondition.smart:
toggle_all.value = false;
toggle_smart.value = true;
toggle_ignore.value = false;
break;
} }
} }
public void keepChain_set(bool val) public chainCondition get_condition()
{ {
try chainCondition res = chainCondition.standard;
if (toggle_ignore.value)
{ {
UIHelper.getByName<UIToggle>(gameObject, "watch_").value = val; res = chainCondition.no;
} }
catch (Exception) if (toggle_smart.value)
{ {
res = chainCondition.smart;
} }
if (toggle_all.value)
{
res = chainCondition.all;
}
return res;
} }
//public void ignoreChain_E()
//{
// UIHelper.getByName<UIToggle>(gameObject, "ignore_").SwEt();
//}
//public void keepChain_E()
//{
// UIHelper.getByName<UIToggle>(gameObject, "watch_").SwEt();
//}
} }
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
public static class Config public static class Config
{ {
public static uint ClientVersion = 0x133d; public static uint ClientVersion = 0x233c;
class oneString class oneString
{ {
......
...@@ -124,6 +124,8 @@ public class GameField : OCGobject ...@@ -124,6 +124,8 @@ public class GameField : OCGobject
label.transform.localScale = new Vector3(0.03f, 0.03f, 0.03f); label.transform.localScale = new Vector3(0.03f, 0.03f, 0.03f);
label.text = ""; label.text = "";
overCount = 0; overCount = 0;
loadNewField();
} }
public void loadOldField() public void loadOldField()
......
...@@ -890,27 +890,33 @@ public class Ocgcore : ServantWithCardDescription ...@@ -890,27 +890,33 @@ public class Ocgcore : ServantWithCardDescription
{ {
Program.cameraPosition.z = camera_max; Program.cameraPosition.z = camera_max;
} }
if (Input.GetKeyDown(KeyCode.C) == true) if (Input.GetKeyDown(KeyCode.C) == true)
{ {
gameInfo.keepChain_set(false); gameInfo.set_condition(gameInfo.chainCondition.smart);
gameInfo.ignoreChain_set(false);
} }
if (Input.GetKeyDown(KeyCode.A) == true) if (Input.GetKeyDown(KeyCode.A) == true)
{ {
gameInfo.keepChain_set(true); gameInfo.set_condition(gameInfo.chainCondition.all);
} }
if (Input.GetKeyUp(KeyCode.A) == true) if (Input.GetKeyDown(KeyCode.S) == true)
{ {
gameInfo.keepChain_set(false); gameInfo.set_condition(gameInfo.chainCondition.no);
} }
if (Input.GetKeyDown(KeyCode.S) == true)
if (Input.GetKeyUp(KeyCode.C) == true)
{
gameInfo.set_condition(gameInfo.chainCondition.standard);
}
if (Input.GetKeyUp(KeyCode.A) == true)
{ {
gameInfo.ignoreChain_set(true); gameInfo.set_condition(gameInfo.chainCondition.standard);
} }
if (Input.GetKeyUp(KeyCode.S) == true) if (Input.GetKeyUp(KeyCode.S) == true)
{ {
gameInfo.ignoreChain_set(false); gameInfo.set_condition(gameInfo.chainCondition.standard);
} }
if (Input.GetMouseButtonDown(2)) if (Input.GetMouseButtonDown(2))
{ {
if (Program.I().book.isShowed) if (Program.I().book.isShowed)
...@@ -1115,17 +1121,33 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1115,17 +1121,33 @@ public class Ocgcore : ServantWithCardDescription
int hint0 = r.ReadInt32(); int hint0 = r.ReadInt32();
int hint1 = r.ReadInt32(); int hint1 = r.ReadInt32();
bool ignore = false; bool ignore = false;
if (gameInfo.ignoreChain()) if (forced == 0)
{
var condition = gameInfo.get_condition();
if (condition == gameInfo.chainCondition.no)
{ {
ignore = true; ignore = true;
} }
else else
{ {
if (gameInfo.keepChain()) if (condition == gameInfo.chainCondition.all)
{ {
ignore = false; ignore = false;
} }
else else
{
if (condition == gameInfo.chainCondition.smart)
{
if (count == 0)
{
ignore = true;
}
else
{
ignore = false;
}
}
else
{ {
if (spcount == 0) if (spcount == 0)
{ {
...@@ -1137,6 +1159,8 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1137,6 +1159,8 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
} }
}
}
if (ignore) if (ignore)
{ {
return false; return false;
...@@ -3196,10 +3220,20 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3196,10 +3220,20 @@ public class Ocgcore : ServantWithCardDescription
code = r.ReadInt32(); code = r.ReadInt32();
gps = r.ReadShortGPS(); gps = r.ReadShortGPS();
r.ReadByte(); r.ReadByte();
int cr = 95;
if (Config.ClientVersion >= 0x233c)
{
int cp = r.ReadInt32();
if (cp > 0)
cr = cp;
}
desc = GameStringManager.get(cr);
card = GCS_cardGet(gps, false); card = GCS_cardGet(gps, false);
desc = desc.Replace("[%ls]", "「" + card.get_data().Name + "」");
if (card != null) if (card != null)
{ {
RMSshow_yesOrNo("return", ES_hint + InterString.Get(",@n发动「[?]」的效果?", card.get_data().Name), new messageSystemValue { value = "1", hint = "yes" }, new messageSystemValue { value = "0", hint = "no" }); string hin = ES_hint + ",\n" + desc;
RMSshow_yesOrNo("return", hin, new messageSystemValue { value = "1", hint = "yes" }, new messageSystemValue { value = "0", hint = "no" });
card.add_one_decoration(Program.I().mod_ocgcore_decoration_chain_selecting, 4, Vector3.zero, "chain_selecting"); card.add_one_decoration(Program.I().mod_ocgcore_decoration_chain_selecting, 4, Vector3.zero, "chain_selecting");
card.currentFlash = gameCard.flashType.Active; card.currentFlash = gameCard.flashType.Active;
} }
...@@ -3375,6 +3409,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3375,6 +3409,7 @@ public class Ocgcore : ServantWithCardDescription
card.effects.Add(eff); card.effects.Add(eff);
} }
} }
var chain_condition = gameInfo.get_condition();
int handle_flag = 0; int handle_flag = 0;
if (forced == 0) if (forced == 0)
{ {
...@@ -3382,12 +3417,12 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3382,12 +3417,12 @@ public class Ocgcore : ServantWithCardDescription
if (spcount == 0) if (spcount == 0)
{ {
//无关键卡 //无关键卡
if (gameInfo.ignoreChain()) if (chain_condition == gameInfo.chainCondition.no)
{ {
//无关键卡 连锁被无视 直接回答--- //无关键卡 连锁被无视 直接回答---
handle_flag = 0; handle_flag = 0;
} }
else if (gameInfo.keepChain()) else if (chain_condition == gameInfo.chainCondition.all)
{ {
//无关键卡但是连锁被监控 //无关键卡但是连锁被监控
if (chainCards.Count == 0) if (chainCards.Count == 0)
...@@ -3409,6 +3444,28 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3409,6 +3444,28 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
} }
else if (chain_condition == gameInfo.chainCondition.smart)
{
//无关键卡但是连锁被智能过滤
if (chainCards.Count == 0)
{
//根本没卡 直接回答---
handle_flag = 0;
}
else
{
if (chainCards.Count == 1 && chainCards[0].effects.Count == 1)
{
//只有一张要处理的卡 常规处理 一张---
handle_flag = 1;
}
else
{
//常规处理 多张---
handle_flag = 2;
}
}
}
else else
{ {
//无关键卡而且连锁没有被监控 直接回答--- //无关键卡而且连锁没有被监控 直接回答---
...@@ -3422,13 +3479,13 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3422,13 +3479,13 @@ public class Ocgcore : ServantWithCardDescription
{ {
//根本没卡 直接回答--- //根本没卡 直接回答---
handle_flag = 0; handle_flag = 0;
if (gameInfo.keepChain()) if (chain_condition == gameInfo.chainCondition.all)
{ {
//欺骗-- //欺骗--
handle_flag = -1; handle_flag = -1;
} }
} }
else if (gameInfo.ignoreChain()) else if (chain_condition == gameInfo.chainCondition.no)
{ {
//有关键卡 连锁被无视 直接回答--- //有关键卡 连锁被无视 直接回答---
handle_flag = 0; handle_flag = 0;
...@@ -7955,6 +8012,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7955,6 +8012,7 @@ public class Ocgcore : ServantWithCardDescription
public override void hide() public override void hide()
{ {
Program.I().cardDescription.shiftCardShower(true);
InAI = false; InAI = false;
MessageBeginTime = 0; MessageBeginTime = 0;
currentMessage = GameMessage.Waiting; currentMessage = GameMessage.Waiting;
...@@ -8692,7 +8750,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8692,7 +8750,7 @@ public class Ocgcore : ServantWithCardDescription
return; return;
} }
rightExcited = true; rightExcited = true;
gameInfo.ignoreChain_set(true); //gameInfo.ignoreChain_set(true);
base.ES_mouseDownRight(); base.ES_mouseDownRight();
} }
...@@ -8703,7 +8761,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8703,7 +8761,7 @@ public class Ocgcore : ServantWithCardDescription
if (Program.I().setting.setting.spyer.value == false) if (Program.I().setting.setting.spyer.value == false)
if (gameInfo.queryHashedButton("hide_all_card") == false) if (gameInfo.queryHashedButton("hide_all_card") == false)
{ {
gameInfo.keepChain_set(true); //gameInfo.keepChain_set(true);
leftExcited = true; leftExcited = true;
} }
base.ES_mouseDownEmpty(); base.ES_mouseDownEmpty();
...@@ -8732,7 +8790,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8732,7 +8790,7 @@ public class Ocgcore : ServantWithCardDescription
if (Input.GetKey(KeyCode.A) == false) if (Input.GetKey(KeyCode.A) == false)
{ {
leftExcited = false; leftExcited = false;
gameInfo.keepChain_set(false); //gameInfo.keepChain_set(false);
} }
} }
...@@ -8752,7 +8810,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8752,7 +8810,7 @@ public class Ocgcore : ServantWithCardDescription
if (Input.GetKey(KeyCode.A) == false) if (Input.GetKey(KeyCode.A) == false)
{ {
leftExcited = false; leftExcited = false;
gameInfo.keepChain_set(false); //gameInfo.keepChain_set(false);
} }
} }
base.ES_mouseUpGameObject(gameObject); base.ES_mouseUpGameObject(gameObject);
...@@ -8766,7 +8824,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8766,7 +8824,7 @@ public class Ocgcore : ServantWithCardDescription
if (Input.GetKey(KeyCode.S) == false) if (Input.GetKey(KeyCode.S) == false)
{ {
rightExcited = false; rightExcited = false;
gameInfo.ignoreChain_set(false); //gameInfo.ignoreChain_set(false);
} }
} }
if (gameInfo.queryHashedButton("sendSelected") == true) if (gameInfo.queryHashedButton("sendSelected") == true)
......
...@@ -520,7 +520,13 @@ public class Room : WindowServantSP ...@@ -520,7 +520,13 @@ public class Room : WindowServantSP
RMSshow_onlyYes("", InterString.Get("更换副卡组失败,请检查卡片张数是否一致。"), null); RMSshow_onlyYes("", InterString.Get("更换副卡组失败,请检查卡片张数是否一致。"), null);
break; break;
case 4: case 4:
RMSshow_none(InterString.Get("你输入的版本号和服务器不一致。")); r.ReadByte();
r.ReadByte();
r.ReadByte();
code = r.ReadInt32();
string hexOutput = "0x"+String.Format("{0:X}", code);
Program.I().selectServer.set_version(hexOutput);
RMSshow_none(InterString.Get("你输入的版本号和服务器不一致,[7CFC00]YGOPro2已经智能切换版本号[-],请重新链接。"));
break; break;
default: default:
break; break;
......
...@@ -53,7 +53,7 @@ public class PrecyOcg ...@@ -53,7 +53,7 @@ public class PrecyOcg
} }
else else
{ {
Config.ClientVersion = 0x133d; Config.ClientVersion = 0x233c;
Program.I().shiftToServant(Program.I().ocgcore); Program.I().shiftToServant(Program.I().ocgcore);
} }
((CardDescription)Program.I().cardDescription).setTitle(path); ((CardDescription)Program.I().cardDescription).setTitle(path);
...@@ -78,7 +78,7 @@ public class PrecyOcg ...@@ -78,7 +78,7 @@ public class PrecyOcg
} }
else else
{ {
Config.ClientVersion = 0x133d; Config.ClientVersion = 0x233c;
Program.I().shiftToServant(Program.I().ocgcore); Program.I().shiftToServant(Program.I().ocgcore);
} }
} }
......
...@@ -126,6 +126,11 @@ public class SelectServer : WindowServantSP ...@@ -126,6 +126,11 @@ public class SelectServer : WindowServantSP
} }
} }
public void set_version(string str)
{
UIHelper.getByName<UIInput>(gameObject, "version_").value = str;
}
void onClickJoin() void onClickJoin()
{ {
if (!isShowed) if (!isShowed)
......
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