123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
- import EventName from "../EventName/EventName";
- import Sdk from "../SDK/SDK";
- import HTTPS, { NetPost } from "../Template/HTTPS";
- import PopComponet from "../Template/PopComponet";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class EmployeeReferral extends PopComponet {
- static RedPoint = 0
- start(): void {
- console.error(this.Options.Data);
- this.initCount()
- }
- initCount() {
- let LabelComp = this.node.getChildByName("Node").getChildByName("yanchang").getChildByName("Label").getComponent(cc.Label)
- let temp = 0
- if (EmployeeReferral.RedPoint >= 3) {
- temp = 3
- LabelComp.string = '领取奖励'
- } else {
- temp = EmployeeReferral.RedPoint
- LabelComp.string = '立即邀请'
- }
- let ProgressBarComp = this.getComponentInChildren(cc.ProgressBar)
- ProgressBarComp.progress = temp / 3
- ProgressBarComp.getComponentInChildren(cc.Label).string = `邀请人数${temp}/3`
- ///
- let Label = this.node.getChildByName("Node").getChildByName("image").getChildByName("Label").getComponent(cc.Label)
- // this.Options.Data.Reward //装扮 0未获取 1已获取
- // this.Options.Data.Reward1 //道具
- console.error(this.Options.Data);
- if (this.Options.Data.resp.Reward == 0) {
- Label.string = `1个装扮${this.Options.Data.resp.Reward1}个游戏道具`
- } else {
- Label.string = `${this.Options.Data.resp.Reward1}个游戏道具`
- }
- }
- yaoqing() {
- if (EmployeeReferral.RedPoint >= 3) {
- // LabelComp.string = '领取奖励'
- HTTPS.Instance.post(NetPost.ReceiveInvitation, {}).then((resp) => {
- if (resp.Code == 200) {
- //领取奖励 成功
- cc.systemEvent.emit(EventName.UpdateOnce)
- this.node.destroy()
- }
- })
- } else {
- // LabelComp.string = '立即邀请'
- Sdk.getInstance().Share()
- }
- }
- }
|