import i18n from "../i18n/runtime-scripts/LanguageData";

export enum ITEM_TYPE {
    Star = "Star",
    Coin = "Coin",
    Magnet = "Magnet",//磁铁
    Hint = "Hint", //提示
    Frozen = "Frozen",//冰冻
    Time = "Time"
}

export enum BOX_TYPE {
    LEVEL,
    STAR,
    TEAM
}

export type TItem = {
    type: ITEM_TYPE,
    num: number;
}

const GameConst = {
    //是否是测试包
    isDebug: false,
    //游戏名字
    gameName: "CatchGoose",
    //本地缓存KEY值
    localCache: {
        player: 'WSOPlayer', //基础数据缓存
        settingData: 'WSOSettingData', //设置的数据
        levelsData: 'WSOLevelsData', //关卡数据
    },
    playerInfoData: `playerInfo`,//玩家信息
    playerName: `playerName`,//玩家名字被修改
    //动态bundle
    bundleName: {
        audios: `audios`,//音乐资源
        models: `models`,//模型预制体
        resources: `resources`,//系统自带的bundle资源包
    },
    //音效
    audios: {
        bg_music: "bg_music", //背景音乐
        btnclick: "btnclick", //
        freeze: "freeze", //
        pass: "pass",//
        softFail: "softFail",//
        starCollect: "starCollect",//
        tap: "tap",//
    },

    //主页面,不会消除释放,可以相互动态切换pop 允许只有一个主页面
    mainUIs:{
        page1: `pageUI/page1`,//主要页面
        page2: `pageUI/page2`,//其他页面
    },
    //popUIs弹出的页面,需要单个消除释放
    popUIs: {
        settingUI: `ui/settingUI`,//设置节点界面
        enterBattleUI: `ui/enterBattleUI`,//进去战斗UI
        spiritFocusUI: `ui/spiritFocusUI`,//聚灵阵页面
    },

    CLEAR_ALL_BOX: "CLEAR_ALL_BOX",
    USE_ITEM_HINT: "USE_ITEM_HINT",
    USE_ITEM_FROZEN: "USE_ITEM_FROZEN",
    USE_ITEM_TIME: "USE_ITEM_TIME",

    getLvBoxReward(key: number) {
        if (key == 1) {
            return [{ type: ITEM_TYPE.Coin, num: 10 }, { type: ITEM_TYPE.Hint, num: 1 }]
        }else if (key == 2) {
            return [{ type: ITEM_TYPE.Coin, num: 20 }, { type: ITEM_TYPE.Hint, num: 1 }, { type: ITEM_TYPE.Magnet, num: 1 }]
        }else {
            return [{ type: ITEM_TYPE.Coin, num: 30 }, { type: ITEM_TYPE.Hint, num: 1 }, { type: ITEM_TYPE.Magnet, num: 1 }, { type: ITEM_TYPE.Time, num: 1 }]
        }
    },

    getStarBoxReward(key: number) {
        if (key == 1) {
            return [{ type: ITEM_TYPE.Coin, num: 20 }, { type: ITEM_TYPE.Hint, num: 1 }]
        }else if (key == 2) {
            return [{ type: ITEM_TYPE.Coin, num: 30 }, { type: ITEM_TYPE.Hint, num: 1 }, { type: ITEM_TYPE.Magnet, num: 1 }]
        }else {
            return [{ type: ITEM_TYPE.Coin, num: 40 }, { type: ITEM_TYPE.Hint, num: 1 }, { type: ITEM_TYPE.Magnet, num: 1 }, { type: ITEM_TYPE.Time, num: 1 }]
        }
    },

    getItemName(type: ITEM_TYPE) {
        return {
            "Star": i18n("main.星星"),
            "Coin": i18n("main.金币"),
            "Magnet": i18n("main.磁铁"),
            "Hint": i18n("main.提示"),
            "Frozen": i18n("main.冰冻"),
            "Time": i18n("main.额外时间")
        }[type];
    },

    local_data_key: "111",
    //游戏窗口层级
    WIN_LAYER:{
        SCENE: 10,
        POPUP: 20,
        GUIDE: 30,
        TIP: 40,
        ERROR: 50,
        VIDEO: 60
    },
    //窗口类型
    WIN_TYPE:{
        NORMAL: 1,//普通
        FULLSCREEN: 2,//全屏
        PERMANENT: 3,//常驻
    },
    MAX_LIFE: 5,
    MAX_LIFE_RECOVERY_TIME: 2,//分钟
    Start_Progress: 100,//多少星星轮一次奖励
    LvBox_Reward: 10,//10关卡奖励一轮
}
export { GameConst }
export const ITEM_HINT_LV = 5;         //  提示
export const ITEM_FROZEN_LV = 10;    //    冰冻时间
export const ITEM_MAGENT_LV = 10;    //    磁铁
export const ITEM_TIME_LV = 20;      //    额外时间