Commit af71becb authored by Unicorn369's avatar Unicorn369

add ClearPsw

parent 4b7a224c
......@@ -23,6 +23,7 @@ public class SelectServer : WindowServantSP
UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "face_", onClickFace);
UIHelper.registEvent(gameObject, "join_", onClickJoin);
UIHelper.registEvent(gameObject, "clearPsw_", onClearPsw);
serversList = UIHelper.getByName<UIPopupList>(gameObject, "server");
//serversList.fontSize = 30;
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
......@@ -199,6 +200,20 @@ public class SelectServer : WindowServantSP
//inputVersion.value = version;
}
void onClearPsw()
{
string PswString = File.ReadAllText("config/passwords.conf");
string[] lines = PswString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
{
list.RemoveItem(lines[i]);//清空list
}
FileStream stream = new FileStream("config/passwords.conf", FileMode.Truncate, FileAccess.ReadWrite);//清空文件内容
stream.Close();
inputPsw.value = "";
Program.PrintToChat(InterString.Get("房间密码已清空"));
}
public override void show()
{
base.show();
......
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