// 游戏服务器 public static void ConnectGameServer() { ProtoMsg.MsgNetAddress address = LoginDC.GetGameServerNetInfo(); if (address == null) { IGGDebug.Log("未获取游戏服务器ip"); return; } // 发送登录请求 Communicate.Disconnect(); if (Communicate.IsConnected() == false) { Communicate.SetGSConnetorGame(true); NetConnectState.SetConnetOverTime(3.0f, OnConnectOverTime); string ip = address.u32Ip.ToString(); if (!isDomainAddrIp(address.u32Ip.ToString().ToCharArray())) { // data.netAdd.ip 转 ip 地址 ip = IntToIp((Int32)address.u32Ip); } IGGDebug.Log("游戏服务器:" + ip + "," + address.u32Port); Communicate.Connect2GS(ip, (int)address.u32Port); } }
private static void OnConnect(bool succ) { if (succ == true) { if (Communicate.IsConnectedGS() == true) { IGGDebug.Log("连接游戏服务器"); LoginDC.SendGSMsgCL2GS(); } else { IGGDebug.Log("连接登录服务器"); LoginDC.SendLoginMsgCL2LS(); } } else { IGGDebug.Log("连接服务器失败"); if (g_failfp != null) { g_failfp(); g_failfp = null; } } }
/// <summary> /// 重登录清理数据中心数据 /// </summary> public void ClearDC() { LoginDC.ClearDC(); }