| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import GameM, { AUDIO_TYPE } from "../../manager/GameM";
- import MemberListItem from "./MemberListItem";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class ClubMemberUnCheck extends cc.Component {
- @property(cc.Node)
- contentNode: cc.Node = null;
- @property(cc.Prefab)
- memberInfoPrefab:cc.Prefab = null;
- @property(cc.Node)
- emtpyTip:cc.Node = null;
- @property(cc.Label)
- checkLabel:cc.Label = null;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- childMoney = null
- childList = null
- childNum = null
- currentIndex = 0
- start () {
- }
- closeClick(){
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if(cc.isValid(this.node)){
- this.node.destroy()
- }
- }
- showMemberListByInfo(event,type){
- let index = Number(type)
- this.currentIndex = index
- this.contentNode.destroyAllChildren()
- if(this.childList != null && this.childList != undefined){
- for(let entry of this.childList){
- let node = cc.instantiate(this.memberInfoPrefab)
- node.parent = this.contentNode
- node.getComponent(MemberListItem).initInfo(entry)
- }
- }
- }
- getChildInfo(){
- this.contentNode.destroyAllChildren()
- let memberInfo = GameM.ClubData.memberInfo
- if(memberInfo == null || memberInfo == null){
- this.emtpyTip.active = true
- return
- }
- let child1List = GameM.ClubData.memberInfo.g1Members
- let validStandard = GameM.ClubData.memberInfo.validStandard
- this.emtpyTip.active = false
- let count = 0
- for (let entry of child1List) {
- if(entry.validStatus == 0){
- let node = cc.instantiate(this.memberInfoPrefab)
- node.parent = this.contentNode
- this.setNodeInfo(node,entry,validStandard)
- count++
- }
- }
- if(count> 0){
- this.emtpyTip.active = false
- }else{
- this.emtpyTip.active = true
- }
- }
- setNodeInfo(node:cc.Node,data,validStandard){
- if(data == null || data == undefined){
- return
- }
- if (data.avatar != null && data.avatar != undefined && data.avatar != "") {
- cc.loader.load(data.avatar + "?aaa=aa.jpg", (err, res) => {
- if (err) {
- console.log('err:', err);
- return;
- }
- if (cc.isValid(node.getChildByName("maskNode") && cc.isValid(node.getChildByName("maskNode").getChildByName("head")))) {
- let tex: cc.Texture2D = res as cc.Texture2D;
- node.getChildByName("maskNode").getChildByName("head").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(tex);
- }
- })
- }
- node.getChildByName("nameLabel").getComponent(cc.Label).string = data.nickname
- node.getChildByName("unCheckJindu").getComponent(cc.Sprite).fillRange = data.gameWithdrawAmount /data.validStandard
- node.getChildByName("jinduLabel").getComponent(cc.Label).string = (data.gameWithdrawAmount/10000).toFixed(2) +"/"+(validStandard/10000)+"元"
- }
- // update (dt) {}
- }
|