public void InitSocket() { network.Init(NetTool.GetIP(serverInfo.Address), NetTool.GetPort(serverInfo.Address)); Logger.Log("Init Network (Battle) [{0}]", serverInfo.Address); network.heartbeat.onTimeout = OnTimeout; network.onConnected = () => { Logger.Log("Network Connect Success (Battle Server)."); if (m_needReconnnect) { SendReconnect(); } else { Login(); } }; }
private void InitSocket() { //Init string ip = NetTool.GetIP(serverInfo.Address); int port = NetTool.GetPort(serverInfo.Address); var socket = new Plugins.Network.WebSocketClient(); socket.Setup(ip, port); var serializer = new ProtoSerializer(); serializer.getTypeFunc = (name) => { return(System.Type.GetType(name)); }; serializer.LoadProtoNum(typeof(ProtoNum)); network.Init(socket, serializer); Debug.Log("Init Network (Battle) [{0}]".FormatStr(serverInfo.Address)); network.onConnected = () => { isConnected = true; Debug.Log("Network Connect Success (Battle Server)."); Login(); }; }