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); }); }
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(); }); } }
// Start is called before the first frame update void Awake() { DontDestroyOnLoad(this.gameObject); Inst = this; }
// Use this for initialization void Start() { PomeloSocket pomeloSocket = new PomeloSocket(); pomeloSocket.Login(host, port); }