Commit f20f545b authored by perfectdicky's avatar perfectdicky

add ai to play player's ydk

parent 41919acf
This diff is collapsed.
fileFormatVersion: 2
guid: 88e23aeef8fc8a24eace5e7fcf3395a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: dcc1be876af31db4a9a0422b13fb06e6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,6 +9,7 @@ public class AIRoom : WindowServantSP
{
#region ui
UIselectableList superScrollView = null;
GameObject aideck_;
string sort = "sortByTimeDeck";
System.Diagnostics.Process serverProcess;
System.Diagnostics.Process botProcess;
......@@ -35,7 +36,7 @@ public class AIRoom : WindowServantSP
newBot.desc = reader.ReadLine().Trim();
line = reader.ReadLine().Trim();
newBot.flags = line.Split(' ');
if (Array.IndexOf(newBot.flags, "SELECT_DECKFILE") < 0)
//if (Array.IndexOf(newBot.flags, "SELECT_DECKFILE") < 0)
Bots.Add(newBot);
}
}
......@@ -68,14 +69,24 @@ public class AIRoom : WindowServantSP
UIHelper.trySetLableText(gameObject, "botdesc_", InterString.Get("请选择对手。"));
superScrollView.install();
ReadBots("config/bot.conf");
aideck_ = GameObject.Find("aideck_");
aideck_.SetActive(false);
//perfectdicky read deck ydk name
//ReadDecks();
SetActiveFalse();
}
void onSelected()
{
int sel = superScrollView.selectedIndex;
if (sel >= 0 && sel < Bots.Count)
{
UIHelper.trySetLableText(gameObject, "botdesc_", Bots[sel].desc);
//Make visible for aideck_
if (Array.IndexOf(Bots[sel].flags, "SELECT_DECKFILE") >= 0)
aideck_.SetActive(true);
else
aideck_.SetActive(false);
}
else
UIHelper.trySetLableText(gameObject, "botdesc_", InterString.Get("请选择对手。"));
}
......@@ -166,7 +177,8 @@ public class AIRoom : WindowServantSP
serverProcess.StartInfo.RedirectStandardOutput = true;
serverProcess.Start();
string port = serverProcess.StandardOutput.ReadLine();
command += " Port=" + port;
//perfectdicky change DeckFile path
command += " Port=" + port + " DeckFile=\"deck/cyberdragon.ydk\"";
botProcess = new System.Diagnostics.Process();
botProcess.StartInfo.UseShellExecute = false;
......@@ -184,7 +196,7 @@ public class AIRoom : WindowServantSP
string name = Config.Get("name", "一秒一咕机会");
Program.I().ocgcore.returnServant = Program.I().aiRoom;
(new Thread(() => { Thread.Sleep(500); TcpHelper.join("127.0.0.1", name, port, "", ""); })).Start();
RMSshow_none(InterString.Get("您在AI模式下遇到的BUG也极有可能会在联机的时候出现,所以请务必向我们报告。"));
//RMSshow_none(InterString.Get("您在AI模式下遇到的BUG也极有可能会在联机的时候出现,所以请务必向我们报告。"));
}
public override void preFrameFunction()
{
......
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