123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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;
- let uid = DWTool.getUrlParam('uid');
- let token = DWTool.getUrlParam('token');
- if(!uid && !token) {
- Global.user = {
- uid: 1,
- token: 'lucifer_test_token',
- nick: 'lucifer',
- avatar: "",
- gender: 1
- }
- } else {
- Global.user = {
- uid: uid,
- token: token,
- nick: "游客",
- 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;
- if(CC_WECHATGAME) {
- cc.game.setFrameRate(40); // 微信环境下强制游戏改为40帧的方法
- }
- console.log("Global: " + Global.channel);
- },
- start() {
- },
- // update (dt) {},
- });
|