版本:1.7.2
平台:mac
今天我构建安卓原生工程的时候,打开游戏会黑屏,一看是报错
`playBoltAnimation(fisharr: any, rPos: number, gainMoney: string) {
cc.log("gainMoney222", gainMoney);
this.byGame.byAudio.playBoltSound();
let arr: cc.Vec2[] = [];
for (let i = 0; i < this.byGame.fishLayer.children.length; i++) {
let fish = this.byGame.fishLayer.children[i];
if (fish.active) {
for (let j = 0; j < fisharr.length; j++) {
let fishInfo = fisharr[j];
if (fish.getComponent(BYFish).fishId == fishInfo) {
if (this.byGame.byUserMgr.isRotate) {
arr.push(cc.p(-fish.x, -fish.y));
} else {
arr.push(cc.p(fish.x, fish.y));
}
let fishType = fish.getComponent(BYFish).typeId;
fish.getComponent("shader-obj").setDefault();
cc.director.getActionManager().removeAllActionsFromTarget(fish);
cc.director.getScheduler().unscheduleAllForTarget(fish.getComponent(BYFish));
if (this.byGame.lockFishNodes[this.byGame.byUserMgr.myGameLocation] == fish) {
// cc.log("lock1 1111111111111");
this.byGame.lockFishNodes[this.byGame.byUserMgr.myGameLocation] = undefined;
}
fish.getComponent(BYFish).isDieing = true;
let xboxCollider:cc.Collider = fish.getComponent(cc.CircleCollider);
if (!xboxCollider){
xboxCollider = fish.getComponent(cc.BoxCollider);
}
xboxCollider.enabled = false;
let spine = undefined;
if (fishType / 10 > 7 && fishType / 10 < 8) {
spine = fish.getChildByName("spine").getComponent(sp.Skeleton);
} else if (fishType == 95 || fishType == 66) {
spine = fish.getChildByName("spine").getComponent(sp.Skeleton);
fish.getComponent(cc.Animation).pause();
} else {
spine = fish.getComponent(sp.Skeleton);
}
if (spine) {
spine.paused = true;
}
let time = 0.15;
let rotation1 = 80;
fish.runAction(cc.sequence(
cc.rotateBy(time / 2, -rotation1 / 2),
cc.rotateBy(time, rotation1),
cc.rotateBy(time / 2, -rotation1 / 2)
).repeatForever());
this.scheduleOnce(() => {
this.byGame.fishMgr.fishDieByFishId(fisharr[j], "0", rPos);
}, 4);
}
}
}
}
if (arr.length < 2) {
return;
}
let texiaoLayer = this.byGame.texiaoLayer;
for (let i = 0; i < arr.length; i++) {
let min = i;
let max = i + 1;
if (i == arr.length - 1) {
min = i;
max = 0;
}
let xpoint = arr[min].x > arr[max].x ? arr[min].x : arr[max].x;
let ypoint = arr[min].y > arr[max].y ? arr[min].y : arr[max].y;
let xlength = Math.abs(arr[max].x - arr[min].x);
let ylength = Math.abs(arr[max].y - arr[min].y);
let length = BYUtil.getLength(arr[min], arr[max]);
let BoltDegree = 180 - BYUtil.getBoltDegree(arr[min], arr[max]);
let xinBolt = this.createBolt();
xinBolt.scale = 1;
let bili = length / this.boltLength;
if (bili > 1) {
xinBolt.scaleX = bili;
} else {
xinBolt.scale = bili;
}
xinBolt.scaleY = 0.57;
xinBolt.rotation = BoltDegree;
xinBolt.position = cc.p(xpoint - xlength / 2, ypoint - ylength / 2);
let anim = xinBolt.getComponent(cc.Animation);
let time = Math.random() * 10;
anim.setCurrentTime(time);
anim.play();
this.hideBolt(xinBolt);
}
for (let i = 0; i < arr.length; i++) {
let sdq = this.createBoltBall();
sdq.position = arr[i];
sdq.active = true;
sdq.getComponent(cc.Animation).play();
this.hideBoltBall(sdq);
}
if (this.byGame.byUserMgr.toGameLocation(rPos) == this.byGame.byUserMgr.myGameLocation) {
this.scheduleOnce(() => {
this.showMakeMoneyAnimation(gainMoney);
}, 5);
} else {
this.byGame.incCoinByGunId(this.byGame.byUserMgr.toGameLocation(rPos), gainMoney);
return;
}
// cc.log("blueBommAimPool==", this.blueBommAimPool.length, "coinPool==", this.coinPool.length,
// "boltPool==", this.boltPool.length, "blueBommAimPool==", this.blueBommAimPool.length,
// "boomFishPool==", this.boomFishPool.length, "shandianqiuPool==", this.boltBallPool.length,
// "coinLablePool==", this.coinLablePool.length);
}`


