// eslint-disable-next-line
var token = null;
// eslint-disable-next-line
var username = null;
// eslint-disable-next-line
var password = null;
// eslint-disable-next-line
var qj_token = null;
// eslint-disable-next-line
var blance = null;
// eslint-disable-next-line
var nickname = null;
// eslint-disable-next-line
var gameInstance = null;
// eslint-disable-next-line
var wechat_login = false;

// eslint-disable-next-line
function SendData() {
    if (wechat_login) {
        // eslint-disable-next-line
        gameInstance.SendMessage(
            "WebData",
            "Data",
            `token#${token}#${wechat_login}`
        );
    } else {
        // eslint-disable-next-line
        gameInstance.SendMessage(
            "WebData",
            "Data",
            `userdata#${username}#${password}#${blance}#${nickname}#${wechat_login}`
        );
    }

}


function game_get_data(obj) {
    if (obj.wechat_login) {
        token = obj.token;
    } else {
        username = obj.username;
        password = obj.password;
        blance = obj.blance;
        nickname = obj.nickname;
    }
    wechat_login = obj.wechat_login;
    gameInstance = UnityLoader.instantiate("gameContainer", "/Build/Fill.json", {
        onProgress: UnityProgress
    });
}