|
@@ -13,14 +13,27 @@ namespace ET.Client
|
|
|
{
|
|
|
private string mIP;
|
|
|
private int mPort;
|
|
|
+ private string strRoomToken;
|
|
|
|
|
|
protected override async ETTask OnEvent(ShowLoginUIEvent a)
|
|
|
{
|
|
|
+ var args = Environment.GetCommandLineArgs();
|
|
|
+ for (var i = 0; i < args.Length; i++)
|
|
|
+ {
|
|
|
+ Log.Debug("args: " + args[i]);
|
|
|
+ if (args[i].StartsWith("-token="))
|
|
|
+ {
|
|
|
+ strRoomToken = args[i][7..];
|
|
|
+ Log.Debug($"env token: {strRoomToken}");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ GRoot.inst.RemoveChildren();
|
|
|
+
|
|
|
var view = await UIHelper.Create( "Login" );
|
|
|
- InitLogin( view );
|
|
|
+ InitLogin( view ).Coroutine();
|
|
|
|
|
|
- var preView = GRoot.inst.GetChild("CheckForResUpdate");
|
|
|
- if(preView != null) GRoot.inst.RemoveChild( preView, true );
|
|
|
UIPackage.RemovePackage( "CheckForResUpdate" );
|
|
|
}
|
|
|
|
|
@@ -121,55 +134,37 @@ namespace ET.Client
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- private void InitLogin(GComponent view)
|
|
|
+ private async ETTask InitLogin(GComponent view)
|
|
|
{
|
|
|
var comp = view.GetChild("comp_login") as GComponent;
|
|
|
var listSvr = view.GetChild("listServer").asComboBox;
|
|
|
- var listResolution = comp.GetChild("listResolution").asComboBox;
|
|
|
+ var listResolution = view.GetChild("listResolution").asComboBox;
|
|
|
InitServerList(listSvr);
|
|
|
InitResolutionList(listResolution);
|
|
|
|
|
|
var tips = comp.GetChild( "txt_tips" );
|
|
|
var inputID = comp.GetChild("txtID").asTextInput;
|
|
|
- var roomid = GameSetting.Instance.GetInt( GameSetting.Sets.TiktokRoomId_int );
|
|
|
+ var imgtips = comp.GetChild("img_tips");
|
|
|
+ /*var roomid = GameSetting.Instance.GetInt( GameSetting.Sets.TiktokRoomId_int );
|
|
|
if(roomid > 0 )
|
|
|
{
|
|
|
inputID.text = roomid.ToString();
|
|
|
}
|
|
|
- inputID.onChanged.Set( () => { tips.visible = false; } );
|
|
|
-
|
|
|
- var btn = comp.GetChild("btn_go");
|
|
|
+ inputID.onChanged.Set( () => { tips.visible = false; } );*/
|
|
|
+
|
|
|
+ inputID.text = strRoomToken;
|
|
|
+ var btn = comp.GetChild("btn_go").asButton;
|
|
|
btn.onClick.Add(async () =>
|
|
|
{
|
|
|
- var imgtips = comp.GetChild("img_tips");
|
|
|
tips.visible = false;
|
|
|
- imgtips.visible = false;
|
|
|
- if (inputID.text.IsNullOrWhitespace())
|
|
|
- {
|
|
|
- tips.visible = true;
|
|
|
- tips.text = "请输入直播间ID";
|
|
|
- return;
|
|
|
- }
|
|
|
- var roomid = 0;
|
|
|
- try
|
|
|
- {
|
|
|
- roomid = Convert.ToInt32( inputID.text );
|
|
|
- }
|
|
|
- catch(Exception)
|
|
|
- {
|
|
|
- tips.visible = true;
|
|
|
- tips.text = "请输入正确的直播间ID";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
imgtips.visible = true;
|
|
|
- btn.enabled = false;
|
|
|
- var ret = await LoginHelper.Login(mIP, mPort, roomid);
|
|
|
+ btn.visible = false;
|
|
|
+ var ret = await LoginHelper.Login(mIP, mPort, strRoomToken);
|
|
|
if (ret != ErrorCode.ERR_Success)
|
|
|
{
|
|
|
imgtips.visible = false;
|
|
|
tips.visible = true;
|
|
|
- btn.enabled = true;
|
|
|
+ btn.visible = true;
|
|
|
|
|
|
if (ret == ErrorCode.ERR_UserNameOrPasswordFormatError ||
|
|
|
ret == ErrorCode.ERR_UserNameOrPasswordError)
|
|
@@ -179,16 +174,32 @@ namespace ET.Client
|
|
|
else
|
|
|
{
|
|
|
tips.text = "连接服务器过程中出现了问题\n" +
|
|
|
- "如重试后还是不行,请与客服联系" +
|
|
|
- "\n[color=#FF0000]QQ: 2910280670[/color]" +
|
|
|
- "\n微信:[color=#FF0000]lvlh117[/color]";
|
|
|
+ "如重试后还是不行,请与客服联系" +
|
|
|
+ "\n抖音:[color=#FF0000]奥陌陌网络科技[/color]" +
|
|
|
+ "\n微信:[color=#FF0000]omm_wh[/color]";
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ /*else
|
|
|
{
|
|
|
GameSetting.Instance.SetInt(GameSetting.Sets.TiktokRoomId_int, roomid);
|
|
|
- }
|
|
|
+ }*/
|
|
|
});
|
|
|
+
|
|
|
+ if (strRoomToken.IsNullOrWhitespace())
|
|
|
+ {
|
|
|
+ tips.visible = true;
|
|
|
+ tips.text = "获得直播间token失败,请重新启动\n" +
|
|
|
+ "如重试后还是不行,请与客服联系" +
|
|
|
+ "\n抖音:[color=#FF0000]奥陌陌网络科技[/color]" +
|
|
|
+ "\n微信:[color=#FF0000]omm_wh[/color]";
|
|
|
+ strRoomToken = "NoToken";
|
|
|
+ Log.Info("start without token");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //await TimerComponent.Instance.WaitAsync(300);
|
|
|
+ //btn.FireClick(false, true);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|