Ejemplo n.º 1
0
        public void AssetBundleTable_GetAssetDataTest()
        {
#if UNITY_EDITOR
            AssetBundleSettings.SimulateAssetBundleInEditor = true;
#endif
            ResKit.Init();

            var assetBundleTable = AssetBundleSettings.AssetBundleConfigFile;

            var resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(AudioClip));
            var audioClipData = assetBundleTable.GetAssetData(resSearchKeys);
            resSearchKeys.Recycle2Cache();

            Assert.IsNotNull(audioClipData);
            Assert.AreEqual(audioClipData.OwnerBundleName, "coin_get1_mp3");
            Assert.AreEqual(audioClipData.AssetObjectTypeCode, typeof(AudioClip).ToCode());

            resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(GameObject));
            var gameObjectData = assetBundleTable.GetAssetData(resSearchKeys);
            resSearchKeys.Recycle2Cache();

            Assert.IsNotNull(gameObjectData);
            Assert.AreEqual(gameObjectData.OwnerBundleName, "coin_get1_prefab");
            Assert.AreEqual(gameObjectData.AssetObjectTypeCode, typeof(GameObject).ToCode());
        }
Ejemplo n.º 2
0
        public void AssetBundleTable_GetAssetDataTest()
        {
            FromUnityToDll.Setting.SimulationMode = false;

            ResKit.Init();

            var assetBundleTable = AssetBundleSettings.AssetBundleConfigFile;

            var resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(AudioClip));
            var audioClipData = assetBundleTable.GetAssetData(resSearchKeys);

            resSearchKeys.Recycle2Cache();

            Assert.IsNotNull(audioClipData);
            Assert.AreEqual(audioClipData.OwnerBundleName, "coin_get1_mp3");
            Assert.AreEqual(audioClipData.AssetObjectTypeCode, typeof(AudioClip).ToCode());

            resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(GameObject));
            var gameObjectData = assetBundleTable.GetAssetData(resSearchKeys);

            resSearchKeys.Recycle2Cache();

            Assert.IsNotNull(gameObjectData);
            Assert.AreEqual(gameObjectData.OwnerBundleName, "coin_get1_prefab");
            Assert.AreEqual(gameObjectData.AssetObjectTypeCode, typeof(GameObject).ToCode());
        }
Ejemplo n.º 3
0
        public IEnumerator LoadAssetWithNameAndTypeAsyncTest()
        {
            FromUnityToDll.Setting.SimulationMode = false;

            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var loadCount = 0;

            resLoader.Add2Load <AudioClip>("coin_get1", (succeed, res) =>
            {
                Assert.IsTrue(res.Asset as AudioClip);

                loadCount++;
            });

            resLoader.Add2Load <GameObject>("coin_get1", (succeed, res) =>
            {
                Assert.IsTrue(res.Asset as GameObject);

                loadCount++;
            });

            resLoader.LoadAsync();

            while (loadCount != 2)
            {
                yield return(null);
            }

            resLoader.Recycle2Cache();
            resLoader = null;
        }
Ejemplo n.º 4
0
        public IEnumerator LoadAssetAsyncTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var loadDone = false;

            resLoader.Add2Load <GameObject>("coin_get1_prefab", "coin_get1", (succeed, res) =>
            {
                var coinGetPrefab = res.Asset as GameObject;

                Assert.IsTrue(coinGetPrefab);

                loadDone = succeed;
            });

            resLoader.LoadAsync();

            while (!loadDone)
            {
                yield return(null);
            }

            resLoader.Recycle2Cache();
        }
Ejemplo n.º 5
0
        public IEnumerator LoadAssetBundleDependenciesAsyncTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var loadDone = false;

            resLoader.Add2Load <GameObject>("coin_get1_prefab", "coin_get1", (succeed, res) =>
            {
                var coinGetPrefab = res.Asset as GameObject;

                var coinGetObj = Object.Instantiate(coinGetPrefab);

                var audioClip = coinGetObj.GetComponent <AudioSource>().clip;

                Assert.IsTrue(audioClip);

                loadDone = true;
            });

            resLoader.LoadAsync();

            while (!loadDone)
            {
                yield return(null);
            }
        }
Ejemplo n.º 6
0
        public IEnumerator LoadAssetResAsyncTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var loadDone = false;

            resLoader.Add2Load <AudioClip>("coin_get1_mp3", "coin_get1", (succeed, res) =>
            {
                var coinGetClip = res.Asset as AudioClip;

                Assert.IsTrue(coinGetClip);

                loadDone = succeed;
            });

            resLoader.LoadAsync();

            while (!loadDone)
            {
                yield return(null);
            }

            resLoader.Recycle2Cache();

            resLoader = null;
        }
Ejemplo n.º 7
0
        public IEnumerator LoadAssetWithNameAndTypeAsyncTest()
        {
#if UNITY_EDITOR
            AssetBundleSettings.SimulateAssetBundleInEditor = true;
#endif
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var loadCount = 0;

            resLoader.Add2Load <AudioClip>("coin_get1", (succeed, res) =>
            {
                Assert.IsTrue(res.Asset as AudioClip);

                loadCount++;
            });

            resLoader.Add2Load <GameObject>("coin_get1", (succeed, res) =>
            {
                Assert.IsTrue(res.Asset as GameObject);

                loadCount++;
            });

            resLoader.LoadAsync();

            while (loadCount != 2)
            {
                yield return(null);
            }

            resLoader.Recycle2Cache();
            resLoader = null;
        }
Ejemplo n.º 8
0
        void OnStart()
        {
            UIKit.Root.SetResolution(640, 1136, 1);

            ResKit.Init();

            ILUIKit.OpenPanel <UITetrisPanel>();
        }
Ejemplo n.º 9
0
        // Use this for initialization
        void Start()
        {
            ResKit.Init();

            mResLoader = ResLoader.Allocate();


            Async();
        }
Ejemplo n.º 10
0
        public void LoadAssetTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var coinGetPrefab = resLoader.LoadSync <GameObject>("coin_get1_prefab", "coin_get1");

            Assert.IsTrue(coinGetPrefab);

            resLoader.Recycle2Cache();
        }
Ejemplo n.º 11
0
        public void LoadAssetResSyncTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var coinGetClip = resLoader.LoadSync <AudioClip>("coin_get1_mp3", "coin_get1");

            Assert.IsTrue(coinGetClip);

            resLoader.Recycle2Cache();

            resLoader = null;
        }
Ejemplo n.º 12
0
        public void LoadAssetBundleDependenciesTest()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var coinGetPrefab = resLoader.LoadSync <GameObject>("coin_get1_prefab", "coin_get1");

            var coinGetObj = Object.Instantiate(coinGetPrefab);

            var audioClip = coinGetObj.GetComponent <AudioSource>().clip;

            Assert.IsTrue(audioClip);

            resLoader.Recycle2Cache();
        }
Ejemplo n.º 13
0
        public void UIKit_CloseAllPanelTest()
        {
            ResKit.Init();

            var uiKitTestPanel  = UIKit.OpenPanel <UIKitTestPanel>();
            var uiKitTestPanel2 = UIKit.OpenPanel <UIKitTestPanel2>();

            UIKit.CloseAllPanel();

            Assert.AreEqual(uiKitTestPanel.State, PanelState.Closed);
            Assert.IsFalse(uiKitTestPanel.gameObject.activeSelf);
            Assert.AreEqual(uiKitTestPanel2.State, PanelState.Closed);
            Assert.IsFalse(uiKitTestPanel2.gameObject.activeSelf);

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 14
0
        public void UIKit_PushPopTest()
        {
            ResKit.Init();

            var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>();

            UIKit.Stack.Push <UIKitTestPanel>();

            Assert.AreEqual(uiKitTestPanel.State, PanelState.Closed);

            UIKit.Stack.Pop();

            uiKitTestPanel = UIKit.GetPanel <UIKitTestPanel>();

            Assert.AreEqual(uiKitTestPanel.State, PanelState.Opening);

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 15
0
        public void UIKit_OpenPanelDefaultTest()
        {
            ResKit.Init();

            var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>();

            Assert.IsTrue(uiKitTestPanel);

            Assert.AreEqual(uiKitTestPanel.State, PanelState.Opening);
            Assert.AreEqual(uiKitTestPanel.Info.Level, UILevel.Common);
            Assert.AreEqual(uiKitTestPanel.Data.OnInitCalledCount, 1);
            Assert.AreEqual(uiKitTestPanel.Data.OnOpenCalledCount, 1);
            Assert.AreEqual(uiKitTestPanel.Data.OnShowCalledCount, 1);

            UIKit.ClosePanel <UIKitTestPanel>();

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 16
0
        public void LoadAssetWithNameAndTypeInRuntimeModeTest()
        {
            FromUnityToDll.Setting.SimulationMode = false;

            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var audioClip = resLoader.LoadSync <AudioClip>("coin_get1");

            Assert.IsTrue(audioClip);

            var gameObj = resLoader.LoadSync <GameObject>("coin_get1");

            Assert.IsTrue(gameObj);

            resLoader.Recycle2Cache();
            resLoader = null;
        }
Ejemplo n.º 17
0
        public void UIKit_GetPanelTest()
        {
            var uiKitTestPanel = UIKit.GetPanel <UIKitTestPanel>();

            Assert.IsFalse(uiKitTestPanel);

            ResKit.Init();

            UIKit.OpenPanel("UIKitTestPanel");

            uiKitTestPanel = UIKit.GetPanel <UIKitTestPanel>();

            Assert.IsTrue(uiKitTestPanel);
            Assert.AreEqual(uiKitTestPanel.State, PanelState.Opening);

            UIKit.ClosePanel("UIKitTestPanel");

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 18
0
        public void UIKit_ClosePanelTest()
        {
            ResKit.Init();

            var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>();

            var data = uiKitTestPanel.Data;

            UIKit.ClosePanel <UIKitTestPanel>();

            Assert.AreEqual(data.OnInitCalledCount, 1);
            Assert.AreEqual(data.OnOpenCalledCount, 1);
            Assert.AreEqual(data.OnShowCalledCount, 1);
            Assert.AreEqual(data.OnHideCalledCount, 1);
            Assert.AreEqual(data.OnCloseCalledCount, 1);

            Assert.AreEqual(uiKitTestPanel.State, PanelState.Closed);

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 19
0
        public void UIKit_ShowPanelTest()
        {
            ResKit.Init();

            var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>();

            Assert.AreEqual(uiKitTestPanel.Data.OnShowCalledCount, 1);

            UIKit.ShowPanel <UIKitTestPanel>();

            Assert.AreEqual(uiKitTestPanel.Data.OnShowCalledCount, 2);

            UIKit.HidePanel <UIKitTestPanel>();

            UIKit.ShowPanel <UIKitTestPanel>();

            Assert.AreEqual(uiKitTestPanel.Data.OnShowCalledCount, 3);

            UIKit.CloseAllPanel();
        }
Ejemplo n.º 20
0
        public void LoadAssetWithNameAndTypeInRuntimeModeTest()
        {
#if UNITY_EDITOR
            AssetBundleSettings.SimulateAssetBundleInEditor = false;
#endif
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var audioClip = resLoader.LoadSync <AudioClip>("coin_get1");

            Assert.IsTrue(audioClip);

            var gameObj = resLoader.LoadSync <GameObject>("coin_get1");

            Assert.IsTrue(gameObj);

            resLoader.Recycle2Cache();
            resLoader = null;
        }
Ejemplo n.º 21
0
        public void LoadAssetBundle()
        {
            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            resLoader.LoadSync <AssetBundle>("coin_get1_mp3");

            var resSearchKeys = ResSearchKeys.Allocate("coin_get1_mp3", null, typeof(AssetBundle));
            var res           = ResMgr.Instance.GetRes(resSearchKeys);

            ;

            resSearchKeys.Recycle2Cache();

            Assert.AreEqual(res.State, ResState.Ready);
            Assert.AreEqual(res.AssetType, typeof(AssetBundle));

            resLoader.Recycle2Cache();
        }
Ejemplo n.º 22
0
        public void ReadConfigTest()
        {
#if UNITY_EDITOR
            AssetBundleSettings.SimulateAssetBundleInEditor = false;
#endif
            ResKit.Init();

            var resDatas = AssetBundleSettings.AssetBundleConfigFile;

            var resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(AudioClip));
            var coinGetData   = resDatas.GetAssetData(resSearchKeys);
            resSearchKeys.Recycle2Cache();

            Assert.AreEqual(coinGetData.AssetName, "coin_get1");
            Assert.AreEqual(coinGetData.AssetObjectTypeCode.ToType(), typeof(AudioClip));

            resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(GameObject));
            var coinGetObjData = resDatas.GetAssetData(resSearchKeys);
            resSearchKeys.Recycle2Cache();

            Assert.AreEqual(coinGetObjData.AssetName, "coin_get1");
            Assert.AreEqual(coinGetObjData.AssetObjectTypeCode.ToType(), typeof(GameObject));
        }
Ejemplo n.º 23
0
        // Use this for initialization
        void Start()
        {
            var image = transform.Find("Image").GetComponent <Image>();

            ResKit.Init();

            var resLoader = ResLoader.Allocate();

            var texture2D = resLoader.LoadSync <Texture2D>("TextureExample1");

            // create Sprite 扩展
            var sprite = texture2D.CreateSprite();

            image.sprite = sprite;

            // 添加关联的 Sprite
            resLoader.AddObjectForDestroyWhenRecycle2Cache(sprite);

            this.Delay(5.0f, () =>
            {
                resLoader.Recycle2Cache();
                resLoader = null;
            });
        }
Ejemplo n.º 24
0
        public void ReadConfigTest()
        {
            FromUnityToDll.Setting.SimulationMode = false;

            ResKit.Init();

            var resDatas = AssetBundleSettings.AssetBundleConfigFile;

            var resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(AudioClip));
            var coinGetData   = resDatas.GetAssetData(resSearchKeys);

            resSearchKeys.Recycle2Cache();

            Assert.AreEqual(coinGetData.AssetName, "coin_get1");
            Assert.AreEqual(coinGetData.AssetObjectTypeCode.ToType(), typeof(AudioClip));

            resSearchKeys = ResSearchKeys.Allocate("coin_get1", null, typeof(GameObject));
            var coinGetObjData = resDatas.GetAssetData(resSearchKeys);

            resSearchKeys.Recycle2Cache();

            Assert.AreEqual(coinGetObjData.AssetName, "coin_get1");
            Assert.AreEqual(coinGetObjData.AssetObjectTypeCode.ToType(), typeof(GameObject));
        }
Ejemplo n.º 25
0
 void Start()
 {
     ResKit.Init();
 }
Ejemplo n.º 26
0
 protected override void OnBegin()
 {
     ResKit.Init();
     Finish();
 }