// Learn TypeScript:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

import GameConst from "../data/GameConst";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GameMgr extends cc.Component {

    //单例模式---------------------------
    private static instance: GameMgr = null;

    public static get Inst(): GameMgr {
        if (!GameMgr.instance) {
            GameMgr.instance = new GameMgr();
        }
        return GameMgr.instance;
    }

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {

    }

    // update (dt) {}

    /**
     * 发送事件
     * @param key key值 数数 不可带空格 请检查
     * @param value value事件值 
     */
    sendEvent(key: string, value: string) {
        // if (!GameConst.ifSendEvent) {
        //     return;
        // }
        // JsbMgr.sendEvent(key, value);
    }

    /**
     * 发送星云事件
     * @param key 
     * @param value 
     */
    sendEventCp(key: string, value: string) {
        if (!GameConst.ifSendEvent) {
            return;
        }
        // HttpMgr.Inst.sendEventCp(key, value);
    }
}

/**UIITEM的名称 */
export enum UI_NAME {
    Loading = "Loading",
    Start = "Start",
    Game = "Game",
    DailyCashOutUI = "DailyCashOutUI",
    GameOverUI = "GameOverUI",
    GetEnergyUI = "GetEnergyUI",
    GetPropUI = "GetPropUI",
    GuideAuthUI = "GuideAuthUI",
    PauseUI = "PauseUI",
    PlayerInfoUI = "PlayerInfoUI",
    RedPacketUI = "RedPacketUI",
    SettingUI = "SettingUI",
    ShopUI = "ShopUI",
    ShopActivityUI = "ShopActivityUI",
    SurpriseTaskUI = "SurpriseTaskUI",
    AdressUI = "AdressUI"
}

/**UIITEM的名称 */
export enum UIITEM_NAME {
    CashOutItem = "CashOutItem",
    ClockInItem = "ClockInItem",
    LevelRedPacketItem = "LevelRedPacketItem",
    ShopGoodItem = "ShopGoodItem",
    ShopRedPacketItem = "ShopRedPacketItem",
    ShopPropItem = "ShopPropItem",
    ShopActivityItem = "ShopActivityItem"
}
