12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- const weChat = require('./net/WeChat');
- const DWTool = require('./utils/DWTool');
- const Api = require('./net/Api');
- // const Ws = require('./net/Ws');
- cc.Class({
- extends: cc.Component,
- properties: {
- game: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad() {
- // Ws.open();
- // setTimeout(() => {
- // Ws.emit('fuck', 111)
- // }, 2000)
- // Ws.on('getFuck', data => {
- // console.log(data);
- // })
-
- if (!CC_WECHATGAME) {
- Global.showLoginPage = false;
- Global.channel = 'LuciferChannel';
- Global.os = 1;
- Global.ver = 1;
- if(CC_PREVIEW) {
- Global.user = {
- uid: DWTool.getUrlParam('uid'),
- token: DWTool.getUrlParam('token'),
- nick: "Ade",
- avatar: "",
- gender: 1
- }
- } else {
- Global.user = {
- uid: 1,
- token: 'lucifer_test_token',
- nick: 'lucifer',
- avatar: "",
- gender: 1
- }
- }
- } else {
- switch (cc.sys.platform) {
- case cc.sys.WECHAT_GAME:
- Global.channel = 'weixin';
- break;
- case cc.sys.QQ_PLAY:
- Global.channel = 'qq';
- break;
- }
- }
- this.game.active = true;
- // cc.game.setFrameRate(30);//强制游戏改为30帧的方法
- console.log("Global: " + Global.channel);
- },
- start() {
- },
- // update (dt) {},
- });
|