Commit c44377fc authored by mercury233's avatar mercury233

update config

parent c92b462b
...@@ -14,7 +14,6 @@ public class Menu : WindowServantSP ...@@ -14,7 +14,6 @@ public class Menu : WindowServantSP
//GameObject screen; //GameObject screen;
public override void initialize() public override void initialize()
{ {
string hint = File.ReadAllText("config/hint.conf");
createWindow(Program.I().new_ui_menu); createWindow(Program.I().new_ui_menu);
UIHelper.registEvent(gameObject, "setting_", onClickSetting); UIHelper.registEvent(gameObject, "setting_", onClickSetting);
UIHelper.registEvent(gameObject, "deck_", onClickSelectDeck); UIHelper.registEvent(gameObject, "deck_", onClickSelectDeck);
......
...@@ -3,6 +3,7 @@ using System; ...@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Text.RegularExpressions;
public class SelectServer : WindowServantSP public class SelectServer : WindowServantSP
{ {
...@@ -13,21 +14,23 @@ public class SelectServer : WindowServantSP ...@@ -13,21 +14,23 @@ public class SelectServer : WindowServantSP
UIInput inputPsw; UIInput inputPsw;
UIInput inputVersion; UIInput inputVersion;
public string name = "";
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().new_ui_selectServer); createWindow(Program.I().new_ui_selectServer);
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "face_", onClickFace); UIHelper.registEvent(gameObject, "face_", onClickFace);
UIHelper.registEvent(gameObject, "join_", onClickJoin); UIHelper.registEvent(gameObject, "join_", onClickJoin);
UIHelper.getByName<UIInput>(gameObject, "name_").value = Config.Get("name","一秒一喵机会"); name = Config.Get("name", "一秒一喵机会");
UIHelper.getByName<UIInput>(gameObject, "name_").value = name;
list = UIHelper.getByName<UIPopupList>(gameObject, "history_"); list = UIHelper.getByName<UIPopupList>(gameObject, "history_");
UIHelper.registEvent(gameObject,"history_", onSelected); UIHelper.registEvent(gameObject,"history_", onSelected);
name = Config.Get("name", "一秒一喵机会");
inputIP = UIHelper.getByName<UIInput>(gameObject, "ip_"); inputIP = UIHelper.getByName<UIInput>(gameObject, "ip_");
inputPort = UIHelper.getByName<UIInput>(gameObject, "port_"); inputPort = UIHelper.getByName<UIInput>(gameObject, "port_");
inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_"); inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_");
inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_"); inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_");
set_version("0x" + String.Format("{0:X}", Config.ClientVersion)); inputVersion.value = "0x" + String.Format("{0:X}", Config.ClientVersion);
SetActiveFalse(); SetActiveFalse();
} }
...@@ -41,20 +44,10 @@ public class SelectServer : WindowServantSP ...@@ -41,20 +44,10 @@ public class SelectServer : WindowServantSP
private void readString(string str) private void readString(string str)
{ {
str = str.Substring(1, str.Length - 1); string remain = "";
string version = "", remain = ""; string ip = "", port = "", psw = "";
string[] splited; string[] splited;
splited = str.Split(")"); splited = str.Split(":");
try
{
version = splited[0];
remain = splited[1];
}
catch (Exception)
{
}
splited = remain.Split(":");
string ip = "";
try try
{ {
ip = splited[0]; ip = splited[0];
...@@ -64,7 +57,6 @@ public class SelectServer : WindowServantSP ...@@ -64,7 +57,6 @@ public class SelectServer : WindowServantSP
{ {
} }
splited = remain.Split(" "); splited = remain.Split(" ");
string psw = "", port = "";
try try
{ {
port = splited[0]; port = splited[0];
...@@ -76,7 +68,6 @@ public class SelectServer : WindowServantSP ...@@ -76,7 +68,6 @@ public class SelectServer : WindowServantSP
inputIP.value = ip; inputIP.value = ip;
inputPort.value = port; inputPort.value = port;
inputPsw.value = psw; inputPsw.value = psw;
//inputVersion.value = version;
} }
public override void show() public override void show()
...@@ -104,6 +95,7 @@ public class SelectServer : WindowServantSP ...@@ -104,6 +95,7 @@ public class SelectServer : WindowServantSP
string[] lines = txtString.Replace("\r", "").Split("\n"); string[] lines = txtString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++) for (int i = 0; i < lines.Length; i++)
{ {
lines[i] = Regex.Replace(lines[i], "^\\(.*\\)", ""); // remove old version
if (i == 0) if (i == 0)
{ {
if (first) if (first)
...@@ -127,11 +119,6 @@ public class SelectServer : WindowServantSP ...@@ -127,11 +119,6 @@ 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)
...@@ -150,7 +137,7 @@ public class SelectServer : WindowServantSP ...@@ -150,7 +137,7 @@ public class SelectServer : WindowServantSP
{ {
name = Name; name = Name;
Config.Set("name", name); Config.Set("name", name);
if (ipString == "" || portString == "" || versionString == "") if (ipString == "" || portString == "")
{ {
RMSshow_onlyYes("", InterString.Get("非法输入!请检查输入的主机名。"), null); RMSshow_onlyYes("", InterString.Get("非法输入!请检查输入的主机名。"), null);
} }
...@@ -158,7 +145,7 @@ public class SelectServer : WindowServantSP ...@@ -158,7 +145,7 @@ public class SelectServer : WindowServantSP
{ {
if (name != "") if (name != "")
{ {
string fantasty = "(" + versionString + ")" + ipString + ":" + portString + " " + pswString; string fantasty = ipString + ":" + portString + " " + pswString;
list.items.Remove(fantasty); list.items.Remove(fantasty);
list.items.Insert(0, fantasty); list.items.Insert(0, fantasty);
list.value = fantasty; list.value = fantasty;
...@@ -184,8 +171,6 @@ public class SelectServer : WindowServantSP ...@@ -184,8 +171,6 @@ public class SelectServer : WindowServantSP
GameObject faceShow = null; GameObject faceShow = null;
public string name = "";
void onClickFace() void onClickFace()
{ {
name = UIHelper.getByName<UIInput>(gameObject, "name_").value; name = UIHelper.getByName<UIInput>(gameObject, "name_").value;
......
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