Commit 67978fdb authored by nanahira's avatar nanahira

Merge branch 'Android' of https://github.com/Unicorn369/YGOPro2_Droid into Android

parents e5be96be b2ed3346
...@@ -7,30 +7,128 @@ using System.Threading; ...@@ -7,30 +7,128 @@ using System.Threading;
public class SelectServer : WindowServantSP public class SelectServer : WindowServantSP
{ {
UIPopupList list; UIPopupList list;
UIPopupList serversList;
UIInput inputIP; UIInput inputIP;
UIInput inputPort; UIInput inputPort;
UIInput inputPsw; UIInput inputPsw;
UIInput inputVersion; UIInput inputVersion;
UISprite inputIP_;
UISprite inputPort_;
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","一秒一喵机会"); serversList = UIHelper.getByName<UIPopupList>(gameObject, "server");
serversList.fontSize = 20;
serversList.value = Config.Get("serversPicker", "[OCG]Koishi");
UIHelper.registEvent(gameObject, "server", pickServer);
UIHelper.getByName<UIInput>(gameObject, "name_").value = Config.Get("name", "YGOPro2 User");
//UIHelper.getByName<UIInput>(gameObject, "name_").defaultText = "昵称不能为空";
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", "一秒一喵机会"); name = Config.Get("name", "YGOPro2 User");
inputIP = UIHelper.getByName<UIInput>(gameObject, "ip_"); inputIP = UIHelper.getByName<UIInput>(gameObject, "ip_");
inputIP_ = UIHelper.getByName<UISprite>(gameObject, "ip_");
//inputIP.defaultText = "服务器IP 或 域名";
inputPort = UIHelper.getByName<UIInput>(gameObject, "port_"); inputPort = UIHelper.getByName<UIInput>(gameObject, "port_");
inputPort_ = UIHelper.getByName<UISprite>(gameObject, "port_");
//inputPort.defaultText = "端口";
inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_"); inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_");
//inputPsw.defaultText = "房间密码";
//inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_"); //inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_");
set_version("0x" + String.Format("{0:X}", Config.ClientVersion)); set_version("0x" + String.Format("{0:X}", Config.ClientVersion));
SetActiveFalse(); SetActiveFalse();
} }
private void pickServer()
{
string server = serversList.value;
switch (server)
{
case "[OCG]Mercury233":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "s1.ygo233.com";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "233";
Config.Set("serversPicker", "[OCG]Mercury233");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
case "[OCG]Koishi":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "koishi.moecube.com";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "7210";
Config.Set("serversPicker", "[OCG]Koishi");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
case "[TCG]Koishi":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "koishi.moecube.com";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "1311";
Config.Set("serversPicker", "[TCG]Koishi");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
case "[222DIY]Koishi":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "koishi.moecube.com";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "222";
Config.Set("serversPicker", "[222DIY]Koishi");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
case "[轮抽服]2Pick":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "2pick.mycard.moe";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "765";
Config.Set("serversPicker", "[轮抽服]2Pick");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
case "[OCG&TCG]한국서버":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "cygopro.fun25.co.kr";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "17225";
Config.Set("serversPicker", "[OCG&TCG]한국서버");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
default:
{
Config.Set("serversPicker", "[Custom]");
list.enabled = true;
inputIP_.enabled = true;
inputPort_.enabled = true;
break;
}
}
}
void onSelected() void onSelected()
{ {
if (list != null) if (list != null)
...@@ -160,7 +258,7 @@ public class SelectServer : WindowServantSP ...@@ -160,7 +258,7 @@ public class SelectServer : WindowServantSP
KF_onlineGame(Name, ipString, portString, versionString, pswString); KF_onlineGame(Name, ipString, portString, versionString, pswString);
} }
public void KF_onlineGame(string Name,string ipString, string portString, string versionString, string pswString="") public void KF_onlineGame(string Name, string ipString, string portString, string versionString, string pswString = "")
{ {
name = Name; name = Name;
Config.Set("name", name); Config.Set("name", name);
......
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
public class SelectServer : WindowServantSP
{
UIPopupList list;
UIInput inputIP;
UIInput inputPort;
UIInput inputPsw;
UIInput inputVersion;
public override void initialize()
{
createWindow(Program.I().new_ui_selectServer);
UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "face_", onClickFace);
UIHelper.registEvent(gameObject, "join_", onClickJoin);
UIHelper.getByName<UIInput>(gameObject, "name_").value = Config.Get("name","一秒一喵机会");
list = UIHelper.getByName<UIPopupList>(gameObject, "history_");
UIHelper.registEvent(gameObject,"history_", onSelected);
name = Config.Get("name", "一秒一喵机会");
inputIP = UIHelper.getByName<UIInput>(gameObject, "ip_");
inputPort = UIHelper.getByName<UIInput>(gameObject, "port_");
inputPsw = UIHelper.getByName<UIInput>(gameObject, "psw_");
//inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_");
set_version("0x" + String.Format("{0:X}", Config.ClientVersion));
SetActiveFalse();
}
void onSelected()
{
if (list != null)
{
readString(list.value);
}
}
private void readString(string str)
{
str = str.Substring(1, str.Length - 1);
string version = "", remain = "";
string[] splited;
splited = str.Split(")");
try
{
version = splited[0];
remain = splited[1];
}
catch (Exception)
{
}
splited = remain.Split(":");
string ip = "";
try
{
ip = splited[0];
remain = splited[1];
}
catch (Exception)
{
}
splited = remain.Split(" ");
string psw = "", port = "";
try
{
port = splited[0];
psw = splited[1];
}
catch (Exception)
{
}
inputIP.value = ip;
inputPort.value = port;
inputPsw.value = psw;
//inputVersion.value = version;
}
public override void show()
{
base.show();
Program.I().room.RMSshow_clear();
printFile(true);
Program.charge();
}
public override void preFrameFunction()
{
base.preFrameFunction();
Menu.checkCommend();
}
void printFile(bool first)
{
list.Clear();
if (File.Exists("config/hosts.conf") == false)
{
File.Create("config/hosts.conf").Close();
}
string txtString = File.ReadAllText("config/hosts.conf");
string[] lines = txtString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
{
if (i == 0)
{
if (first)
{
readString(lines[i]);
}
}
list.AddItem(lines[i]);
}
}
void onClickExit()
{
Program.I().shiftToServant(Program.I().menu);
if (TcpHelper.tcpClient != null)
{
if (TcpHelper.tcpClient.Connected)
{
TcpHelper.tcpClient.Close();
}
}
}
public void set_version(string str)
{
UIHelper.getByName<UIInput>(gameObject, "version_").value = str;
}
void onClickJoin()
{
if (!isShowed)
{
return;
}
string Name = UIHelper.getByName<UIInput>(gameObject, "name_").value;
string ipString = UIHelper.getByName<UIInput>(gameObject, "ip_").value;
string portString = UIHelper.getByName<UIInput>(gameObject, "port_").value;
string pswString = UIHelper.getByName<UIInput>(gameObject, "psw_").value;
string versionString = UIHelper.getByName<UIInput>(gameObject, "version_").value;
KF_onlineGame(Name, ipString, portString, versionString, pswString);
}
public void onClickRoomList()
{
if (!isShowed)
{
return;
}
string Name = UIHelper.getByName<UIInput>(gameObject, "name_").value;
string ipString = UIHelper.getByName<UIInput>(gameObject, "ip_").value;
string portString = UIHelper.getByName<UIInput>(gameObject, "port_").value;
string pswString = "L";
string versionString = UIHelper.getByName<UIInput>(gameObject, "version_").value;
KF_onlineGame(Name, ipString, portString, versionString, pswString);
}
public void KF_onlineGame(string Name, string ipString, string portString, string versionString, string pswString = "")
{
name = Name;
Config.Set("name", name);
if (ipString == "" || portString == "" || versionString == "")
{
RMSshow_onlyYes("", InterString.Get("非法输入!请检查输入的主机名。"), null);
}
else
{
if (name != "")
{
string fantasty = "(" + versionString + ")" + ipString + ":" + portString + " " + pswString;
list.items.Remove(fantasty);
list.items.Insert(0, fantasty);
list.value = fantasty;
if (list.items.Count>5)
{
list.items.RemoveAt(list.items.Count - 1);
}
string all = "";
for (int i = 0; i < list.items.Count; i++)
{
all += list.items[i] + "\r\n";
}
File.WriteAllText("config/hosts.conf", all);
printFile(false);
(new Thread(() => { TcpHelper.join(ipString, name, portString, pswString,versionString); })).Start();
}
else
{
RMSshow_onlyYes("", InterString.Get("昵称不能为空。"), null);
}
}
}
GameObject faceShow = null;
public string name = "";
void onClickFace()
{
name = UIHelper.getByName<UIInput>(gameObject, "name_").value;
RMSshow_face("showFace", name);
Config.Set("name", name);
}
}
fileFormatVersion: 2
guid: c464dbd1ac99e3a43abe843543ea6be6
timeCreated: 1554805035
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
...@@ -434,7 +434,7 @@ Prefab: ...@@ -434,7 +434,7 @@ Prefab:
- target: {fileID: 11419100, guid: 995e2fa1a1156d248955c5fb98502585, type: 2} - target: {fileID: 11419100, guid: 995e2fa1a1156d248955c5fb98502585, type: 2}
propertyPath: new_ui_selectServer propertyPath: new_ui_selectServer
value: value:
objectReference: {fileID: 165948, guid: 66c270580b57825498511f78f7bc78bb, type: 2} objectReference: {fileID: 115020, guid: aeecebc57be069842a18f05155794f6c, type: 2}
- target: {fileID: 11419100, guid: 995e2fa1a1156d248955c5fb98502585, type: 2} - target: {fileID: 11419100, guid: 995e2fa1a1156d248955c5fb98502585, type: 2}
propertyPath: new_ui_faceShower propertyPath: new_ui_faceShower
value: value:
......
...@@ -163,7 +163,7 @@ Transform: ...@@ -163,7 +163,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 107096} m_GameObject: {fileID: 107096}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -81, y: 10, z: 0} m_LocalPosition: {x: -170, y: 10, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 481496} m_Father: {fileID: 481496}
...@@ -189,7 +189,7 @@ Transform: ...@@ -189,7 +189,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 150246} m_GameObject: {fileID: 150246}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1446, y: -80, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 448176} - {fileID: 448176}
...@@ -303,7 +303,7 @@ BoxCollider: ...@@ -303,7 +303,7 @@ BoxCollider:
m_IsTrigger: 1 m_IsTrigger: 1
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 172, y: 34, z: 0} m_Size: {x: 350, y: 34, z: 0}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!65 &6581546 --- !u!65 &6581546
BoxCollider: BoxCollider:
...@@ -501,13 +501,13 @@ MonoBehaviour: ...@@ -501,13 +501,13 @@ MonoBehaviour:
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 1} mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4 mPivot: 4
mWidth: 172 mWidth: 350
mHeight: 34 mHeight: 34
mDepth: 20 mDepth: 20
autoResizeBoxCollider: 1 autoResizeBoxCollider: 1
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 5.0588236 aspectRatio: 10.294118
mType: 1 mType: 1
mFillDirection: 4 mFillDirection: 4
mFillAmount: 1 mFillAmount: 1
...@@ -872,13 +872,13 @@ MonoBehaviour: ...@@ -872,13 +872,13 @@ MonoBehaviour:
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 0.40392157} mColor: {r: 1, g: 1, b: 1, a: 0.40392157}
mPivot: 0 mPivot: 0
mWidth: 162 mWidth: 340
mHeight: 27 mHeight: 27
mDepth: 21 mDepth: 21
autoResizeBoxCollider: 0 autoResizeBoxCollider: 0
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 7.6136365 aspectRatio: 6
keepCrispWhenShrunk: 1 keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3} mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3}
mFont: {fileID: 0} mFont: {fileID: 0}
......
...@@ -161,7 +161,7 @@ Transform: ...@@ -161,7 +161,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 125396} m_GameObject: {fileID: 125396}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -495, y: -126, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 410700} - {fileID: 410700}
...@@ -273,7 +273,7 @@ Transform: ...@@ -273,7 +273,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 163322} m_GameObject: {fileID: 163322}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071067} m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071067}
m_LocalPosition: {x: -2, y: -86.055, z: 0} m_LocalPosition: {x: -1.5, y: -86, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 462324} m_Father: {fileID: 462324}
...@@ -377,7 +377,7 @@ MonoBehaviour: ...@@ -377,7 +377,7 @@ MonoBehaviour:
mPivot: 4 mPivot: 4
mWidth: 225 mWidth: 225
mHeight: 78 mHeight: 78
mDepth: 3 mDepth: 2
autoResizeBoxCollider: 1 autoResizeBoxCollider: 1
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
...@@ -394,7 +394,7 @@ MonoBehaviour: ...@@ -394,7 +394,7 @@ MonoBehaviour:
mEffectStyle: 1 mEffectStyle: 1
mEffectColor: {r: 0, g: 0, b: 0, a: 1} mEffectColor: {r: 0, g: 0, b: 0, a: 1}
mSymbols: 1 mSymbols: 1
mEffectDistance: {x: 2, y: 2} mEffectDistance: {x: 1, y: 1}
mOverflow: 0 mOverflow: 0
mMaterial: {fileID: 0} mMaterial: {fileID: 0}
mApplyGradient: 1 mApplyGradient: 1
...@@ -456,12 +456,12 @@ MonoBehaviour: ...@@ -456,12 +456,12 @@ MonoBehaviour:
mColor: {r: 1, g: 1, b: 1, a: 1} mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4 mPivot: 4
mWidth: 457 mWidth: 457
mHeight: 7 mHeight: 8
mDepth: 3 mDepth: 2
autoResizeBoxCollider: 0 autoResizeBoxCollider: 0
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 65.28571 aspectRatio: 57.125
mType: 0 mType: 0
mFillDirection: 4 mFillDirection: 4
mFillAmount: 1 mFillAmount: 1
...@@ -638,7 +638,7 @@ MonoBehaviour: ...@@ -638,7 +638,7 @@ MonoBehaviour:
mPivot: 4 mPivot: 4
mWidth: 390 mWidth: 390
mHeight: 180 mHeight: 180
mDepth: 15 mDepth: 10
autoResizeBoxCollider: 1 autoResizeBoxCollider: 1
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
...@@ -702,13 +702,13 @@ MonoBehaviour: ...@@ -702,13 +702,13 @@ MonoBehaviour:
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 1} mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4 mPivot: 4
mWidth: 79 mWidth: 80
mHeight: 6 mHeight: 6
mDepth: 3 mDepth: 2
autoResizeBoxCollider: 0 autoResizeBoxCollider: 0
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 13.166667 aspectRatio: 13.333333
mType: 0 mType: 0
mFillDirection: 4 mFillDirection: 4
mFillAmount: 1 mFillAmount: 1
...@@ -740,7 +740,7 @@ MonoBehaviour: ...@@ -740,7 +740,7 @@ MonoBehaviour:
contentRect: {fileID: 0} contentRect: {fileID: 0}
dragEffect: 2 dragEffect: 2
momentumAmount: 35 momentumAmount: 35
scale: {x: 2, y: 2, z: 0} scale: {x: 1, y: 1, z: 0}
scrollWheelFactor: 0 scrollWheelFactor: 0
--- !u!114 &11465794 --- !u!114 &11465794
MonoBehaviour: MonoBehaviour:
...@@ -774,7 +774,7 @@ MonoBehaviour: ...@@ -774,7 +774,7 @@ MonoBehaviour:
mPivot: 4 mPivot: 4
mWidth: 222 mWidth: 222
mHeight: 78 mHeight: 78
mDepth: 3 mDepth: 2
autoResizeBoxCollider: 1 autoResizeBoxCollider: 1
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
......
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