Example #1
0
    public bool ConnectToHost(string id, string password, string HostIp)
    {
        connector = new ClientConnector(id, password, 100, ConfigMgr.ServerIp, 9200, this);
        // GameController.LogToScreen("Connector Created");
        Debug.Log("Connector Created");
        connector.Start();
        StartCoroutine(InteruptStallConnector());
        while (connector.lastErr == eErrorCode.LOADING)
        {
        }
        if (connector.lastErr != eErrorCode.DONE)
        {
            GameController.LogToScreen("LoginFailed ");
            Debug.Log("LoginFailed " + connector.lastErr.ToString());
            return(false);
        }
        PlayerPrefs.SetString("Id", id);
        PlayerPrefs.SetString("Pass", password + "123");
        PlayerPrefs.SetString("Host", HostIp);
        PlayerPrefs.SetString("28102000", password);
        GameController.LogToScreen("Connector Started");
        Debug.Log("Login Done - Connector Started");
        ((CommonUIController)gameController.uiController).notiPanel.ShowText("Đang xử lý ... ");
        string      decStr   = connector.LoadTemplate();
        XmlDocument document = new XmlDocument();

        document.LoadXml(decStr);
        XmlNodeList itemNodes = document.GetElementsByTagName("Item");

        StartCoroutine(ExecLoadTemplate(itemNodes));
        StartCoroutine(UpdateLoadTemplateProcess());
        isLogedIn = true;
        return(true);
    }