示例#1
0
文件: LoginM.cs 项目: 741645596/Golf
    // 游戏服务器
    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);
        }
    }
示例#2
0
文件: LoginM.cs 项目: 741645596/Golf
 // 登录服务器
 public static void ConnectLoginServer()
 {
     // 发送登录请求
     if (Communicate.IsConnected() == false)
     {
         Communicate.Disconnect();
         Communicate.SetGSConnetorGame(false);
         NetConnectState.SetConnetOverTime(3.0f, OnConnectOverTime);
         //Communicate.Connect2GS(g_ip, g_port);
         ServerInfo sInfo = GetServerInfo();
         if (null != sInfo)
         {
             Communicate.Connect2GS(sInfo.iP, sInfo.Port);
         }
         else
         {
             IGGDebug.Log("未获取登入服务器ip");
         }
     }
 }