Example #1
0
 private void OnLogin()
 {
     pclient = PomeloSocket.Inst.InitClient(host, port, (data) =>
     {
         Debug.Log("Connect gate server success!");
         JsonObject msg = new JsonObject();
         msg["uid"]     = txtName.text;
         pclient.Request("gate.gateHandler.enter", msg, OnQuery);
     });
 }
Example #2
0
    void OnQuery(JsonObject result)
    {
        Debug.Log(result);
        if (Convert.ToInt32(result["code"]) == 200)
        {
            pclient.Disconnect();
            string host = (string)result["host"];
            int    port = Convert.ToInt32(result["port"]);

            pclient = PomeloSocket.Inst.InitClient(host, port, (data) =>
            {
                Debug.Log("Connect gate server success!");
                Enter();
            });
        }
    }
Example #3
0
 // Start is called before the first frame update
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     Inst = this;
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        PomeloSocket pomeloSocket = new PomeloSocket();

        pomeloSocket.Login(host, port);
    }