/*
 * @Author: mojunshou 1637302775@qq.com
 * @Date: 2025-04-10 14:49:42
 * @LastEditors: mojunshou 1637302775@qq.com
 * @LastEditTime: 2025-04-28 16:40:03
 * @Description: 
 */
import { ecs } from "db://oops-framework/libs/ecs/ECS";

interface CurLevelInfo {
    level: number;
    score: number;
}



interface CurLevelConfig {
    level: number;        //当前关卡    
    score: number;        //当前关卡目标分数
    skipCount: number;    //当前关卡跳过次数
    eliminateScope: number[];   //消除配置 用于展示惊喜翻倍弹窗
    eventType: string      //消除配置
}

//费用配置
interface CostInfo {
    handlingCharge: number; //处理费
    giftNum: number;         //赠送金
}

//提现记录
interface RecordInfo {
    title: string,
    amount: number,
    payMethod: number,
    createTime: number,
    successTime: number,
    status: number
}

interface goodsList {
    propId: string,
    propNum: number
}

interface PassViewInfo {
    showReward: goodsList[]
    doubleReward: boolean
}

//微信提现页信息
interface wechat_tx_info {
    money: number,          //已有金额
    gapGoldNum: number,    //差多少金砖
    handingChargeProgress: cost_info
}

//手续费信息
interface cost_info {
    totalMoney: number,      //已有金额
    handingCharge: number,   //设置的手续费
    hasNum: number,  //已经有
    gapNum: number,  //还差
}

//红包币提现页信息
interface taskList_info {
    level: number,
    target: number,
    reward: goodsList[],
    status: number
}

//翻倍奖励信息
interface doubleRewardInfo {
    showReward: goodsList[],
    handingChargeProgress: cost_info,
    levelProgress: levelProgress
}

//翻倍奖励进度信息
interface levelProgress {
    nextProgress: number,  //下一关提现点距离
    levelInfoList: levelInfo[]
}

interface levelInfo {
    level: number,
    eventType: string,
    withdraw: boolean,
}


interface loadBarInfo {
    levelProgress: levelProgress,
    wealCount: number  //福利次数
}

// 游戏状态枚举
enum GameState {
    READY,      // 准备中
    PLAYING,    // 游戏中
    PAUSED,     // 暂停 --进其他界面，广告等，游戏自动状态暂停
    GAME_OVER,  // 游戏结束
    GAME_PASS
}



/** 数据层对象 */
@ecs.register('GameModel')
export class GameModelComp extends ecs.Comp {
    id: number = -1;


    // /**手续费*/
    _handlingCharge: number = 0;
    /**当前分数*/
    _curScore: number = 0;
    /**目标分数*/
    _targetScore: number = 0;
    /**协议类型 1隐私 2用户*/
    _protocolType: number = 1;
    //当前关卡信息
    _curLevelInfo: CurLevelInfo = null!;
    /**当前关卡配置*/
    _curLevelConfig: CurLevelConfig = null!;
    /**游戏费用配置*/
    _costInfo: CostInfo = null!;
    //提现记录
    _recordList: RecordInfo[] = [];
    //是否是广告时间
    _isShowAd: boolean = false;
    /**激励广告价值*/
    _price: number = 0;
    /**看完广告是否发奖励*/
    _isDone: boolean = false;
    /**通关奖励*/
    _passViewInfo: PassViewInfo = null!;
    /**视频签名*/
    _sign: string = "";
    //改变的红包币数
    _changeHbCoin: number = 0;
    //微信币数
    _changeWxCoin: number = 0;
    /**页面类型*/
    _viewType: string = "";   //1翻倍 2通关 3加速 4复活  

    /**提现必反*/
    _cashNum: number = 0;
    //微信提现页金钱
    _txNum: number = 0;
    //事件类型 WITHDRAW_POINT-提现点  SIGN_POINT--预约登记  --PROCEDURE_POINT手续费
    _eventType: string = "";
    /**提现方式 1正常提现 2红包币提现，不要打开提现返利*/
    _txType: number = 1;

    //微信提现页信息
    _wechat_tx_info: wechat_tx_info = null!;
    //红包提现页信息
    _wxCash: number = 0;

    _taskList: taskList_info = null!;

    //2倍速时长
    _doubleSpeedTime: number = 0;


    _doubleRewardInfo: doubleRewardInfo = null!;

    _loadBarInfo: loadBarInfo = null!;


    _popupType: string = "";
    _popupShow: boolean = false;

    _gameState: GameState = GameState.READY;

    //广告跳过次数
    _skipAdCount: number = 0;

    //广告跳过次数配置
    _skipAdConfig: number = -1;


    /**统计少量领取广告次数*/
    _smallAdCount: number = 0;
    /**统计点击全都要的统计次数*/
    _allAdCount: number = 0;
    /**统计直接弹出激励视频广告的统计次数*/
    _directAdCount: number = 0;
    /**二倍速视频广告统计*/
    _doubleSpeedAdCount: number = 0;


    /** 数据层组件移除时，重置所有数据为默认值 */
    reset() {
        this.id = -1;
        this.protocolType = 1;
        this.curLevelInfo = null!;
        this.curLevelConfig = null!;
        this.costInfo = null!;
        this.recordList = [];
        this.isShowAd = false;
        this.price = 0;
        this.isDone = false;
        this.sign = "";
        this.changeHbCoin = 0;
        this.changeWxCoin = 0;
        this.viewType = "";
        this.txType = 1;
        this.txNum = 0;
        this.eventType = "";
        this.wechat_tx_info = null!;
        this.wxCash = 0;
        this.taskList = null!;
        this.doubleSpeedTime = 0;
        this.doubleRewardInfo = null!;
        this.loadbarInfo = null!;
        this.popupType = "";
        this.popupShow = false;
        this.gameState = GameState.READY;
        this.skipAdCount = 0;
        this.skipAdConfig = -1;
    }


    set doubleSpeedAdCount(v: number) {
        this._doubleSpeedAdCount = v;
    }

    get doubleSpeedAdCount() {
        return this._doubleSpeedAdCount;
    }


    set smallAdCount(v: number) {
        this._smallAdCount = v;
    }

    get smallAdCount() {
        return this._smallAdCount;
    }

    set allAdCount(v: number) {
        this._allAdCount = v;
    }

    get allAdCount() {
        return this._allAdCount;
    }


    set directAdCount(v: number) {
        this._directAdCount = v;
    }

    get directAdCount() {
        return this._directAdCount;
    }


    set skipAdCount(v: number) {
        this._skipAdCount = v;
    }

    get skipAdCount() {
        return this._skipAdCount;
    }


    set skipAdConfig(v: number) {
        this._skipAdConfig = v;
    }

    get skipAdConfig() {
        return this._skipAdConfig;
    }



    set gameState(v: GameState) {
        this._gameState = v;
    }

    get gameState() {
        return this._gameState;
    }

    set popupShow(v: boolean) {
        this._popupShow = v;
    }

    get popupShow() {
        return this._popupShow
    }

    set popupType(v: string) {
        this._popupType = v;
    }

    get popupType() {
        return this._popupType;
    }



    get doubleSpeedTime() {
        return this._doubleSpeedTime;
    }
    set doubleSpeedTime(value: number) {
        this._doubleSpeedTime = value;
    }

    set wxCash(v: number) {
        this._wxCash = v;
    }

    get wxCash() {
        return this._wxCash;
    }

    set taskList(v: taskList_info) {
        this._taskList = v;
    }

    get taskList() {
        return this._taskList;
    }


    set wechat_tx_info(value: wechat_tx_info) {
        this._wechat_tx_info = value;
    }

    get wechat_tx_info() {
        return this._wechat_tx_info;
    }


    set eventType(v: string) {
        this._eventType = v;
    }

    get eventType() {
        return this._eventType;
    }

    set txType(v: number) {
        this._txType = v;
    }

    get txType() {
        return this._txType;
    }

    //提现成功的金额
    set txNum(v: number) {
        this._txNum = v;
    }

    get txNum() {
        return this._txNum;
    }

    /**改变的红包币*/
    set changeHbCoin(value: number) {
        this._changeHbCoin = value;
    }

    get changeHbCoin() {
        return this._changeHbCoin;
    }

    set changeWxCoin(v: number) {
        this._changeWxCoin = v;
    }

    get changeWxCoin() {
        return this._changeWxCoin;
    }

    set viewType(value: string) {
        this._viewType = value;
    }

    get viewType() {
        return this._viewType;
    }

    set price(value: number) {
        this._price = value;
    }

    get price() {
        return this._price;
    }

    set isDone(value: boolean) {
        this._isDone = value;
    }

    get isDone() {
        return this._isDone;
    }


    set sign(value: string) {
        this._sign = value;
    }

    get sign() {
        return this._sign;
    }

    get handlingCharge() {
        return this._handlingCharge;
    }

    set handlingCharge(value: number) {
        this._handlingCharge = value;
    }

    set curScore(value: number) {
        this._curScore = value;
    }

    get curScore() {
        return this._curScore;
    }

    get targetScore() {
        return this._targetScore;
    }

    set targetScore(value: number) {
        this._targetScore = value;
    }

    get protocolType() {
        return this._protocolType;
    }

    set protocolType(value: number) {
        this._protocolType = value;
    }

    get curLevelInfo() {
        return this._curLevelInfo;
    }

    set curLevelInfo(value: CurLevelInfo) {
        this._curLevelInfo = value;
    }

    get curLevelConfig() {
        return this._curLevelConfig;
    }

    set curLevelConfig(value: CurLevelConfig) {
        this._curLevelConfig = value;
    }

    get costInfo() {
        return this._costInfo;
    }

    set costInfo(value: CostInfo) {
        this._costInfo = value;
    }



    get recordList() {
        return this._recordList;
    }

    set recordList(value: RecordInfo[]) {
        this._recordList = value;
    }

    get isShowAd() {
        return this._isShowAd;
    }

    set isShowAd(value: boolean) {
        this._isShowAd = value
    }


    get passViewInfo() {
        return this._passViewInfo;
    }

    set passViewInfo(value: PassViewInfo) {
        this._passViewInfo = value;
    }

    set cashNum(value: number) {
        this._cashNum = value;
    }

    get cashNum() {
        return this._cashNum;
    }

    //翻倍
    set doubleRewardInfo(value: doubleRewardInfo) {
        this._doubleRewardInfo = value;
    }
    get doubleRewardInfo() {
        return this._doubleRewardInfo;
    }



    //进度条奖励
    set loadbarInfo(v: loadBarInfo) {
        this._loadBarInfo = v;
    }

    get loadbarInfo() {
        return this._loadBarInfo;
    }

}