Commit 821626d8 authored by Tt's avatar Tt

完成

parent 116b9125
{
"ver": "2.0.1",
"uuid": "5255a58d-d2b0-4b9d-9f3c-4fee75337f94",
"downloadMode": 0,
"duration": 1.724082,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "1b0c30e8-d852-4ec8-a505-fd959388ef14",
"downloadMode": 0,
"duration": 2.008,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f47470c5-d9d6-45f7-98c0-c1f91e5db5f4",
"downloadMode": 0,
"duration": 2.194286,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "32af9de6-73b8-44e8-9b18-f0f42c5caadc",
"downloadMode": 0,
"duration": 1.955125,
"subMetas": {}
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initData();
this.initView();
this.initListener();
this.initStart()
this.gameStart();
}
......@@ -39,9 +40,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
GameNGT14.getIns().reset();
let data = GameNGT14.getIns().getCurrent();
console.log('gamestart', data)
pg.event.emit('mouse_14_num', GameNGT14.getIns().getLen())
}
private layout_start: cc.Node;
private layout_finish: cc.Node;
initView() {
this.layout_start = pg.view.find(this, 'layout_start')
this.layout_finish = pg.view.find(this, 'layout_finish')
this.initBlocks();
}
......@@ -62,11 +68,78 @@ export default class SceneComponent extends MyCocosSceneComponent {
let data = GameNGT14.getIns().nextQuestion();
if (!data) {
//游戏结束
this.showFinal();
} else {
this.gameStart();
}
}
private showFinal() {
this.playLocalAudio("finish");
let layout_finish = cc.find("layout_finish", this.node);
layout_finish.active = true;
let finish_db = cc.find("finish_db", layout_finish);
let btn_again = cc.find("btn_again", layout_finish);
let btn_next = cc.find("btn_next", layout_finish);
btn_again.on(cc.Node.EventType.TOUCH_END, this.onAgain, this);
btn_next.on(cc.Node.EventType.TOUCH_END, this.onNext, this);
finish_db.active = true;
btn_again.active = false;
btn_next.active = false;
finish_db.getComponent(dragonBones.ArmatureDisplay).playAnimation("newAnimation", 1);
this.playLocalAudio("finish").then(() => {
finish_db.active = false;
btn_again.active = true;
btn_next.active = true;
});
}
private initStart() {
return new Promise((resolve, reject) => {
this.layout_start.active = true;
cc.find("layout_top/label_title", this.node).getComponent(cc.Label).string = GameNGT14.getIns().title;
pg.event.emit("mouse_09_num", GameNGT14.getIns().total);
let start_ske = cc.find("layout_start/start_ske", this.node);
pg.load.loadDB(start_ske, { ske: GameNGT14.getIns().aniEnter.ske.url, tex: GameNGT14.getIns().aniEnter.tex.url, png: GameNGT14.getIns().aniEnter.png.url }).then((animationName) => {
if (animationName && animationName != "") {
let db = start_ske.getComponent(dragonBones.ArmatureDisplay);
let anis = db.getAnimationNames(db.armatureName);
db.playAnimation(anis[0], 0);
cc.tween(start_ske).by(1, { x: -500 }).call(() => {
pg.audio.playAudioByUrl(GameNGT14.getIns().startAudio).then(() => {
cc.tween(start_ske).delay(1).by(1, { x: 500 }).call(() => {
this.layout_start.active = false;
// this.playLaba();
resolve('');
}).start();
});
}).start();
} else {
this.layout_start.active = false;
resolve('');
}
})
});
}
private resetGame() {
cc.audioEngine.stopAllEffects();
this.playLocalAudio("again");
this.initData();
this.gameStart();
}
private onAgain() {
this.layout_finish.active = false;
this.resetGame();
}
private onNext() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const mc = middleLayer.getComponent('middleLayer');
// // 切换下一页
mc.goNextPage();
}
}
//----------------------------------------右上题目部分-----------------------------------
private layout_question: cc.Node;
updateQuestion() {
......@@ -94,7 +167,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
return cc.instantiate(pg.view.find(base, 'img'))
}
case BLOCK_TYPE.TXT:
return cc.instantiate(pg.view.find(base, 'label'))
if (onlyImg) {
return cc.instantiate(pg.view.find(base, 'label_big'))
} else {
return cc.instantiate(pg.view.find(base, 'label'))
}
case BLOCK_TYPE.LINE:
return cc.instantiate(pg.view.find(base, 'line'))
case BLOCK_TYPE.TAG:
......@@ -113,7 +190,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let list: Array<Option> = data.getList();
list.forEach(option => {
let blocks = option.getList();
let showCenter = blocks.length == 1 && blocks[0].type == BLOCK_TYPE.IMG;
let showCenter = blocks.length == 1 && (blocks[0].type == BLOCK_TYPE.IMG || blocks[0].type == BLOCK_TYPE.TXT);
let onlyImg = list.length == 1 && showCenter;
//确定使用的单双行
let lay = this.getLayByOption(option, base, { onlyImg, showCenter });
......@@ -377,6 +454,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.tween(node).by(0.2, { scale: 0.1 }).by(0.2, { scale: -0.1 }).start();
if (index == nodes.length - 1) {
this.scheduleOnce(() => {
pg.event.emit("mouse_14_add");
//执行颜色变right
this.updateBlockColor(nodes, 'img_right')
//播放right音效
......@@ -385,9 +463,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
//其他字母向下掉出
this.layout_words.children.forEach((node, index) => {
cc.tween(node)
.delay(0.05 * index)
.delay(0.05 * (this.layout_words.children.length - index))
.by(0.3, { y: -1000 })
.delay(0.3)
.delay(0.8)
.call(() => {
this.nextQuestion();
})
......@@ -424,13 +502,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
//播放音频right_wrong
this.playLocalAudio('right_wrong')
//播放灰色徽章
pg.event.emit("mouse_10_add_error");
pg.event.emit("mouse_14_add_error");
//其他字母向下掉出
this.layout_words.children.forEach((node, index) => {
cc.tween(node)
.delay(0.05 * index)
.delay(0.05 * (this.layout_words.children.length - index))
.by(0.3, { y: -1000 })
.delay(0.1)
.delay(0.8)
.call(() => {
this.nextQuestion();
})
......
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "5f5d51c1-6f71-4bb1-a47d-dc508ccd8c7c",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "layout_start",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 7
}
],
"_active": false,
"_components": [
{
"__id__": 10
}
],
"_prefab": {
"__id__": 11
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 1080
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 110,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 1080
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1920,
"_originalHeight": 1080,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "88iu8QvK5GfqhrCOwz7voJ",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "start_ske",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 230.1,
"height": 184.5
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1300,
-413.848,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "0d00069a-964d-44d5-b69a-f9a27fd672f6#29f6e472-b4ff-4576-870f-eac44e2f5415",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": null,
"_N$dragonAtlasAsset": null,
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "cbZ9rrrOxESYcgiJ5tA0QB",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1920,
"_originalHeight": 1080,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "a23d8f50-6f8d-4c1e-8f11-536b8a936e28",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "9b9c46c3-79b4-4c8e-a6e5-f67d16fb1588",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -22,13 +22,9 @@
}
],
"_active": true,
"_components": [
{
"__id__": 13
}
],
"_components": [],
"_prefab": {
"__id__": 14
"__id__": 13
},
"_opacity": 255,
"_color": {
......@@ -473,27 +469,6 @@
"fileId": "9eIg5jomZOV5E+Yzh+2uPU",
"sync": false
},
{
"__type__": "e9eaeH4ZsVKx4dSvhRwGuVF",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"bigStarClip": {
"__uuid__": "71b51036-3bca-4d2a-84e1-fedc216ba064"
},
"starCountClip": {
"__uuid__": "71b51036-3bca-4d2a-84e1-fedc216ba064"
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
......@@ -175,6 +175,9 @@ export class GameNGT14 {
}
return list
}
getLen() {
return this.questions.length;
}
getCurrent(): Question {
return this.questions[this.current];
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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