示例#1
0
文件: Boot.cs 项目: MF-JIN/test
    public override IEnumerator Init()
    {
        AppLog.isEditor = Application.isEditor;
        AppLog.d(Tag, "App.Awake 0");

        yield return(AssetSys.Instance.Init());

        yield return(LuaSys.Instance.Init());

        string luas = AssetSys.GetStreamingAsset("config.lua") as string;

        LuaSys.Instance.DoString(luas, "config");

        yield return(SdkSys.Instance.Init());

        // download boot res
        {
            var ifix_patch_path = $"ifix/{AssetSys.PlatformName()}/Assembly-CSharp.patch.ifix";
            yield return(AssetSys.GetAsset <IFixAsset>(ifix_patch_path, asset =>
            {
                if (asset != null)
                {
                    try
                    {
                        PatchManager.Load(new MemoryStream(asset.data));
                        IFixPatched = true;
                        StartCoroutine(IFixTest());
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogError(e);
                    }
                }
                else
                {
                    Debug.LogError($"AppResourceManager.Load({ifix_patch_path}) failed.");
                }
            }));

            yield return(AssetSys.GetAsset("lua/utility/util.lua"));

            yield return(AssetSys.GetAsset("ui/loading/loading.prefab"));

            yield return(AssetSys.GetAsset("ui/dialog/dialog01.prefab"));

            yield return(AssetSys.GetAsset("common/config/config.lua"));

            yield return(AssetSys.GetAsset("common/root/root.prefab"));
        }

        yield return(AssetSys.GetAsset <GameObject>("common/root/root.prefab", asset =>
        {
            var obj = GameObject.Instantiate(asset);
            obj.transform.localPosition = Vector3.zero;
            obj.transform.eulerAngles = Vector3.zero;
        }));

        yield return(base.Init());
    }
示例#2
0
    public IEnumerator GetRemoteVersion()
    {
        var remoteVersionUrl = AssetSys.WebRoot + AssetSys.PlatformName() + "/" + "resversion.txt";

        AppLog.d(Tag, remoteVersionUrl);

        var temp = Path.GetTempFileName().upath();

        yield return(AssetSys.Download(remoteVersionUrl, temp));

        mRemoteVersion = new Version(File.ReadAllText(temp));
        AppLog.d(Tag, "RemoteVersion {0}", mRemoteVersion.ToString());
        yield return(null);
    }
示例#3
0
    public IEnumerator GetRemoteManifest()
    {
        var remoteManifestUrl = AssetSys.WebRoot + AssetSys.PlatformName() + "/" + mRemoteVersion + "/" + AssetSys.PlatformName();

        var old = AssetBundle.GetAllLoadedAssetBundles().ToList().Find(i => i.name == ""); //AssetBundleManifest);

        if (old)
        {
            AppLog.d(Tag, $"unload AssetBundleManifest {old.name}:{old}");
            old.Unload(true);
        }

        var temp = Path.GetTempFileName().upath();

        yield return(AssetSys.Download(remoteManifestUrl, temp, fs =>
        {
            mRemoteManifest = AssetBundle.LoadFromStream(fs).LoadAsset <AssetBundleManifest>("AssetBundleManifest");
        }));
    }