Exemplo n.º 1
0
    private IEnumerator StartLogin(string strAccount)
    {
        Player.playerData = new proto.PlayerData();
        Player.playerInfo = new proto.PlayerInfo();

        SaveData.data.account = strAccount;
        WWW requestToken = new WWW("http://127.0.0.1:18080/login/login?account=" + strAccount);

        yield return(requestToken);

        SysLog.debug("get token {0}", requestToken.text);
        LoginResult result = JsonUtility.FromJson <LoginResult>(requestToken.text);

        if (result.Code != "ok")
        {
            SysLog.error("login failed {0}", result.Code);
            yield return(null);
        }
        moduleNetGameServ.stopConnect();
        moduleNetGameServ.startConnect(Config.ins.gameServerHost.ip, Config.ins.gameServerHost.port);
        moduleLogin.requestLogin(result.Token);
    }