Ejemplo n.º 1
0
 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);
         }));
     }));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public void DisConnectSocket()
 {
     PomeloSocketEntry.DisConnect();
 }
Ejemplo n.º 4
0
 public void Listen(string route)
 {
     Debug.Log((object)("开始监听 " + route));
     PomeloSocketEntry.LOn(route);
 }
Ejemplo n.º 5
0
 public void ReconnectSocket(string url, int port, int playerid, string route)
 {
     PomeloSocketEntry.LReconnect(url, port, playerid, route);
 }
Ejemplo n.º 6
0
 public void ConnectSocket(string url, int port, string token, string route)
 {
     PomeloSocketEntry.LConnect(url, port, token, route);
 }