Commit 381f7f5d authored by mercury233's avatar mercury233

set env to optional

parent b764fea6
......@@ -55,7 +55,13 @@ namespace WindBot.Game.AI
{
_game = game;
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(DialogsData));
using (FileStream fs = File.OpenRead("Dialogs/" + Environment.GetEnvironmentVariable("YGOPRO_DIALOG") + ".json"))
string dialogfilename = "zh-CN";
string envdialogfilename = Environment.GetEnvironmentVariable("YGOPRO_DIALOG");
if (envdialogfilename != null)
{
dialogfilename = envdialogfilename;
}
using (FileStream fs = File.OpenRead("Dialogs/" + dialogfilename + ".json"))
{
DialogsData data = (DialogsData)serializer.ReadObject(fs);
_welcome = data.welcome;
......
......@@ -9,7 +9,7 @@ namespace WindBot
{
public class Program
{
public static short ProVersion = Int16.Parse(Environment.GetEnvironmentVariable("YGOPRO_VERSION"));
public static short ProVersion = 0x133A;
public static int PlayerNameSize = 20;
internal static Random Rand;
......@@ -40,8 +40,17 @@ namespace WindBot
private static void Run()
{
Init("cards.cdb");
GameClient client = new GameClient(Environment.GetEnvironmentVariable("YGOPRO_NAME"), Environment.GetEnvironmentVariable("YGOPRO_DECK"), Environment.GetEnvironmentVariable("YGOPRO_HOST"), Int32.Parse(Environment.GetEnvironmentVariable("YGOPRO_PORT")));
GameClient client;
string EnvName = Environment.GetEnvironmentVariable("YGOPRO_NAME");
if (EnvName != null)
{
ProVersion = Int16.Parse(Environment.GetEnvironmentVariable("YGOPRO_VERSION"));
client = new GameClient(EnvName, Environment.GetEnvironmentVariable("YGOPRO_DECK"), Environment.GetEnvironmentVariable("YGOPRO_HOST"), Int32.Parse(Environment.GetEnvironmentVariable("YGOPRO_PORT")));
}
else
{
client = new GameClient("谜之剑士LV4", "Blue-Eyes", "127.0.0.1", 7911);
}
client.Start();
while (client.Connection.IsConnected)
{
......
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