| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- // 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 AdM from "../../manager/AdM";
- import GameM, { AUDIO_TYPE } from "../../manager/GameM";
- import UiM, { PANEL_NAME } from "../../manager/UiM";
- import ClubMain from "../ClubMain";
- import EffectNode from "../EffectNode";
- import RedCodeNode from "../RedCodeNode";
- import ClubTixianNode from "./ClubTixianNode";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class ClubInviteItem2 extends cc.Component {
- @property(cc.Label)
- moneyLabel: cc.Label = null
- @property(cc.Label)
- personLabel: cc.Label = null
- @property(cc.Label)
- sliderLabel: cc.Label = null
- @property(cc.Node)
- handNode: cc.Node = null
- @property(cc.Sprite)
- progressSprite: cc.Sprite = null
- @property(cc.Node)
- getNode: cc.Node = null
- @property(cc.Node)
- redCodeNode: cc.Node = null
- @property(cc.Node)
- cashNode: cc.Node = null
- @property(cc.Node)
- clubNode: cc.Node = null;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- private data = null
- private index = 0
- start() {
- }
- // /**
- // * 招募人数
- // */
- // private Integer peopleNum;
- // /**
- // * 提现时间
- // */
- // private Date withdrawTime;
- // /**
- // * 提现状态(0未提现,1已提现)
- // */
- // private Integer status;
- // /**
- // * 奖励金额
- // */
- // private Long rewardAmount;
- initItem(data, index) {
- this.data = data
- this.index = index
- let money = (data.rewardAmount) / 10000 + ""
- if (data.rewardAmount % 10000 != 0) {
- money = ((data.rewardAmount) / 10000).toFixed(1)
- }
- this.moneyLabel.string = "¥" + money
- let process = GameM.ClubData.clubInviteInfo.finishCount + "/" + data.peopleNum
- this.personLabel.string = `招募${data.peopleNum}个徒弟`
- this.sliderLabel.string = process
- //this.personLabel.string = `<b><outline color=#460000 width=2><color=#ffffff>招募</color> <color=#FFD86C>${process}</color> <color=#ffffff>玩家</color> </outline></b>`
- this.progressSprite.fillRange = GameM.ClubData.clubInviteInfo.finishCount / data.peopleNum
- if (GameM.ClubData.clubInviteInfo.finishCount >= data.peopleNum && this.data.status == 0) {
- this.handNode.active = true
- } else {
- this.handNode.active = false
- }
- if (this.data.status == 0) {
- if (GameM.ClubData.clubInviteInfo.finishCount >= this.data.peopleNum) {
- this.getNode.active = false
- this.redCodeNode.active = false
- this.cashNode.active = true
- this.clubNode.active = false;
- } else {
- this.getNode.active = false
- this.redCodeNode.active = false
- this.cashNode.active = false
- this.clubNode.active = true;
- }
- } else {
- this.getNode.active = true
- this.redCodeNode.active = true
- this.cashNode.active = false
- this.clubNode.active = false;
- }
- }
- sharePic() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.ClubData.inviteOtherPlayer()
- }
- clicktixian() {
- //to do
- if (GameM.ClubData.clubInviteInfo.finishCount < this.data.peopleNum) {
- EffectNode.instance.PlayTip("招募人数不足")
- return
- }
- if (this.data.status != 0) {
- EffectNode.instance.PlayTip("您老人家已经提现辣!")
- return
- }
- // GameM.ClubData.requestClubDoWithdraw(GameM.commonData.version,3+"", this.data.peopleNum, (this.data.rewardAmount)/10000)
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.readyToLingqu(3 + "", (this.data.rewardAmount / 10000), this.data.peopleNum)
- }
- readyToLingqu(type, money, peopleNum) {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- // this.tixianNode.active = true
- cc.loader.loadRes('prefabs/club/ClubTixianNode', cc.Prefab, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- let node: cc.Node = cc.instantiate(assets)
- node.parent = UiM.Instance.clubMainNode.getComponent(ClubMain).alertNode
- UiM.Instance.openPanel(node)
- node.getComponent(ClubTixianNode).initView(type, money, peopleNum, this.index)
- })
- }
- clickRedCode() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- UiM.Instance.onPanel(PANEL_NAME.RedCodeNode, false, () => {
- UiM.Instance.redCodeNode.getComponent(RedCodeNode).init(50)
- })
- }
- //1.1.6 招募按钮
- clickClubBtn(){
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.ClubData.inviteOtherPlayer()
- }
- // update (dt) {}
- }
|