123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- import ResMgr from "../base/ResMgr";
- import SoundMgr from "../base/SoundMgr";
- import Tool from "../base/Tool";
- import UserInfoMgr from "../base/user/UserInfoMgr";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- atlasVIP: cc.SpriteAtlas, //vip图集
- numsNode: [cc.Node],
- labTime: cc.Label,
- topThreeNode: [cc.Node],
- myNoRank: cc.Node,
- myRank: cc.Node,
- topsNode: [cc.Node],
- labMyRank: cc.Label,
- labMyGua: cc.Label,
- labMyBli: cc.Label,
- spMyHead: cc.Sprite,
- spVipDi: cc.Sprite,
- spVip: cc.Sprite,
- labMyName: cc.Label,
- labMyCount: cc.Label,
- itemPre: cc.Node,
- conNode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this._super();
- this.poolNum = 343512; //奖池数字
- this.lerpTime = 13123123;
- },
- start () {
- this.setNums();
- this.daojishi();
- this.schedule(this.daojishi, 1, cc.macro.REPEAT_FOREVER);
- this.topThree();
- this.setCon();
- this.setMy();
- },
- //设置奖池
- setNums(){
- let pLength = this.poolNum.toString().length;
- if(pLength > this.numsNode.length){
- console.log('位数超了');
- return;
- }
- let splitNum = this.poolNum.toString().split('');
- splitNum.reverse();
- for(let i= this.numsNode.length-1; i > 0; i--){
- this.numsNode[i].getComponent(cc.Label).string = 0;
- if(splitNum[ (this.numsNode.length-1) - i]){
- this.numsNode[i].getComponent(cc.Label).string = splitNum[ (this.numsNode.length-1) - i];
- }
- }
- },
- daojishi(){
- if(this.lerpTime <= 1){
- this.unschedule(this.daoshiji);
- return;
- }
- this.lerpTime -= 1;
- this.labTime.string = Tool.timesBySec(this.lerpTime);
- },
- topThree(){
- for(let tNode of this.topThreeNode){
- tNode.getChildByName('labName').getComponent(cc.Label).string = '叶孤城';
- let spHead = cc.find('mask/head', tNode).getComponent(cc.Sprite);
- // ResMgr.loadRemoteTexture('xxx', (spFrame)=>{
- // spHead.spriteFrame = spFrame;
- // });
- let labBli = cc.find('di3/labBli', tNode).getComponent(cc.Label);
- labBli.string = 1288;
- tNode.getChildByName('labGua').getComponent(cc.Label).string = `瓜分: ${19.99}%`;
- tNode.getChildByName('labCount').getComponent(cc.Label).string = 550055;
- }
- },
- setCon(){
- this.conNode.removeAllChildren();
- for(let i=0; i < 15; i++){
- let temp = cc.instantiate(this.itemPre);
- temp.setParent(this.conNode);
- temp.name = `${i}`;
- temp.active = true;
- temp.getChildByName('labR').getComponent(cc.Label).string = 17;
- let sp = cc.find('mask/sp', temp).getComponent(cc.Sprite);
- ResMgr.loadTexture('texture/head/h1', (spFrame)=>{
- sp.spriteFrame = spFrame;
- });
- temp.getChildByName('spVipDi').getComponent(cc.Sprite).spriteFrame = this.atlasVIP.getSpriteFrame('VIPdi1');
- temp.getChildByName('spVIP').getComponent(cc.Sprite).spriteFrame = this.atlasVIP.getSpriteFrame('VIP1');
- temp.getChildByName('labName').getComponent(cc.Label).string = '陆小凤';
- temp.getChildByName('labCount').getComponent(cc.Label).string = 9998;
- temp.getChildByName('labGua').getComponent(cc.Label).string = `瓜分: ${87.12}%`;
- temp.getChildByName('labBli').getComponent(cc.Label).string = 8999;
- }
- },
- setMy(){
- this.myNoRank.active = false;
- this.myRank.active = true;
- if(this.myRank.active){
- for(let i=0; i < this.topsNode.length; i++){
- this.topsNode[i].active = false;
- }
- this.labMyRank.string = 12;
- this.labMyGua.string = `瓜分: ${12.12}%`;
- this.labMyBli.string = 778811;
- }
- ResMgr.loadTexture('texture/head/h1', (sp)=>{
- this.spMyHead.spriteFrame = sp;
- this.spMyHead.node.width = 90;
- this.spMyHead.node.height = 90;
- });
- this.spVipDi.spriteFrame = this.atlasVIP.getSpriteFrame('VIPdi1');
- this.spVip.spriteFrame = this.atlasVIP.getSpriteFrame('VIP1');
- this.labMyName.string = UserInfoMgr.getUserName();
- this.labMyCount.string = '998';
- },
-
- });
|