import Loading from "./loading/Loading";
import { NetManager } from "../libs/tw/manager/NetManager";
import { DataManager } from "../libs/tw/manager/DataManager";
import { NetName } from "../libs/tw/enum/NetName";
import PanelCtrl from "./ctrls/PanelCtrl";
import ToastPanel from "./components/ToastPanel";
import SceneCtrl from "./ctrls/SceneCtrl";
import MainScene from "./Scene/MainScene";

export const getResPath = () => window['resPath'] || '';
export const getSkinPath = (key: any) => `resource/skins/${key}Skin.exml`

let shareImg: HTMLElement = null;
export function setShareImg(imgUrl: string, rect: egret.Rectangle, visible: boolean = true) {
    shareImg = shareImg || document.getElementById('shareImg');
    shareImg.style.position = 'absolute';
    shareImg.style.display = 'block';
    shareImg.style.visibility = "visible";
    shareImg.style.opacity = visible ? "1" : "0";
    let scaler = document.body.clientWidth / 750;
    shareImg.style.width = (scaler * rect.width).toString() + "px";
    shareImg.style.height = (scaler * rect.height).toString() + "px";
    shareImg.style.left = (rect.x * scaler).toString() + "px";
    shareImg.style.top = (rect.y * scaler).toString() + "px";
    shareImg['src'] = imgUrl;
}
export function clearShareImg() {
    if (!shareImg) {
        console.log("shareImg is null");
        return;
    }

    shareImg.style.width = "0px";
    shareImg.style.height = "0px";
    shareImg.style.visibility = "hidden";
}

export function startGameRequest() {
   
}