public static void LReconnect(string url, int port, int playerid, string route) { PomeloSocketEntry.Client = new PomeloClient(); PomeloSocketEntry.Client.NetWorkStateChangedEvent += (NWorkStateChangedEvent)(state => { PomeloSocketEntry.networkState = state; Debug.Log(PomeloSocketEntry.networkState); if (PomeloSocketEntry.NwStateChangeDel == null) { return; } PomeloSocketEntry.NwStateChangeDel((int)PomeloSocketEntry.networkState); }); PomeloSocketEntry.Client.initClient(url, port, (Action)(() => { JsonObject user = new JsonObject(); PomeloSocketEntry.Client.connect(user, (Action <JsonObject>)(responseData => { Debug.Log(responseData + "handshake call back data"); if (NetWorkState.CONNECTED != PomeloSocketEntry.networkState) { return; } PomeloSocketEntry.LSocketRequest(new JsonObject() { { "playerId", (object)playerid } }, route); })); })); }
public void SocketRequest(string sendData, string route) { object obj; SimpleJson.SimpleJson.TryDeserializeObject(sendData, out obj); Debug.Log((object)("SocketRequest Send Message" + obj)); PomeloSocketEntry.LSocketRequest((JsonObject)obj, route); }
public void DisConnectSocket() { PomeloSocketEntry.DisConnect(); }
public void Listen(string route) { Debug.Log((object)("开始监听 " + route)); PomeloSocketEntry.LOn(route); }
public void ReconnectSocket(string url, int port, int playerid, string route) { PomeloSocketEntry.LReconnect(url, port, playerid, route); }
public void ConnectSocket(string url, int port, string token, string route) { PomeloSocketEntry.LConnect(url, port, token, route); }