Commit 396d96dd authored by 范雪寒's avatar 范雪寒

feat: global问题

parent 181499e2
const tools = require("../script/tools");
import { initGlobal_NGT_02 } from "../../script/common/_preDefine";
var picNode = cc.Class({
extends: cc.Component,
......@@ -12,6 +14,7 @@ var picNode = cc.Class({
},
ctor: function () {
initGlobal_NGT_02();
picNode.inst = this;
g.picNode = picNode;
},
......
This diff is collapsed.
import { initDataMgr_NGT_02 } from "../manager/data_mgr";
import { initEventMgr_NGT_02 } from "../manager/event_mgr";
import { initStorageMgr_NGT_02 } from "../manager/local_storage";
import { initResMgr_NGT_02 } from "../manager/res_mgr";
import { initSndMgr_NGT_02 } from "../manager/snd_mgr";
import { initUtils_NGT_02 } from "./utils";
import { initEnumMgr_NGT_02 } from "../game/speaker";
// 全局环境预声明
function initGlobal_NGT_02() {
export function initGlobal_NGT_02() {
console.log('window.g init');
window.g = {};
initDataMgr_NGT_02();
initEventMgr_NGT_02();
initStorageMgr_NGT_02();
initResMgr_NGT_02();
initSndMgr_NGT_02();
initUtils_NGT_02();
if (!window.g) {
window.g = {};
initDataMgr_NGT_02();
initEventMgr_NGT_02();
initStorageMgr_NGT_02();
initResMgr_NGT_02();
initSndMgr_NGT_02();
initUtils_NGT_02();
initEnumMgr_NGT_02();
}
}
\ No newline at end of file
This diff is collapsed.
g.enum = {
E_Audio: {
Star: 0,//大星星
BtnCommom: 1,//按钮
Flowers: 2,//撒花
Right: 3,//正确
Error: 4,//错误
Question: 5,//题数
}
export function initEnumMgr_NGT_02() {
g.enum = {
E_Audio: {
Star: 0, //大星星
BtnCommom: 1, //按钮
Flowers: 2, //撒花
Right: 3, //正确
Error: 4, //错误
Question: 5, //题数
},
};
}
/**
* 音效
*/
var speaker = cc.Class({
extends: cc.Component,
extends: cc.Component,
properties: {
eff_audio: {
default: [],
type: cc.AudioClip,
displayName: "音效列表"
},
},
properties: {
eff_audio: {
default: [],
type: cc.AudioClip,
displayName: "音效列表",
},
},
ctor: function () {
speaker.inst = this;
g.speaker = speaker;
},
ctor: function () {
speaker.inst = this;
g.speaker = speaker;
},
// //播放音效
// playEffect: function (num, cb) {
// g.snd_mgr.playEffect(this.eff_audio[num], cb);
// },
// //播放音效
// playEffect: function (num, cb) {
// g.snd_mgr.playEffect(this.eff_audio[num], cb);
// },
playEffect: function (num, cb) {
g.snd_mgr.playMusic(this.eff_audio[num], 1, cb);
},
playEffect: function (num, cb) {
g.snd_mgr.playMusic(this.eff_audio[num], 1, cb);
},
});
/**
* 数据管理器
*/
function initDataMgr_NGT_02() {
export function initDataMgr_NGT_02() {
g.data_mgr = {
data: null, //表所有数据
......
function initEventMgr_NGT_02() {
export function initEventMgr_NGT_02() {
// 事件汞
let eventList = {}; // 响应列表(元素结构:eventName,[[target:cb]])
g.event_mgr = {
......
function initStorageMgr_NGT_02() {
export function initStorageMgr_NGT_02() {
// localStorage封装
g.local_storage = {
// 背景音乐音量
......
function initResMgr_NGT_02() {
export function initResMgr_NGT_02() {
/**
* 资源管理器
*/
......
function initSndMgr_NGT_02() {
export function initSndMgr_NGT_02() {
// 声音管理器
g.snd_mgr = {
bgmId: -1, // 背景音乐的音频ID
......
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