Beispiel #1
0
    void LoadTable()
    {
        //运行时热重载配置表数据
        var val1 = BillboardSettings.Get("Billboard1");

        Log.Info(val1.Title);
    }
Beispiel #2
0
    /// <summary>
    /// After Init Modules, coroutine
    /// </summary>
    /// <returns></returns>
    public override IEnumerator OnGameStart()
    {
        WaitForSeconds wait = new WaitForSeconds(1);

        while (DownloadManager.Instance.DownloadFinish == false)
        {
            yield return(wait);
        }
        Log.Info(I18N.Get("btn_billboard"));
        // Print AppConfigs
        // Log.Info("======================================= Read Settings from C# =================================");
        foreach (BillboardSetting setting in BillboardSettings.GetAll())
        {
            Debug.Log(string.Format("C# Read Setting, Key: {0}, Value: {1}", setting.Id, setting.Title));
        }

        //加载公共图集
        AssetBundleLoader.Load($"uiatlas/{UIModule.Instance.CommonAtlases[0]}", (isOk, ab) =>
        {
            if (isOk && ab)
            {
                var atlas = ab.LoadAsset <SpriteAtlas>("atlas_common");
                ABManager.SpriteAtlases["atlas_common"] = atlas;
            }
        });
        yield return(null);

        UIModule.Instance.OpenWindow("UILogin", 888);

        // Test Load a scene in asset bundle
        SceneLoader.Load("Scene/Scene1001/Scene1001");

        //预加载公告界面
        // UIModule.Instance.PreLoadUIWindow("Billboard");
        //UIModule.Instance.OpenWindow("Billboard");
        // 测试Collect函数,立即回收所有资源
        var path        = "ui/UIRoleInfo";
        var assetLoader = AssetBundleLoader.Load(path);

        while (!assetLoader.IsCompleted)
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(1));

        assetLoader.Release();

        KResourceModule.Collect();
    }