import ResDic from "./ResDic";
import { EventManager, EventState } from "./EventManager";
import { GameTools } from "./GameTools";

export class AssetManager{
    private static ins:AssetManager;
    //主场景
    public mainscene:Laya.Scene3D;
    //主相机
    public maincamera:Laya.Camera;
    //plane
    public Plane:Laya.Sprite3D;
    //玩家
    public Player:ResDic = new ResDic();
    //敌人
    public Enemy:ResDic = new ResDic();
    //马
    public Horse:ResDic = new ResDic();
    //道具
    public Prop:ResDic = new ResDic();

    constructor(){
        AssetManager.ins = this;
        EventManager.EventOn(EventState.LoadComplete,this,this.Init);
    }
    public static get Instance():AssetManager{
        if(AssetManager.ins){
            return AssetManager.ins
        }
        else{
            return new AssetManager();
        }
    }
    Init(){
        this.maincamera = this.mainscene.getChildByName("Main Camera") as Laya.Camera;
        this.Plane = this.mainscene.getChildByName("Plane") as Laya.Sprite3D;
        GameTools.Instance.SetCollider(this.Plane,100);
        EventManager.EventTrigger(EventState.SceneInit);
    }
}
export class ResourcesPath{
    static MainScene = "Game/res/MainScene/LayaScene_Mainscene/Conventional/Mainscene.ls";
    static Horse =
    [
        "Game/res/Role/LayaScene_Role/Conventional/Horse.lh"
    ] 
    static Player = 
    [
        "Game/res/Role/LayaScene_Role/Conventional/player.lh"
    ]
    static Enemy = 
    [
        "Game/res/Role/LayaScene_Role/Conventional/enemy.lh"
    ]
    static Prop = 
    [
        "Game/res/Prop/LayaScene_Prop/Conventional/Archer"
    ]
}