Commit dad70bdf authored by Tt's avatar Tt

左中

parent 4beae6b1
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 9
...@@ -862,7 +862,7 @@ ...@@ -862,7 +862,7 @@
"__id__": 18 "__id__": 18
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 20
...@@ -1064,7 +1064,7 @@ ...@@ -1064,7 +1064,7 @@
"__id__": 28 "__id__": 28
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 30 "__id__": 30
...@@ -1126,7 +1126,7 @@ ...@@ -1126,7 +1126,7 @@
"__id__": 21 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 23
...@@ -1179,7 +1179,7 @@ ...@@ -1179,7 +1179,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "79v0P/tbZO1q/TXOHrxgfo" "_id": "5atndb/r1GHIrieBFz27+g"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -1212,7 +1212,7 @@ ...@@ -1212,7 +1212,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "98YBGU+69JyYxPN65uduYD" "_id": "feFJE08N1D4qLWjkcbeRjw"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -1222,7 +1222,7 @@ ...@@ -1222,7 +1222,7 @@
"__id__": 21 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 25 "__id__": 25
...@@ -1275,7 +1275,7 @@ ...@@ -1275,7 +1275,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "d01PXFPjBMyJi0h/vk6MWI" "_id": "dbfpeAI0hBXJl8DkVMrSCD"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -1308,7 +1308,7 @@ ...@@ -1308,7 +1308,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "14a0DR/bpOjqjEyUVXXoJu" "_id": "09QzxNLodAY5MiGE8I0t5L"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -1318,7 +1318,7 @@ ...@@ -1318,7 +1318,7 @@
"__id__": 21 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 27 "__id__": 27
...@@ -1371,7 +1371,7 @@ ...@@ -1371,7 +1371,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "a0M/N0nlVP5ownmZDlVkXI" "_id": "56iP3dv/xAE4cChqvRcrKf"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -1404,7 +1404,7 @@ ...@@ -1404,7 +1404,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "63vxNcWZFN3ZgVRsKw8gGR" "_id": "0938RYUS5Ajr9gHPeujOJM"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -1414,7 +1414,7 @@ ...@@ -1414,7 +1414,7 @@
"__id__": 21 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 29 "__id__": 29
...@@ -1467,7 +1467,7 @@ ...@@ -1467,7 +1467,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "20ARUteUpOTIZn3eXEMVg8" "_id": "c8bG+UsAlAwL924kkHATYK"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -1500,7 +1500,7 @@ ...@@ -1500,7 +1500,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "3aaoBd9GRPO4k+7uBFdThz" "_id": "b3zXpvRaVNkYmhc8/2TQIl"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -1531,7 +1531,7 @@ ...@@ -1531,7 +1531,7 @@
"__id__": 14 "__id__": 14
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 32 "__id__": 32
...@@ -1947,7 +1947,7 @@ ...@@ -1947,7 +1947,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "a1fv8luW5AqqoI/05ksc/a" "_id": "4022wtqg1NxoZKAZrxwQj1"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -1980,7 +1980,7 @@ ...@@ -1980,7 +1980,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "aeINOKprFE56MLUZ4IRj6M" "_id": "86+aK97YVLUK28xlixiRSP"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -2043,7 +2043,7 @@ ...@@ -2043,7 +2043,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "95Okuwmz9Kzaj2QSJZm1Al" "_id": "e4hAaOrQhIIbDQtQ6eHN8k"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -2076,7 +2076,7 @@ ...@@ -2076,7 +2076,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "a1rC/GDq5JibUD5FxEWHz4" "_id": "3dg5gjU0hDzbpb2f7nxakd"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -2139,7 +2139,7 @@ ...@@ -2139,7 +2139,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "406BrI7o5KzL0W85bEu787" "_id": "b2ffgz8QlDKrFp0hCHleNG"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -2172,7 +2172,7 @@ ...@@ -2172,7 +2172,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "adM4WbRAROZqYzg2Uys2Im" "_id": "39X28eTaVCAbJ/ocBNDhxr"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -2235,7 +2235,7 @@ ...@@ -2235,7 +2235,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "6aWgkHGKlPsrjuEc/91e/a" "_id": "13ZTJlg0pHvoIJkiFifx4X"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -2268,7 +2268,7 @@ ...@@ -2268,7 +2268,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "dcPM6fUe9EPKUjhhub5H84" "_id": "55VjrW2xdDKLQGgznYXCXU"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -2682,7 +2682,7 @@ ...@@ -2682,7 +2682,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 380, "width": 420,
"height": 176.04 "height": 176.04
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -2756,7 +2756,7 @@ ...@@ -2756,7 +2756,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-190, -210,
19.980000000000004, 19.980000000000004,
0, 0,
0, 0,
...@@ -2780,7 +2780,7 @@ ...@@ -2780,7 +2780,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "fbwDKA66FGxaQ7QV8Psihg" "_id": "0a3IKrcVRLDJURBAKmJdLR"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -2813,7 +2813,7 @@ ...@@ -2813,7 +2813,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "f3ikBamuNE2rjHHdVhuqM7" "_id": "57HjW6dBdP9I/+WDSAFKl/"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -2852,7 +2852,7 @@ ...@@ -2852,7 +2852,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-190, -210,
-34.019999999999996, -34.019999999999996,
0, 0,
0, 0,
...@@ -2876,7 +2876,7 @@ ...@@ -2876,7 +2876,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "a6CzqiA9ZDEZ1AYEAW77JY" "_id": "2dgSlFsK5NxpNmhUjNs+GZ"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -2909,7 +2909,7 @@ ...@@ -2909,7 +2909,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "22ml3u0CRI+7cgCRGvvjAk" "_id": "a0E6D0Pd5F+LjFgM3ZnRK6"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -2948,7 +2948,7 @@ ...@@ -2948,7 +2948,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-102.94, -122.94,
-34.019999999999996, -34.019999999999996,
0, 0,
0, 0,
...@@ -2972,7 +2972,7 @@ ...@@ -2972,7 +2972,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "26uytclO5BpLE+qs3NpVlS" "_id": "fcvkIeC+tGnoL3HRbI3Blw"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3005,7 +3005,7 @@ ...@@ -3005,7 +3005,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "b9WFLapgVOMYu2RMoy/4Bi" "_id": "016UQrpnJLObTgPFQxxizx"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -3044,7 +3044,7 @@ ...@@ -3044,7 +3044,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-190, -210,
-88.02, -88.02,
0, 0,
0, 0,
...@@ -3068,7 +3068,7 @@ ...@@ -3068,7 +3068,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "60fxlwhCJEjqvFul+R6kwD" "_id": "4a46FH8MRCaLPTRiiKzIyJ"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3101,7 +3101,7 @@ ...@@ -3101,7 +3101,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "22Y6zmLNBIWJPAibGDEwkH" "_id": "318Wzl5HtJ7qh0IVwpouRq"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -3140,7 +3140,7 @@ ...@@ -3140,7 +3140,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-90.94, -110.94,
-88.02, -88.02,
0, 0,
0, 0,
...@@ -3164,7 +3164,7 @@ ...@@ -3164,7 +3164,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "2cm49y0gtI/rnKPH5/SJO1" "_id": "0bs1l6jHVDzpI0nwp97XgT"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3197,7 +3197,7 @@ ...@@ -3197,7 +3197,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "c1MfjU4Y9EtLgLKvjwudSj" "_id": "fbZvztgsRHy5ylKmIpO+t+"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -3214,7 +3214,7 @@ ...@@ -3214,7 +3214,7 @@
"_N$fontSize": 54, "_N$fontSize": 54,
"_N$font": null, "_N$font": null,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_N$maxWidth": 380, "_N$maxWidth": 420,
"_N$lineHeight": 54, "_N$lineHeight": 54,
"_N$imageAtlas": null, "_N$imageAtlas": null,
"_N$handleTouchEvent": true, "_N$handleTouchEvent": true,
...@@ -3525,7 +3525,7 @@ ...@@ -3525,7 +3525,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "c3K0fOGLFAKqKMA9dsnTrZ" "_id": "b8V+p/2L9GTID/Q6fiqZFW"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3558,7 +3558,7 @@ ...@@ -3558,7 +3558,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "3bjHheuqRObqtVRQ3v4xVJ" "_id": "74j4/ccaBC7Lc1gx9X/QY+"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -3621,7 +3621,7 @@ ...@@ -3621,7 +3621,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "5ag6aqGqpPMbgzgGsChDTd" "_id": "07zmUbrgJLo70TEJZwxWFs"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3654,7 +3654,7 @@ ...@@ -3654,7 +3654,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "ddV+f9vf5KXIxqI9FPbpLG" "_id": "c574VPrBNCEr97f2VZ34Ot"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -3717,7 +3717,7 @@ ...@@ -3717,7 +3717,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "f4GWF4Ip5EJLnQV02KGJFD" "_id": "6dlAV9ylpDgZi2gdNsptGC"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3750,7 +3750,7 @@ ...@@ -3750,7 +3750,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "dbP3Ee771DCrMYK5p6Y1A/" "_id": "5aH+HHGmpAOoBXmJQgV6a6"
}, },
{ {
"__type__": "cc.PrivateNode", "__type__": "cc.PrivateNode",
...@@ -3813,7 +3813,7 @@ ...@@ -3813,7 +3813,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "cab0CSqVlCqYtnsJsW6eYl" "_id": "5cEPfSKURHnKYr/4BhO3aE"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -3846,7 +3846,7 @@ ...@@ -3846,7 +3846,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "3ar/iu5f5Kn66AVOoOWHPJ" "_id": "bfNIDXDdxJG60g+6r6PIdq"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -5705,6 +5705,30 @@ ...@@ -5705,6 +5705,30 @@
"__id__": 2 "__id__": 2
}, },
"_enabled": true, "_enabled": true,
"item_main": {
"__id__": 14
},
"item_vegetables": {
"__id__": 34
},
"item_meat": {
"__id__": 49
},
"item_pie": {
"__id__": 66
},
"layout_main": {
"__id__": 84
},
"layout_vegetables": {
"__id__": 85
},
"layout_meat": {
"__id__": 86
},
"layout_pie": {
"__id__": 87
},
"_id": "eaTVUpqahPfZeO9+sUI7RP" "_id": "eaTVUpqahPfZeO9+sUI7RP"
} }
] ]
\ No newline at end of file
import { asyncDelay, onHomeworkFinish } from "../script/util"; import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import pg from "./pg";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -25,46 +26,218 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -25,46 +26,218 @@ export default class SceneComponent extends MyCocosSceneComponent {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
this.initListener(); this.initEvent();
this.initGame();
} }
_cantouch = null; _cantouch = null;
questions: Array<any>;
current: number;
initData() { initData() {
// 所有全局变量 默认都是null // 所有全局变量 默认都是null
this._cantouch = true; this._cantouch = true;
this.current = 0;
this.questions = this.data.questions;
} }
// 当前数据
get currentQuestion() { return this.questions[this.current] }
get preQuestion() { return this.questions[this.current - 1] }
get nextQuestion() { return this.questions[this.current + 1] }
// 5个音频播放,如果没有自动跳过
// 结束
get audioEnd() { return this.data.audioEnd }
// 完成一个
get auidoFinish() { return this.data.auidoFinish }
// 肉饼拖拽下来
get audioMeet() { return this.data.audioMeet }
// 开始
get audioStart() { return this.data.audioStart }
// 蔬菜拖拽下来
get audioVegetable() { return this.data.audioVegetable }
@property(cc.Node) public item_main: cc.Node = null;
@property(cc.Node) public item_vegetables: cc.Node = null;
@property(cc.Node) public item_meat: cc.Node = null;
@property(cc.Node) public item_pie: cc.Node = null;
@property(cc.Node) public layout_main: cc.Node = null;
@property(cc.Node) public layout_vegetables: cc.Node = null;
@property(cc.Node) public layout_meat: cc.Node = null;
@property(cc.Node) public layout_pie: cc.Node = null;
// 初始化页面
initView() { initView() {
this.item_main.active = false;
this.item_vegetables.active = false;
this.item_meat.active = false;
this.item_pie.active = false;
this.hideGuide();
this.updateBtns();
} }
initListener() {
initEvent() {
let layout_btn = pg.view.find(this, 'layout_btn');
let btn_left = pg.view.find(layout_btn, 'btn_left');
let btn_right = pg.view.find(layout_btn, 'btn_right');
pg.view.touchOn(btn_left, this.onTouchLast, this);
pg.view.touchOn(btn_right, this.onTouchNext, this);
} }
// 5个音频播放,如果没有自动跳过 initGame() {
this.meetNodes = [];
// 初始化场景所有内容物
//标题刷新 标题如果不配置,就不显示那个黄色标题小标签。 三种情况 题干无、题干有、题干图片+文字 文字默认颜色和高亮颜色都是不同的。超框体缩字。
updateItemMain() { // 肉饼区域初始化
this.initLayoutMeet();
// 蔬菜部分初始化
// 开始第一题(中间初始化)
this.initLayoutMain();
}
//-------------------------------肉饼区域---------------------------------
static meetDefaultPos: cc.Vec2 = cc.v2(-655, 172);
static meetSpace: cc.Vec2 = cc.v2(0, 30);
private meetNodes: Array<cc.Node>;
initLayoutMeet() {
// 计算肉饼总数量
this.questions.forEach((question, i) => {
// 创建节点
let node = pg.view.clone(this.item_meat);
this.layout_meat.addChild(node)
// 刷新节点
this.updateItemMeet(node, question);
// 设定坐标
let pos = this.getMeetPosByI(i);
node.x = pos.x
node.y = pos.y
// 放入数组中便于引用
this.meetNodes.push(node);
})
} }
// 左侧图片/文字 文字有多色高亮 文字默认颜色和高亮颜色都是不同的。 // 左侧图片/文字 文字有多色高亮 文字默认颜色和高亮颜色都是不同的。
updateItemMeet() { updateItemMeet(item, data) {
item.data = data;
item.active = true;
let img = pg.view.find(item, 'img');
if (data.meetType.indexOf('img') > -1) {
img.active = true;
pg.view.setNetImg(img, data.meetImage, { w: 350, h: 220 })
} else {
img.active = false;
}
let text = pg.view.find(item, 'text');
if (data.meetType.indexOf('text') > -1) {
text.active = true;
let str = this.getText(data.meetTextArr, `#F7D63A`, `#FFFFFF`);
text.getComponent(cc.RichText).string = str;
} else {
text.active = false;
}
item.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMeetMove, this);
item.on(cc.Node.EventType.TOUCH_END, this.onTouchMeetEnd, this);
}
getMeetPosByI(i) {
let pos = cc.v2(SceneComponent.meetDefaultPos)
pos.y += i * SceneComponent.meetSpace.y;
return pos;
} }
onTouchMeetMove() {
}
onTouchMeetEnd() {
}
//-------------------------------中间区域---------------------------------
static mainDefaultPos: cc.Vec2 = cc.v2(-48.822, -93.308);
static mainStartPos: cc.Vec2 = cc.v2(-48.822, 693.308);
initLayoutMain() {
// init必定是第一个
let node = pg.view.clone(this.item_main);
this.layout_meat.addChild(node)
node.x = SceneComponent.mainDefaultPos.x;
node.y = SceneComponent.mainDefaultPos.y;
this.updateItemMain(node, this.currentQuestion);
}
//标题刷新 标题如果不配置,就不显示那个黄色标题小标签。 三种情况 题干无、题干有、题干图片+文字 文字默认颜色和高亮颜色都是不同的。超框体缩字。
updateItemMain(item, data) {
item.data = data;
item.active = true;
let img = pg.view.find(item, 'img');
if (data.mainType.indexOf('img') > -1) {
img.active = true;
pg.view.setNetImg(img, data.mainImage, { w: 300, h: 200 })
} else {
img.active = false;
}
let text = pg.view.find(item, 'text');
if (data.mainType.indexOf('text') > -1) {
text.active = true;
let str = this.getText(data.mainTextArr, `#AF5725`, `#00580A`);
text.getComponent(cc.RichText).string = str;
} else {
text.active = false;
}
let bg_title = pg.view.find(item, 'bg_title');
bg_title.active = !!data.title
pg.view.setString(pg.view.find(bg_title, 'label'), data.title);
}
// 右侧文字高亮 右上角菜叶子我给了一个,但是你展示在右上角时,每一片都需要有5-10度的转动。 // 右侧文字高亮 右上角菜叶子我给了一个,但是你展示在右上角时,每一片都需要有5-10度的转动。
updateItemVegetable() { updateItemVegetable() {
} }
// 先引导左边肉饼, 再引导菜叶子 引导动画虽然有顺序,但是用户第一题跟随引导完,自己做其他题时候拖拽顺序不被限制。
// 停留时间8s以上,手指提示拖拽。
startGuide() {
}
// 5.上面掉下来一个面包片 炸星星 上面那个面包片掉下来之后,需要弹起一下再落下。 // 5.上面掉下来一个面包片 炸星星 上面那个面包片掉下来之后,需要弹起一下再落下。
updateItemPie() { updateItemPie() {
//面包片有图片+文字 或 文字 //面包片有图片+文字 或 文字
} }
//----------------------------------通用部分-----------------------------------
getText(list, colorNormal, colorLight) {
// 列表处理
let str = "";
for (let i = 0; i < list.length; i++) {
let li = list[i];
let s = "";
if (li.block) {
s = `<color=${colorLight}> ${li.text} </c>`
} else {
s = `<color=${colorNormal}> ${li.text} </c>`
}
str += s;
}
return str;
}
//-----------------------------------翻页部分------------------------------------
updateBtns() {
let layout_btn = pg.view.find(this, 'layout_btn');
let btn_left = pg.view.find(layout_btn, 'btn_left');
let btn_right = pg.view.find(layout_btn, 'btn_right');
let img_left = pg.view.find(layout_btn, 'img_left');
let img_right = pg.view.find(layout_btn, 'img_right');
btn_left.active = !!this.preQuestion
img_left.active = !this.preQuestion
btn_right.active = !!this.nextQuestion
img_right.active = !this.nextQuestion
}
// 用户点击下一页, 面包移出画面。 当不做题的时候点击。面包向下移出,蔬菜和肉饼乡下移动回来。 // 用户点击下一页, 面包移出画面。 当不做题的时候点击。面包向下移出,蔬菜和肉饼乡下移动回来。
onTouchNext() { onTouchNext() {
...@@ -74,8 +247,39 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -74,8 +247,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
//-----------------------------------引导部分------------------------------------
// 先引导左边肉饼, 再引导菜叶子 引导动画虽然有顺序,但是用户第一题跟随引导完,自己做其他题时候拖拽顺序不被限制。
// 停留时间8s以上,手指提示拖拽。
startGuide() {
}
hideGuide() {
let layout_tip = pg.view.find(this, 'layout_tip');
let line_left = pg.view.find(layout_tip, 'line_left');
let line_right = pg.view.find(layout_tip, 'line_right');
line_left.active = false;
line_right.active = false;
}
showGuideLeft() {
}
showGuideRight() {
}
showGuide(type) {
let layout_tip = pg.view.find(this, 'layout_tip');
let line_left = pg.view.find(layout_tip, 'line_left');
let line_right = pg.view.find(layout_tip, 'line_right');
line_left.active = type == 'left';
line_right.active = type == 'right';
}
// 下一题刷新选项 // 下一题刷新选项
nextQuestion() { nextStage() {
} }
...@@ -88,23 +292,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -88,23 +292,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
showData(label_rich, data) {
let list = data.result.sentences[0].details;
// 列表处理
let str = "";
for (let i = 0; i < list.length; i++) {
let li = list[i];
let s = "";
if (li.overall > 40) {
s = `<color=#000000>${li.word}</c>`
} else {
s = `<color=#FF0000> ${li.word} </c>`
}
str += s;
}
label_rich.getComponent(cc.RichText).string = str;
}
playLocalAudio(audioName) { playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource); const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -115,3 +302,101 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -115,3 +302,101 @@ export default class SceneComponent extends MyCocosSceneComponent {
}) })
} }
} }
/*
let question = {
title: "Countries",
type: "img",
mainType: "empty",
mainText: "this is info",
mainTextArr: [
{
text: "this",
block: true,
check: 1,
},
{
text: "is",
block: false,
check: 1,
},
{
text: "info",
block: false,
check: 1,
},
],
meetType: "img",
meetText: "test info",
meetTextArr: [
{
text: "test",
block: true,
check: 1,
},
{
text: "info",
block: false,
check: 1,
},
],
vegetableType: "text",
pieType: "img_text",
pieText: "Countries have their own flag.",
pieTextArr: [
{
text: "Countries",
block: false,
check: 1,
},
{
text: "have",
block: true,
check: 1,
},
{
text: "their",
block: true,
check: 1,
},
{
text: "own",
block: true,
check: 1,
},
{
text: "flag.",
block: false,
check: 1,
},
],
meetImage: "http://staging-teach.cdn.ireadabc.com/b4494456199505bdf990fff96a0c9fb8.jpg",
vegetableText: "have one's own flag",
vegetableTextArr: [
{
text: "have",
block: false,
check: 1,
},
{
text: "one's",
block: false,
check: 1,
},
{
text: "own",
block: false,
check: 1,
},
{
text: "flag",
block: true,
check: 1,
},
],
pieImage: "http://staging-teach.cdn.ireadabc.com/0205b2ff3fc18a109419aec0c84d5bfe.png",
}
*/
\ No newline at end of file
import pg from "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class dg_xiaodi extends cc.Component {
@property(cc.Node)
aniRole: cc.Node = null;
@property moveX: number = 500;
private defaultX: number;
onLoad() {
this.defaultX = this.aniRole.x;
}
private audioIdEnter: any;
playEnter(audioUrl) {
return new Promise((resolve, reject) => {
this.node.active = true;
let startX = this.defaultX + this.moveX;
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: 0 })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdEnter = null;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: -1800 })
.call(() => {
this.scheduleOnce(() => {
resolve('');
}, 0.5)
})
.start();
}, audioId => {
this.audioIdEnter = audioId;
})
})
.start();
});
}
playEnterEnd() {
this.node.active = false;
if (this.audioIdEnter) {
cc.audioEngine.stopEffect(this.audioIdEnter)
}
}
private audioIdOver: any;
playOver(audioUrl) {
this.node.active = true;
let startX = this.defaultX + this.moveX;
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.3, { x: this.defaultX })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdOver = null;
pg.view.playDBAnimation(this.aniRole, 'normal');
}, audioId => {
this.audioIdOver = audioId;
})
})
.start();
}
playOverEnd() {
this.node.active = false;
if (this.audioIdOver) {
cc.audioEngine.stopEffect(this.audioIdOver)
}
}
start() {
}
update(dt) {
}
}
{
"ver": "1.0.8",
"uuid": "4c50260e-13ba-4b6a-8001-fa53f011a8bc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "temp/vscode-dist", "outDir": "temp/vscode-dist",
"allowJs": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true
}, },
"exclude": [ "exclude": [
......
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