// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html var Main = require("Main") var ShaderMaterial = require('ShaderMaterial'); var playerData = require('playerData') cc.Class({ extends: cc.Component, properties: { pb_tips: { default: null, type: cc.Prefab, }, wssCacert: { type: cc.Asset, default: null }, nd_loading: { default: null, type: cc.Node, }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, resetpos() { var winSize = cc.winSize; var width = winSize.width; var height = winSize.height; this.node.width = width; this.node.height = height; this.node.position = cc.v2(width / 2, height / 2); }, showLoading() { if (this.nd_loading) { this.nd_loading.active = true } // if (this.nd_loading) { // this.nd_loading.active = true // this.loadingani.play("loading_ani") // let self =this; // setTimeout(() => { // self.nd_loading.active = false; // }, 2000); // } }, hideLoading() { if (this.nd_loading) { this.nd_loading.active = false } }, hideLoading2(){ if (this.nd_loading) { this.nd_loading.active = false } }, isloading() { if (this.nd_loading) { return this.nd_loading.active } return false }, start() { this.hideLoading2() this.nd = null; this.uiNode = null; this.loadingCount = 0; cc.uiHelper = this this.tipsarr = [] cc.Notifier.on("sdkloginnotic2", this, this.sdkloginnotic2.bind(this)); console.log("LoadUIManagerStart"); }, checksdk(){ if(cc.fcmseitch){ this.sdkloginnotic2() } }, sdkloginnotic2(v){ if(cc.inlogin){ if(window.voiceSDK.m_sdkPlatform == 2){ cc.fcmseitch = true } return } playerData.init2() playerData.init() cc.chatMgr.close() if(cc.newbieManage){ cc.newbieManage.doclean() } this.hideLoading2() cc.sdkdata = null cc.tableView._cellPoolCache={} //cc.sdkdata = v cc.inlogin = true var ree = cc.director.loadScene("LoginScene"); if(!ree){ cc.fcmseitch = true }else{ cc.fcmseitch = false } }, cleanUI() { this.uiNode = null; this.nd = null; this.nowprefab = null; }, showBox(str) { // this.scbox.node.active = true // this.scbox.setStr(str) }, ColorTo_RGB(color) { var r = 0xFF & color; var g = 0xFF00 & color; g >>= 8; var b = 0xFF0000 & color; b >>= 16; return cc.color(r, g, b, 255) }, showTips(str, color) { var nd = this.tipsarr.length > 0 ? this.tipsarr.pop() : cc.instantiate(this.pb_tips) cc.find('DonotDestroy').addChild(nd, 999); var lb = cc.find('tips', nd).getComponent(cc.Label) if (color) { lb.node.color = this.ColorTo_RGB(color) } else { lb.node.color = cc.Color.WHITE } lb.string = str; nd.y = 0 nd.opacity = 255 var self = this var cb = cc.callFunc(function() { nd.removeFromParent(false) self.tipsarr.push(nd) }); nd.runAction(cc.sequence(cc.delayTime(1.5), cc.spawn(cc.moveBy(0.7, cc.v2(0, 300)), cc.fadeOut(0.7)), cb)); }, messageBox(cb1, cb2, des, parent) { var nd = cc.instantiate(this.pb_message); nd.getComponent('messageBox').initdata(cb1, cb2, des); if (!parent) { parent = cc.find('DonotDestroy') } parent.addChild(nd, 998); }, loadScene(name) { this.cleanUI(); this.showLoading(); var self = this; var onSceneLaunched = function() { self.hideLoading(); } cc.director.loadScene(name, onSceneLaunched); }, update(dt) { if (cc.adcdtime > 0) { cc.adcdtime -= dt } ShaderMaterial.update(dt) }, });