Commit 1cf96696 authored by Tt's avatar Tt

小炮台完成

parent 9f5f5457
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "0b8bef42-5045-4dc7-b5c8-04df72fa967a",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "cb9fa4ea-66ca-45af-ad31-e445c7b0ef32",
"uuid": "945d5d0e-1b05-4e27-88f5-d8315f4f8955",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "2.0.1",
"uuid": "dbf5caaa-d303-4598-8874-54c414cae4af",
"downloadMode": 0,
"duration": 1.410612,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "a300ce77-2748-4d1d-a564-df739bea7653",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "91cbe320-bb88-4d89-8274-4bae5a5c613c",
"downloadMode": 0,
"duration": 0.496327,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "326d6a8a-46b7-4a65-8987-16be449367df",
"downloadMode": 0,
"duration": 1.619592,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "0853721c-3f55-4eb2-873d-e3081cfadd4b",
"uuid": "47946d92-b3e1-4eb2-b153-10f23f015214",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "f44daac1-2ed5-4dab-a2ce-3c99da76f32b",
"subMetas": {}
}
\ No newline at end of file
{"name":"cannon","imagePath":"cannon_tex.png","SubTexture":[{"name":"炮管正面/底座","x":1,"height":107,"y":325,"width":184},{"name":"炮管正面/小管正","x":305,"height":136,"y":250,"width":102},{"name":"炮管正面/大管正","x":157,"height":120,"y":1,"width":146},{"name":"炮管正面/管口正","x":1,"height":160,"y":1,"width":154},{"name":"炮管正面/小管左","x":287,"height":125,"y":123,"width":126},{"name":"炮管正面/大管左","x":150,"height":139,"y":163,"width":135},{"name":"炮管正面/管口左","x":1,"height":160,"y":163,"width":147},{"name":"炮管正面/炮弹","x":187,"height":104,"y":304,"width":103},{"name":"炮管正面/线","x":150,"height":13,"y":304,"width":21},{"name":"炮管正面/fire","x":187,"height":79,"y":410,"width":30}],"height":512,"width":512}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "0f348577-177a-47ae-80b4-4caa32c9b400",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e3caa708-9f74-4b92-a08f-59b5aae1034c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 512,
"platformSettings": {},
"subMetas": {
"cannon_tex": {
"ver": "1.0.4",
"uuid": "3de562ef-76c6-4c63-8d48-5e5616c4b9db",
"rawTextureUuid": "e3caa708-9f74-4b92-a08f-59b5aae1034c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -49,
"offsetY": 11,
"trimX": 1,
"trimY": 1,
"width": 412,
"height": 488,
"rawWidth": 512,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{"name":"smoke","version":"5.5","frameRate":24,"isGlobal":0,"armature":[{"name":"Sprite","animation":[{"name":"Sprite","ik":[],"ffd":[],"frame":[],"duration":61,"slot":[{"name":"sheetSlot","displayFrame":[{"duration":1},{"duration":1,"value":1},{"duration":1,"value":2},{"duration":1,"value":3},{"duration":1,"value":4},{"duration":1,"value":5},{"duration":1,"value":6},{"duration":1,"value":7},{"duration":1,"value":8},{"duration":1,"value":9},{"duration":1,"value":10},{"duration":1,"value":11},{"duration":1,"value":12},{"duration":1,"value":13},{"duration":1,"value":14},{"duration":1,"value":15},{"duration":1,"value":16},{"duration":1,"value":17},{"duration":1,"value":18},{"duration":1,"value":19},{"duration":1,"value":20},{"duration":1,"value":21},{"duration":1,"value":22},{"duration":1,"value":23},{"duration":1,"value":24},{"duration":1,"value":25},{"duration":1,"value":26},{"duration":1,"value":27},{"duration":1,"value":28},{"duration":1,"value":29},{"duration":1,"value":30},{"duration":1,"value":31},{"duration":1,"value":32},{"duration":1,"value":33},{"duration":1,"value":34},{"duration":1,"value":35},{"duration":1,"value":36},{"duration":1,"value":37},{"duration":1,"value":38},{"duration":1,"value":39},{"duration":1,"value":40},{"duration":1,"value":41},{"duration":1,"value":42},{"duration":1,"value":43},{"duration":1,"value":44},{"duration":1,"value":45},{"duration":1,"value":46},{"duration":1,"value":47},{"duration":1,"value":48},{"duration":1,"value":49},{"duration":1,"value":50},{"duration":1,"value":51},{"duration":1,"value":52},{"duration":1,"value":53},{"duration":1,"value":54},{"duration":1,"value":55},{"duration":1,"value":56},{"duration":1,"value":57},{"duration":1,"value":58},{"duration":1,"value":59},{"duration":1,"value":60}],"colorFrame":[]}],"bone":[],"playTimes":0}],"defaultActions":[{"gotoAndPlay":"Sprite"}],"bone":[{"name":"root","transform":{}}],"skin":[{"name":"","slot":[{"name":"sheetSlot","display":[{"name":"1","transform":{},"type":"image","path":"1"},{"name":"2","transform":{},"type":"image","path":"2"},{"name":"3","transform":{},"type":"image","path":"3"},{"name":"4","transform":{},"type":"image","path":"4"},{"name":"5","transform":{},"type":"image","path":"5"},{"name":"6","transform":{},"type":"image","path":"6"},{"name":"7","transform":{},"type":"image","path":"7"},{"name":"8","transform":{},"type":"image","path":"8"},{"name":"9","transform":{},"type":"image","path":"9"},{"name":"10","transform":{},"type":"image","path":"10"},{"name":"11","transform":{},"type":"image","path":"11"},{"name":"12","transform":{},"type":"image","path":"12"},{"name":"13","transform":{},"type":"image","path":"13"},{"name":"14","transform":{},"type":"image","path":"14"},{"name":"15","transform":{},"type":"image","path":"15"},{"name":"16","transform":{},"type":"image","path":"16"},{"name":"17","transform":{},"type":"image","path":"17"},{"name":"18","transform":{},"type":"image","path":"18"},{"name":"19","transform":{},"type":"image","path":"19"},{"name":"20","transform":{},"type":"image","path":"20"},{"name":"21","transform":{},"type":"image","path":"21"},{"name":"22","transform":{},"type":"image","path":"22"},{"name":"23","transform":{},"type":"image","path":"23"},{"name":"24","transform":{},"type":"image","path":"24"},{"name":"25","transform":{},"type":"image","path":"25"},{"name":"26","transform":{},"type":"image","path":"26"},{"name":"27","transform":{},"type":"image","path":"27"},{"name":"28","transform":{},"type":"image","path":"28"},{"name":"29","transform":{},"type":"image","path":"29"},{"name":"30","transform":{},"type":"image","path":"30"},{"name":"31","transform":{},"type":"image","path":"31"},{"name":"32","transform":{},"type":"image","path":"32"},{"name":"33","transform":{},"type":"image","path":"33"},{"name":"34","transform":{},"type":"image","path":"34"},{"name":"35","transform":{},"type":"image","path":"35"},{"name":"36","transform":{},"type":"image","path":"36"},{"name":"37","transform":{},"type":"image","path":"37"},{"name":"38","transform":{},"type":"image","path":"38"},{"name":"39","transform":{},"type":"image","path":"39"},{"name":"40","transform":{},"type":"image","path":"40"},{"name":"41","transform":{},"type":"image","path":"41"},{"name":"42","transform":{},"type":"image","path":"42"},{"name":"43","transform":{},"type":"image","path":"43"},{"name":"44","transform":{},"type":"image","path":"44"},{"name":"45","transform":{},"type":"image","path":"45"},{"name":"46","transform":{},"type":"image","path":"46"},{"name":"47","transform":{},"type":"image","path":"47"},{"name":"48","transform":{},"type":"image","path":"48"},{"name":"49","transform":{},"type":"image","path":"49"},{"name":"50","transform":{},"type":"image","path":"50"},{"name":"51","transform":{},"type":"image","path":"51"},{"name":"52","transform":{},"type":"image","path":"52"},{"name":"53","transform":{},"type":"image","path":"53"},{"name":"54","transform":{},"type":"image","path":"54"},{"name":"55","transform":{},"type":"image","path":"55"},{"name":"56","transform":{},"type":"image","path":"56"},{"name":"57","transform":{},"type":"image","path":"57"},{"name":"58","transform":{},"type":"image","path":"58"},{"name":"59","transform":{},"type":"image","path":"59"},{"name":"61","transform":{},"type":"image","path":"61"},{"name":"62","transform":{},"type":"image","path":"62"}]}]}],"ik":[],"frameRate":24,"slot":[{"name":"sheetSlot","color":{},"parent":"root","displayIndex":4}],"type":"Sheet","aabb":{"x":-133.5,"height":275,"y":-137.5,"width":267}}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "ae0d6056-f9e5-48d1-99d0-11df0a913f5d",
"subMetas": {}
}
\ No newline at end of file
{"name":"smoke","imagePath":"smoke_tex.png","SubTexture":[{"name":"15","x":237,"height":236,"frameWidth":267,"y":1240,"frameY":-19,"frameHeight":275,"frameX":-16,"width":235},{"name":"10","x":1574,"height":235,"frameWidth":267,"y":505,"frameY":-20,"frameHeight":275,"frameX":-17,"width":234},{"name":"7","x":1510,"height":233,"frameWidth":267,"y":755,"frameY":-21,"frameHeight":275,"frameX":-17,"width":233},{"name":"55","x":474,"height":192,"frameWidth":267,"y":1473,"frameY":-41,"frameHeight":275,"frameX":-31,"width":206},{"name":"62","x":1845,"height":153,"frameWidth":267,"y":1,"frameY":-61,"frameHeight":275,"frameX":-54,"width":159},{"name":"2","x":1513,"height":227,"frameWidth":267,"y":1222,"frameY":-24,"frameHeight":275,"frameX":-20,"width":227},{"name":"18","x":1038,"height":240,"frameWidth":267,"y":748,"frameY":-17,"frameHeight":275,"frameX":-16,"width":235},{"name":"46","x":1280,"height":224,"frameWidth":267,"y":1447,"frameY":-25,"frameHeight":275,"frameX":-22,"width":223},{"name":"22","x":1328,"height":235,"frameWidth":267,"y":518,"frameY":-20,"frameHeight":275,"frameX":-12,"width":244},{"name":"14","x":1,"height":236,"frameWidth":267,"y":1269,"frameY":-19,"frameHeight":275,"frameX":-17,"width":234},{"name":"27","x":1065,"height":247,"frameWidth":267,"y":250,"frameY":-14,"frameHeight":275,"frameX":-3,"width":261},{"name":"44","x":1810,"height":228,"frameWidth":267,"y":741,"frameY":-23,"frameHeight":275,"frameX":-15,"width":237},{"name":"54","x":682,"height":192,"frameWidth":267,"y":1645,"frameY":-41,"frameHeight":275,"frameX":-31,"width":205},{"name":"11","x":759,"height":236,"frameWidth":267,"y":994,"frameY":-19,"frameHeight":275,"frameX":-16,"width":235},{"name":"24","x":237,"height":239,"frameWidth":267,"y":759,"frameY":-18,"frameHeight":275,"frameX":-8,"width":252},{"name":"30","x":1,"height":251,"frameWidth":267,"y":1,"frameY":-12,"frameHeight":275,"frameX":0,"width":267},{"name":"6","x":1810,"height":232,"frameWidth":267,"y":971,"frameY":-21,"frameHeight":275,"frameX":-18,"width":232},{"name":"45","x":1742,"height":225,"frameWidth":267,"y":1437,"frameY":-25,"frameHeight":275,"frameX":-20,"width":228},{"name":"29","x":538,"height":250,"frameWidth":267,"y":1,"frameY":-12,"frameHeight":275,"frameX":-1,"width":265},{"name":"43","x":1328,"height":238,"frameWidth":267,"y":278,"frameY":-18,"frameHeight":275,"frameX":-13,"width":242},{"name":"21","x":1038,"height":234,"frameWidth":267,"y":990,"frameY":-20,"frameHeight":275,"frameX":-14,"width":240},{"name":"49","x":996,"height":214,"frameWidth":267,"y":1226,"frameY":-30,"frameHeight":275,"frameX":-24,"width":219},{"name":"51","x":728,"height":210,"frameWidth":267,"y":1232,"frameY":-32,"frameHeight":275,"frameX":-26,"width":216},{"name":"28","x":1581,"height":248,"frameWidth":267,"y":1,"frameY":-13,"frameHeight":275,"frameX":-3,"width":262},{"name":"47","x":1280,"height":221,"frameWidth":267,"y":1224,"frameY":-27,"frameHeight":275,"frameX":-20,"width":227},{"name":"9","x":1810,"height":234,"frameWidth":267,"y":505,"frameY":-20,"frameHeight":275,"frameX":-17,"width":234},{"name":"53","x":1839,"height":196,"frameWidth":267,"y":251,"frameY":-39,"frameHeight":275,"frameX":-30,"width":208},{"name":"19","x":1,"height":271,"frameWidth":267,"y":756,"frameY":-2,"frameHeight":275,"frameX":-17,"width":234},{"name":"57","x":1,"height":187,"frameWidth":267,"y":1667,"frameY":-44,"frameHeight":275,"frameX":-31,"width":205},{"name":"16","x":759,"height":238,"frameWidth":267,"y":754,"frameY":-18,"frameHeight":275,"frameX":-16,"width":235},{"name":"17","x":1,"height":238,"frameWidth":267,"y":1029,"frameY":-18,"frameHeight":275,"frameX":-17,"width":234},{"name":"36","x":805,"height":250,"frameWidth":267,"y":250,"frameY":-12,"frameHeight":275,"frameX":-5,"width":258},{"name":"37","x":1581,"height":252,"frameWidth":267,"y":251,"frameY":-11,"frameHeight":275,"frameX":-6,"width":256},{"name":"56","x":237,"height":190,"frameWidth":267,"y":1478,"frameY":-42,"frameHeight":275,"frameX":-30,"width":207},{"name":"38","x":1,"height":252,"frameWidth":267,"y":502,"frameY":-11,"frameHeight":275,"frameX":-7,"width":253},{"name":"5","x":1280,"height":232,"frameWidth":267,"y":990,"frameY":-21,"frameHeight":275,"frameX":-18,"width":231},{"name":"23","x":237,"height":238,"frameWidth":267,"y":1000,"frameY":-18,"frameHeight":275,"frameX":-9,"width":249},{"name":"52","x":728,"height":199,"frameWidth":267,"y":1444,"frameY":-38,"frameHeight":275,"frameX":-26,"width":215},{"name":"8","x":1275,"height":233,"frameWidth":267,"y":755,"frameY":-21,"frameHeight":275,"frameX":-17,"width":233},{"name":"35","x":270,"height":249,"frameWidth":267,"y":253,"frameY":-13,"frameHeight":275,"frameX":-5,"width":258},{"name":"41","x":784,"height":250,"frameWidth":267,"y":502,"frameY":-12,"frameHeight":275,"frameX":-8,"width":252},{"name":"3","x":1746,"height":230,"frameWidth":267,"y":1205,"frameY":-22,"frameHeight":275,"frameX":-19,"width":229},{"name":"12","x":491,"height":236,"frameWidth":267,"y":997,"frameY":-19,"frameHeight":275,"frameX":-16,"width":235},{"name":"4","x":1513,"height":230,"frameWidth":267,"y":990,"frameY":-22,"frameHeight":275,"frameX":-18,"width":231},{"name":"1","x":1505,"height":222,"frameWidth":267,"y":1451,"frameY":-26,"frameHeight":275,"frameX":-23,"width":222},{"name":"61","x":1,"height":155,"frameWidth":267,"y":1507,"frameY":-60,"frameHeight":275,"frameX":-38,"width":192},{"name":"34","x":1065,"height":247,"frameWidth":267,"y":499,"frameY":-14,"frameHeight":275,"frameX":-3,"width":261},{"name":"42","x":509,"height":244,"frameWidth":267,"y":751,"frameY":-15,"frameHeight":275,"frameX":-10,"width":248},{"name":"33","x":1074,"height":247,"frameWidth":267,"y":1,"frameY":-14,"frameHeight":275,"frameX":-1,"width":265},{"name":"32","x":805,"height":247,"frameWidth":267,"y":1,"frameY":-14,"frameHeight":275,"frameX":0,"width":267},{"name":"39","x":256,"height":253,"frameWidth":267,"y":504,"frameY":-11,"frameHeight":275,"frameX":-8,"width":251},{"name":"50","x":996,"height":214,"frameWidth":267,"y":1442,"frameY":-30,"frameHeight":275,"frameX":-26,"width":215},{"name":"58","x":446,"height":170,"frameWidth":267,"y":1667,"frameY":-52,"frameHeight":275,"frameX":-32,"width":203},{"name":"59","x":446,"height":166,"frameWidth":267,"y":1839,"frameY":-54,"frameHeight":275,"frameX":-36,"width":196},{"name":"20","x":1341,"height":275,"frameWidth":267,"y":1,"frameY":0,"frameHeight":275,"frameX":-15,"width":238},{"name":"26","x":1,"height":239,"frameWidth":267,"y":254,"frameY":-18,"frameHeight":275,"frameX":-5,"width":258},{"name":"25","x":509,"height":241,"frameWidth":267,"y":508,"frameY":-17,"frameHeight":275,"frameX":-6,"width":255},{"name":"13","x":491,"height":236,"frameWidth":267,"y":1235,"frameY":-19,"frameHeight":275,"frameX":-16,"width":235},{"name":"31","x":270,"height":250,"frameWidth":267,"y":1,"frameY":-12,"frameHeight":275,"frameX":-1,"width":266},{"name":"40","x":530,"height":253,"frameWidth":267,"y":253,"frameY":-11,"frameHeight":275,"frameX":-8,"width":252},{"name":"48","x":1729,"height":220,"frameWidth":267,"y":1673,"frameY":-27,"frameHeight":275,"frameX":-25,"width":218}],"height":2048,"width":2048}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "44b7c994-54f2-4f0f-9ac9-cf09ec2e3df6",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "2.3.5",
"uuid": "5b80eb61-2581-4584-9a9e-4da0ad4dbbb0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2048,
"height": 2048,
"platformSettings": {},
"subMetas": {
"smoke_tex": {
"ver": "1.0.4",
"uuid": "480b7874-ca43-4e54-847e-76244ea8a1f4",
"rawTextureUuid": "5b80eb61-2581-4584-9a9e-4da0ad4dbbb0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 21,
"trimX": 1,
"trimY": 1,
"width": 2046,
"height": 2004,
"rawWidth": 2048,
"rawHeight": 2048,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "aa7b55e1-dab4-4d30-86d8-ebc1881ce78d",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"name":"speak","version":"5.5","armature":[{"name":"Armature","slot":[{"name":"椭圆_11","color":{},"parent":"big"},{"name":"椭圆_11_拷贝","color":{},"z":1,"parent":"small"},{"name":"组_1","color":{},"z":2,"parent":"root"}],"defaultActions":[{"gotoAndPlay":"newAnimation"}],"aabb":{"x":-101.5312185134179,"height":204,"y":-101.03171071912247,"width":205},"skin":[{"name":"","slot":[{"name":"组_1","display":[{"name":"提示/组_1","transform":{"x":1.0034,"y":-5.0077},"type":"image","path":"提示/组_1"}]},{"name":"椭圆_11","display":[{"name":"提示/椭圆_11","transform":{"x":1.4845,"skY":-90,"y":-0.9839,"skX":-90},"type":"image","path":"提示/椭圆_11"}]},{"name":"椭圆_11_拷贝","display":[{"name":"提示/椭圆_11_拷贝","transform":{"x":-0.0038,"skY":-179.9215,"y":5.8107,"skX":-179.9215},"type":"image","path":"提示/椭圆_11_拷贝"}]}]}],"animation":[{"name":"newAnimation","frame":[],"bone":[{"name":"root","rotateFrame":[],"translateFrame":[],"scaleFrame":[]},{"name":"big","rotateFrame":[],"translateFrame":[],"scaleFrame":[{"tweenEasing":0,"duration":18},{"x":1.5,"y":1.5,"duration":0}]},{"name":"small","rotateFrame":[],"translateFrame":[],"scaleFrame":[{"tweenEasing":0,"duration":18},{"x":1.4,"y":1.4,"duration":0}]}],"playTimes":0,"ffd":[],"ik":[],"slot":[{"name":"椭圆_11","displayFrame":[],"colorFrame":[{"duration":18,"tweenEasing":0},{"duration":0,"color":{"aM":0}}]},{"name":"椭圆_11_拷贝","displayFrame":[],"colorFrame":[{"duration":18,"tweenEasing":0},{"duration":0,"color":{"aM":12}}]},{"name":"组_1","displayFrame":[],"colorFrame":[]}],"duration":18}],"bone":[{"name":"root","transform":{"x":0.4842,"skY":-0.0188,"y":0.4842,"skX":-0.0188}},{"name":"big","transform":{"x":-0.5,"skY":89.9812,"y":-1,"skX":89.9812},"parent":"root"},{"name":"small","transform":{"x":1.9369,"skY":179.9812,"y":0.0006,"skX":179.9812},"parent":"root"}],"frameRate":24,"type":"Armature","ik":[]}],"frameRate":24,"isGlobal":0}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "001bbdda-bdb6-4b66-9129-7c023000c8c7",
"subMetas": {}
}
\ No newline at end of file
{"name":"speak","imagePath":"speak_tex.png","SubTexture":[{"name":"提示/椭圆_11","x":1,"height":204,"y":1,"width":205},{"name":"提示/椭圆_11_拷贝","x":1,"height":156,"y":207,"width":156},{"name":"提示/组_1","x":159,"height":130,"y":207,"width":90}],"height":512,"width":256}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "4398de9b-3a89-4c33-919f-7d323b602208",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0c0d1cee-c023-48b9-a550-2753eaf75633",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 256,
"height": 512,
"platformSettings": {},
"subMetas": {
"speak_tex": {
"ver": "1.0.4",
"uuid": "ca3d9ce0-c6c3-4c0d-9474-08fe4122b52a",
"rawTextureUuid": "0c0d1cee-c023-48b9-a550-2753eaf75633",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -3,
"offsetY": 74,
"trimX": 1,
"trimY": 1,
"width": 248,
"height": 362,
"rawWidth": 256,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "20185448-a1ca-4de2-8b37-7bf6cdfccbae",
"uuid": "0285fb60-fa4a-4923-9b9c-e1da60f0cc3d",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.0",
"uuid": "a83e8433-286d-4232-a9d4-2a310dce4e8d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"uuid": "5669bf47-55dc-4e2f-8332-3d17b6170436",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "861f498a-b902-4bd4-af9a-a520620d3564",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "d96c76e1-bce1-42e1-8eaa-19ba3726d599",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "89c8a795-4b6c-4715-b803-c3e2c2a613ba",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "90f02105-42fe-4e8d-a506-e5a155a62c0c",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "e8bd16b0-3804-45a9-a8ca-f52c02224f55",
"uuid": "3f846ce4-6084-4db6-9ab5-8e1d5f6f5445",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"uuid": "409d19f5-2c4b-4a71-bd34-84ec0c3a3fce",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
......
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import Game, { FISH_OUT, GAME_STATE, Option } from "./tool/Game";
import pg from "./tool/pg";
const { ccclass, property } = cc._decorator;
export function getDegree(p1, p2) {
let vector = p2.sub(p1);
let degree = Math.atan(vector.y / vector.x) / Math.PI * 180;
if (vector.x >= 0) {
if (vector.y < 0) {
degree += 360;
}
} else {
if (vector.y > 0) {
degree += 180;
} else {
degree = 180 + degree;
}
}
return -(-degree + 90);//角度计算方法
}
let win: any = window;
let courseware = win.courseware;
enum GUN_STATE {
WAIT = 1,
SHUT_MIDDLE,
SHUT_LEFT,
SHUT_RIGHT
}
enum FISH_STATE {
NORMAL = 1,
BREAK,
FALL,
}
enum TIPS_STATE {
GOOD = 1,
TRY,
COM,
}
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initEvent();
}
protected onDestroy(): void {
pg.event.clear();
}
@property(cc.Node)
res: cc.Node = null;
@property(cc.Node)
layout_player: cc.Node = null;
@property(cc.Node)
layout_balloon: cc.Node = null;
@property(cc.Node)
layout_cannon: cc.Node = null;
@property(cc.Node)
btn_laba: cc.Node = null;
_cantouch = null;
initData() {
Game.getIns().init(this.data);
Game.getIns().reset();
// 所有全局变量 默认都是null
this._cantouch = true;
}
private layout_start: cc.Node;
private audioId: any;
private countDown: number = 999999;
private timeCount: number;
private startCount = 15;
async initView() {
cc.audioEngine.stopAllEffects();
this.layout_start = pg.view.find(this, "layout_start");
let touch = pg.view.find(this, "layout_start/touch");
this.layout_start.active = true;
let desc = this.layout_start.getChildByName("desc");
desc.getComponent(cc.Label).string = Game.getIns().questionText;
this.audioId = await pg.audio.playAudioByUrl(Game.getIns().question.audio, () => { }, (audioId) => {
if (audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) pg.audio.stopAudio(audioId);
});
if (this.audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) {
cc.audioEngine.stopAllEffects();
pg.audio.stopAudio(this.audioId);
}
touch.on(cc.Node.EventType.TOUCH_END, () => {
cc.audioEngine.stopAllEffects();
pg.audio.stopAudio(this.audioId);
pg.audio.playAudioByUrl(Game.getIns().question.audio);
})
}
initEvent() {
pg.view.touchOn(pg.view.find(this.layout_start, 'btn_start'), this.onTouchStart, this);
this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this);
pg.event.on("game_start", () => {
this.gameStart();
this.playLaba();
});
pg.event.on("play_laba_audio", () => {
this.playLaba();
});
pg.event.on("game_time_over", () => {
// alert("game_time_over")
//这里的事件会发送的很早。但是我们需要等待动画执行完了之后再开始后续的内容
Game.getIns().addPage();
if (!Game.getIns().isOver) return pg.event.emit("game_start");
//发送给上端最后的数据
// alert("game_finish")
// int total
// int right
// int[] scores
// let player = { right: Game.getIns().player.score, error: Game.getIns().player.error }
Game.getIns().state = GAME_STATE.OVER;
let data: any = {};
data.total = Game.getIns().getTotla;
data.right = Game.getIns().player.right;
data.scores = Game.getIns().player.voices;
this.log("total: " + data.total + " right: " + data.right);
onHomeworkFinish(data)
})
}
onTouchStart() {
pg.audio.playLocalAudio(cc.find(`Canvas/res/audio/btn`));
pg.event.emit("game_start");
}
private count: number;
private list: Option[];
private fishs: cc.Node[];
gameStart() {
Game.getIns().state = GAME_STATE.RUNNING;
//游戏开始小鱼出现等等
this.layout_start.active = false;
if (this.audioId > -1 && Game.getIns().state != GAME_STATE.WAIT) {
cc.audioEngine.stopAllEffects();
pg.audio.stopAudio(this.audioId);
}
//开始
// //根据数据随机热气球
// let page = Game.getIns().getCurrentPage();
// let list = page.optionList.concat();
// list = JSON.parse(JSON.stringify(list));
// list.sort((A, B) => { return Math.random() < 0.5 });
// Game.getIns().player.addScore(this.list.length);
this.count = 0;
this.lastCount = null;
this.fishs = [];
this.viewFishs = [];
this.touchFishs = [];
//根据顺序生成对应的鱼。
//顺序根据时间来进行跳动。当顺序跳动之后,就会产生新的鱼。
}
private lastCount: number;
private viewFishs: Option[];
private touchFishs: Option[];
update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return;
// if (this.fishLen < 5) this.count++;
// let fish = this.getFishByCount(this.count);
// if (fish) this.fishs.push(fish);
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => { resolve(id); });
})
}
private intervalId;
private playLaba() {
let btn_kaba2 = this.btn_laba.getChildByName("btn_laba2");
let btn_kaba3 = this.btn_laba.getChildByName("btn_laba3");
btn_kaba2.active = true;
btn_kaba3.active = true;
let count = 0;
if (this.intervalId) clearInterval(this.intervalId);
let stop = false;
this.intervalId = setInterval(() => {
count++;
btn_kaba2.active = count % 3 == 1;
btn_kaba3.active = count % 3 == 2;
if (stop && count % 3 == 2) clearInterval(this.intervalId);
}, 150)
pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio).then(() => { stop = true; })
}
}
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"uuid": "05985d6b-a863-40e2-ba42-3775e559b112",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "3b921bd9-8a2f-4453-895e-b5943e748d60",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "2c202f09-806d-495e-a073-166f6e6ab56f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "86d713c0-8182-403d-b248-b6d89b96fc22",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import Game, { GAME_STATE } from "../tool/Game";
import pg from "../tool/pg";
pg.event.clear();
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
// private btn_laba: cc.Node;
// private countDown: number = 999;
onLoad() {
this.initView();
this.initEvent();
}
private initEvent() {
pg.event.on("game_start", () => {
this.gameStart();
});
// pg.event.on("game_set_game_time", (count) => {
// this.countDown = count;
// });
// this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this);
}
private gameStart() {
// this.countDown = Game.getIns().getCurrentPage().duration;
// this.playLaba();
}
private initView() {
// this.btn_laba = cc.find("btn_laba", this.node);
}
// private intervalId;
// private playLaba() {
// let btn_kaba2 = this.btn_laba.getChildByName("btn_laba2");
// let btn_kaba3 = this.btn_laba.getChildByName("btn_laba3");
// btn_kaba2.active = true;
// btn_kaba3.active = true;
// let count = 0;
// if (this.intervalId) clearInterval(this.intervalId);
// let stop = false;
// this.intervalId = setInterval(() => {
// count++;
// btn_kaba2.active = count % 3 == 1;
// btn_kaba3.active = count % 3 == 2;
// if (stop && count % 3 == 2) clearInterval(this.intervalId);
// }, 150)
// pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio).then(() => { stop = true; })
// }
// private lastCount: number;
update(dt) {
if (Game.getIns().title) {
cc.find("bg_title/title", this.node).getComponent(cc.Label).string = Game.getIns().title;
}
// if (Game.getIns().state == GAME_STATE.OVER) return;
// if (Game.getIns().state == GAME_STATE.WAIT) return;
// if (this.countDown <= 0) {
// Game.getIns().state = GAME_STATE.OVER;
// pg.event.emit("game_time_over");
// return;
// }
// this.countDown = this.countDown - dt;
// if (this.countDown < 6) {
// let count = Math.floor(this.countDown);
// if (count != this.lastCount) {
// this.lastCount = count;
// if (this.lastCount == 1) {
// pg.audio.playLocalAudio(cc.find("bg_cd_red/audio_cd1", this.node))
// } else if (this.lastCount > 1) {
// pg.audio.playLocalAudio(cc.find("bg_cd_red/audio_cd", this.node))
// }
// }
// cc.find("bg_cd_red", this.node).active = true;
// cc.find("bg_cd_red/label_cd", this.node).getComponent(cc.Label).string = "" + parseInt("" + this.countDown);
// } else {
// cc.find("bg_cd_red", this.node).active = false;
// cc.find("bg_cd/label_cd", this.node).getComponent(cc.Label).string = "" + parseInt("" + this.countDown);
// }
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "fdb2b344-303e-47f2-aa24-356f920e07d1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "23e951c7-bc8b-4b05-87f7-497f916d716f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
export enum FISH_OUT {
RUNNING,
TOUCH,
CATCH,
ESCAP,
OUT
}
export class Fish {
public isOut: number;
public node: cc.Node;
public isLeft: boolean;//在左侧 向右运动
constructor() {
this.isOut = 0;
this.isLeft = Math.random() < 0.5;
}
}
export class Option {
public type;
public txt;
public picUrl;
public audioUrl;
public right: boolean;
public data;
public id: number;
public count: number;
public time: number;
public touchRight: boolean;
public fish: Fish;
constructor(data) {
// this.id = id;
this.data = data;
this.type = data.type;
this.txt = data.text;
this.time = data.time;
this.picUrl = data.image;
this.audioUrl = data.audio;
this.right = data.right;
this.touchRight = false;
this.fish = new Fish();
}
}
export class Item {
public page;
public audio;
public duration;
public optionList;
public checkMore: boolean;
constructor(data, page) {
this.audio = data.questionAudio;
this.duration = data.duration;
let id = 0;
this.optionList = data.options.map(o => {
return new Option(o);
})
this.optionList.sort(function () {
return (0.5 - Math.random());
});
let rNum = 0;
for (let i = 0; i < this.optionList.length; i++) {
if (this.optionList[i].right) rNum++;
}
this.checkMore = rNum > 1;
this.page = page;
}
}
class Role {
public score: number;
public right: number;
public error: number;
public voices: Array<any>;
constructor() {
this.score = 0;
this.error = 0;
this.right = 0;
this.voices = [];
}
addScore(score: number = 1) {
this.score += score;
}
addError(score: number = 1) {
this.error += score;
}
addRight() {
this.right += 1;
}
addVoice(obj: any) {
this.voices.push(obj);
}
}
export class Player extends Role {
constructor() {
super();
}
reset() {
this.score = 0;
this.error = 0;
this.right = 0;
this.voices = [];
}
}
export class Robot extends Role {
constructor() {
super();
}
reset() {
this.score = 0;
this.error = 0;
this.right = 0;
this.voices = [];
}
}
export enum GAME_STATE {
WAIT,
RUNNING,
OVER
}
export default class Game {
private static ins: Game;
public static getIns(): Game {
if (!Game.ins) Game.ins = new Game();
return Game.ins;
}
private data: any;
private lists: Array<Item>
public player: Player;
public robot: Robot;
public state: GAME_STATE;
constructor() {
this.start = false;
this.lists = [];
this.player = new Player();
this.robot = new Robot();
this.state = GAME_STATE.WAIT;
}
get len() {
return this.lists.length;
}
public singleGame: boolean;
public question: { text, audio };
public title: string;
public questionText: string;
public init(data) {
this.singleGame = !data.onlineFlg;
this.question = { text: data.questionText, audio: data.questionTextAudio };
this.title = data.title;
this.questionText = data.questionText;
this.start = false;
this.lists = [];
this.data = data.questions;
}
public start: boolean;
public page: number;
reset() {
this.player.reset();
this.robot.reset();
this.page = 1;
this.start = true;
this.lists = [];
for (let i = 0; i < this.data.length; i++) {
let data = this.data[i];
this.lists.push(new Item(data, i + 1));
}
this.state = GAME_STATE.WAIT;
}
checkSuccess(arr: Option[]) {
let data = this.getCurrentPage();
let options = data.optionList.concat();
options.sort((A, B) => A.id - B.id)
for (let i = 0; i < options.length; i++) {
if (arr[i] && arr[i].id != options[i].id) {
return false;
}
}
return true;
}
getDataByPage(page): Item {
return this.lists.filter(li => li.page == page)[0]
}
getCurrentPage(): Item {
let page = this.page;
return this.lists.filter(li => li.page == page)[0]
}
getTotalPageNum() {
return this.lists.length;
}
getCurrentPageNum() {
return this.page;
}
addPage() {
this.page += 1;
}
get getTotla() {
return this.data.length;
}
get isOver() {
return this.page > this.lists.length;
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "5fbcedfa-ac7a-43c4-bfef-2b1a961a1f5b",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "7c23f2f5-1cc8-43d3-94ca-461229062570",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "b0c008bc-cf92-463b-8360-0984e13c2e4d",
"uuid": "8505beff-6225-4ba6-820e-d30529a5ae0e",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29",
"uuid": "59f2b078-f3b0-4a65-93f8-cdddfc773361",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
export const defaultData = {
"title": "热气球大战",
"questionText": "可恶的小偷将魔法卡牌藏在热气球里,准备偷走!快击落热气球,夺回魔法卡牌。游戏开始,请点击弹弓,发射小球,击落热气球,魔法卡牌就会掉落下来。请仔细观察魔法卡牌,并大声说出魔法咒语。魔法咒语正确,你将获得该张魔法卡牌。游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
"questionTextAudio": "https://staging-teach.cdn.ireadabc.com/3152e0ea17b07406a002b2c05028b0cc.mp3",
"questions": [
{
"questionAudio": "https://teach.cdn.ireadabc.com/73dae647c4099fe65bc28f568e351e96.mp3",
"options": [
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/1832bc553f77f876e0bba64062bd6b38.jpg",
"audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
"text": "Please apple",
"right": false
},
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/52e8f2868ab7ea8b584bf6beb6b9672d.png",
"audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "Please take some Bag",
"right": false
},
{
"type": "txt",
"image": "https://staging-teach.cdn.ireadabc.com/8c6fef67a0095c2564e8df4b536fc540.png",
"audio": "https://staging-teach.cdn.ireadabc.com/b44fa51172b19b555fda30717c773027.mp3",
"text": "take cat",
"right": true
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
"text": "Please take some cookies",
"right": false
}
]
},
{
"questionAudio": "https://teach.cdn.ireadabc.com/73dae647c4099fe65bc28f568e351e96.mp3",
"options": [
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/d948ef84a50e6ac36bc31110f9062878.mp3",
"text": "umbrella",
"right": true
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/8d6a8d7764011afb0ef537d5a44d1d10.mp3",
"text": "key",
"right": true
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "bag",
"right": false
},
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/7b315ba7227294d63933cd659d5372fb.png",
"audio": "https://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
"text": "egg",
"right": true
}
]
}
]
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "c41b0e51-55d7-443c-af3a-b22c3dd9b9e5",
"uuid": "cb99e402-6724-4811-a116-b581f499fcf1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.0.8",
"uuid": "b54300af-b8e5-4b4e-aa2f-9ac1cef7b598",
"uuid": "f7f1cf67-96ae-4361-93b6-5711637e2eaf",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
......@@ -411,56 +411,15 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(right);
}
export function httpHeadCall(requsetUrl: string, callback) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
callback(false);
};
xhr.ontimeout = (e) => {
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e);
}
}
export function onHomeworkFinish(data = "", callback = ()=>{}) {
export function onHomeworkFinish(data) {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.onHomeworkFinish(callback, data);
} else {
console.log('onHomeworkFinish', JSON.stringify(data));
}
}
export function callMiddleLayerFunction(apiName: string, data: any, callback: Function) {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.callMiddleLayerFunction(apiName, data, callback);
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { }, data);
}
} else {
console.log('callMiddleLayerFunction: ' + apiName);
console.log('onHomeworkFinish');
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "ade7af40-d56d-4087-bbc6-2888fef55353",
"uuid": "f680f4a3-dbc7-4d5e-ab08-07e5752a5f83",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "8ba21262-178f-4fa5-afc9-2c1dd50ba3ab",
"uuid": "ccfcd337-1b1e-412a-b118-aee99d459403",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "9eb89c84-1cc7-42c9-ac57-df702f77dcef",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"1orange": {
"ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "17487daf-3875-48b5-9884-fb0a0bccd3d5",
"rawTextureUuid": "9eb89c84-1cc7-42c9-ac57-df702f77dcef",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "1.1.2",
"uuid": "75516bff-fc79-4ad2-a5a4-86ef8fb7574c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "43a14bd3-2751-408d-b517-bc43c9c1ef0f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 683,
"platformSettings": {},
"subMetas": {
"bg_bg": {
"ver": "1.0.4",
"uuid": "4c851b90-6031-47c6-9d65-51ecdc7be283",
"rawTextureUuid": "43a14bd3-2751-408d-b517-bc43c9c1ef0f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 683,
"rawWidth": 1334,
"rawHeight": 683,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "33f1f55f-6ec5-40d5-94b4-0b8e75add11a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 219,
"height": 243,
"platformSettings": {},
"subMetas": {
"bg_cannon-front": {
"ver": "1.0.4",
"uuid": "f0dcc359-81b5-402f-8d35-eee76f09ac9f",
"rawTextureUuid": "33f1f55f-6ec5-40d5-94b4-0b8e75add11a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 0,
"trimX": 18,
"trimY": 0,
"width": 184,
"height": 243,
"rawWidth": 219,
"rawHeight": 243,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6ef4ffde-6cf6-447b-a1e9-87e9e19d0c94",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 219,
"height": 243,
"platformSettings": {},
"subMetas": {
"bg_cannon-left": {
"ver": "1.0.4",
"uuid": "89c3bf5e-2dd6-4b02-92f4-f281b96e15dd",
"rawTextureUuid": "6ef4ffde-6cf6-447b-a1e9-87e9e19d0c94",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -8.5,
"offsetY": -5.5,
"trimX": 0,
"trimY": 11,
"width": 202,
"height": 232,
"rawWidth": 219,
"rawHeight": 243,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c83fe42f-1bbc-4e74-91a1-b3d081a9ff71",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 219,
"height": 243,
"platformSettings": {},
"subMetas": {
"bg_cannon-right": {
"ver": "1.0.4",
"uuid": "ca9a3af3-8f13-4264-8eaa-552eaf9349fa",
"rawTextureUuid": "c83fe42f-1bbc-4e74-91a1-b3d081a9ff71",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 9,
"offsetY": -5.5,
"trimX": 18,
"trimY": 11,
"width": 201,
"height": 232,
"rawWidth": 219,
"rawHeight": 243,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1140808b-49a1-4cef-93fa-90695eaeae63",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 828,
"height": 319,
"platformSettings": {},
"subMetas": {
"bg_di": {
"ver": "1.0.4",
"uuid": "c9c93c22-8d20-43b7-8e49-150d9f2386d6",
"rawTextureUuid": "1140808b-49a1-4cef-93fa-90695eaeae63",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 828,
"height": 319,
"rawWidth": 828,
"rawHeight": 319,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "def482d3-315c-4649-951e-fca9c93bb2ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 104,
"platformSettings": {},
"subMetas": {
"bg_front": {
"ver": "1.0.4",
"uuid": "3166e3b9-ab52-4629-962a-f03cad653204",
"rawTextureUuid": "def482d3-315c-4649-951e-fca9c93bb2ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 104,
"rawWidth": 1334,
"rawHeight": 104,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8d70192f-61cb-44c1-be63-2ac601af8521",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 330,
"platformSettings": {},
"subMetas": {
"bg_pic-right": {
"ver": "1.0.4",
"uuid": "5d0c0324-3a46-40f2-96c7-226447a3916e",
"rawTextureUuid": "8d70192f-61cb-44c1-be63-2ac601af8521",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -42,
"trimX": 0,
"trimY": 84,
"width": 260,
"height": 246,
"rawWidth": 260,
"rawHeight": 330,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f861632a-ccce-4004-a41a-9050a7ed4654",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 330,
"platformSettings": {},
"subMetas": {
"bg_pic": {
"ver": "1.0.4",
"uuid": "d41947b8-967e-42d4-8c27-e295b13604f9",
"rawTextureUuid": "f861632a-ccce-4004-a41a-9050a7ed4654",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -5,
"offsetY": 0,
"trimX": 3,
"trimY": 0,
"width": 244,
"height": 330,
"rawWidth": 260,
"rawHeight": 330,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "45ea3631-4a06-43a1-ad03-45da5ea4f290",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"bg_sky": {
"ver": "1.0.4",
"uuid": "9b3e85e2-3c05-4d1e-87d3-57226444ceb2",
"rawTextureUuid": "45ea3631-4a06-43a1-ad03-45da5ea4f290",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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.
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.
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