//实例化添加组件
    protected IEnumerator IE_InstantAndAddC()
    {
        yield return(ToolsScripts.StartCoroutine(InstantiateManager.GetInstance().IE_InstantiateObjMain()));

        yield return(ToolsScripts.StartCoroutine(InstantiateManager.GetInstance().IE_AddComponent()));

        yield return(null);
    }
    //开始时加载资源
    public IEnumerator IE_LoadAsset()
    {
        yield return(ToolsScripts.StartCoroutine(Init()));          //初始化

        yield return(ToolsScripts.StartCoroutine(loadAssetMain())); //加载资源完成

        yield return(null);
    }
    private IEnumerator loadAssetMain()
    {
        ToolsScripts.StartCoroutine(loadSceneObjAsset());
        ToolsScripts.StartCoroutine(loadUIAsset());
        ToolsScripts.StartCoroutine(loadOtherAsset());
        ToolsScripts.StartCoroutine(loadOther2Asset());
        yield return(new WaitUntil(() => { return isAssetSceneObjLoadComplete && isUIAssetLoadComplete && isOtherAssetLoadComplete && isOther2AssetLoadComplete; }));

        Debug.Log(Time.time);
    }
    private IEnumerator loadAsset(AssetManager item)
    {
        yield return(ToolsScripts.StartCoroutine(item.IE_GetAsset()));

        assetsDic.Add(item.Name, item.GetAsset());
        GameObject go = GameObject.Instantiate(item.GetAsset()) as GameObject;

        AssetNumber++;
        Debug.Log(Time.time);
        yield return(go);
    }
Beispiel #5
0
 //实例化并获取obj
 public IEnumerator IE_InstantiateObjMain()
 {
     foreach (var item in instantObjList)
     {
         if (null == item)
         {
             continue;
         }
         ToolsScripts.StartCoroutine(IE_InstantObj(item));//可等待也可不等待
     }
     yield return(null);
 }
    protected IEnumerator InitManage()
    {
        yield return(ToolsScripts.StartCoroutine(LoadAssets()));

        Debug.Log("<color=red>LoadAssetsComplete</color>");
        yield return(ToolsScripts.StartCoroutine(IE_InstantAndAddC()));

        Debug.Log("<color=red>AddComponentComplete</color>");
        yield return(ToolsScripts.StartCoroutine(IE_DataInit()));

        Debug.Log("<color=red>DataInitComplete</color>");
        isInitComplete = true;
    }
    private IEnumerator loadSingleAsset(string Name)
    {
        foreach (var item in L_assetManager)
        {
            if (item.asset.AssetsName == Name)
            {
                yield return(ToolsScripts.StartCoroutine(item.IE_GetAsset()));

                if (!assetsDic.ContainsKey(item.Name))
                {
                    assetsDic.Add(item.Name, item.GetAsset());
                }
            }
        }
        yield return(null);
    }
    //加载主场景物体
    private IEnumerator loadSceneObjAsset()
    {
        foreach (var item in L_assetManager)
        {
            if (item.asset.assetsType == E_AssetsType.SceneObj)
            {
                yield return(ToolsScripts.StartCoroutine(item.IE_GetAsset()));

                if (!assetsDic.ContainsKey(item.Name))
                {
                    assetsDic.Add(item.Name, item.GetAsset());
                }
            }
        }
        isAssetSceneObjLoadComplete = true;
        yield return(null);
    }
    private IEnumerator loadOtherAsset()
    {
        foreach (var item in L_assetManager)
        {
            if (item.asset.assetsType == (E_AssetsType)3)
            {
                yield return(ToolsScripts.StartCoroutine(item.IE_GetAsset()));

                if (!assetsDic.ContainsKey(item.Name))
                {
                    assetsDic.Add(item.Name, item.GetAsset());
                }
            }
            AssetNumber++;
        }
        isOtherAssetLoadComplete = true;
    }
Beispiel #10
0
    public IEnumerator IE_DataInit()
    {
        yield return(ToolsScripts.StartCoroutine(PublicData._MainSceneObjScript.IE_Init()));

        yield return(null);
    }
    //数据脚本初始化
    protected IEnumerator IE_DataInit()
    {
        yield return(ToolsScripts.StartCoroutine(DataInit.GetInstance().IE_DataInit()));

        yield return(null);
    }
    //加载资源
    protected IEnumerator LoadAssets()
    {
        yield return(ToolsScripts.StartCoroutine(AssetsLoader.GetInstance().IE_LoadAsset()));

        yield return(null);
    }
 protected void Init()
 {
     ToolsScripts.StartCoroutine(InitManage());
 }
 //加载单独资源
 public IEnumerator IE_LoadSingleAsset(string Name)
 {
     ToolsScripts.StartCoroutine(IE_LoadSingleAsset(Name));
     yield return(null);
 }