| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { _decorator, Component, Node, Label } from 'cc';
- import { Http } from '../../core/net/Http';
- import { WindowManager } from '../../core/ui/window/WindowManager';
- import { ConfigData } from '../../Data/ConfigData';
- import { g } from '../../Data/g';
- import { platform } from '../../Data/platform';
- import { FsUtils } from '../../FsUtils/FsUtils';
- import { ShenTaiRoleGroup } from './ShenTaiRoleGroup';
- const { ccclass, property } = _decorator;
- @ccclass('ShenTaiWindow')
- export class ShenTaiWindow extends Component {
- // @property({ type: ProgressBar, tooltip: "等级宝箱奖励进度" }) boxGiftProgress: ProgressBar;
- // @property({ type: ProgressBar, tooltip: "红包领取进度" }) redPacketProgress: ProgressBar;
- @property({ type: Http, tooltip: "消息控制" })
- http: Http;
- @property({ type: [Node], tooltip: "好友子节组" })
- roleGroup: Node[] = [];
- @property({ type: Label, tooltip: "贡献文本" })
- contributionLabel: Label;
- @property({ type: Label, tooltip: "可提现文本" })
- cashLabel: Label;
- private contribution: number = -1;
- start() {
- g.gameData.playAddMoneySound = false;
- this.onOpenHandler();
- }
- update() {
- if (this.contribution != g.userData.contribution) {
- this.contributionLabel.string = g.userData.contribution + '';
- this.cashLabel.string = '约' + FsUtils.toFixed(g.userData.contribution / ConfigData.configMap.get("systemConfig").moneyRate, 2) + '元';
- }
- }
- private onOpenHandler() {
- g.gameData.hasG1BembersUpdate = true;
- g.gameData.hasG2BembersUpdate = true;
- g.gameData.hasG3BembersUpdate = true;
- g.gameData.hasG4BembersUpdate = true;
- g.gameData.hasG5BembersUpdate = true;
- }
- public onOpenUserInfo() {
- console.log("onOpenUserInfo");
- //this.http.send("",{});
- // WindowManager.open("Prefabs/Windows/FriendInfoWindow", WindowOpenMode.CloseAndCover, []);
- }
- /**一键领取 */
- public async onGetButton() {
- if (g.gameData.getAllRevenueAmount()) {
- let result = await this.http.send("/api/fission/ReceiveFission", { receiveUserID: 0 });
- if (!result.code) {//
- g.userData.contribution += result.data.addTotalContribution;
- WindowManager.showTips('贡献领取成功');
- g.gameData.clearRevenue();
- this.onOpenHandler();
- }
- } else {
- WindowManager.showTips("当前没有贡献可领取!");
- }
- }
- //邀请
- public async onInvite() {
- let result = await this.http.send("/api/app/share", {});
- if (result.code == 0) {
- platform.wxShare(result.data.url, result.data.title, result.data.descroption);
- } else {
- WindowManager.showTips("分享信息获取失败,请稍后再试");
- }
- }
- onDestroy() {
- g.gameData.playAddMoneySound = true;
- }
- }
|