示例#1
0
        // Use this for initialization
        void Start()
        {
            var hitClip = mResLoader.LoadSync <AudioClip>("resources://hit");

            var coinClip = mResLoader.LoadSync <AudioClip>("resources://hit");

            var bgmClip = mResLoader.LoadSync <AudioClip>("resources://bgm");
        }
示例#2
0
        // Use this for initialization
        void Start()
        {
            mBundle = mResLoader.LoadSync <AssetBundle>("gameobject");

            var gameObj = mBundle.LoadAsset <GameObject>("GameObject");

            Instantiate(gameObj);
        }
示例#3
0
        // Use this for initialization
        void Start()
        {
            var squareTexture = mResLoader.LoadSync <Texture2D>("square", "Square");

            Debug.Log(squareTexture.name);

            //mResLoader.LoadAsync<GameObject>("gameobject", "GameObject", gameObjPrefab =>
            //{
            //    Instantiate(gameObjPrefab);
            //});
        }
示例#4
0
        // Use this for initialization
        IEnumerator Start()
        {
            yield return(new WaitForSeconds(2f));

            mResLoader.LoadAsync <AudioClip>("resources://hit", hitClip => {
                Debug.Log(hitClip.name);
                Debug.Log(Time.deltaTime);
            });

            Debug.Log(Time.deltaTime);

            mResLoader.LoadSync <GameObject>("resources://HomePanel");

            yield return(new WaitForSeconds(2f));

            mResLoader.LoadSync <AudioClip>("resources://bgm");

            mResLoader.LoadSync <AudioClip>("resources://Audio/hit");

            yield return(new WaitForSeconds(5f));

            mResLoader.ReleaseAll();
        }
示例#5
0
        public override bool LoadSync()
        {
            State = ResState.Loading;

            var dependencyBundleNames = ResData.Instance.GetDirectDependencies(Name);

            foreach (var dependencyBundleName in dependencyBundleNames)
            {
                mResLoader.LoadSync <AssetBundle>(dependencyBundleName);
            }

            if (!ResMgr.IsSimulationModeLogic)
            {
                AssetBundle = AssetBundle.LoadFromFile(mPath);
            }

            State = ResState.Loaded;

            return(AssetBundle);
        }
示例#6
0
        public override bool LoadSync()
        {
            State = ResState.Loading;

            var ownerBundle = mResLoader.LoadSync <AssetBundle>(mOwnerBundleName);

            if (ResMgr.IsSimulationModeLogic)
            {
#if UNITY_EDITOR
                var assetPaths = UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(mOwnerBundleName, Name);

                Asset = UnityEditor.AssetDatabase.LoadAssetAtPath <Object>(assetPaths[0]);
#endif
            }
            else
            {
                Asset = ownerBundle.LoadAsset(Name);
            }
            State = ResState.Loaded;

            return(Asset);
        }