private void _onLoginButtonClick() { if (m_edit_account.text == string.Empty) { UI_MessageBox.Show(Locale.Instance["Login@PleaseInputAccount"]); return; } if (m_edit_password.text == string.Empty) { UI_MessageBox.Show(Locale.Instance["Login@PleaseInputPassword"]); return; } CG_LoginRequestMsg msg = new CG_LoginRequestMsg(); msg.PlatformID = 0; msg.PlayerName = m_edit_account.text; msg.PlayerPassword = m_edit_password.text; var bt = Encoding.UTF8.GetBytes(UnityEngine.SystemInfo.deviceUniqueIdentifier); msg.Mac = BitConverter.ToUInt64(bt, 0); msg.Md5 = MD5Helper.GetMD5Hash(bt); msg.NameType = 0; msg.Version = 17696793; NetManager.Instance.SendMsg(msg); LoginSystem.Instance.CurAccount = msg.PlayerName; LoginSystem.Instance.CurPassword = msg.PlayerPassword; WaitForResponse.Retain(); }
private void _forceLogin(SignalId _signal_id, SignalParameters _parameters) { CG_ForceLoginRequestMsg msg = new CG_ForceLoginRequestMsg(); msg.PlatformID = 0; msg.PlayerName = m_edit_account.text; msg.PlayerPassword = m_edit_password.text; var bt = Encoding.UTF8.GetBytes(UnityEngine.SystemInfo.deviceUniqueIdentifier); msg.Mac = BitConverter.ToUInt64(bt, 0); msg.Md5 = MD5Helper.GetMD5Hash(bt); msg.NameType = 0; NetManager.Instance.SendMsg(msg); WaitForResponse.Retain(); }
public override void Enter() { WaitForResponse.Retain(); NetManager.Instance.Register <ConnectMsg>(_onGameSrvConnected); NetManager.Instance.Register <DisconnectMsg>(_onGameSrvDisconnected); IPAddress ip; if (!IPAddress.TryParse("192.168.100.200", out ip)) { throw new ServerInfoException(ServerInfoException.ErrorType.IpParseError); } IPEndPoint ip_end = new IPEndPoint(ip, 12345); Entity.m_net_client_gamesrv.Connect(ip_end); if (m_time_out == null) { m_time_out = Timer.CreateTimer(10000); m_time_out.eventTimesUp += _onTimeOut; } m_time_out.Start(); m_time_out_tip = "GameSrvConnectTimeOut"; }