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()); }
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()); }
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; }
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(); }
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); } }
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; }
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; }
void OnStart() { UIKit.Root.SetResolution(640, 1136, 1); ResKit.Init(); ILUIKit.OpenPanel <UITetrisPanel>(); }
// Use this for initialization void Start() { ResKit.Init(); mResLoader = ResLoader.Allocate(); Async(); }
public void LoadAssetTest() { ResKit.Init(); var resLoader = ResLoader.Allocate(); var coinGetPrefab = resLoader.LoadSync <GameObject>("coin_get1_prefab", "coin_get1"); Assert.IsTrue(coinGetPrefab); resLoader.Recycle2Cache(); }
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; }
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(); }
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(); }
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(); }
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(); }
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(); }
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; }
IEnumerator Start() { yield return(ResKit.InitAsync()); mResLoader.Add2Load <GameObject>("Image"); mResLoader.Add2Load <Texture2D>("WebGLTestTexture"); mResLoader.LoadAsync(() => { var imagePrefab = mResLoader.LoadSync <GameObject>("Image"); var image = imagePrefab.InstantiateWithParent(this.transform).GetComponent <Image>(); var texture2D = mResLoader.LoadSync <Texture2D>("WebGLTestTexture"); var sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); image.sprite = sprite; }); yield return(new WaitForSeconds(3.0f)); // 申请一个 ResLoader var resLoader = ResLoader.Allocate(); // 提前加载 HelloWebGL resLoader.Add2Load <GameObject>("HelloWebGLPanel"); // 异步加载 resLoader.LoadAsync(() => { // 打开界面 UIKit.OpenPanel <HelloWebGLPanel>() .OnClosed(() => { // 关闭时卸载 resLoader resLoader.Recycle2Cache(); resLoader = null; }); }); }
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(); }
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(); }
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; }
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(); }
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)); }
// 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; }); }
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)); }
void Start() { ResKit.Init(); }
protected override void OnBegin() { ResKit.Init(); Finish(); }