| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- import AdM from "../manager/AdM";
- import { GameController } from "../manager/GameController";
- import GameM from "../manager/GameM";
- import GuideMng from "../manager/GuideMng";
- import HttpM from "../manager/HttpM";
- import UiM from "../manager/UiM";
- import RoadItem from "../other/item/RoadItem";
- import Roads from "../other/item/Roads";
- import MyExtends from "../tools/MyExtends";
- import Time from "../tools/Time";
- import AdRbPanel from "../ui/AdRbPanel";
- import EffectNode from "../ui/EffectNode";
- import RichPanel from "../ui/RichPanel";
- import Task from "../ui/Task";
- import UIMng, { PanelType } from "../uiFrames/UIMng";
- import Sciencen_M from "../utils/Sciencen_M";
- import { HTTP_TYPE } from "./CommonData";
- export class TuCaoData {
- //三国战戟数据管理类
- private static _ins: TuCaoData = null;
- public static get Ins(): TuCaoData {
- if (this._ins == null) {
- this._ins = new TuCaoData();
- }
- return this._ins;
- }
- videoRbData: any = null;
- adRbPanel: AdRbPanel = null;
- bigRbNum: number = 0;
- taskRbId: number = 0;
- taskRbNum: number = 0;
- adsource_id_value = "";
- Destroy() {
- TuCaoData._ins = null;
- }
- ServerInit(data: any) {
- this.videoRbData = data;
- }
- /**
- * 打开任务红包页面
- * @param taskRbNum 红包金额
- * @param redMoneyId 任务红包id
- * @param type 打开红包类型 1 大额红包 2 任务红包
- * @param num 红包金额
- */
- OpenTaskRbPanel(taskRbNum: number, redMoneyId: number, type: number, num: number) {
- this.taskRbId = redMoneyId;
- this.taskRbNum = taskRbNum;
- if (this.adRbPanel != null) {
- this.adRbPanel.OpenRbPanel(type, num);
- }
- }
- /**更新视频进度*/
- async UpdateVideoProgress(data: any) {
- this.videoRbData = data.UserRedMoneyInfo;
- //console.log("UpdateVideoProgress:" + JSON.stringify(data));
- await Time.WaitForSeconds(0.5);
- if (this.adRbPanel != null) {
- //显示动画
- this.adRbPanel.UpdateInfo(true);
- this.adRbPanel.AdProgressEnd();
- }
- }
- /**更新视频进度失败*/
- UpdateVideoProgressFial() {
- }
- /**
- * 免费加进度
- * @param cb 提现回调
- */
- HttpNoAdProgress(cb: Function) {
- HttpM.Instance.SendData(HTTP_TYPE.adRbNoNeedVideo, {}, (res) => {
- //console.log("No Ad UpdateVideoProgress:" , JSON.stringify(res));
- if (res.data != null) {
- this.videoRbData = res.data.UserRedMoneyInfo;
- cb(res.data);
- }
- });
- }
- /**
- * 大额红包提现
- * @param cb 提现回调
- */
- HttpCashBig(cb: Function) {
- HttpM.Instance.SendData(HTTP_TYPE.adRbBigCash, {}, (res) => {
- if (res.data != null) {
- this.videoRbData = res.data.UserRedMoneyInfo;
- cb(res.data);
- }
- });
- }
- /**
- * 任务红包提现
- * @param cb 提现回调
- */
- HttpCashTask(cb: Function) {
- HttpM.Instance.SendData(HTTP_TYPE.adRbTaskCash, { redMoneyId: this.taskRbId }, (res) => {
- if (res.data != null) {
- this.videoRbData = res.data.UserRedMoneyInfo;
- cb(res.data);
- if (res.data.code == 1) {
- AdM.onSendEvent('VideoCash_' + this.taskRbId, '视频红包第' + this.taskRbId + '档领取成功', 'VideoCash');
- }
- }
- });
- }
- /**清空数据*/
- HttpInitAdRbData() {
- HttpM.Instance.SendData(HTTP_TYPE.adRbInit, {}, (res) => {
- console.log("--->Init", res);
- if (res.data != null) {
- this.videoRbData = res.data.UserRedMoneyInfo;
- if (this.adRbPanel != null) {
- this.adRbPanel.UpdateInfo();
- }
- if (res.data.code == 1) {
- AdM.onSendEvent('VideoCashBig_' + res.data.UserRedMoneyInfo.preLargeAmountCashId, ' 视频红包大额提现第' + res.data.UserRedMoneyInfo.preLargeAmountCashId + '档领取成功', 'VideoCashBig');
- }
- }
- });
- }
- }
- /*
- 1.RedPackageNode jinrititle mingrititle null
- let targetPos: cc.Vec2 = this.target.getPosition();
- let bulletPos: cc.Vec2 = this.node.getPosition();
- let normalizeVec: cc.Vec2 = targetPos.subtract(bulletPos).normalize();
- //角度变化以y轴正方向为起点,逆时针角度递增
- this.node.angle = cc.v2(0, 1).signAngle(normalizeVec) * 180 / Math.PI;
- */
|