Commit 8f539b6f authored by SherryChaos's avatar SherryChaos

fix windbot diyDeck selection bug

parent 33c59667
...@@ -29,7 +29,6 @@ namespace MDPro3 ...@@ -29,7 +29,6 @@ namespace MDPro3
public InputField inputDraw; public InputField inputDraw;
public GameObject btnDeck; public GameObject btnDeck;
public static readonly int diyAI = 6;
public static string port; public static string port;
public class BotInfo public class BotInfo
...@@ -175,11 +174,11 @@ namespace MDPro3 ...@@ -175,11 +174,11 @@ namespace MDPro3
Program.I().ShiftToServant(Program.I().selectDeck); Program.I().ShiftToServant(Program.I().selectDeck);
} }
string GetWindBotCommand(int aiCode) string GetWindBotCommand(int aiCode, bool diyDeck)
{ {
BotInfo bot = bots[aiCode]; BotInfo bot = bots[aiCode];
string aiCommand = bot.command; string aiCommand = bot.command;
if (aiCode == diyAI) if (diyDeck)
{ {
string selectedDeck = btnDeck.transform.GetChild(0).GetComponent<Text>().text; string selectedDeck = btnDeck.transform.GetChild(0).GetComponent<Text>().text;
if (!File.Exists(Program.deckPath + selectedDeck + Program.ydkExpansion)) if (!File.Exists(Program.deckPath + selectedDeck + Program.ydkExpansion))
...@@ -200,16 +199,16 @@ namespace MDPro3 ...@@ -200,16 +199,16 @@ namespace MDPro3
return aiCommand; return aiCommand;
} }
public void StartAIForSolo(int aiCode) public void StartAIForSolo(int aiCode, bool diyDeck)
{ {
string aiCommand = GetWindBotCommand(aiCode); string aiCommand = GetWindBotCommand(aiCode, diyDeck);
if(aiCommand != string.Empty) if(aiCommand != string.Empty)
Launch(aiCommand, toggleLockHand.isOn, toggleNoCheck.isOn, toggleNoShuffle.isOn); Launch(aiCommand, toggleLockHand.isOn, toggleNoCheck.isOn, toggleNoShuffle.isOn);
} }
public void StartAIForRoom(int aiCode) public void StartAIForRoom(int aiCode, bool diyDeck)
{ {
string aiCommand = GetWindBotCommand(aiCode); string aiCommand = GetWindBotCommand(aiCode, diyDeck);
if (aiCommand != string.Empty) if (aiCommand != string.Empty)
{ {
StartWindBot(aiCommand, TcpHelper.joinedAddress, TcpHelper.joinedPort, TcpHelper.joinedPassword, toggleLockHand.isOn); StartWindBot(aiCommand, TcpHelper.joinedAddress, TcpHelper.joinedPort, TcpHelper.joinedPassword, toggleLockHand.isOn);
......
...@@ -12,13 +12,14 @@ namespace MDPro3.UI ...@@ -12,13 +12,14 @@ namespace MDPro3.UI
public RawImage face; public RawImage face;
public Solo.BotInfo botInfo; public Solo.BotInfo botInfo;
bool diyDeck;
public override void OnSelected() public override void OnSelected()
{ {
base.OnSelected(); base.OnSelected();
Program.I().solo.superScrollView.selected = id; Program.I().solo.superScrollView.selected = id;
Program.I().solo.description.text = botInfo.desc; Program.I().solo.description.text = botInfo.desc;
Program.I().solo.description.GetComponent<RectTransform>().anchoredPosition = Vector2.zero; Program.I().solo.description.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
if(id == Solo.diyAI) if(diyDeck)
Program.I().solo.btnDeck.SetActive(true); Program.I().solo.btnDeck.SetActive(true);
else else
Program.I().solo.btnDeck.SetActive(false); Program.I().solo.btnDeck.SetActive(false);
...@@ -28,12 +29,13 @@ namespace MDPro3.UI ...@@ -28,12 +29,13 @@ namespace MDPro3.UI
{ {
base.Refresh(); base.Refresh();
title.text = botInfo.name; title.text = botInfo.name;
diyDeck = botInfo.command.Contains("Lucky");
action = () => action = () =>
{ {
if(Solo.condition == Solo.Condition.ForSolo) if(Solo.condition == Solo.Condition.ForSolo)
Program.I().solo.StartAIForSolo(id); Program.I().solo.StartAIForSolo(id, diyDeck);
else else
Program.I().solo.StartAIForRoom(id); Program.I().solo.StartAIForRoom(id, diyDeck);
}; };
} }
......
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