Commit 1ae3ec8a authored by lllyasviel's avatar lllyasviel

rewrite ai mode and single mode

Without percy's core method
parent b22b054e
...@@ -103,7 +103,7 @@ public class Menu : WindowServantSP ...@@ -103,7 +103,7 @@ public class Menu : WindowServantSP
void onClickAI() void onClickAI()
{ {
//Program.I().shiftToServant(Program.I().aiRoom); Program.I().shiftToServant(Program.I().aiRoom);
} }
void onClickPizzle() void onClickPizzle()
......
...@@ -60,7 +60,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -60,7 +60,7 @@ public class Ocgcore : ServantWithCardDescription
} }
if (value) if (value)
{ {
target.gameObject = create_s(Program.I().mod_ocgcore_ss_link_mark, get_point_worldposition(target.p) + new Vector3(0, -0.1f, 0), Vector3.zero, false, null, true); target.gameObject = create_s(Program.I().mod_ocgcore_ss_link_mark, get_point_worldposition(target.p) + new Vector3(0, -0.1f, 0), Vector3.zero, true, null, true);
} }
else else
{ {
...@@ -1332,6 +1332,11 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1332,6 +1332,11 @@ public class Ocgcore : ServantWithCardDescription
Sleep(21); Sleep(21);
break; break;
case GameMessage.ReloadField: case GameMessage.ReloadField:
MasterRule = r.ReadByte() + 1;
if (MasterRule > 255)
{
MasterRule -= 255;
}
confirmedCards.Clear(); confirmedCards.Clear();
gameField.currentPhase = GameField.ph.dp; gameField.currentPhase = GameField.ph.dp;
result = duelResult.disLink; result = duelResult.disLink;
...@@ -1377,7 +1382,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1377,7 +1382,7 @@ public class Ocgcore : ServantWithCardDescription
{ {
life_1 = r.ReadInt32(); life_1 = r.ReadInt32();
} }
for (int i = 0; i < 5; i++) for (int i = 0; i < 7; i++)
{ {
val = r.ReadByte(); val = r.ReadByte();
if (val > 0) if (val > 0)
...@@ -2823,7 +2828,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -2823,7 +2828,6 @@ public class Ocgcore : ServantWithCardDescription
showWait(); showWait();
break; break;
case GameMessage.Start: case GameMessage.Start:
realize(true);
if (MasterRule >= 4) if (MasterRule >= 4)
{ {
gameField.loadNewField(); gameField.loadNewField();
...@@ -2832,6 +2836,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -2832,6 +2836,7 @@ public class Ocgcore : ServantWithCardDescription
{ {
gameField.loadOldField(); gameField.loadOldField();
} }
realize(true);
if (condition != Condition.record) if (condition != Condition.record)
{ {
if (isObserver) if (isObserver)
...@@ -2871,8 +2876,15 @@ public class Ocgcore : ServantWithCardDescription ...@@ -2871,8 +2876,15 @@ public class Ocgcore : ServantWithCardDescription
hideCaculator(); hideCaculator();
break; break;
case GameMessage.ReloadField: case GameMessage.ReloadField:
if (MasterRule >= 4)
{
gameField.loadNewField();
}
else
{
gameField.loadOldField();
}
realize(true); realize(true);
gameField.loadOldField();
if (condition != Condition.record) if (condition != Condition.record)
{ {
if (isObserver) if (isObserver)
......
...@@ -27,7 +27,7 @@ public class AIRoom : WindowServantSP ...@@ -27,7 +27,7 @@ public class AIRoom : WindowServantSP
UIHelper.registEvent(gameObject, "rank_", onSave); UIHelper.registEvent(gameObject, "rank_", onSave);
UIHelper.registEvent(gameObject, "start_", onStart); UIHelper.registEvent(gameObject, "start_", onStart);
UIHelper.registEvent(gameObject, "exit_", ()=> { Program.I().shiftToServant(Program.I().menu); }); UIHelper.registEvent(gameObject, "exit_", ()=> { Program.I().shiftToServant(Program.I().menu); });
UIHelper.trySetLableText(gameObject,"percyHint",PrecyOcg.HintInGame); UIHelper.trySetLableText(gameObject,"percyHint",InterString.Get("人机模式"));
superScrollView.install(); superScrollView.install();
SetActiveFalse(); SetActiveFalse();
} }
...@@ -66,7 +66,7 @@ public class AIRoom : WindowServantSP ...@@ -66,7 +66,7 @@ public class AIRoom : WindowServantSP
{ {
aideck = "ai/ydk/" + Config.Get("list_aideck", suiji) + ".ydk"; aideck = "ai/ydk/" + Config.Get("list_aideck", suiji) + ".ydk";
} }
launch("deck/" + Config.Get("deckInUse","miaowu") + ".ydk", aideck, "ai/" + Config.Get("list_airank","ai") + ".lua", UIHelper.getByName<UIToggle>(gameObject, "first_").value, UIHelper.getByName<UIToggle>(gameObject, "unrand_").value, l, UIHelper.getByName<UIToggle>(gameObject, "god_").value); launch("deck/" + Config.Get("deckInUse", "miaowu") + ".ydk", aideck, "ai/" + Config.Get("list_airank", "ai") + ".lua", UIHelper.getByName<UIToggle>(gameObject, "first_").value, UIHelper.getByName<UIToggle>(gameObject, "unrand_").value, l, UIHelper.getByName<UIToggle>(gameObject, "god_").value, UIHelper.getByName<UIToggle>(gameObject, "mr4_").value ? 4 : 3);
} }
void printFile() void printFile()
...@@ -150,14 +150,14 @@ public class AIRoom : WindowServantSP ...@@ -150,14 +150,14 @@ public class AIRoom : WindowServantSP
PrecyOcg precy; PrecyOcg precy;
public void launch(string playerDek, string aiDeck, string aiScript, bool playerGo, bool suffle, int life,bool god) public void launch(string playerDek, string aiDeck, string aiScript, bool playerGo, bool suffle, int life,bool god,int rule)
{ {
if (precy != null) if (precy != null)
{ {
precy.dispose(); precy.dispose();
} }
precy = new PrecyOcg(); precy = new PrecyOcg();
precy.startAI(playerDek, aiDeck, aiScript, playerGo, suffle, life, god); precy.startAI(playerDek, aiDeck, aiScript, playerGo, suffle, life, god,rule);
RMSshow_none(InterString.Get("AI模式还在开发中,您在AI模式下遇到的BUG不会在联机的时候出现。")); RMSshow_none(InterString.Get("AI模式还在开发中,您在AI模式下遇到的BUG不会在联机的时候出现。"));
} }
......
...@@ -48,7 +48,7 @@ public class PrecyOcg ...@@ -48,7 +48,7 @@ public class PrecyOcg
Program.I().ocgcore.returnServant = Program.I().puzzleMode; Program.I().ocgcore.returnServant = Program.I().puzzleMode;
if (!ygopro.startPuzzle(path)) if (!ygopro.startPuzzle(path))
{ {
Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试。")); Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试,文件名中不能包含中文。"));
return; return;
} }
else else
...@@ -60,20 +60,20 @@ public class PrecyOcg ...@@ -60,20 +60,20 @@ public class PrecyOcg
} }
} }
public void startAI(string playerDek, string aiDeck, string aiScript, bool playerGo, bool unrand, int life,bool god) public void startAI(string playerDek, string aiDeck, string aiScript, bool playerGo, bool unrand, int life,bool god,int rule)
{ {
if (Program.I().ocgcore.isShowed == false) if (Program.I().ocgcore.isShowed == false)
{ {
Program.I().room.mode = 0; Program.I().room.mode = 0;
Program.I().ocgcore.MasterRule = 3; Program.I().ocgcore.MasterRule = rule;
godMode = god; godMode = god;
prepareOcgcore(); prepareOcgcore();
Program.I().ocgcore.lpLimit = life; Program.I().ocgcore.lpLimit = life;
Program.I().ocgcore.isFirst = playerGo; Program.I().ocgcore.isFirst = playerGo;
Program.I().ocgcore.returnServant = Program.I().aiRoom; Program.I().ocgcore.returnServant = Program.I().aiRoom;
if (!ygopro.startAI(playerDek, aiDeck, aiScript, playerGo, unrand, life, god)) if (!ygopro.startAI(playerDek, aiDeck, aiScript, playerGo, unrand, life, god, rule))
{ {
Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试。")); Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试,文件名中不能包含中文。"));
return; return;
} }
else else
......
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