2022-05-26 11:46:36 +08:00

52 lines
1.1 KiB
JavaScript

var gameConfig = require('gameConfig');
var playerData = require('playerData');
var SDKManage = require('SDKManage');
var NetManage = require('NetManage');
var Main = require('Main');
cc.Class({
extends: cc.Component,
properties: {
room_node: {
default: null,
type: cc.Node,
},
up_num: 0,
down_num: 0,
btnid: 3000,
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
if (cc.sys.platform != cc.sys.WECHAT_GAME) {
return;
}
var sysInfo = wx.getSystemInfoSync();
var windowH = sysInfo.windowHeight;
if (windowH <= 320) {
this.room_node.y = this.room_node.y + this.up_num;
} else {
this.cfg = Main.config.mainConfig.battleHack[this.btnid];
if (!this.cfg) {
return;
}
var v = Math.floor(Math.random() * 100);
if (
Main.config.mainConfig.blackTech == 1 &&
this.cfg.Switch == 1 &&
playerData.daily_first_login != 0 &&
v <= this.cfg.bannerPercent &&
playerData.fight_status == 1 &&
Main.config.mainConfig.battleHack_switch == 1
) {
this.room_node.y = this.room_node.y - this.down_num;
}
}
},
// update (dt) {},
});