Commit b7a48342 authored by Tt's avatar Tt

修改完成

parent 3faa109b
const { ccclass, property } = cc._decorator;
@ccclass
export default class Clund_06 extends cc.Component {
@property(cc.Node)
yun_1: cc.Node = null;
@property(cc.Node)
yun_2: cc.Node = null;
@property(cc.Node)
yun_3: cc.Node = null;
@property(cc.Node)
yun_4: cc.Node = null;
@property(cc.Node)
yun_5: cc.Node = null;
@property(cc.Node)
yun_6: cc.Node = null;
@property(cc.Node)
yun_7: cc.Node = null;
private speed: number;
private speed2: number;
private width: number;//背景图宽度
public onEnable() {
}
protected onDestroy(): void {
}
protected onLoad(): void {
this.speed = 0.5;
this.speed2 = 0.8;
let size = cc.view.getCanvasSize();
let scale = (size.width / size.height) / (1920 / 1080);
if (scale > 1) {
Math.floor(this.node.width *= scale);
Math.floor(this.node.width *= scale);
Math.floor(this.node.width *= scale);
}
this.width = this.node.width / 2;
}
protected update(dt) {
this.yun_1.x += this.speed;
this.yun_2.x += this.speed2;
this.yun_4.x += this.speed2;
this.yun_3.x -= this.speed;
this.yun_5.x -= this.speed2;
this.yun_6.x -= this.speed;
this.yun_7.x -= this.speed;
if (this.yun_1.x > this.width + 200)
this.yun_1.x = -this.width - 150;
if (this.yun_2.x > this.width + 200)
this.yun_2.x = -this.width - 150;
if (this.yun_4.x > this.width + 200)
this.yun_4.x = -this.width - 150;
if (this.yun_3.x < -this.width - 200)
this.yun_3.x = this.width + 150;
if (this.yun_5.x < -this.width - 200)
this.yun_5.x = this.width + 150;
if (this.yun_6.x < -this.width - 200)
this.yun_6.x = this.width + 150;
if (this.yun_7.x < -this.width - 200)
this.yun_7.x = this.width + 150;
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "2ea681a7-773b-4059-980f-f890bd1ea71e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -15,21 +15,22 @@ export default class boatmove extends cc.Component { ...@@ -15,21 +15,22 @@ export default class boatmove extends cc.Component {
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
onLoad() { onLoad() {
let mul = 3;
if (this.firstUp) { if (this.firstUp) {
cc.tween(this.node).repeatForever( cc.tween(this.node).repeatForever(
cc.tween() cc.tween()
.by(10, { y: 25 }) .by(10, { y: 25 * mul })
.by(10, { y: -25 }) .by(10, { y: -25 * mul })
.by(10, { y: -25 }) .by(10, { y: -25 * mul })
.by(10, { y: 25 }) .by(10, { y: 25 * mul })
).start(); ).start();
} else { } else {
cc.tween(this.node).repeatForever( cc.tween(this.node).repeatForever(
cc.tween() cc.tween()
.by(10, { y: -25 }) .by(10, { y: -25 * mul })
.by(10, { y: 25 }) .by(10, { y: 25 * mul })
.by(10, { y: 25 }) .by(10, { y: 25 * mul })
.by(10, { y: -25 }) .by(10, { y: -25 * mul })
).start(); ).start();
} }
} }
......
This diff is collapsed.
...@@ -20,7 +20,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -20,7 +20,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio() { addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源 // TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url }); // this._audioResList.push({ url: this.data.audio_url });
let arr = [];
this.data.questions.forEach(question => {
question.options.forEach(op => {
arr.push({ url: op.audio })
})
})
this._audioResList.push(...arr);
} }
addPreloadAnima() { addPreloadAnima() {
...@@ -127,9 +134,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -127,9 +134,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
let db = start_ske.getComponent(dragonBones.ArmatureDisplay); let db = start_ske.getComponent(dragonBones.ArmatureDisplay);
let anis = db.getAnimationNames(db.armatureName); let anis = db.getAnimationNames(db.armatureName);
db.playAnimation(anis[0], 0); db.playAnimation(anis[0], 0);
cc.tween(start_ske).by(1, { x: -500 }).call(() => { cc.tween(start_ske).by(0.5, { x: -500 }).call(() => {
pg.audio.playAudioByUrl(Game.getIns().startAudio).then(() => { pg.audio.playAudioByUrl(Game.getIns().startAudio).then(() => {
cc.tween(start_ske).delay(1).by(1, { x: 500 }).call(() => { cc.tween(start_ske).delay(1).by(0.5, { x: 500 }).call(() => {
this.layout_start.active = false; this.layout_start.active = false;
resolve(''); resolve('');
}).start(); }).start();
...@@ -173,14 +180,23 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -173,14 +180,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 出现鱼 // 出现鱼
let fishList = Game.getIns().getFishList(); let fishList = Game.getIns().getFishList();
let layout_fish = pg.view.find(this, 'layout_bottom/layout_fish') let layout_fish = pg.view.find(this, 'layout_bottom/layout_fish')
let fishs_left = pg.view.find(this, 'layout_bottom/boat_left/fishs')
let fishs_right = pg.view.find(this, 'layout_bottom/boat_right/fishs')
layout_fish.removeAllChildren(); layout_fish.removeAllChildren();
fishs_left.removeAllChildren();
fishs_right.removeAllChildren();
let item = pg.view.find(this, 'layout_bottom/item') let item = pg.view.find(this, 'layout_bottom/item')
for (let i = 0; i < 10; i++) {
fishList.sort((A, B) => {
return 0.5 - Math.random();
})
}
fishList.forEach((fish, index) => { fishList.forEach((fish, index) => {
let node = cc.instantiate(item); let node = cc.instantiate(item);
layout_fish.addChild(node); layout_fish.addChild(node);
this.scheduleOnce(() => { this.scheduleOnce(() => {
this.updateItem(node, fish); this.updateItem(node, fish);
}, index * Math.random()) }, index * 12)
}); });
} }
updateItem(item, data: Option) { updateItem(item, data: Option) {
...@@ -200,31 +216,27 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -200,31 +216,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.y = -315 - Math.random() * 150; item.y = -315 - Math.random() * 150;
item.scaleX = -1; item.scaleX = -1;
text.scaleX = -1; text.scaleX = -1;
this.scheduleOnce(() => { item.active = true;
item.active = true; cc.tween(item).repeatForever(cc.tween().by(21 * 3, { x: 1920 + 400 }).call(() => {
cc.tween(item).repeatForever(cc.tween().by(21 + (data.id % 10), { x: 1920 + 400 }).call(() => { item.scaleX = -item.scaleX;
item.scaleX = -item.scaleX; text.scaleX = -text.scaleX;
text.scaleX = -text.scaleX; }).by(21 * 3, { x: - 1920 - 400 }).call(() => {
}).by(7 + Math.random() * 8, { x: - 1920 - 400 }).call(() => { item.scaleX = -item.scaleX;
item.scaleX = -item.scaleX; text.scaleX = -text.scaleX;
text.scaleX = -text.scaleX; })).start();
})).start();
}, data.id % 10)
} else { } else {
item.x = 1920 / 2 + Math.random() * 200 item.x = 1920 / 2 + Math.random() * 200
item.y = -315 - Math.random() * 150; item.y = -315 - Math.random() * 150;
item.scaleX = 1; item.scaleX = 1;
text.scaleX = 1; text.scaleX = 1;
this.scheduleOnce(() => { item.active = true;
item.active = true; cc.tween(item).repeatForever(cc.tween().by(21 * 3, { x: -1920 - 400 }).call(() => {
cc.tween(item).repeatForever(cc.tween().by(21 + (data.id % 10), { x: -1920 - 400 }).call(() => { item.scaleX = -item.scaleX;
item.scaleX = -item.scaleX; text.scaleX = -text.scaleX;
text.scaleX = -text.scaleX; }).by(21 * 3, { x: 1920 + 400 }).call(() => {
}).by(7 + Math.random() * 8, { x: 1920 + 400 }).call(() => { item.scaleX = -item.scaleX;
item.scaleX = -item.scaleX; text.scaleX = -text.scaleX;
text.scaleX = -text.scaleX; })).start();
})).start();
}, data.id % 10)
} }
item.on(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this); item.on(cc.Node.EventType.TOUCH_START, this.onItemTouchStart, this);
item.on(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this); item.on(cc.Node.EventType.TOUCH_MOVE, this.onItemTouchMove, this);
...@@ -270,11 +282,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -270,11 +282,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
let isRight = false; let isRight = false;
let currentRect = null; let currentRect = null;
let parent = null;
let netLeft = false;
if (rect.intersects(leftRect)) { if (rect.intersects(leftRect)) {
parent = boat_left;
netLeft = true;
isRight = !!Game.getIns().boatLeft.isChild(data); isRight = !!Game.getIns().boatLeft.isChild(data);
isRight && Game.getIns().boatLeft.setRight(data); isRight && Game.getIns().boatLeft.setRight(data);
currentRect = leftRect; currentRect = leftRect;
} else if (rect.intersects(rightRect)) { } else if (rect.intersects(rightRect)) {
parent = boat_right;
netLeft = false;
isRight = !!Game.getIns().boatRight.isChild(data); isRight = !!Game.getIns().boatRight.isChild(data);
isRight && Game.getIns().boatRight.setRight(data); isRight && Game.getIns().boatRight.setRight(data);
currentRect = rightRect; currentRect = rightRect;
...@@ -304,7 +322,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -304,7 +322,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.touching = null; this.touching = null;
} }
}) })
let fishs_left = pg.view.find(this, 'layout_bottom/boat_left/fishs')
let fishs_right = pg.view.find(this, 'layout_bottom/boat_right/fishs')
if (netLeft) {
item.x = item.x + 442;
item.y = item.y - boat_left.y;
item.parent = fishs_left;
} else {
item.x = item.x - 452;
item.y = item.y - boat_right.y;
item.parent = fishs_right;
}
if (item.scaleX == -1) { if (item.scaleX == -1) {
// 计算当前坐标距离最左侧的距离 // 计算当前坐标距离最左侧的距离
let space = currentRect.width - ((rect.x + rect.width) - currentRect.x) - lastArea / 5; let space = currentRect.width - ((rect.x + rect.width) - currentRect.x) - lastArea / 5;
......
...@@ -58,8 +58,11 @@ export default class Ngt_star_7 extends cc.Component { ...@@ -58,8 +58,11 @@ export default class Ngt_star_7 extends cc.Component {
this.bigStarArr = []; this.bigStarArr = [];
let size = cc.view.getCanvasSize();
let scale = (1920 / 1080) / (size.width / size.height);
let baseX = this.position.x; let baseX = this.position.x;
let baseY = this.position.y; let baseY = this.position.y * scale + 15;
if (scale <= 1) baseY = this.position.y;
let disW = 80;// * this._mapScaleMin let disW = 80;// * this._mapScaleMin
// let disH = 80 * this._mapScaleMin; // let disH = 80 * this._mapScaleMin;
let disScale = 1; let disScale = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment