Commit 53368db2 authored by 范雪寒's avatar 范雪寒

fix: g

parent 50c2a6c9
...@@ -14,7 +14,7 @@ var game = cc.Class({ ...@@ -14,7 +14,7 @@ var game = cc.Class({
ctor: function () { ctor: function () {
game.inst = this; game.inst = this;
g.game = game; g_ps05.game = game;
}, },
// 生命周期 onLoad // 生命周期 onLoad
...@@ -31,20 +31,20 @@ var game = cc.Class({ ...@@ -31,20 +31,20 @@ var game = cc.Class({
//屏幕缩放 //屏幕缩放
scaleEventCallBack: function () { scaleEventCallBack: function () {
g.event_mgr.send("adjustUI"); g_ps05.event_mgr.send("adjustUI");
}, },
//初始化游戏 //初始化游戏
initGame: function () { initGame: function () {
//获得数据 //获得数据
g.res_mgr.getFormData(); g_ps05.res_mgr.getFormData();
}, },
onBtnTest() { onBtnTest() {
g.Light.inst.addLightNum(3); g_ps05.Light.inst.addLightNum(3);
}, },
onBtnTest2() { onBtnTest2() {
g.Light.inst.showLight(); g_ps05.Light.inst.showLight();
}, },
//检查当前缩放倍数 //检查当前缩放倍数
...@@ -61,9 +61,9 @@ var game = cc.Class({ ...@@ -61,9 +61,9 @@ var game = cc.Class({
//添加节点 //添加节点
addItem: function () { addItem: function () {
let itemArr = g.data_mgr.getSheepArr(); let itemArr = g_ps05.data_mgr.getSheepArr();
this.idx = this.checkNodeParent(); this.idx = this.checkNodeParent();
g.data_mgr.nowNum = itemArr.length; g_ps05.data_mgr.nowNum = itemArr.length;
itemArr.sort(function () { return Math.random() > 0.5 ? -1 : 1; }) itemArr.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
...@@ -76,7 +76,7 @@ var game = cc.Class({ ...@@ -76,7 +76,7 @@ var game = cc.Class({
com.updateUI(itemInfo); com.updateUI(itemInfo);
newItem_0.active = true; newItem_0.active = true;
//设置类别 //设置类别
let sheepInfo = g.data_mgr.getSheep(i); let sheepInfo = g_ps05.data_mgr.getSheep(i);
newItem_0.getChildByName("item").type = this.checkType(sheepInfo.sheepfoldId); newItem_0.getChildByName("item").type = this.checkType(sheepInfo.sheepfoldId);
...@@ -87,7 +87,7 @@ var game = cc.Class({ ...@@ -87,7 +87,7 @@ var game = cc.Class({
//检测放到哪个节点底下 //检测放到哪个节点底下
checkNodeParent: function () { checkNodeParent: function () {
//获取到总列表 //获取到总列表
var itemArr = g.data_mgr.getSheepArr(); var itemArr = g_ps05.data_mgr.getSheepArr();
// //
if (itemArr.length <= 7) { if (itemArr.length <= 7) {
...@@ -102,8 +102,8 @@ var game = cc.Class({ ...@@ -102,8 +102,8 @@ var game = cc.Class({
//检查类别 //检查类别
checkType: function (Id) { checkType: function (Id) {
for (var i in g.data_mgr.getSheepfoldArr()) { for (var i in g_ps05.data_mgr.getSheepfoldArr()) {
var sheepfoldInfo = g.data_mgr.getSheepfoldArr()[i]; var sheepfoldInfo = g_ps05.data_mgr.getSheepfoldArr()[i];
if (Id == sheepfoldInfo.id) { if (Id == sheepfoldInfo.id) {
return ~~i + 1; return ~~i + 1;
} }
...@@ -114,7 +114,7 @@ var game = cc.Class({ ...@@ -114,7 +114,7 @@ var game = cc.Class({
//设置目标节点类型 //设置目标节点类型
setOptionType: function () { setOptionType: function () {
//设置类型 //设置类型
this.OptionType = g.data_mgr.getSheepfoldArr().length - 3; this.OptionType = g_ps05.data_mgr.getSheepfoldArr().length - 3;
}, },
getOptionType: function () { getOptionType: function () {
...@@ -126,28 +126,28 @@ var game = cc.Class({ ...@@ -126,28 +126,28 @@ var game = cc.Class({
this.btnRestart.active = false; this.btnRestart.active = false;
//设置题目长度 //设置题目长度
g.scoreStart.inst.addStar(g.data_mgr.data.starArr.length); g_ps05.scoreStart.inst.addStar(g_ps05.data_mgr.data.starArr.length);
g.data_mgr.ansId = 0; g_ps05.data_mgr.ansId = 0;
g.data_mgr.startId = 0; g_ps05.data_mgr.startId = 0;
//初始化单题题目 //初始化单题题目
this.InitQuestion(); this.InitQuestion();
}, },
//初始化单个题目 //初始化单个题目
InitQuestion() { InitQuestion() {
var question = g.data_mgr.data.starArr[g.data_mgr.startId].queArr[g.data_mgr.ansId] var question = g_ps05.data_mgr.data.starArr[g_ps05.data_mgr.startId].queArr[g_ps05.data_mgr.ansId]
//初始化灯 //初始化灯
g.Light.inst.addLightNum(question.hotZoneItemArr.length); g_ps05.Light.inst.addLightNum(question.hotZoneItemArr.length);
//初始化标题 //初始化标题
g.titleType.inst.showTitle(question.title, question.title_audio_url); g_ps05.titleType.inst.showTitle(question.title, question.title_audio_url);
if (question.title_audio_url) { if (question.title_audio_url) {
g.data_mgr.gameState = 2; g_ps05.data_mgr.gameState = 2;
setTimeout(() => { setTimeout(() => {
g.titleType.inst.onBtnPlayEffect(); g_ps05.titleType.inst.onBtnPlayEffect();
}, 500) }, 500)
} }
//设置中间图片 //设置中间图片
g.picNode.inst.onShow(question); g_ps05.picNode.inst.onShow(question);
}, },
onBtnCheck() { onBtnCheck() {
...@@ -156,21 +156,21 @@ var game = cc.Class({ ...@@ -156,21 +156,21 @@ var game = cc.Class({
//播放特效 //播放特效
//灯+1 //灯+1
g.speaker.inst.playEffect(g.enum.E_Audio.Right); g_ps05.speaker.inst.playEffect(g_ps05.enum.E_Audio.Right);
let num = g.Light.inst.showLight(); let num = g_ps05.Light.inst.showLight();
if (num == -1) { if (num == -1) {
g.data_mgr.ansId += 1; g_ps05.data_mgr.ansId += 1;
if (g.data_mgr.ansId >= g.data_mgr.data.starArr[g.data_mgr.startId].queArr.length) { if (g_ps05.data_mgr.ansId >= g_ps05.data_mgr.data.starArr[g_ps05.data_mgr.startId].queArr.length) {
//大星星音效 //大星星音效
g.speaker.inst.playEffect(g.enum.E_Audio.Star); g_ps05.speaker.inst.playEffect(g_ps05.enum.E_Audio.Star);
g.scoreStart.inst.showStar(); g_ps05.scoreStart.inst.showStar();
g.data_mgr.ansId = 0; g_ps05.data_mgr.ansId = 0;
g.data_mgr.startId += 1; g_ps05.data_mgr.startId += 1;
} }
setTimeout(() => { setTimeout(() => {
if (g.data_mgr.startId >= g.data_mgr.data.starArr.length) { if (g_ps05.data_mgr.startId >= g_ps05.data_mgr.data.starArr.length) {
g.speaker.inst.playEffect(g.enum.E_Audio.Flowers); g_ps05.speaker.inst.playEffect(g_ps05.enum.E_Audio.Flowers);
g.effect.inst.showEffect2(); g_ps05.effect.inst.showEffect2();
this.btnRestart.active = true; this.btnRestart.active = true;
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find('middleLayer');
if (middleLayer) { if (middleLayer) {
...@@ -191,9 +191,9 @@ var game = cc.Class({ ...@@ -191,9 +191,9 @@ var game = cc.Class({
//播放标题音效 //播放标题音效
playAudioTitle: function () { playAudioTitle: function () {
//获得播放路径 //获得播放路径
var path = g.data_mgr.data.audio_url; var path = g_ps05.data_mgr.data.audio_url;
g.res_mgr.playAudioByUrl(path, (url) => { g_ps05.res_mgr.playAudioByUrl(path, (url) => {
g.snd_mgr.playEffect(url, null); g_ps05.snd_mgr.playEffect(url, null);
}); });
}, },
...@@ -203,12 +203,12 @@ var game = cc.Class({ ...@@ -203,12 +203,12 @@ var game = cc.Class({
this.contentArr_2[0].removeAllChildren(); this.contentArr_2[0].removeAllChildren();
this.contentArr_2[1].removeAllChildren(); this.contentArr_2[1].removeAllChildren();
//移除所有子节点 //移除所有子节点
g.event_mgr.send("reSetGame"); g_ps05.event_mgr.send("reSetGame");
}, },
//重新开始 //重新开始
onBtnReStart: function () { onBtnReStart: function () {
g.speaker.inst.playEffect(g.enum.E_Audio.BtnCommom); g_ps05.speaker.inst.playEffect(g_ps05.enum.E_Audio.BtnCommom);
//移除所有计时器 //移除所有计时器
this.unscheduleAllCallbacks(); this.unscheduleAllCallbacks();
//初始化界面 //初始化界面
...@@ -217,7 +217,7 @@ var game = cc.Class({ ...@@ -217,7 +217,7 @@ var game = cc.Class({
//游戏开始 //游戏开始
gameStart: function () { gameStart: function () {
console.log("游戏开始:" + g.data_mgr); console.log("游戏开始:" + g_ps05.data_mgr);
//播放一个上面的音乐 //播放一个上面的音乐
this.setAudioInfo(1); this.setAudioInfo(1);
}, },
......
// 全局环境预声明 // 全局环境预声明
window.g = window.g || {}; // 全局 window.g_ps05 = window.g_ps05 || {}; // 全局
\ No newline at end of file \ No newline at end of file
...@@ -14,7 +14,7 @@ var eff_well = cc.Class({ ...@@ -14,7 +14,7 @@ var eff_well = cc.Class({
ctor: function () { ctor: function () {
eff_well.inst = this; eff_well.inst = this;
g.eff_well = eff_well; g_ps05.eff_well = eff_well;
}, },
//显示特效 //显示特效
...@@ -22,7 +22,7 @@ var eff_well = cc.Class({ ...@@ -22,7 +22,7 @@ var eff_well = cc.Class({
this.node.active = true; this.node.active = true;
this.eff_welldown.play(); this.eff_welldown.play();
//播放撒花音效 //播放撒花音效
g.speaker.inst.play_congratulation(); g_ps05.speaker.inst.play_congratulation();
setTimeout(() => { setTimeout(() => {
this.node.active = false; this.node.active = false;
}, 2000) }, 2000)
......
g.utils = { g_ps05.utils = {
// 范围随机 // 范围随机
randFromTo: function (_min, _max) { randFromTo: function (_min, _max) {
var min = parseFloat(_min); var min = parseFloat(_min);
......
...@@ -62,7 +62,7 @@ cc.Class({ ...@@ -62,7 +62,7 @@ cc.Class({
} }
}, 0); }, 0);
g.event_mgr.reg("adjustUI", () => { g_ps05.event_mgr.reg("adjustUI", () => {
this.setBgScale(); this.setBgScale();
this.setUiPositon(); this.setUiPositon();
}); });
...@@ -89,7 +89,7 @@ cc.Class({ ...@@ -89,7 +89,7 @@ cc.Class({
var h = (canvaSize.height) / 1334; var h = (canvaSize.height) / 1334;
this.MaxSize = w / h > 1 ? w / h : h / w; this.MaxSize = w / h > 1 ? w / h : h / w;
g.data_mgr.MaxSize = this.MaxSize; g_ps05.data_mgr.MaxSize = this.MaxSize;
this.setUIMax(this.MaxSize); this.setUIMax(this.MaxSize);
this.settopUI(this.MaxSize); this.settopUI(this.MaxSize);
this.setBgScale(); this.setBgScale();
...@@ -102,15 +102,15 @@ cc.Class({ ...@@ -102,15 +102,15 @@ cc.Class({
}, },
onDestroy: function () { onDestroy: function () {
if (g.event_pump) { if (g_ps05.event_pump) {
g.event_pump.unReg("adjustUI"); g_ps05.event_pump.unReg("adjustUI");
} }
}, },
settopUI: function (s) { settopUI: function (s) {
if (!g.data_mgr.phoneInfo) { if (!g_ps05.data_mgr.phoneInfo) {
return; return;
} }
var top = g.data_mgr.phoneInfo; var top = g_ps05.data_mgr.phoneInfo;
top = top * s; top = top * s;
for (var i in this.topUI) { for (var i in this.topUI) {
if (this.topUI[i].perTop == undefined) { if (this.topUI[i].perTop == undefined) {
......
...@@ -15,15 +15,15 @@ cc.Class({ ...@@ -15,15 +15,15 @@ cc.Class({
}, },
onLoad() { onLoad() {
this.labTitle.string = g.data_mgr.getSheepfold(this.setAnswerId).word; this.labTitle.string = g_ps05.data_mgr.getSheepfold(this.setAnswerId).word;
this.Event(); this.Event();
}, },
Event() { Event() {
this.m_uuid = g.utils.generateUUID(); //生成一个唯一Id this.m_uuid = g_ps05.utils.generateUUID(); //生成一个唯一Id
g.event_mgr.reg("reSetGame", () => { g_ps05.event_mgr.reg("reSetGame", () => {
this.node.getChildByName("scrollView").getChildByName("view").getChildByName("content").removeAllChildren(); this.node.getChildByName("scrollView").getChildByName("view").getChildByName("content").removeAllChildren();
}, this.m_uuid); }, this.m_uuid);
}, },
......
...@@ -13,7 +13,7 @@ var scoreStart = cc.Class({ ...@@ -13,7 +13,7 @@ var scoreStart = cc.Class({
ctor: function () { ctor: function () {
scoreStart.inst = this; scoreStart.inst = this;
g.scoreStart = scoreStart; g_ps05.scoreStart = scoreStart;
}, },
addStar(num) { addStar(num) {
......
...@@ -15,14 +15,14 @@ var effect = cc.Class({ ...@@ -15,14 +15,14 @@ var effect = cc.Class({
ctor: function () { ctor: function () {
effect.inst = this; effect.inst = this;
g.effect = effect; g_ps05.effect = effect;
}, },
showEffect: function () { showEffect: function () {
const bg = cc.find('Canvas/bg/connent'); const bg = cc.find('Canvas/bg/connent');
this.showAllFirework(bg, cc.find('paperBase').children); this.showAllFirework(bg, cc.find('paperBase').children);
g.speaker.inst.play_congratulation(); g_ps05.speaker.inst.play_congratulation();
}, },
showEffect2: function () { showEffect2: function () {
......
...@@ -26,7 +26,7 @@ var TouchDragger = cc.Class({ ...@@ -26,7 +26,7 @@ var TouchDragger = cc.Class({
}, },
ctor: function () { ctor: function () {
TouchDragger.inst = this; TouchDragger.inst = this;
g.TouchDragger = TouchDragger; g_ps05.TouchDragger = TouchDragger;
}, },
onLoad: function () { onLoad: function () {
this.arMap = []; this.arMap = [];
...@@ -36,7 +36,7 @@ var TouchDragger = cc.Class({ ...@@ -36,7 +36,7 @@ var TouchDragger = cc.Class({
this.isFirstMove = true; this.isFirstMove = true;
//初始化格子数据 //初始化格子数据
this.initGridInfo(g.data_mgr.challengeData.IngredientList); this.initGridInfo(g_ps05.data_mgr.challengeData.IngredientList);
}, },
start: function () { start: function () {
......
...@@ -79,7 +79,7 @@ cc.Class({ ...@@ -79,7 +79,7 @@ cc.Class({
return return
} }
var answer = g.game.inst.checkAnswer(this.node, this.node.type); var answer = g_ps05.game.inst.checkAnswer(this.node, this.node.type);
if (answer) { if (answer) {
this.setItemState(answer); this.setItemState(answer);
...@@ -91,28 +91,28 @@ cc.Class({ ...@@ -91,28 +91,28 @@ cc.Class({
setItemState: function (content) { setItemState: function (content) {
this.Item_complete.active = true; this.Item_complete.active = true;
this.node.isComplent = true; this.node.isComplent = true;
g.data_mgr.nowNum -= 1; g_ps05.data_mgr.nowNum -= 1;
if (g.data_mgr.nowNum == 0) { if (g_ps05.data_mgr.nowNum == 0) {
setTimeout(() => { setTimeout(() => {
g.speaker.inst.play_congratulation(); g_ps05.speaker.inst.play_congratulation();
g.effect.inst.showEffect2(); g_ps05.effect.inst.showEffect2();
}, 500) }, 500)
} }
g.speaker.inst.play_good(); g_ps05.speaker.inst.play_good();
if (g.game.inst.getOptionType() == 2) { if (g_ps05.game.inst.getOptionType() == 2) {
// newItem_temp.scale = 0.8; // newItem_temp.scale = 0.8;
// this.node.scale = this.node.scale * 0.8; // this.node.scale = this.node.scale * 0.8;
var newItem_temp = cc.instantiate(g.game.inst.Item_0[3]); var newItem_temp = cc.instantiate(g_ps05.game.inst.Item_0[3]);
} else { } else {
var newItem_temp = cc.instantiate(g.game.inst.Item_0[2]); var newItem_temp = cc.instantiate(g_ps05.game.inst.Item_0[2]);
} }
// var newItem_temp = cc.instantiate(g.game.inst.Item_0[2]); // var newItem_temp = cc.instantiate(g_ps05.game.inst.Item_0[2]);
content.getChildByName("db").active = true; content.getChildByName("db").active = true;
content.getChildByName("db").getComponent(dragonBones.ArmatureDisplay).playAnimation("newAnimation", 1); content.getChildByName("db").getComponent(dragonBones.ArmatureDisplay).playAnimation("newAnimation", 1);
if (this.node.width >= 150) { if (this.node.width >= 150) {
if (g.game.inst.getOptionType() == 2) { if (g_ps05.game.inst.getOptionType() == 2) {
this.node.scale = 0.45; this.node.scale = 0.45;
this.node.x = 0; this.node.x = 0;
} else { } else {
...@@ -120,7 +120,7 @@ cc.Class({ ...@@ -120,7 +120,7 @@ cc.Class({
this.node.x = 0; this.node.x = 0;
} }
} else { } else {
if (g.game.inst.getOptionType() == 2) { if (g_ps05.game.inst.getOptionType() == 2) {
this.node.scale = 0.7; this.node.scale = 0.7;
this.node.x = 0; this.node.x = 0;
} else { } else {
...@@ -138,7 +138,7 @@ cc.Class({ ...@@ -138,7 +138,7 @@ cc.Class({
}, },
errorEffect: function () { errorEffect: function () {
g.speaker.inst.play_error(); g_ps05.speaker.inst.play_error();
this.node.getChildByName("red").active = true; this.node.getChildByName("red").active = true;
cc.tween(this.node) cc.tween(this.node)
...@@ -178,7 +178,7 @@ cc.Class({ ...@@ -178,7 +178,7 @@ cc.Class({
//点击翻面 //点击翻面
onBtnRotate: function () { onBtnRotate: function () {
//翻面音效 //翻面音效
g.speaker.inst.play_btn(); g_ps05.speaker.inst.play_btn();
var scaleX = this.node.scaleY; var scaleX = this.node.scaleY;
...@@ -207,10 +207,10 @@ cc.Class({ ...@@ -207,10 +207,10 @@ cc.Class({
//初始化信息 //初始化信息
InitData: function () { InitData: function () {
//设置图片 //设置图片
g.res_mgr.getSpriteFrimeByUrl(this.itemInfo.picUrl, (list) => { g_ps05.res_mgr.getSpriteFrimeByUrl(this.itemInfo.picUrl, (list) => {
this.Item_photo.getComponent(cc.Sprite).spriteFrame = list; this.Item_photo.getComponent(cc.Sprite).spriteFrame = list;
this.photoScare(this.Item_photo, g.game.inst.idx); this.photoScare(this.Item_photo, g_ps05.game.inst.idx);
// this.photoScare(this.nodeState[2].getChildByName("spt_item"), 1); // this.photoScare(this.nodeState[2].getChildByName("spt_item"), 1);
}); });
//设置名字 //设置名字
......
...@@ -11,7 +11,7 @@ var Light = cc.Class({ ...@@ -11,7 +11,7 @@ var Light = cc.Class({
ctor: function () { ctor: function () {
Light.inst = this; Light.inst = this;
g.Light = Light; g_ps05.Light = Light;
}, },
addLightNum(Num) { addLightNum(Num) {
......
g.enum = { g_ps05.enum = {
E_Audio: { E_Audio: {
Star: 0,//大星星 Star: 0,//大星星
BtnCommom: 1,//按钮 BtnCommom: 1,//按钮
...@@ -25,15 +25,15 @@ var speaker = cc.Class({ ...@@ -25,15 +25,15 @@ var speaker = cc.Class({
ctor: function () { ctor: function () {
speaker.inst = this; speaker.inst = this;
g.speaker = speaker; g_ps05.speaker = speaker;
}, },
// //播放音效 // //播放音效
// playEffect: function (num, cb) { // playEffect: function (num, cb) {
// g.snd_mgr.playEffect(this.eff_audio[num], cb); // g_ps05.snd_mgr.playEffect(this.eff_audio[num], cb);
// }, // },
playEffect: function (num, cb) { playEffect: function (num, cb) {
g.snd_mgr.playMusic(this.eff_audio[num], 1, cb); g_ps05.snd_mgr.playMusic(this.eff_audio[num], 1, cb);
}, },
}); });
...@@ -11,7 +11,7 @@ var titleType = cc.Class({ ...@@ -11,7 +11,7 @@ var titleType = cc.Class({
ctor: function () { ctor: function () {
titleType.inst = this; titleType.inst = this;
g.titleType = titleType; g_ps05.titleType = titleType;
}, },
start() { start() {
...@@ -49,8 +49,8 @@ var titleType = cc.Class({ ...@@ -49,8 +49,8 @@ var titleType = cc.Class({
//获得播放路径 //获得播放路径
this.schedule(this.setSndEff, 0.3); this.schedule(this.setSndEff, 0.3);
g.res_mgr.playAudioByUrl(this.audio, (url) => { g_ps05.res_mgr.playAudioByUrl(this.audio, (url) => {
g.snd_mgr.playEffect(url, () => { g_ps05.snd_mgr.playEffect(url, () => {
//关闭效果 //关闭效果
this.unschedule(this.setSndEff); this.unschedule(this.setSndEff);
this.btnSnd.active = true; this.btnSnd.active = true;
......
/** /**
* 数据管理器 * 数据管理器
*/ */
g.data_mgr = { g_ps05.data_mgr = {
data: null,//表所有数据 data: null,//表所有数据
nowNum: null,//剩余个数 nowNum: null,//剩余个数
...@@ -117,8 +117,8 @@ g.data_mgr = { ...@@ -117,8 +117,8 @@ g.data_mgr = {
}, },
loadEnd() { loadEnd() {
//更新游戏界面信息 //更新游戏界面信息
g.game.inst.UpdataUi(); g_ps05.game.inst.UpdataUi();
g.game.inst.isLoadEnd = true; g_ps05.game.inst.isLoadEnd = true;
}, },
} }
\ No newline at end of file
// 事件汞 // 事件汞
let eventList = {}; // 响应列表(元素结构:eventName,[[target:cb]]) let eventList = {}; // 响应列表(元素结构:eventName,[[target:cb]])
g.event_mgr = { g_ps05.event_mgr = {
// 注册事件-响应 入参:事件名、响应、目标名 // 注册事件-响应 入参:事件名、响应、目标名
reg: function (eventName, cb, target) { reg: function (eventName, cb, target) {
var event = eventList[eventName]; var event = eventList[eventName];
......
// localStorage封装 // localStorage封装
g.local_storage = { g_ps05.local_storage = {
// 背景音乐音量 // 背景音乐音量
getMusicVolume: function () { getMusicVolume: function () {
var vol = cc.sys.localStorage.getItem("music"); var vol = cc.sys.localStorage.getItem("music");
......
/** /**
* 资源管理器 * 资源管理器
*/ */
g.res_mgr = { g_ps05.res_mgr = {
//获得表数据数据 //获得表数据数据
getFormData() { getFormData() {
console.log('初始化数据'); console.log('初始化数据');
...@@ -9,9 +9,9 @@ g.res_mgr = { ...@@ -9,9 +9,9 @@ g.res_mgr = {
if (window && window.courseware) { if (window && window.courseware) {
window.courseware.getData((res) => { window.courseware.getData((res) => {
//存入数据管理器 //存入数据管理器
g.data_mgr.data = res; g_ps05.data_mgr.data = res;
//数据处理 //数据处理
g.data_mgr.proGameData(); g_ps05.data_mgr.proGameData();
console.log("获得表单数据:" + res); console.log("获得表单数据:" + res);
}); });
return; return;
...@@ -22,9 +22,9 @@ g.res_mgr = { ...@@ -22,9 +22,9 @@ g.res_mgr = {
const middleLayerComponent = middleLayer.getComponent('middleLayer'); const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.getData((res) => { middleLayerComponent.getData((res) => {
//存入数据管理器 //存入数据管理器
g.data_mgr.data = res; g_ps05.data_mgr.data = res;
//数据处理 //数据处理
g.data_mgr.proGameData(); g_ps05.data_mgr.proGameData();
console.log("获得表单数据:" + res); console.log("获得表单数据:" + res);
}); });
return; return;
...@@ -32,9 +32,9 @@ g.res_mgr = { ...@@ -32,9 +32,9 @@ g.res_mgr = {
//console.error('没有查找到courseware.getData方法', error); //console.error('没有查找到courseware.getData方法', error);
//获得默认数据 //获得默认数据
g.data_mgr.data = g.data_mgr.getDefaultData(); g_ps05.data_mgr.data = g_ps05.data_mgr.getDefaultData();
//数据处理 //数据处理
g.data_mgr.proGameData(); g_ps05.data_mgr.proGameData();
}, },
//得到图片资源 //得到图片资源
...@@ -84,7 +84,7 @@ g.res_mgr = { ...@@ -84,7 +84,7 @@ g.res_mgr = {
return; return;
} }
animationDisplay.armatureName = data.name; animationDisplay.armatureName = data.name;
g.data_mgr.dragonName = data.animation[0].name; g_ps05.data_mgr.dragonName = data.animation[0].name;
animationDisplay.node.active = true; animationDisplay.node.active = true;
} }
......
// 声音管理器 // 声音管理器
g.snd_mgr = { g_ps05.snd_mgr = {
bgmId: -1, // 背景音乐的音频ID bgmId: -1, // 背景音乐的音频ID
effIds: [], // 音效的音频ID列表(由cc.audioEngine保证音频ID不重复) effIds: [], // 音效的音频ID列表(由cc.audioEngine保证音频ID不重复)
bgmVol: 1, // 背景音乐音量 bgmVol: 1, // 背景音乐音量
...@@ -10,7 +10,7 @@ g.snd_mgr = { ...@@ -10,7 +10,7 @@ g.snd_mgr = {
sndNativeUrls: {}, sndNativeUrls: {},
newsnd: null, newsnd: null,
init: function () { init: function () {
var local_storage = g.local_storage; var local_storage = g_ps05.local_storage;
var music_vol = local_storage.getMusicVolume(); var music_vol = local_storage.getMusicVolume();
var effect_vol = local_storage.getEffectsVolume(); var effect_vol = local_storage.getEffectsVolume();
music_vol != undefined && music_vol + "" != "" && this.setMusicVolume(music_vol); music_vol != undefined && music_vol + "" != "" && this.setMusicVolume(music_vol);
...@@ -32,7 +32,7 @@ g.snd_mgr = { ...@@ -32,7 +32,7 @@ g.snd_mgr = {
if (!snd) return; if (!snd) return;
this.newsnd = snd; this.newsnd = snd;
var loop = _loop ? false : true; // 除非指定为false,否则默认为true var loop = _loop ? false : true; // 除非指定为false,否则默认为true
// if (g.configs.platform == "vo") { // if (g_ps05.configs.platform == "vo") {
// this.bgmId = cc.audioEngine.play(snd, loop); // this.bgmId = cc.audioEngine.play(snd, loop);
// return; // return;
// } // }
......
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