123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- var baseScene = require('BaseScene');
- import EventMgr from "../base/EventMgr";
- import ResMgr from "../base/ResMgr";
- import UIMgr from "../base/UIMgr";
- import SoundMgr from "../base/SoundMgr";
- import Tool from "../base/Tool";
- import UserInfoMgr from "../base/user/UserInfoMgr";
- cc.Class({
- extends: baseScene,
- properties: {
- atlasVIP: cc.SpriteAtlas, //vip图集
- labCoin: cc.Label,
- labBli: cc.Label,
- labName: cc.Label,
- labID: cc.Label,
- labHBNum: cc.Label,
- labYGNum: cc.Label,
- labJixian: cc.Label,
- spHead: cc.Sprite,
- spVipDi: cc.Sprite,
- spVip: cc.Sprite,
-
- yunNode: cc.Node,
- haidaoNode: cc.Node,
- centerNode: cc.Node,
- roomNode: cc.Node,
- shopNode: cc.Node,
- mailNode: cc.Node,
- exchangeNode: cc.Node,
- btnsNode: cc.Node,
- jiaziNode: cc.Node,
- jixianSuoNode: cc.Node,
- paomaNode: cc.Node,
- dropDownNode: cc.Node, //下拉内容
- geduanNode: cc.Node, //遮挡(防止瞎点)
-
-
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this._super();
- this.initData();
- this.initListeners();
- this.setPopLayerData();
- // var frameSize = cc.view.getFrameSize();
- // if (frameSize.width / frameSize.height < 1.65) {
- // cc.view.setDesignResolutionSize(720,1280, cc.ResolutionPolicy.FIXED_WIDTH);
- // }
- },
- start () {
- this.onShow();
- this.popLayer();
- this.setPlayerInfo();
- this.setPoolValue();
- cc.director.preloadScene("gameScene");
- },
- // update (dt) {},
- initData(){
- this.popLayers = []; //存储需要自动打开的界面
- this.llkConfig = ConfigModel.getGlobalConfigByKey("llk");
- },
- initListeners(){
- // this.registerListener('121', this.setPlayerInfo);
- this.registerListener('121', this.setPlayerInfo);
- EventMgr.on(EventType.OtherJC_REFRESH, this.setPoolValue, this); //刷新奖池
- },
- setPopLayerData(){
- this.popLayers = [];
- // this.popLayers.push('xxxxx');
- },
- popLayer(){
- if(this.popLayers.length <= 0){
- this.showGeduan(false);
- return;
- }
- let tempPop = this.popLayers.shift();
- let self = this;
- this.showGeduan(true);
- if(tempPop){
- UIMgr.openUI(`prefabs/${tempPop}`, (pf)=>{
- pf.getComponent(tempPop).setCloseBack(()=>{
- self.scheduleOnce(()=>{
- self.popLayer();
- });
- });
- });
- }
- },
- onShow(){
- if(this.llkConfig.Onoff == 1 && GameModel.player.VIPExp >= this.llkConfig.Viplimt){
- this.jixianSuoNode.active = true;
- }else{
- this.jixianSuoNode.active = false;
- }
- },
- setPlayerInfo(){
- this.labCoin.string = utils.getGoldString(GameModel.getItemCountByModel(GAME_RES_MAP.Gold));
- this.labBli.string = GameModel.getItemCountByModel(GAME_RES_MAP.Red);
- console.log('sasdas: ', GameModel.player);
- this.labName.string = GameModel.player.Name;
- this.labID.string = `ID:${GameModel.player.ID}`;
- let vipLv = utils.getVipLevel();
- this.spVipDi.spriteFrame = this.atlasVIP.getSpriteFrame(`VIPdi${vipLv+1}`);
- this.spVip.spriteFrame = this.atlasVIP.getSpriteFrame(`VIP${vipLv+1}`);
- ResMgr.loadRemoteTexture(this.spHead, GameModel.player.Head);
- /*
- this.labHBNum.string = 222222;
- this.labYGNum.string = 333333;
- ResMgr.loadTexture('texture/head/h1', (sp)=>{
- this.spHead.spriteFrame = sp;
- this.spHead.node.width = 90;
- this.spHead.node.height = 90;
- });
- */
- },
- setPoolValue(){
- let value1 = Tool.formatNumber(GameModel.pool3, 7);
- let value2 = Tool.formatNumber(GameModel.pool1, 7);
- let value3 = Tool.formatNumber(GameModel.Pool7, 7);
- this.labHBNum.string = value1;
- this.labYGNum.string = value2;
- this.labJixian.string = value3;
- },
- showGeduan(bShow = false){
- this.geduanNode.active = bShow;
- },
- showHides(bShow){
- for(let i=1; i< this.centerNode.childrenCount; i++){
- this.centerNode.children[i].active = false;
- }
- if(this.centerNode.children[0].active) //房间界面只能自己关闭
- bShow = false;
-
- this.yunNode.active = bShow;
- this.haidaoNode.active = bShow;
- this.btnsNode.active = bShow;
- this.jiaziNode.active = bShow;
- this.paomaNode.getComponent('PaomaLayer').setShowOrHide(bShow);
- },
- //---------------------点击事件---------------------------
- onClickHongbao(){
- SoundMgr.playClick();
- // EventMgr.emit('paopao', 'Hello World');
- this.showHides(false);
- this.roomNode.getComponent('RoomLayer').showRoom(this, 1);
- },
- //赏金争夺
- onClickBonusRank(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/BonusRankLayer');
- },
- onClickYuangu(){
- SoundMgr.playClick();
- this.showHides(false);
- this.roomNode.getComponent('RoomLayer').showRoom(this, 2);
- },
- onClickJixian(){
- SoundMgr.playClick();
- this.showHides(false);
- this.roomNode.getComponent('RoomLayer').showRoom(this, 3);
- },
- onClickCoin(){
- // 测试
- // UIMgr.openUI('prefabs/TipsLayer', (pf)=>{
- // pf.getComponent('TipsLayer').setCon('飒飒飒飒');
- // });
- // UIMgr.openUI('prefabs/GetRewardLayer', (pf)=>{
- // pf.getComponent('GetRewardLayer').initData();
- // });
- this.onClickShop();
- },
- onClickBli(){
- SoundMgr.playClick();
- this.showHides(false);
- this.exchangeNode.getComponent('ExchangeLayer').showExchange(this);
- },
- onClickHead(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/PlayerInfoLayer');
- },
- onClickMenu(){
- SoundMgr.playClick();
- this.dropDownNode.active = !this.dropDownNode.active;
- let tPosY = [80, -10, -100];
- if(this.dropDownNode.active){
- Tool.effectMoveY(this.dropDownNode, tPosY);
- }
- },
- onClickFirst(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/FirstChargeLayer');
- },
- onClickSign(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/SignLayer');
- },
- onClickService(){
- SoundMgr.playClick();
- },
- onClickSet(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/SetLayer');
- },
- onClickChaozhi(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/FortuneGiftLayer');
- },
- onClickMonthCard(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/MonthCardLayer');
- },
- onClickZhaocai(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/ZhaoCaiLayer');
- },
- onClickVIP(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/VIPLayer');
- },
- onClickShare(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/ShareTaskLayer');
- },
- onClickRedgrowth(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/RedGrowthLayer');
- },
-
- onClickInvestment(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/SevenInvestLayer');
- },
- onClickExchangeTask(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/ExchangeTaskLayer');
- },
- onClickMail(){
- SoundMgr.playClick();
- this.showHides(false);
- this.mailNode.getComponent('MailLayer').showMail(this);
- },
- onClickActivity(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/ActivityLayer');
- },
- onClickShop(){
- SoundMgr.playClick();
- this.showHides(false);
- this.shopNode.getComponent('ShopLayer').showShop(this);
- },
- onClickTask(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/TaskLayer', (pf)=>{
- pf.getComponent('TaskLayer').initData();
- });
- },
- onClickDailySale(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/TeHuiLayer', (pf)=>{
- // pf.getComponent('TeHuiLayer').initData();
- });
- },
- });
|