Exemplo n.º 1
0
 public void buildSelectedAndLoadTest()
 {
     using (ResourceManager manager = ResourceManagerTests.createManager())
     {
         using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
         {
             usingTempFile(() =>
             {
                 ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT, new ResourceInfo()
                 {
                     type = ResourceType.Resources,
                     path = PATH_RESOURCE_TO_LOAD
                 },
                                           new ResourceInfo()
                 {
                     type = ResourceType.Assetbundle,
                     path = PATH_ASSET_TO_PACK,
                 },
                                           new ResourceInfo()
                 {
                     type = ResourceType.File,
                     path = PATH_FILE_TO_READ
                 });
                 manager.resourcesInfo = info;
                 loadAllKindResAssert(manager);
             });
         }
     }
 }
Exemplo n.º 2
0
        IEnumerator createManagerBuildAndAssertAsync(Func <ResourceManager, IEnumerator> onAssert, bool reCreate = false)
        {
            if (!reCreate && manager != null)
            {
                bool isFileTemp = false;
                if (!Directory.Exists(Path.GetDirectoryName(PATH_FILE_TO_READ)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(PATH_FILE_TO_READ));
                }
                if (!File.Exists(PATH_FILE_TO_READ))
                {
                    isFileTemp = true;
                    File.Create(PATH_FILE_TO_READ).Close();
                }
                yield return(onAssert?.Invoke(manager));

                if (isFileTemp)
                {
                    File.Delete(PATH_FILE_TO_READ);
                }
                yield break;
            }
            using (manager = ResourceManagerTests.createManager())
            {
                using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
                {
                    bool isFileTemp = false;
                    if (!Directory.Exists(Path.GetDirectoryName(PATH_FILE_TO_READ)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(PATH_FILE_TO_READ));
                    }
                    if (!File.Exists(PATH_FILE_TO_READ))
                    {
                        isFileTemp = true;
                        File.Create(PATH_FILE_TO_READ).Close();
                    }
                    ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT);
                    manager.resourcesInfo = info;
                    yield return(onAssert?.Invoke(manager));

                    if (isFileTemp)
                    {
                        File.Delete(PATH_FILE_TO_READ);
                    }
                }
            }
            manager = null;
        }
Exemplo n.º 3
0
 private void createManagerBuildAndAssert(Action <ResourceManager> onAssert, bool reCreate = true)
 {
     if (!reCreate && manager != null)
     {
         usingTempFile(() =>
         {
             onAssert?.Invoke(manager);
         });
         return;
     }
     using (manager = ResourceManagerTests.createManager())
     {
         using (ResourcesInfo info = ScriptableObject.CreateInstance <ResourcesInfo>())
         {
             usingTempFile(() =>
             {
                 ResourcesInfoEditor.build(info, PATH_BUILD_OUTPUT);
                 manager.resourcesInfo = info;
                 onAssert?.Invoke(manager);
             });
         }
     }
     manager = null;
 }