| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import AdM from "../manager/AdM";
- import GameM, { AUDIO_TYPE, VIDEO_TYPE } from "../manager/GameM";
- import UiM, { PANEL_NAME } from "../manager/UiM";
- import BasePanel from "../uiFrames/BasePanel";
- import UIMng, { PanelType } from "../uiFrames/UIMng";
- import CashOut from "./CashOut";
- import OfficialNode from "./OfficialNode";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class RedCodePanel extends BasePanel {
- @property(cc.Node)
- panelNode: cc.Node = null;
- @property(cc.Label)
- labOfficial: cc.Label = null;
- @property(cc.Label)
- labRed: cc.Label = null;
- @property(cc.Label)
- labMoney: cc.Label = null;
- @property(cc.Label)
- labRedCode: cc.Label = null;
- @property(cc.Node)
- parNode: cc.Node = null;
- videoNode = null
- officialStr = "白羊游戏社"
- redCodeStr = "领红包"
- code = ""
- coolTime = false
- start() {
- this.coolTime = false
- this.labOfficial.string = `“${this.officialStr}”`
- this.labRed.string = `“${this.redCodeStr}”`
- }
- OnEnter(param: any) {
-
- this.panelNode.scale = 0;
- this.node.active = true;
- cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" })
- .call(() => {
- console.log("AAAAAA");
- })
- .start();
- this.labMoney.string = `${param.money.toFixed(2)}元`
- this.code = param.code
- this.labRedCode.string = `提现红包码:${this.code}`
- }
- OnExit() {
- this.node.active = false;
- }
- init(money, code) {
- this.labMoney.string = `${money.toFixed(2)}元`
- this.code = code
- this.labRedCode.string = `提现红包码:${this.code}`
- }
- /** 点击复制公众号 */
- clickCopyOfficial() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- AdM.setClipboard(this.officialStr)
- }
- /** 点击教程 */
- clickTeach() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (this.coolTime) {
- return
- }
- this.coolTime = true
- GameM.commonData.teachVideoType = 1;
- console.log('clickTeach')
- let temp = cc.loader.getRes('prefabs/VideoNode')
- this.videoNode = cc.instantiate(temp)
- this.videoNode.getChildByName('video').on("completed", this.onCompleted, this)
- this.node.addChild(this.videoNode)
- }
- onCompleted() {
- this.videoNode.getChildByName('video').off("completed", this.onCompleted, this)
- this.videoNode.destroy()
- GameM.audioM.setResumeMusic()
- GameM.audioM.setTempEffect(true)
- this.coolTime = false
- }
- /** 点击复制红包码 */
- clickCopyRedCode() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- AdM.setClipboard(this.code)
- }
- /** 点击关闭 */
- clickClose() {
- GameM.audioM.setResumeMusic()
- GameM.audioM.setTempEffect(true)
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.OnExit();
- //this.hideEff()
- }
- hideEff() {
- if (UiM.Instance.cashNode) {
- let pos = UiM.Instance.cashNode.getComponent(CashOut).labRedCode.position
- let addy = (cc.winSize.height - 1334) / 2
- pos.y += addy
- cc.tween(this.parNode).to(0.2, { scale: 0, position: pos }).call(() => {
- UiM.Instance.offPanel(PANEL_NAME.OfficialNode)
- }).start();
- }
- else {
- UiM.Instance.offPanel(PANEL_NAME.OfficialNode)
- }
- }
- }
|