void clientForGateStateChanged(SocketNetState state) { switch (state) { case SocketNetState.CONNECTED: { //TODO::ask for connector host netState = LogicNetState.TRY_TO_CONNECT_GATE_SUCCESS; Debug.Log("gate server connect success"); }break; case SocketNetState.DISCONNECTED: { Debug.Log("gate server disconnected!"); }break; case SocketNetState.ERROR: { //TODO::error handle netState = LogicNetState.TRY_TO_CONNECT_GATE_ERROR; Debug.Log("gate server connect error!"); }break; case SocketNetState.TIMEOUT: { //TODO::error handle netState = LogicNetState.TRY_TO_CONNECT_GATE_ERROR; Debug.Log("gate server connect timeout!"); }break; } }
void afterGet(string httpReturn,string error) { if (httpReturn.Length == 0) { netState = LogicNetState.ASK_FOR_GATE_HOST_ERROR; } else { string host;int port; Utils.GetGateHostAndPort(httpReturn,out host,out port); netState = LogicNetState.TRY_TO_CONNECT_GATE; NetManager.sharedInstance.connectTo("gate",host,port,netStateChanged); } }