Commit dfa7aac1 authored by Lwd's avatar Lwd

commit

parent d4c5cd1b
{
"ver": "1.1.2",
"uuid": "0498b6c3-cff3-4053-bc52-d6b602d73927",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "ee4ab879-bb2e-4351-887a-d63651305737",
"downloadMode": 0,
"duration": 0.130612,
"duration": 1.476,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "6d9a7863-9d4c-4020-831c-f54ad2a39c17",
"downloadMode": 0,
"duration": 2.1956,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "98c9432f-962f-4d0a-8548-382b4e22b33e",
"downloadMode": 0,
"duration": 0.168,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "616654f9-f059-4475-a5c8-c16f8ae28510",
"downloadMode": 0,
"duration": 0.626939,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b00febb5-cfe4-4df2-85e2-ec0b561ff3e3",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "2cfe31da-7088-483a-b4a4-4c385f425896",
"downloadMode": 0,
"duration": 0.972,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d7c7c1c2-b419-4848-b006-d53f8fb66071",
"downloadMode": 0,
"duration": 0.864,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "ac1c4f2f-b8a5-4276-ac02-328d57c329a5",
"downloadMode": 0,
"duration": 1.188,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "8e5dee94-edd4-44d5-bb05-798f0d436886",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "97ca1d92-03be-469f-adff-758682ad46ab",
"downloadMode": 0,
"duration": 1.188,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7fc4afe9-9e57-42bd-a355-2f4143c11216",
"downloadMode": 0,
"duration": 0.936,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "6679e31f-b07a-4500-8c8d-a82c8493a4c4",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "600b0af1-92f2-4139-8ae5-b53eb5cd9bec",
"subMetas": {}
}
\ No newline at end of file
{"name":"mao","imagePath":"mao_tex.png","SubTexture":[{"name":"猫01/影子","x":1,"height":66,"y":343,"width":337},{"name":"猫01/尾巴","x":1,"height":109,"y":188,"width":175},{"name":"猫01/右腿","x":178,"height":117,"y":188,"width":104},{"name":"猫01/左腿","x":1,"height":115,"y":569,"width":64},{"name":"猫01/右手","x":427,"height":122,"y":590,"width":69},{"name":"猫01/左手","x":301,"height":74,"y":590,"width":124},{"name":"猫01伸/左手伸直","x":299,"height":169,"y":172,"width":168},{"name":"猫01伸/右手伸直","x":299,"height":169,"y":1,"width":168},{"name":"猫01/身体","x":340,"height":180,"y":343,"width":122},{"name":"猫01/领带","x":1,"height":156,"y":411,"width":120},{"name":"猫01/右耳","x":155,"height":76,"y":602,"width":90},{"name":"猫01/左耳","x":67,"height":85,"y":602,"width":86},{"name":"猫01/组_1","x":1,"height":185,"y":1,"width":296},{"name":"猫01/右眼","x":1,"height":60,"y":686,"width":59},{"name":"猫01/右眉毛","x":67,"height":5,"y":595,"width":33},{"name":"猫01/左眼","x":247,"height":60,"y":666,"width":59},{"name":"猫01/左眉毛","x":247,"height":12,"y":602,"width":31},{"name":"猫01/眼镜","x":301,"height":63,"y":525,"width":170},{"name":"猫01/胡子","x":123,"height":85,"y":515,"width":176},{"name":"猫01/鼻子","x":67,"height":24,"y":569,"width":28},{"name":"猫01/嘴","x":1,"height":30,"y":299,"width":65},{"name":"猫01/帽子","x":123,"height":102,"y":411,"width":158}],"height":1024,"width":512}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "da99fa22-02ff-4d47-a6d2-34d0447f83db",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "bfb55d5d-2afe-468f-baf4-5190c9310f99",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 1024,
"platformSettings": {},
"subMetas": {
"mao_tex": {
"ver": "1.0.4",
"uuid": "d0882ce3-0831-4bc1-befd-3856e5ba0ca7",
"rawTextureUuid": "bfb55d5d-2afe-468f-baf4-5190c9310f99",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7.5,
"offsetY": 138.5,
"trimX": 1,
"trimY": 1,
"width": 495,
"height": 745,
"rawWidth": 512,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "de93dea6-de18-4f49-abf1-86bd2ea3662b",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "8549fef3-5ffa-4e88-9496-13fe5201e87d",
"subMetas": {}
}
\ No newline at end of file
{"width":2048,"SubTexture":[{"width":958,"y":2137,"height":140,"name":"正常-影子","x":961},{"width":840,"y":1344,"height":274,"name":"正常-身体","x":1},{"width":291,"y":2452,"height":167,"name":"正常-手上","x":1736},{"width":254,"y":2495,"height":119,"name":"正常-下巴","x":1064},{"width":211,"y":1263,"height":71,"name":"正常-嘴巴","x":992},{"width":417,"y":1619,"height":374,"name":"正常-脸","x":843},{"width":351,"y":2660,"height":162,"name":"正常-耳朵","x":711},{"width":209,"y":1146,"height":115,"name":"正常-睁眼","x":992},{"width":198,"y":2923,"height":94,"name":"正常-半睁眼","x":982},{"width":198,"y":2826,"height":115,"name":"正常-闭眼","x":1544},{"width":492,"y":352,"height":492,"name":"正常-头","x":1239},{"width":214,"y":2824,"height":94,"name":"正常-鼻子","x":774},{"width":232,"y":850,"height":294,"name":"正常-手右","x":992},{"width":554,"y":2764,"height":87,"name":"正常尾巴","x":1},{"width":958,"y":2137,"height":140,"name":"皱眉-影子","x":1},{"width":206,"y":2920,"height":96,"name":"皱眉-摆手胳膊","x":774},{"width":286,"y":1619,"height":278,"name":"皱眉-摆手","x":1670},{"width":419,"y":2751,"height":73,"name":"皱眉-尾巴-后","x":1607},{"width":739,"y":1,"height":400,"name":"皱眉-身体","x":1},{"width":292,"y":1063,"height":168,"name":"皱眉-正常收上","x":1733},{"width":420,"y":899,"height":397,"name":"皱眉-脸","x":1},{"frameX":0,"y":1620,"frameY":-39,"frameWidth":417,"width":417,"frameHeight":483,"height":444,"name":"皱眉-正常脸","x":1},{"width":352,"y":2421,"height":163,"name":"皱眉-耳朵","x":357},{"width":209,"y":700,"height":115,"name":"皱眉-睁眼","x":498},{"width":199,"y":1233,"height":115,"name":"皱眉-半睁眼","x":1841},{"width":495,"y":403,"height":494,"name":"皱眉-头发","x":1},{"width":492,"y":846,"height":492,"name":"皱眉-正常头发","x":1239},{"width":199,"y":2806,"height":115,"name":"皱眉-闭眼","x":1064},{"width":215,"y":2824,"height":94,"name":"皱眉-鼻子","x":557},{"width":231,"y":300,"height":295,"name":"皱眉-手1","x":1733},{"width":557,"y":2586,"height":87,"name":"皱眉-尾巴-前","x":1},{"width":958,"y":2279,"height":140,"name":"张嘴-影子","x":1},{"width":842,"y":1,"height":349,"name":"张嘴-身体","x":742},{"width":292,"y":892,"height":169,"name":"张嘴-上手","x":1733},{"width":271,"y":2677,"height":122,"name":"张-下巴","x":1334},{"width":403,"y":2494,"height":181,"name":"张-鼻","x":1331},{"width":351,"y":2495,"height":163,"name":"张嘴-耳朵","x":711},{"width":366,"y":2279,"height":213,"name":"张嘴-脸","x":1331},{"width":268,"y":2677,"height":127,"name":"张嘴-下巴","x":1064},{"width":285,"y":2621,"height":128,"name":"张嘴-张嘴","x":1736},{"width":212,"y":2421,"height":71,"name":"张嘴-闭嘴嘴","x":711},{"width":406,"y":1619,"height":229,"name":"张嘴-脸-中","x":1262},{"width":368,"y":1919,"height":214,"name":"张嘴-脸-上","x":420},{"width":208,"y":2801,"height":114,"name":"张嘴-睁眼","x":1334},{"width":198,"y":2826,"height":114,"name":"张嘴-半眼","x":1744},{"width":199,"y":2917,"height":114,"name":"张嘴-闭眼","x":1265},{"width":492,"y":850,"height":492,"name":"张嘴-头发","x":498},{"width":214,"y":2942,"height":95,"name":"张嘴-鼻子","x":1744},{"width":232,"y":597,"height":293,"name":"张嘴-手下","x":1733},{"width":555,"y":2675,"height":87,"name":"张嘴-尾巴","x":1},{"width":958,"y":1995,"height":140,"name":"嚼--影子","x":843},{"width":847,"y":1340,"height":277,"name":"嚼-身体","x":992},{"width":294,"y":2279,"height":171,"name":"嚼-手-上-完整","x":1699},{"width":406,"y":1,"height":297,"name":"lian","x":1586},{"width":406,"y":1620,"height":297,"name":"嚼-脸_拷贝","x":420},{"width":354,"y":2421,"height":163,"name":"嚼-左耳","x":1},{"width":368,"y":2279,"height":214,"name":"嚼-脸-上","x":961},{"width":210,"y":1989,"height":115,"name":"嚼-睁眼","x":1803},{"width":199,"y":1350,"height":115,"name":"嚼-半睁眼","x":1841},{"width":495,"y":352,"height":496,"name":"嚼-毛发","x":742},{"width":199,"y":1467,"height":115,"name":"嚼-闭眼","x":1841},{"width":215,"y":2943,"height":94,"name":"嚼-鼻子_","x":1466},{"width":233,"y":403,"height":295,"name":"嚼-手-下","x":498},{"width":559,"y":1899,"height":88,"name":"嚼-尾巴-前","x":1262},{"width":198,"y":3019,"height":94,"name":"皱眉-正常-半睁眼 ","x":982}],"height":4096,"name":"lion","imagePath":"lion_tex.png"}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "27736c82-e8ad-4ec9-9aa8-93dd4278069b",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "2.3.5",
"uuid": "c2512365-4d01-4adf-8d7f-8795350351bc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2048,
"height": 4096,
"platformSettings": {},
"subMetas": {
"lion_tex": {
"ver": "1.0.4",
"uuid": "f2fec664-8c69-43fb-a0f1-d63abfebf8f0",
"rawTextureUuid": "c2512365-4d01-4adf-8d7f-8795350351bc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -3.5,
"offsetY": 491,
"trimX": 1,
"trimY": 1,
"width": 2039,
"height": 3112,
"rawWidth": 2048,
"rawHeight": 4096,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"uuid": "1b0e2927-fd31-40e1-a43f-e2fce2c0500c",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"uuid": "05d84521-5b96-4e69-b47c-becb96187117",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"autoReleaseAssets": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 游戏主逻辑
*/
var game = cc.Class({
extends: cc.Component,
properties: {
Item: {
default: null,
type: cc.Node,
displayName: "预制体"
},
contentArr: {
default: null,
type: cc.Node,
displayName: "Layer"
},
dragonLion: {
default: null,
type: dragonBones.ArmatureDisplay,
displayName: "狮子"
},
dragonCat: {
default: null,
type: dragonBones.ArmatureDisplay,
displayName: ""
},
btnReStart: {
default: null,
type: cc.Node,
displayName: "重新开始按钮"
},
nodCircle: {
default: null,
type: cc.Node,
displayName: "光圈"
},
handTip: {
default: null,
type: cc.Node,
displayName: "重新开始按钮"
},
nodEndEffect: {
default: null,
type: cc.Node,
displayName: "结束特效节点"
},
nodMask: {
default: null,
type: cc.Node,
displayName: "遮罩"
}
},
ctor: function () {
this._timeoutIds = [];
this._intervalIds = [];
game.inst = this;
OP26.game = game;
},
// 生命周期 onLoad
onLoad() {
//初始化游戏
this.initGame()
},
//屏幕缩放
scaleEventCallBack: function () {
},
//初始化游戏
initGame: function () {
//获得数据
OP26.res_mgr.getFormData();
},
setAABB() {
var node = this.dragonLion.node;
let svLeftBottomPoint = node.parent.convertToWorldSpaceAR(
cc.v2(
node.x - node.anchorX * node.width / 2,
node.y - node.anchorY * node.height / 2
)
);
// 求出 ScrollView 可视区域在世界坐标系中的矩形(碰撞盒)
let svBBoxRect = cc.rect(
svLeftBottomPoint.x - 300,
svLeftBottomPoint.y - 500,
node.width,
node.height
);
// console.log(Id + ":" + svLeftBottomPoint.x + "," + svLeftBottomPoint.y);
return svBBoxRect
},
//添加节点
addItem: function () {
let itemArr = OP26.data_mgr.getQuestionOneList(OP26.data_mgr.quesId);
itemArr.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
OP26.data_mgr.nowNum = 0;
for (var i = 0; i < itemArr.length; i++) {
let newItem = cc.instantiate(this.Item);
//更新子项
var com = newItem.getChildByName("item").getComponent("item");
let itemInfo = itemArr[i];
com.updateUI(itemInfo);
newItem.active = true;
if (itemInfo.is_right == true) {
OP26.data_mgr.nowNum += 1;
}
newItem.getChildByName("item").is_right = itemInfo.is_right;
newItem.parent = this.contentArr;
};
},
//隐藏剩余物品并跳转下一题
resetQues: function () {
if (OP26.data_mgr.quesId >= 4) {
this._timeoutIds.push(setTimeout(() => {
this.finish();
}, 1000));
OP26.data_mgr.gameState = 2
} else {
for (var i = 0; i < this.contentArr.childrenCount; i++) {
cc.tween(this.contentArr.children[i].children[0])
.to(0.8, { opacity: 0 })
.start();
}
this._timeoutIds.push(setTimeout(() => {
this.UpdataUi();
//播放题干
this.playAudioTitle();
}, 1000));
}
},
//结束
finish() {
this.playLionDragon("normal")
this.playCatDragon("finish")
//播放引导音频
let path = OP26.data_mgr.getAudioEnd();
if (path == -1) {
this.showEndEffect();
// this.showRestartBtn();
return
}
OP26.res_mgr.playAudioByUrl(path, (url) => {
OP26.snd_mgr.playEffect(url, () => {
this.showEndEffect();
// this.showRestartBtn();
})
})
},
//开始引导游戏
guideGame: function () {
this.UpdataUi();
this.playCatDragon("begin");
//播放引导音频
let path = OP26.data_mgr.getAudioBegin();
if (path == -1) return this.nodMask.active = false;
OP26.res_mgr.playAudioByUrl(path, (url) => {
OP26.snd_mgr.playEffect(url, () => {
this.nodMask.active = false;
//播放题干
this.playAudioTitle();
})
})
},
//更新界面信息
UpdataUi: function () {
OP26.data_mgr.gameState == 1;
var Info = {
tex_json: OP26.data_mgr.data.tex_json,
ske_json: OP26.data_mgr.data.ske_json,
tex_png: OP26.data_mgr.data.tex_png,
}
OP26.res_mgr.loadSpine(this.dragonLion, Info);
//刚进入课件
//播放第一题题干
//设置俩个人物状态
this.playCatDragon("begin");
this.playLionDragon("normal");
// //播放题干
// this.playAudioTitle();
//重置UI界面
this.resetUI();
//添加项
this.addItem();
},
//播放猫动画
playCatDragon(name) {
this.dragonCat.armatureName = "Armature";
this.dragonCat.playAnimation(name);
},
//播放猫动画
playLionDragon(name) {
this.dragonLion.armatureName = "armatureName";
this.dragonLion.playAnimation(name);
},
//点击猫猫
onBtnCheckCat: function () {
if (this._isSpeak) return;
//判断当前状态
if (OP26.data_mgr.quesId < 4) {
this._isSpeak = true;
this.playCatDragon("begin");
this.playAudioTitle(() => {
this._isSpeak = false;
this.playCatDragon("normal");
});
}
//如果结束了则提示音
if (this.btnReStart.active) {
let path = OP26.data_mgr.getAudioReStart();
if (path == -1) return;
this._isSpeak = true
this.playCatDragon("begin");
OP26.res_mgr.playAudioByUrl(path, (url) => {
OP26.snd_mgr.playEffect(url, () => {
this._isSpeak = false;
this.playCatDragon("normal");
})
});
}
},
//播放题干
playAudioTitle: function (cb) {
var path = OP26.data_mgr.getQuestionStem(OP26.data_mgr.quesId);
if (OP26.data_mgr.quesId >= 4 || !path) return
//获得播放路径
OP26.res_mgr.playAudioByUrl(path, (url) => {
OP26.snd_mgr.playEffect(url, () => {
//结束回调
this.playCatDragon("normal");
cb && cb();
});
});
},
//重置UI界面
resetUI: function () {
//移除所有子节点
this.contentArr.removeAllChildren();
},
//游戏开始
gameStart: function () {
console.log("游戏开始:" + OP26.data_mgr);
//播放一个上面的音乐
this.setAudioInfo(1);
},
//重新开始
onBtnReStart() {
//隐藏节点
this.btnReStart.active = false;
//播放音效
OP26.speaker.inst.playEffect(OP26.enum.E_Audio.BtnCommom);
//数据重置
OP26.data_mgr.quesId = 0;
//更新界面
this.UpdataUi();
//播放题干
this.playAudioTitle();
this.hideRestartBtn();
},
//手势移动
setHandTip(node) {
//传入当前点击的节点坐标,移动至中心点
var beginPos = cc.v2(node.x, node.y + this.contentArr.y);
//50偏移量到嘴巴
var EndPos = cc.v2(this.dragonLion.node.x, this.dragonLion.node.y - 300);
this.handTween && this.handTween.stop();
this.handTween = cc.tween(this.handTip)
.call(() => {
this.handTip.active = true;
this.handTip.x = beginPos.x;
this.handTip.y = beginPos.y;
})
.to(1.5, { x: EndPos.x, y: EndPos.y })
.call(() => {
this.handTip.active = false;
})
.union()
.repeat(2) // 执行2次
.start();
},
//显示结束效果界面
showEndEffect() {
this.nodEndEffect.getComponent("nodEndEffect").onShow();
},
showRestartBtn() {
this.btnReStart.active = true;
cc.tween(this.nodCircle)
.set({ scale: 0.8, opacity: 255 })
.to(2, { scale: 1.2, opacity: 0 })
.union()
.repeatForever()
.start();
},
hideRestartBtn() {
this.nodCircle.stopAllActions();
this.nodCircle.scale = 0.8;
this.nodCircle.opacity = 255;
},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
OP26.game.inst._intervalIds.forEach(id => {
clearInterval(id);
});
OP26.data_mgr.quesId = 0;
},
});
{
"ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29",
"uuid": "61513ab2-9077-4bca-9318-331f6cb5cd81",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "5c5117fc-a35a-442f-b2f5-0c431572d3c2",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// 全局环境预声明
window.OP26 = window.OP26 || {}; // 全局
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "c41b0e51-55d7-443c-af3a-b22c3dd9b9e5",
"uuid": "a9bcccd1-c2b7-4db1-8744-3c0fcb95b824",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
/**
* eff_welldown
*/
var eff_well = cc.Class({
extends: cc.Component,
properties: {
eff_welldown: {
default: null,
type: cc.Animation,
displayName: "撒花特效"
},
},
ctor: function () {
eff_well.inst = this;
OP26.eff_well = eff_well;
this._timeoutIds = [];
this._intervalIds = [];
},
//显示特效
showEff: function () {
this.node.active = true;
this.eff_welldown.play();
//播放撒花音效
OP26.speaker.inst.play_congratulation();
this._timeoutIds.push(setTimeout(() => {
this.node.active = false;
}, 2000));
},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
});
{
"ver": "1.0.8",
"uuid": "ade7af40-d56d-4087-bbc6-2888fef55353",
"uuid": "872df374-a19c-4662-9d3d-1f85329b5d49",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
OP26.utils = {
// 范围随机
randFromTo: function (_min, _max) {
var min = parseFloat(_min);
var max = parseFloat(_max);
return (min + Math.random() * (max - min));
},
// 范围随机一个整数
// 例:1~3,返回的可能值为:1、2、3
randFromTo_Int: function (min, max) {
var val = this.randFromTo(min, max + 1 - 0.0001);
return Math.floor(val);
},
// 深拷贝
deepCopy: function (src) {
var cpy = src instanceof Array ? [] : {};
for (var i in src) {
cpy[i] = typeof src[i] === 'object' ? this.deepCopy(src[i]) : src[i];
}
return cpy;
},
deletList: function (list, val) {
var index = list(val);
if (index > -1) {
this.splice(index, 1);
}
}
}
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function Between(a, b, c) {
return [a, b, c].sort((a, b) => a - b)[1];
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export async function asyncTweenTo(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncTweenBy(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1, onFrameEvent) {
return new Promise((resolve, reject) => {
node.getComponent(dragonBones.ArmatureDisplay)
.once(dragonBones.EventObject.COMPLETE, () => {
resolve();
});
node.getComponent(dragonBones.ArmatureDisplay)
.on(dragonBones.EventObject.FRAME_EVENT, ({ name }) => {
if (onFrameEvent && typeof (onFrameEvent) == 'function') {
onFrameEvent(name);
}
});
node.getComponent(dragonBones.ArmatureDisplay)
.playAnimation(animationName, time);
});
}
export async function asyncPlayEffectByUrl(url, loop = false) {
return new Promise((resolve, reject) => {
cc.assetManager.loadRemote(url, (err, clip) => {
console.log(clip);
cc.audioEngine.playEffect(clip, loop);
resolve();
});
});
}
export async function jelly(node) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(0.1, { scaleX: 0.9, scaleY: 1.1 })
.to(0.1, { scaleX: 1.1, scaleY: 0.9 })
.to(0.1, { scaleX: 1, scaleY: 1 })
.call(resolve)
.start();
});
}
export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time * 1000);
})
}
export async function showFireworks(baseNode, nodeList, pos = cc.v2(0, 0), side = cc.v2(0, 100), range = 50, number = 100) {
new Array(number).fill(' ').forEach(async (_, i) => {
let rabbonNode = new cc.Node();
rabbonNode.parent = baseNode;
rabbonNode.x = pos.x;
rabbonNode.y = pos.y;
rabbonNode.angle = 60 * Math.random() - 30;
let node = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
node.parent = rabbonNode;
node.active = true;
node.x = 0;
node.y = 0;
node.angle = 0;
const rate = Math.random();
const angle = Math.PI * (Math.random() * 2 - 1);
await asyncTweenBy(rabbonNode, 0.3, {
x: side.x * rate + Math.cos(angle) * range * rate,
y: side.y * rate + Math.sin(angle) * range * rate
}, {
easing: 'quadIn'
});
cc.tween(rabbonNode)
.by(8, { y: -2000 })
.start();
rabbonFall(rabbonNode);
await asyncDelay(Math.random());
cc.tween(node)
.by(0.15, { x: -10, angle: -10 })
.by(0.3, { x: 20, angle: 20 })
.by(0.15, { x: -10, angle: -10 })
.union()
.repeatForever()
.start();
cc.tween(rabbonNode)
.delay(5)
.to(0.3, { opacity: 0 })
.call(() => {
node.stopAllActions();
node.active = false;
node.parent = null;
node = null;
})
.start();
});
}
async function rabbonFall(node) {
const time = 1 + Math.random();
const offsetX = RandomInt(-200, 200) * time;
await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 });
rabbonFall(node);
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"uuid": "3cf09c30-536f-42ae-83bb-cbb3c5cd93eb",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
const WIDTH = 1280;
const HEIGTH = 720;
/**
* 适配
*/
cc.Class({
extends: cc.Component,
properties: {
bgScaleMax: {
default: [],
type: cc.Node,
displayName: "背景适配"
},
nodeUIOffset: {
default: [],
type: cc.Node,
displayName: "节点偏移"
},
canvasView: {
default: null,
type: cc.Canvas,
displayName: "根节点"
},
isCanvas: {
default: false,
}
},
onLoad: function () { //开启适配
this.widgetList = [];
this.initSize();
this.scheduleOnce(function () {
if (!this.isCanvas) {
this.init();
} else {
// var canvaSize = this.findCanvas();
// var w = (canvaSize.width) / HEIGTH;
// var h = (canvaSize.height) / WIDTH;
this.MaxSize = 1 //w / h > 1 ? w / h : h / w;
this.setBgScale();
this.setUiPositon();
var scene = cc.director.getScene();
var list = scene.getComponentsInChildren(cc.Widget)
for (var i in list) {
// list[i].updateAlignment();
}
}
}, 0);
OP26.event_mgr.reg("adjustUI", () => {
this.setBgScale();
this.setUiPositon();
});
this.MaxSize = 1;
},
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
this.canvas = cc.find("Canvas");
},
init: function () {
// var canvaSize = this.findCanvas();
// var diff = canvaSize.width / canvaSize.height;
// var bili = WIDTH / HEIGTH;
// if (diff > bili) {
// this.canvasView.fitWidth = false;
// this.canvasView.fitHeight = true;
// } else if (diff < bili) {
// this.canvasView.fitWidth = true;
// this.canvasView.fitHeight = false;
// } else {
// this.canvasView.fitWidth = true;
// this.canvasView.fitHeight = true;
// }
// var w = (canvaSize.width) / WIDTH;
// var h = (canvaSize.height) / HEIGTH;
this.MaxSize = 1 // w / h > 1 ? w / h : h / w;
OP26.data_mgr.MaxSize = this.MaxSize;
this.setBgScale();
this.setUiPositon();
var scene = cc.director.getScene();
var list = scene.getComponentsInChildren(cc.Widget)
for (var i in list) {
// list[i].updateAlignment();
}
},
onDestroy: function () {
if (OP26.event_pump) {
OP26.event_pump.unReg("adjustUI");
}
},
//背景适配
setBgScale: function () {
const bg = cc.find('Canvas/bg');
bg.scale = this._mapScaleMax;
const grass = cc.find('Canvas/connent/bg_grass');
grass.scaleX = this.canvas.width / grass.width;
return;
for (var i in this.bgScaleMax) {
// 1. 先找到 SHOW_ALL 模式适配之后,本节点的实际宽高以及初始缩放值
let scaleForShowAll = Math.min(
cc.view.getCanvasSize().width / this.bgScaleMax[i].width,
cc.view.getCanvasSize().height / this.bgScaleMax[i].height
);
let realWidth = this.bgScaleMax[i].width * scaleForShowAll;
let realHeight = this.bgScaleMax[i].height * scaleForShowAll;
// 2. 基于第一步的数据,再做缩放适配
this.bgScaleMax[i].scale = Math.max(
cc.view.getCanvasSize().width / realWidth,
cc.view.getCanvasSize().height / realHeight
);
}
},
//适配节点位置
setUiPositon: function () {
for (var i in this.nodeUIOffset) {
// 1. 先找到 SHOW_ALL 模式适配之后,本节点的实际宽高以及初始缩放值
let srcScaleForShowAll = Math.min(
cc.view.getCanvasSize().width / WIDTH,
cc.view.getCanvasSize().height / HEIGTH
);
let realWidth = WIDTH * srcScaleForShowAll;
let realHeight = HEIGTH * srcScaleForShowAll;
// 2. 基于第一步的数据,再做节点宽高重置
this.nodeUIOffset[i].width = WIDTH * (cc.view.getCanvasSize().width / realWidth);
this.nodeUIOffset[i].height = HEIGTH * (cc.view.getCanvasSize().height / realHeight);
}
},
findCanvas: function () {
if (cc.sys.isNative) {
return {
width: cc.view.getFrameSize().width,
height: cc.view.getFrameSize().height
};
} else {
return {
width: cc.game.canvas.clientWidth,
height: cc.game.canvas.clientHeight
};
}
}
});
{
"ver": "1.0.8",
"uuid": "0e963fa9-ea21-492e-a9ae-92a33a8c7456",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "39d2496b-65e0-4525-8411-51d9926950b8",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.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 { asyncDelay, RandomInt, showFireworks } from "../common/utils";
var effect = cc.Class({
extends: cc.Component,
properties: {
},
ctor: function () {
effect.inst = this;
OP26.effect = effect;
},
showEffect: function () {
const bg = cc.find('Canvas/bg/connent');
this.showAllFirework(bg, cc.find('paperBase').children);
OP26.speaker.inst.play_congratulation();
},
showEffect2: function () {
const bg = cc.find('Canvas/bg/connent');
showFireworks(bg, cc.find('RibbonNodeBase').children, cc.v2(0, -400), cc.v2(0, 1000), 200, 200
);
showFireworks(bg, cc.find('RibbonNodeBase').children, cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
);
showFireworks(bg, cc.find('RibbonNodeBase').children, cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
);
},
async showOneFirework(pos, parentNode, nodeList) {
for (let i = 0; i < 3; i++) {
this.showFirework(pos, parentNode, nodeList, 200, 200, 15);
await asyncDelay(0.1);
}
},
async showAllFirework(parentNode, nodeList) {
for (let i = 0; i < 6; i++) {
this.showFirework(cc.v2(0, -parentNode.height / 2), parentNode, nodeList, parentNode.width * 2 / 3, parentNode.height * 1.3);
await asyncDelay(0.1);
}
},
showFirework(pos, parentNode, nodeList, width = 200, height = 200, number = 30) {
for (let i = 0; i < number; i++) {
const quad = this.createQuads(pos, parentNode, nodeList);
const targetX = RandomInt(width / 2, -width / 2);
const targetY = RandomInt(height);
cc.tween(quad)
.by(0.5, { x: targetX })
.by(3, { x: targetX * 2 })
.start();
cc.tween(quad)
.by(0.5, { y: targetY }, { easing: 'quadOut' })
.to(4, { y: -parentNode.height * 2 }, { easing: 'quadIn' })
.removeSelf()
.start();
cc.tween(quad)
.delay(1)
.to(1.5, { opacity: 0 })
.start();
}
},
createQuads(pos, parentNode, nodeList) {
const quadBase = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
quadBase.x = pos.x;
quadBase.y = pos.y;
quadBase.z = pos.z;
quadBase.angle = RandomInt(180);
quadBase.parent = parentNode;
const quad = quadBase.getChildByName('quad');
quad.x = 0;
quad.y = 0;
quad.angle = RandomInt(180);
const paper = quad.getChildByName('paper');
paper.scaleX = Math.random() * 0.5 + 0.5;
paper.scaleY = Math.random() * 0.5 + 0.5;
quadBase.scaleX = Math.random();
cc.tween(quadBase)
.to((1 - quadBase.scaleX) * 0.3, { scaleX: 1 })
.call(() => {
const time = Math.random() * 0.2;
cc.tween(quadBase)
.to(0.1 + time, { scaleX: -1 })
.to(0.1 + time, { scaleX: 1 })
.union()
.repeatForever()
.start();
})
.start();
return quadBase;
},
});
{
"ver": "1.0.8",
"uuid": "0df3ab6c-e62c-47f8-a791-56073deccaed",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
OP26.enum = {
E_Audio: {
AllPop: 0,//全部弹出
BtnCommom: 1,//按钮
CatComplete: 2,
CatHint: 3,
Right: 4,
Error: 5,
ENDEFFECT: 6
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "abd266cd-33d4-4036-8f6a-950c340d5fed",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
var TouchDragger = cc.Class({
extends: cc.Component,
properties: {
MaxHeight: {
default: "",
displayName: "最大高度"
},
MaxWidth: {
default: "",
displayName: "最大宽度"
},
grid: {
default: null,
type: cc.Prefab,
displayName: "格子预制体"
},
hGrid: {
default: "",
displayName: "单个高度"
},
wGrid: {
default: "",
displayName: "单个宽度"
}
},
ctor: function () {
TouchDragger.inst = this;
OP26.TouchDragger = TouchDragger;
},
onLoad: function () {
this.arMap = [];
this.isEnd = false;
//是否是第一次执行移动
this.isFirstMove = true;
//初始化格子数据
this.initGridInfo(OP26.data_mgr.challengeData.IngredientList);
},
start: function () {
this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCancel, this);
},
//触摸开始
touchBegan: function (event) {
if (this.isEnd) return;
this.isMove = false;
var posScreen = event.getLocation();//点击事件获取位置
var posNode = this.node.parent.convertToNodeSpaceAR(posScreen);
this.iposBegan = this.getFormatIPos(posNode);
this.iposMove = cc.v2(-1, -1);
if (this.iposBegan.x == -1) return;
var ndBegan = this.arMap[this.iposBegan.y][this.iposBegan.x];
if (!ndBegan.active) {
return;
}
ndBegan.runAction(this.getAction("scale"));
ndBegan.zIndex = 1;
this.deltaPos = ndBegan.x + ndBegan.y;
},
//触摸移动
touchMove: function (event) {
if (this.isEnd || (GodGuide && GodGuide.getTask())) return;
if (this.iposBegan.x == -1) return;
var posScreen = event.getLocation(); //点击事件获取位置
var posNode = this.node.parent.convertToNodeSpaceAR(posScreen);
var iposTouch = this.getFormatIPos(posNode);
if (this.isFirstMove == true) {
this.iposBegan = this.getFormatIPos(posNode);
this.isFirstMove = false;
};
var delta = event.getDelta();
var ndBegan = this.arMap[this.iposBegan.y][this.iposBegan.x];
if (!ndBegan.active) {
return;
}
ndBegan.x += delta.x;
ndBegan.y += delta.y;
var deltaPos = ndBegan.x + ndBegan.y;
if (Math.abs(this.deltaPos - deltaPos) > 10) {
this.isMove = true;
}
this.iposMove = iposTouch;
},
//触摸结束
touchEnd: function (event) {
if (this.isEnd) return;
if (this.iposBegan.x == -1) return;
var ndBegan = this.arMap[this.iposBegan.y][this.iposBegan.x];
if (!ndBegan.active) {
this.isMove = false;
return;
}
if (!this.isMove) {
cc.log("点击了");
ndBegan.stopAllActions();
ndBegan.setScale(1);
ndBegan.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposBegan)));
ndBegan.callback && ndBegan.callback();
return
}
this.isFirstMove = true;
this.arMap[this.iposBegan.y][this.iposBegan.x].zIndex = 0;
if (this.iposBegan.x == -1 || this.iposMove.x >= 0 && this.iposMove.y >= 0) {
ndBegan.stopAllActions();
ndBegan.setScale(1);
ndBegan.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposMove)));
if (this.iposMove.x != -1) {
var ndMove = this.arMap[this.iposMove.y][this.iposMove.x];
ndMove.stopAllActions();
ndMove.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposBegan)));
this.arMap[this.iposMove.y][this.iposMove.x] = ndBegan;
this.arMap[this.iposBegan.y][this.iposBegan.x] = ndMove;
}
} else {
ndBegan.stopAllActions();
ndBegan.setScale(1);
ndBegan.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposBegan)));
if (this.iposMove.x != -1) {
var ndMove = this.arMap[this.iposMove.y][this.iposMove.x];
ndMove.stopAllActions();
ndMove.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposMove)));
}
}
this.isMove = false;
},
//触摸取消
touchCancel: function (event) {
this.arMap[this.iposBegan.y][this.iposBegan.x].zIndex = 0;
var ndBegan = this.arMap[this.iposBegan.y][this.iposBegan.x];
ndBegan.stopAllActions();
ndBegan.setScale(1);
ndBegan.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposBegan)));
if (this.iposMove.x != -1) {
var ndMove = this.arMap[this.iposMove.y][this.iposMove.x];
ndMove.stopAllActions();
ndMove.runAction(cc.moveTo(0.1, this.getGridOriginPos(this.iposMove)));
}
this.isMove = false;
},
//初始化格子数据
initGridInfo: function (list) {
for (var i = this.MaxHeight - 1; i >= 0; --i) {
this.arMap[i] = [];
for (var j = 0; j < this.MaxWidth; ++j) {
var ndGrid = cc.instantiate(this.grid);
ndGrid.parent = this.node;
//获得节点的位置
ndGrid.position = this.getGridOriginPos(cc.v2(j, i));
this.arMap[i][j] = ndGrid;
// ndGrid.getComponent("grid").updateUI(3, 30);
var num = (this.MaxHeight - i - 1) * this.MaxWidth + j;
ndGrid.active = list[num] != undefined;
ndGrid.getComponent("grid").updateUI(list[num], 0);
}
}
},
//获得动作
getAction: function (name) {
if (name === "scale") {
return cc.repeatForever(cc.sequence(cc.scaleTo(0.15, 1.3)
, cc.scaleTo(0.3, 1)));
}
else if (name === "rotate") {
return cc.repeatForever(cc.sequence(cc.rotateBy(0.15, 30), cc.rotateBy(0.3, -60), cc.rotateBy(0.15, 30)));
}
return null;
},
//获得直角坐标
getFormatIPos: function (pos) {
var ipos = cc.v2(Math.floor((pos.x - this.node.x) / this.wGrid), Math.floor((pos.y - this.node.y) / this.hGrid));
if (ipos.x < 0 || ipos.x >= this.MaxWidth || ipos.y < 0 || ipos.y >= this.MaxHeight) {
ipos.x = -1;
}
return ipos;
},
//获得格子起始坐标
getGridOriginPos: function (ipos) {
return cc.v2(10 + (ipos.x + 0.5) * this.wGrid, 10 + (ipos.y + 0.5) * this.hGrid);
},
});
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "ccc66642-cf0e-4b1b-ae3d-c4b18f4fe53a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
//手势移动
cc.Class({
extends: cc.Component,
properties: {
},
start() {
},
});
{
"ver": "1.0.8",
"uuid": "3965d960-0cbf-4158-af67-3ddc4ae03225",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* item
*/
cc.Class({
extends: cc.Component,
properties: {
Item_name: {
default: null,
type: cc.Label,
displayName: "名字"
},
Item_photo: {
default: null,
type: cc.Node,
displayName: "图片"
},
},
start: function () {
this._timeoutIds = [];
this._intervalIds = [];
this.handTip = 0;//手势提示次数
this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegan, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCancel, this);
},
//触摸开始
touchBegan: function (event) {
OP26.data_mgr.gameState = 2;
OP26.data_mgr.time = 0;
//如果有提示手则停止
OP26.game.inst.handTween && OP26.game.inst.handTween.stop() && (OP26.game.inst.handTip.active = false);
//狮子猫动画
OP26.game.inst.playLionDragon("openmouth");
OP26.res_mgr.playAudioByUrl(this.itemInfo.audio_url, (url) => {
OP26.snd_mgr.playEffect(url, null);
});
this.m_touchTime = 0;
clearInterval(this.timer);
//定时器
this.timer = setInterval(() => {
this.m_touchTime += 1;
if (this.m_touchTime >= 3) {
this.m_touchTime = 0;
OP26.res_mgr.playAudioByUrl(this.itemInfo.audio_url, (url) => {
OP26.snd_mgr.playEffect(url, null);
});
}
}, 1000)
this._intervalIds.push(this.timer);
this.isMove = false;
this.deltaPos = this.node.x + this.node.y;
},
//触摸移动
touchMove: function (event) {
if (this.node.isComplent || this._isRotate) {
return
}
var delta = event.getDelta();
this.node.x += delta.x;
this.node.y += delta.y;
var deltaPos = this.node.x + this.node.y;
if (Math.abs(this.deltaPos - deltaPos) > 10) {
this.isMove = true;
}
},
//触摸结束
touchEnd: function (event) {
clearInterval(this.timer);
//暂停音效
OP26.snd_mgr.pauseVolume();
OP26.data_mgr.gameState = 1;
//获得世界坐标
var posScreen = event.getLocation(); //点击事件获取位置
var posNode = this.node.convertToNodeSpaceAR(posScreen);
console.log("世界坐标" + posNode);
if (!this.isMove) {
cc.log("点击了");
// this.onBtnRotate();
this.handTip += 1;
if (this.handTip >= 2) {
OP26.game.inst.setHandTip(this.node.parent);
this.handTip = 0;
}
//回到原来的位置
this.node.x = 0;
this.node.y = 0;
return
}
//获得俩个节点的世界坐标
var contentArrPos = OP26.game.inst.setAABB();
// 获取 ScrollView Node 的左下角坐标在世界坐标系中的坐标
let svLeftBottomPoint = this.node.parent.convertToWorldSpaceAR(
cc.v2(
this.node.x - this.node.anchorX * this.node.width,
this.node.y - this.node.anchorY * this.node.height
)
);
// 求出 ScrollView 可视区域在世界坐标系中的矩形(碰撞盒)
var posNode_1 = cc.rect(
svLeftBottomPoint.x,
svLeftBottomPoint.y,
0,
0
);
var isIntersect = contentArrPos.containsRect(posNode_1);//判断是否被包含
console.log("坐标" + svLeftBottomPoint.x + "," + svLeftBottomPoint.y + "是否包含" + isIntersect);
if (isIntersect) {
if (this.node.is_right == true) {
this.setItemState();
}
else {
this.errorEffect();
}
} else {
this.handTip += 1;
this.errorEffect();
}
},
setItemState: function () {
this.node.isComplent = true;
this.node.active = false;
OP26.data_mgr.nowNum -= 1;
//狮子猫动画
OP26.game.inst.playLionDragon("chew");
//先播放错误声音
OP26.speaker.inst.playEffect(OP26.enum.E_Audio.Right);
this._timeoutIds.push(setTimeout(() => {
OP26.game.inst.playCatDragon("right");
//先播放错误声音
OP26.speaker.inst.playErrorEffect();
//当前关卡是否结束
if (OP26.data_mgr.nowNum <= 0) {
OP26.data_mgr.quesId += 1;
OP26.game.inst.resetQues();
}
}, 500));
},
errorEffect: function () {
//狮子猫动画
OP26.game.inst.playCatDragon("wrong");
OP26.game.inst.playLionDragon("no");
//先播放错误声音
OP26.speaker.inst.playEffect(OP26.enum.E_Audio.Error);
cc.tween(this.node)
.to(0.1, { scaleY: 0.9, scaleX: 1.1 })
.to(0.15, { scaleY: 1.1, scaleX: 0.9 })
.to(0.1, { scaleY: 1, scaleX: 1 })
.start()
this._timeoutIds.push(setTimeout(() => {
//回到原来的位置
this.node.x = 0;
this.node.y = 0;
let num = OP26.utils.randFromTo_Int(OP26.enum.E_Audio.CatError1, OP26.enum.E_Audio.CatError2);
//先播放错误声音
OP26.speaker.inst.playEffect(num, () => {
OP26.game.inst.playCatDragon("normal");
});
OP26.game.inst.playCatDragon("wrong");
OP26.game.inst.playLionDragon("normal");
if (this.handTip >= 2) {
OP26.game.inst.setHandTip(this.node.parent);
this.handTip = 0;
}
}, 500));
},
//触摸取消
touchCancel: function (event) {
clearInterval(this.timer);
//回到原来的位置
this.node.x = 0;
this.node.y = 0;
this.isMove = false;
OP26.data_mgr.gameState = 1;
},
//更新界面ui
updateUI: function (Info) {
//当前数据
this.itemInfo = Info;
//初始化数据
this.InitData();
//是否已经完成了
this.node.isComplent = false;
},
//点击翻面
onBtnRotate: function () {
var scaleX = this.node.scaleY;
this._isRotate = true;
this._timeoutIds.push(setTimeout(() => {
this._isRotate = false;
}, 600));
cc.tween(this.node)
.to(0.3, { scaleX: 0 })
.call(() => {
if (this.Item_name.node.active) {
this.Item_name.node.active = false;
this.Item_photo.active = true;
} else {
this.Item_name.node.active = true;
this.Item_photo.active = false;
}
})
.to(0.3, { scaleX: scaleX })
.start();
},
//初始化信息
InitData: function () {
//设置图片
OP26.res_mgr.getSpriteFrimeByUrl(this.itemInfo.pic_url, (list) => {
this.Item_photo.getComponent(cc.Sprite).spriteFrame = list;
this.photoScare(this.Item_photo, OP26.game.inst.idx);
// this.photoScare(this.nodeState[2].getChildByName("spt_item"), 1);
});
//设置名字
this.Item_name.string = this.itemInfo.text;
},
//图片适配
photoScare: function (node, type) {
var maxNum = type == 0 ? 50 : 168;
let maxSize = Math.min(maxNum / node.height, maxNum / node.width);
if (node.perScale == undefined) {
node.perScale = node.scaleX;
} else {
node.scaleX = node.perScale;
node.scaleY = node.perScale;
}
node.scaleX *= maxSize;
node.scaleY *= maxSize;
},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
});
{
"ver": "1.0.8",
"uuid": "e729b387-9d1a-47a4-9d3d-076fd1ddc360",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
nodBg: {
default: null,
type: cc.Node,
displayName: "背景"
},
nodEffLight: {
default: null,
type: cc.Node,
displayName: "旋转亮光"
},
dragonItem: {
default: null,
type: dragonBones.ArmatureDisplay,
displayName: "龙骨动画"
},
nodScale: {
default: null,
type: cc.Node,
displayName: "缩放节点"
}
},
start: function () {
this._timeoutIds = [];
this._intervalIds = [];
},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this.nodEffLight.stopAllActions();
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
onShow: function () {
this.node.active = true;
//初始化信息
this.InitData();
},
onHide: function () {
this.node.active = false;
this.nodEffLight.stopAllActions();
},
//初始化信息
InitData: function () {
//背景渐入
this.nodBg.opacity = 0;
this.nodBg.runAction(cc.fadeIn(0.2))
//显示龙骨动画
this.setDragon();
//设置缩放
this.scaleItem(this.nodScale);
//播放音效
OP26.speaker.inst.playEffect(OP26.enum.E_Audio.ENDEFFECT);
},
rotateItem(item) {
cc.tween(item)
.by(0.1, { angle: 8 })
.repeatForever()
.start();
},
scaleItem(item) {
item.scale = 0;
cc.tween(item)
.to(0.15, { scale: 1.2 })
.to(0.15, { scale: 1 })
.call(() => {
this.rotateItem(this.nodEffLight)
})
.start();
},
setDragon() {
//先设置节点大小为0,
var Info = {
tex_json: OP26.data_mgr.data.tex_json,
ske_json: OP26.data_mgr.data.ske_json,
tex_png: OP26.data_mgr.data.tex_png,
}
OP26.res_mgr.loadSpine(this.dragonItem, Info);
this.playDragon("normal");
},
//播放动画
playDragon(name) {
this.dragonItem.armatureName = "armatureName";
this.dragonItem.playAnimation(name);
},
});
{
"ver": "1.0.8",
"uuid": "402091db-f415-4d47-bd51-d6371427c70a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "e5afe4a3-c16b-4f1d-acd8-c5eb68d573b3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 音效
*/
//一定按照顺序来
var E_Audio = {
AllPop: 0,//全部弹出
BtnCommom: 1,//按钮
CatComplete: 2,
CatHint: 3,
Right: 4,
Error: 5,
}
var speaker = cc.Class({
extends: cc.Component,
properties: {
eff_audio: {
default: [],
type: cc.AudioClip,
displayName: "音效列表"
},
eff_right: {
default: [],
type: cc.AudioClip,
displayName: "正确音效"
},
eff_error: {
default: [],
type: cc.AudioClip,
displayName: "答错音效"
}
},
ctor: function () {
speaker.inst = this;
OP26.speaker = speaker;
},
//播放音效
playEffect: function (num, cb) {
OP26.snd_mgr.playEffect(this.eff_audio[num], cb);
},
//播放正确音效
playRightEffect: function (cb) {
let num = OP26.utils.randFromTo_Int(0, this.eff_right.length);
OP26.snd_mgr.playEffect(this.eff_right[num], cb);
},
//播放失败音效
playErrorEffect: function (cb) {
let num = OP26.utils.randFromTo_Int(0, this.eff_error.length);
OP26.snd_mgr.playEffect(this.eff_error[num], cb);
}
});
{
"ver": "1.0.8",
"uuid": "ab52071c-b063-4dc5-8f90-7b771a4d0e68",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "782b613f-5fb8-4c6f-83ca-c4db95389092",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
/**
* 数据管理器
*/
OP26.data_mgr = {
data: null,//表所有数据
quesId: 0,//题目id
nowNum: 0,//剩余正确数量
gameState: 2,//游戏状态1可操作 2不可操作
//获得默认数据
getDefaultData() {
const dataJson = {
"maxWrongNumber": 4,
"question_arr": [{
"question_audio_url": "http://staging-teach.cdn.ireadabc.com/25432da42768ff9681946ea7fc7ee272.mp3",
"option_arr": [{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "a" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/58eec304909298176bde6c408c9dac1b.mp3", "is_right": false, "text": "b" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "c" }],
"audio_url": "http://staging-teach.cdn.ireadabc.com/25432da42768ff9681946ea7fc7ee272.mp3"
},
{
"question_audio_url": "http://staging-teach.cdn.ireadabc.com/25432da42768ff9681946ea7fc7ee272.mp3",
"option_arr": [{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "a" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/58eec304909298176bde6c408c9dac1b.mp3", "is_right": false, "text": "b" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "c" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/58eec304909298176bde6c408c9dac1b.mp3", "is_right": false, "text": "d" }]
},
{
"question_audio_url": "http://staging-teach.cdn.ireadabc.com/25432da42768ff9681946ea7fc7ee272.mp3",
"option_arr": [{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "a" }]
},
{
"question_audio_url": "http://staging-teach.cdn.ireadabc.com/25432da42768ff9681946ea7fc7ee272.mp3",
"option_arr": [
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "a" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/58eec304909298176bde6c408c9dac1b.mp3", "is_right": false, "text": "b" }]
}],
"ske_json": "http://staging-teach.cdn.ireadabc.com/7355648029551e6848a2cf36ea8a6ba6.json",
"ske_json_name": "lion_ske.json",
"tex_json": "http://staging-teach.cdn.ireadabc.com/511fe163f2df10925e3da82f0f69590b.json",
"tex_json_name": "lion_tex.json",
"tex_png": "http://staging-teach.cdn.ireadabc.com/2fd2a53fcb36d36281a6ded9500dd54f.png",
"tex_png_name": "lion_tex.png",
"ske_json1": "http://staging-teach.cdn.ireadabc.com/7355648029551e6848a2cf36ea8a6ba6.json",
"ske_json_name1": "lion_ske.json",
"tex_json1": "http://staging-teach.cdn.ireadabc.com/511fe163f2df10925e3da82f0f69590b.json",
"tex_json_name1": "lion_tex.json",
"tex_png1": "http://staging-teach.cdn.ireadabc.com/2fd2a53fcb36d36281a6ded9500dd54f.png",
"tex_png_name1": "lion_tex.png",
"guideBegin_audio_url": "http://staging-teach.cdn.ireadabc.com/bd6e2b3a870ef3f9ee9ad9c0fda79228.mp3",
"guideEnd_audio_url": "http://staging-teach.cdn.ireadabc.com/bd6e2b3a870ef3f9ee9ad9c0fda79228.mp3",
"guideRestart_audio_url": "http://staging-teach.cdn.ireadabc.com/bd6e2b3a870ef3f9ee9ad9c0fda79228.mp3",
}
const data = dataJson;
// const data = JSON.parse(dataJson);
// const data = [];
return data;
},
getAudioBegin() {
if (!this.data.guideBegin_audio_url) return -1;
return this.data.guideBegin_audio_url;
},
getAudioEnd() {
if (!this.data.guideEnd_audio_url) return -1;
return this.data.guideEnd_audio_url
},
getAudioReStart() {
if (!this.data.guideRestart_audio_url) return -1;
return this.data.guideRestart_audio_url
},
//数据处理
resetQuestion() {
for (var i in this.data.question_arr) {
if (i % 2 == 0) {
let num = OP26.utils.randFromTo_Int(0, 1);
if (num == 0 && this.data.question_arr[~~i + 1]) {
let swap = (arr, i, j) => {
[arr[i], arr[j]] = [arr[j], arr[i]];
}
//交换
swap(this.data.question_arr, ~~i, ~~i + 1)
};
}
}
},
//获取问题列表
getQuestionArr() {
return this.data.question_arr;
},
//获得表单信息
getQuestion(num) {
return this.data.question_arr[num];
},
//获得单题列表
getQuestionOneList(num) {
return this.data.question_arr[num].option_arr;
},
//获得题干
getQuestionStem(num) {
return this.data.question_arr[num].question_audio_url;
},
//获得标题
getTitle() {
return this.data.title;
},
//获得表单信息
getSheepfoldArr() {
return this.data.sheepfoldArr;
},
//获得表单信息
getSheepfold(num) {
return this.data.sheepfoldArr[num];
},
//获得所有选项
getSheepArr() {
return this.data.sheepArr;
},
//获得单项信息
getSheep(num) {
return this.data.sheepArr[num];
},
//获取当前整页数据
getPageInfo: function () {
return this.data.contentObj.pageArr[this.pageId].pageInfo;
},
//获得整条数据
getResultInfo: function (id) {
var pageInfo = this.data.contentObj.pageArr[this.pageId].pageInfo;
return pageInfo[id];
},
//处理数据
proGameData: function () {
this.resetQuestion();
this.preload();
console.log("数据处理完毕:");
},
preload() {
cc.assetManager.loadAny(null, null, null, (err, data) => {
if (window && window["air"]) {
cc.find('Canvas').opacity = 0;
window.air.onCourseInScreen = (next) => {
cc.find('Canvas').opacity = 255;
this.loadEnd();
next();
}
window.air.hideAirClassLoading();
} else {
this.loadEnd();
}
cc.debug.setDisplayStats(false);
});
},
loadEnd() {
//更新游戏界面信息
OP26.game.inst.guideGame();
OP26.game.inst.isLoadEnd = true;
},
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "91e03520-a8ad-4317-a914-1850e6e64926",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// 事件汞
let eventList = {}; // 响应列表(元素结构:eventName,[[target:cb]])
OP26.event_mgr = {
// 注册事件-响应 入参:事件名、响应、目标名
reg: function (eventName, cb, target) {
var event = eventList[eventName];
if (!event) {
event = eventList[eventName] = {};
}
event[target] = cb;
},
// 注销事件-响应 入参:事件名、目标名
unReg: function (eventName, target) {
var event = eventList[eventName];
if (event) {
if (event[target]) {
event[target] = null;
}
}
},
unRegName: function (eventName) {
eventList[eventName] = {};
},
// 广播事件 入参:事件名、参数
send: function (eventName, params) {
var event = eventList[eventName];
if (event) {
for (var target in event) {
var cb = event[target];
if (cb) {
cb(params);
}
}
}
},
getReglist: function () {
return eventList;
}
};
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "b8bf01c9-341f-4994-91ea-ff45a2f9d150",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// localStorage封装
OP26.local_storage = {
// 背景音乐音量
getMusicVolume: function () {
var vol = cc.sys.localStorage.getItem("music");
return vol;
},
setMusicVolume: function (vol) {
cc.sys.localStorage.setItem('music', vol)
},
// 音效音量
getEffectsVolume: function () {
var vol = cc.sys.localStorage.getItem("effect");
return vol;
},
setEffectsVolume: function (vol) {
cc.sys.localStorage.setItem('effect', vol);
},
};
{
"ver": "1.0.8",
"uuid": "0d515142-090e-49ac-aea8-19c7b34f8cb4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 资源管理器
*/
OP26.res_mgr = {
//获得表数据数据
getFormData() {
console.log('初始化数据');
try {
window.courseware.getData((res) => {
//存入数据管理器
OP26.data_mgr.data = res;
//数据处理
OP26.data_mgr.proGameData();
console.log("获得表单数据:" + res);
});
} catch (error) {
//console.error('没有查找到courseware.getData方法', error);
//获得默认数据
OP26.data_mgr.data = OP26.data_mgr.getDefaultData();
//数据处理
OP26.data_mgr.proGameData();
}
},
//得到图片资源
getSpriteFrimeByUrl(url, cb) {
cc.assetManager.loadRemote(url, cc.SpriteFrame, (e, sp) => {
const spriteFrame = new cc.SpriteFrame(sp)
cb && cb(spriteFrame);
});
},
playAudioByUrl(audio_url, cb) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
cb && cb(audioClip);
});
}
},
//加载龙骨
loadSpine(animationDisplay, Info) {
cc.assetManager.loadAny([{ url: Info.tex_json, ext: '.txt' }, { url: Info.ske_json, ext: '.txt' }], (error, assets) => {
if (error) {
console.log(error)
}
else {
cc.assetManager.loadRemote(Info.tex_png, (error, texture) => {
if (error) {
console.log(error)
}
else {
var atlas = new dragonBones.DragonBonesAtlasAsset();
atlas._uuid = Info.tex_json;
atlas.atlasJson = assets[0];
atlas.texture = texture;
var asset = new dragonBones.DragonBonesAsset();
asset._uuid = Info.ske_json;
asset.dragonBonesJson = assets[1];
animationDisplay.dragonAtlasAsset = atlas;
animationDisplay.dragonAsset = asset;
let data = asset._dragonBonesJsonData.armature[0];
if (!data) {
return;
}
animationDisplay.armatureName = data.name;
OP26.data_mgr.dragonName = data.animation[0].name;
animationDisplay.node.active = true;
}
});
}
});
},
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "7121d1fd-fef5-46f9-ae16-ffc9aa7f5e16",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// 声音管理器
OP26.snd_mgr = {
bgmId: -1, // 背景音乐的音频ID
effIds: [], // 音效的音频ID列表(由cc.audioEngine保证音频ID不重复)
bgmVol: 1, // 背景音乐音量
neweffId: null, //保存上一个音效ID
effVol: 1, // 音效音量
pausebgVol: 1,
pauseeffVol: 1,
sndNativeUrls: {},
newsnd: null,
init: function () {
var local_storage = OP26.local_storage;
var music_vol = local_storage.getMusicVolume();
var effect_vol = local_storage.getEffectsVolume();
music_vol != undefined && music_vol + "" != "" && this.setMusicVolume(music_vol);
effect_vol != undefined && effect_vol + "" != "" && this.setEffectsVolume(effect_vol);
},
delAudId: function (id) {
if (id == this.bgmId) {
this.bgmId = -1;
return;
}
for (var i = 0; i < this.effIds.length; ++i) {
if (this.effIds[i] == id) {
this.effIds.splice(i, 1);
return;
}
}
},
playMusic: function (snd, _loop, finishCB) {
if (!snd) return;
this.newsnd = snd;
var loop = _loop ? false : true; // 除非指定为false,否则默认为true
// if (OP26.configs.platform == "vo") {
// this.bgmId = cc.audioEngine.play(snd, loop);
// return;
// }
this.bgmId = cc.audioEngine.playMusic(snd, loop);
// 播放完成回调
if (finishCB) {
cc.audioEngine.setFinishCallback(this.bgmId, function () {
finishCB();
});
}
},
playEffect: function (snd, finishCB) {
if (!snd || this.effVol == 0) return;
var id = cc.audioEngine.playEffect(snd, false); // 音效限定不能重复播放
this.playaudioEffect(id, finishCB);
},
//播放音效
playaudioEffect: function (id, finishCB) {
var self = this;
this.neweffId = id;
this.effIds.push(id);
// 播放完记得删ID
cc.audioEngine.setFinishCallback(id, function () {
self.delAudId(id);
finishCB && finishCB();
});
},
pauseVolume: function () {
cc.audioEngine.stopAll();
},
resumeVolume: function () {
if (this.newsnd != null) {
cc.audioEngine.playMusic(this.newsnd)
}
},
setMusicVolume: function (percent) {
this.bgmVol = percent;
cc.audioEngine.setMusicVolume(~~percent);
},
setEffectsVolume: function (percent) {
this.effVol = percent;
cc.audioEngine.setEffectsVolume(~~percent);
cc.audioEngine.setMusicVolume(~~this.bgmVol);
},
};
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "fb034e6e-0e2d-4e5e-8a3a-b9a12ff90a0d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b",
"uuid": "14836b98-8e4d-4a83-8590-004b965ffb7c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b",
"uuid": "1007f5ae-0b02-488e-97c6-9c1b707578d4",
"rawTextureUuid": "14836b98-8e4d-4a83-8590-004b965ffb7c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "cb8364f7-043f-4e0f-b100-0bb75e56ff10",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 366,
"height": 336,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"1orange": {
"bg_back": {
"ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "7579c400-0156-40f8-abcb-a496cc0a49ab",
"rawTextureUuid": "cb8364f7-043f-4e0f-b100-0bb75e56ff10",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"offsetY": 0,
"trimX": 0,
"trimY": 1,
"width": 366,
"height": 335,
"rawWidth": 366,
"rawHeight": 336,
"trimY": 0,
"width": 1280,
"height": 720,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "405ffc19-1281-4e7b-94b4-d3e545448c7c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 409,
"height": 409,
"platformSettings": {},
"subMetas": {
"btn_right": {
"bg_circle": {
"ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "34014b86-5854-4b25-81a5-7f74c9241368",
"rawTextureUuid": "405ffc19-1281-4e7b-94b4-d3e545448c7c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 0.5,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 60,
"height": 66,
"rawWidth": 61,
"rawHeight": 67,
"width": 409,
"height": 409,
"rawWidth": 409,
"rawHeight": 409,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "f75321d5-95ac-4e96-8e1f-105b8691d8ab",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1271,
"height": 536,
"platformSettings": {},
"subMetas": {
"bg_desk": {
"ver": "1.0.4",
"uuid": "74335f19-b710-42d5-b83d-777631e98e7d",
"rawTextureUuid": "f75321d5-95ac-4e96-8e1f-105b8691d8ab",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1271,
"height": 536,
"rawWidth": 1271,
"rawHeight": 536,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "f1e28ade-3c0d-48ae-b9ba-972b1aa98587",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 209,
"height": 146,
"platformSettings": {},
"subMetas": {
"btn_left": {
"btn_next": {
"ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "385776b9-f855-4540-859a-8c65eefbe71e",
"rawTextureUuid": "f1e28ade-3c0d-48ae-b9ba-972b1aa98587",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 61,
"height": 67,
"rawWidth": 61,
"rawHeight": 67,
"width": 209,
"height": 146,
"rawWidth": 209,
"rawHeight": 146,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "2d128bd0-c993-40d4-88bb-6272f67864e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 262,
"height": 268,
"platformSettings": {},
"subMetas": {
"btn_restart": {
"ver": "1.0.4",
"uuid": "2b74a4ab-b3be-4c0d-b986-b99ec48ea911",
"rawTextureUuid": "2d128bd0-c993-40d4-88bb-6272f67864e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 262,
"height": 268,
"rawWidth": 262,
"rawHeight": 268,
"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.
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