Пример #1
0
        public bool IsMatch(string path)
        {
            int index = path.IndexOf(BuildConfig.ResourceRootPath);

            if (index != -1)
            {
                path = path.Substring(index + BuildConfig.ResourceRootPath.Length);
            }
            string packagePath = EditorPath.NormalizePathSplash(path);

            if (packagePath.StartsWith("/"))
            {
                packagePath = packagePath.Substring(1);
            }

            string formatPath = EditorPath.NormalizePathSplash(RootPath);

            if (!string.IsNullOrEmpty(formatPath) &&
                !packagePath.StartsWith(formatPath, System.StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            EditorRegex regex = EditorRegex.Create(FileNameMatch);

            return(regex == null ? false : regex.IsMatch(packagePath));
        }
Пример #2
0
 void SpawnUnits(GameObject unit, List <Transform> path, EditorPath pathToFollow)
 {
     unit.name = "Enemy";
     unit.tag  = "Enemy";
     unit.GetComponent <MoveOnPath>().PathToFollow = pathToFollow;
     Instantiate(unit, path[0].position, path[0].rotation);
 }
Пример #3
0
        public static ParticleInfo[] CreateParticleInfo(string assetPath)
        {
            if (!EditorPath.IsPrefab(assetPath))
            {
                return(null);
            }

            GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);

            ParticleSystem[] particleSystem = prefab.GetComponentsInChildren <ParticleSystem>();
            ParticleInfo[]   particleInfo   = new ParticleInfo[particleSystem.Length];

            for (int i = 0; i < particleSystem.Length; i++)
            {
                particleInfo[i]              = new ParticleInfo();
                particleInfo[i].Path         = assetPath;
                particleInfo[i].RealPath     = assetPath + "/" + ViewerConst.GetPath(particleSystem[i].transform);
                particleInfo[i].MaxParticles = particleSystem[i].main.maxParticles;
                particleInfo[i].Duration     = particleSystem[i].main.duration;
                particleInfo[i].PlayOnAwake  = particleSystem[i].main.playOnAwake;
                particleInfo[i].Looping      = particleSystem[i].main.loop;
            }

            return(particleInfo);
        }
Пример #4
0
        public static TextureInfo CreateTextureInfo(string assetPath)
        {
            if (!EditorPath.IsTexture(assetPath))
            {
                return(null);
            }

            TextureInfo textureInfo = null;

            if (!_dictTexInfo.TryGetValue(assetPath, out textureInfo))
            {
                textureInfo = new TextureInfo();
                _dictTexInfo.Add(assetPath, textureInfo);
            }

            TextureImporter textureImport = AssetImporter.GetAtPath(assetPath) as TextureImporter;
            Texture         texture       = AssetDatabase.LoadAssetAtPath <Texture>(assetPath);

            if (textureImport == null || texture == null)
            {
                return(null);
            }

            textureInfo.Path                = textureImport.assetPath;
            textureInfo.ImportType          = textureImport.textureType;
            textureInfo.ImportShape         = textureImport.textureShape;
            textureInfo.ReadWriteEnable     = textureImport.isReadable;
            textureInfo.MipmapEnable        = textureImport.mipmapEnabled;
            textureInfo.WrapMode            = textureImport.wrapMode;
            textureInfo.FilterMode          = textureImport.filterMode;
            textureInfo.StandaloneFormat    = EditorTool.GetPlatformTextureSettings(textureImport, EditorConst.PlatformStandalone);
            textureInfo.AndroidFormat       = EditorTool.GetPlatformTextureSettings(textureImport, EditorConst.PlatformAndroid);
            textureInfo.IosFormat           = EditorTool.GetPlatformTextureSettings(textureImport, EditorConst.PlatformIos);
            textureInfo.StandaloneOverriden = EditorTool.IsTextureOverriden(textureImport, EditorConst.PlatformStandalone);
            textureInfo.AndroidOverriden    = EditorTool.IsTextureOverriden(textureImport, EditorConst.PlatformAndroid);
            textureInfo.IosOverriden        = EditorTool.IsTextureOverriden(textureImport, EditorConst.PlatformIos);
            textureInfo.StandaloneSize      = EditorTool.CalculateTextureSizeBytes(texture, textureInfo.StandaloneFormat);
            textureInfo.AndroidSize         = EditorTool.CalculateTextureSizeBytes(texture, textureInfo.AndroidFormat);
            textureInfo.IosSize             = EditorTool.CalculateTextureSizeBytes(texture, textureInfo.IosFormat);
            textureInfo.MemSize             = Mathf.Max(textureInfo.StandaloneSize, textureInfo.AndroidSize, textureInfo.IosSize);
            textureInfo.Width               = texture.width;
            textureInfo.Height              = texture.height;

            if (Selection.activeObject != texture)
            {
                Resources.UnloadAsset(texture);
            }

            if (++_loadCount % 256 == 0)
            {
                Resources.UnloadUnusedAssets();
            }

            return(textureInfo);
        }
Пример #5
0
 private static void ProcessSpecialResource(string path)
 {
     if (m_specialCache.ContainsKey(path))
     {
         return;
     }
     m_specialCache.Add(path, path);
     if (EditorPath.IsShader(path))
     {
         if (!BundleDataManager.CheckPathInBundle(path))
         {
             BundleData shader = BundleDataManager.GetBundleData(BundleName.BN_SHADER);
             if (shader != null && shader.children.Count > 0)
             {
                 BundleDataManager.AddPathToBundle(path, shader.children[0], 1024);
             }
         }
     }
     else if (EditorPath.IsMaterial(path))
     {
         BundleData shaderBundle = BundleDataManager.GetBundleData(BundleName.BN_SHADER);
         if (shaderBundle == null)
         {
             return;
         }
         UnityEngine.Object[] assetAtPath = AssetDatabase.LoadAllAssetsAtPath(path);
         foreach (var obj in assetAtPath)
         {
             if (obj != null && obj.GetType() == typeof(Material))
             {
                 Material mat = obj as Material;
                 if (mat != null && mat.shader != null && !string.IsNullOrEmpty(mat.shader.name))
                 {
                     if (!shaderBundle.includs.Contains(mat.shader.name))
                     {
                         shaderBundle.includs.Add(mat.shader.name);
                     }
                 }
             }
             if ((!(obj is GameObject)) && (!(obj is Component)))
             {
                 Resources.UnloadAsset(obj);
             }
         }
         ProcessClear();
     }
     else if (EditorPath.IsScript(path))
     {
         BundleData script = BundleDataManager.GetBundleData(BundleName.BN_SCRIPT);
         if (script != null && script.children.Count > 0)
         {
             BundleDataManager.AddPathToBundle(path, script.children[0], 1024);
         }
     }
 }
Пример #6
0
// Randomize chance of path
    void setChanceAndPath()
    {
        chance = Random.Range(0f, 1f);
        if (chance <= 0.5f)
        {
            PathToFollow = Paths[0];
        }
        else
        {
            PathToFollow = Paths[1];
        }
    }
        private static void CopyDatabaseFile(string dbFolderPath, long dbLocalAddress, string entityName = null)
        {
            var sourceFilePath = PathUtility.UnifyToAltDirectorySeparatorChar(Path.Combine(TempFolderPath, $"db{dbLocalAddress}.box"));
            var newFileName    = dbLocalAddress > 1 ? $"{entityName}.db.bytes" : "MetadataEntityDBConfig.db.bytes";
            var destFilePath   = PathUtility.UnifyToAltDirectorySeparatorChar(Path.Combine(dbFolderPath, newFileName));

            FileUtil.ReplaceFile(sourceFilePath, destFilePath);
            EncryptFileRawData(destFilePath);
            var assetFilePath = EditorPath.ConvertToAssetPath(destFilePath);

            AssetDatabase.ImportAsset(assetFilePath);
        }
Пример #8
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Rail") && !is_railed)
     {
         if (other.gameObject.transform.parent.GetComponent <EditorPath> ())
         {
             is_railed = true;
             GetComponent <Rigidbody> ().isKinematic = true;
             PathToFollow = other.gameObject.transform.parent.GetComponent <EditorPath> ();
             assign_part_of_path();
         }
     }
 }
        private void BrowseButton4_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog editorDialog = new OpenFileDialog();

            editorDialog.Title  = "Open UE4Editor Executable";
            editorDialog.Filter = "Application|*.exe";
            if (editorDialog.ShowDialog() == true)
            {
                editorExeFile = Path.GetFullPath(editorDialog.FileName);
                Console.WriteLine("Value returned: " + editorDialog);

                EditorPath.Clear();
                EditorPath.AppendText(editorExeFile);
            }
        }
Пример #10
0
        public static ModelInfo CreateModelInfo(string assetPath)
        {
            if (!EditorPath.IsModel(assetPath))
            {
                return(null);
            }

            ModelInfo tInfo = null;

            if (!m_dictModelInfo.TryGetValue(assetPath, out tInfo))
            {
                tInfo = new ModelInfo();
                m_dictModelInfo.Add(assetPath, tInfo);
            }
            ModelImporter tImport = AssetImporter.GetAtPath(assetPath) as ModelImporter;
            Mesh          mesh    = AssetDatabase.LoadAssetAtPath <Mesh>(assetPath);

            if (tImport == null || mesh == null)
            {
                return(null);
            }

            tInfo.Path            = assetPath;
            tInfo.ReadWriteEnable = tImport.isReadable;
            tInfo.OptimizeMesh    = tImport.optimizeMesh;
            tInfo.ImportMaterials = tImport.importMaterials;
            tInfo.ImportAnimation = tImport.importAnimation;
            tInfo.MeshCompression = tImport.meshCompression;

            tInfo.bHasUV        = mesh.uv != null && mesh.uv.Length != 0;
            tInfo.bHasUV2       = mesh.uv2 != null && mesh.uv2.Length != 0;
            tInfo.bHasUV3       = mesh.uv3 != null && mesh.uv3.Length != 0;
            tInfo.bHasUV4       = mesh.uv4 != null && mesh.uv4.Length != 0;
            tInfo.bHasColor     = mesh.colors != null && mesh.colors.Length != 0;
            tInfo.bHasNormal    = mesh.normals != null && mesh.normals.Length != 0;
            tInfo.bHasTangent   = mesh.tangents != null && mesh.tangents.Length != 0;
            tInfo.vertexCount   = mesh.vertexCount;
            tInfo.triangleCount = mesh.triangles.Length / 3;

            tInfo.MemSize = EditorTool.CalculateModelSizeBytes(assetPath);

            if (m_loadCount % 256 == 0)
            {
                Resources.UnloadUnusedAssets();
            }

            return(tInfo);
        }
        internal static bool CreateMetadataDatabaseFiles()
        {
            var result   = false;
            var settings = MetadataAssetSettings.Load();

            MetadataAssetSettings.CreateMetadataPersistentStoreFolder(settings);
            DeleteTempDbFiles();

            var dbFolderPath = EditorPath.ConvertToAbsolutePath(settings.MetadataPersistentStorePath);

            ForEachExcelFile(settings.ExcelWorkbookFilesFolderPath, (table, fileName, index, length) =>
            {
                if (table == null)
                {
                    return;
                }

                var entityClassName = fileName.ToTitleCase();
                var info            = $"Creating Database File for Entity {entityClassName}... {index + 1}/{length}";
                var progress        = (float)(index + 1) / length;
                UnityEditorUtility.DisplayProgressBar("Hold on...", info, progress);

                var rawInfoList     = CreateMetadataEntityRawInfoList(settings, table);
                var entityClassType = GetEntityClassType(settings, entityClassName);

                if (entityClassType != null)
                {
                    var entityDataList = CreateEntityDataList(settings, table, entityClassType, rawInfoList);
                    typeof(MetadataAssetUtility).InvokeGenericStaticMethod("InsertEntityData", new[] { entityClassType }, new object[] { dbFolderPath, entityClassName, rawInfoList, entityDataList, index });
                    result = true;
                }
                else
                {
                    UnityDebug.LogErrorFormat(null, "Can not find the entity class: {0}.cs!", entityClassName);
                    result = false;
                }
            });

            // Copy MetadataEntityDBConfig database file.
            if (result)
            {
                CopyDatabaseFile(dbFolderPath, MetadataEntityDBConfig.DatabaseLocalAddress);
            }

            UnityEditorUtility.ClearProgressBar();
            return(result);
        }
Пример #12
0
 private void RefreshList(List <string> list)
 {
     for (int i = 0; i < list.Count; ++i)
     {
         string path = EditorPath.FormatAssetPath(list[i]);
         string name = System.IO.Path.GetFileName(path);
         EditorUtility.DisplayProgressBar("获取AssetPath数据", name, (i * 1.0f) / list.Count);
         if (EditorPath.IsMeta(path))
         {
             continue;
         }
         AssetPathInfo pathInfo = AssetPathInfo.CreatePathInfo(path);
         m_pathInfoList.Add(pathInfo);
     }
     EditorUtility.ClearProgressBar();
     RefreshDataWithSelect();
 }
Пример #13
0
        public static AudioInfo CreateAudioInfo(string assetPath)
        {
            if (!EditorPath.IsAudio(assetPath))
            {
                return(null);
            }

            AudioInfo audioInfo = null;

            if (!_dictAudioInfo.TryGetValue(assetPath, out audioInfo))
            {
                audioInfo = new AudioInfo();
                _dictAudioInfo.Add(assetPath, audioInfo);
            }

            AudioImporter audioImporter = AssetImporter.GetAtPath(assetPath) as AudioImporter;
            AudioClip     audioClip     = AssetDatabase.LoadAssetAtPath <AudioClip>(assetPath);

            if (audioImporter == null || audioClip == null)
            {
                Debug.LogError("audioImporter is empty");
                return(null);
            }

            audioInfo.Path                             = assetPath;
            audioInfo.ForceToMono                      = audioImporter.forceToMono;
            audioInfo.LoadInBackground                 = audioImporter.loadInBackground;
            audioInfo.Ambisonic                        = audioImporter.ambisonic;
            audioInfo.MemSize                          = EditorTool.GetRuntimeMemorySize(audioClip);
            audioInfo.ImportedSize                     = EditorTool.GetRuntimeMemorySize(audioClip);
            audioInfo.StandAloneAudioClipLoadType      = audioImporter.GetOverrideSampleSettings("Standalone").loadType;
            audioInfo.AndroidAudioClipLoadType         = audioImporter.GetOverrideSampleSettings("Android").loadType;
            audioInfo.iOSAudioClipLoadType             = audioImporter.GetOverrideSampleSettings("iOS").loadType;
            audioInfo.StandAloneAudioCompressionFormat = audioImporter.GetOverrideSampleSettings("Standalone").compressionFormat;
            audioInfo.AndroidAudioCompressionFormat    = audioImporter.GetOverrideSampleSettings("Android").compressionFormat;
            audioInfo.iOSAudioCompressionFormat        = audioImporter.GetOverrideSampleSettings("iOS").compressionFormat;
            audioInfo.OriginSize                       = ViewerConst.GetInternalValue <int>(audioImporter, "get_origSize", null);
            audioInfo.CompressedSize                   = ViewerConst.GetInternalValue <int>(audioImporter, "get_compSize", null);

            if (++_loadCount % 256 == 0)
            {
                Resources.UnloadUnusedAssets();
            }

            return(audioInfo);
        }
Пример #14
0
        public static List <ModelInfo> GetModelInfoByDirectory(string dir)
        {
            List <ModelInfo> modelInfoList = new List <ModelInfo>();
            List <string>    list          = new List <string>();

            EditorPath.ScanDirectoryFile(dir, true, list);
            for (int i = 0; i < list.Count; ++i)
            {
                string    assetPath = EditorPath.FormatAssetPath(list[i]);
                ModelInfo modelInfo = CreateModelInfo(assetPath);
                if (modelInfo != null)
                {
                    modelInfoList.Add(modelInfo);
                }
            }

            return(modelInfoList);
        }
Пример #15
0
        public static ShaderInfo CreateShaderInfo(string assetPath)
        {
            if (!EditorPath.IsShader(assetPath))
            {
                return(null);
            }

            ShaderInfo shaderInfo = null;

            if (!_dictShaderInfo.TryGetValue(assetPath, out shaderInfo))
            {
                shaderInfo = new ShaderInfo();
                _dictShaderInfo.Add(assetPath, shaderInfo);
            }
            Shader shader     = AssetDatabase.LoadAssetAtPath <Shader>(assetPath);
            string shaderText = File.ReadAllText(assetPath);

            //ShaderUtil.OpenCompiledShader(shader, (int)ShaderPlatformModes.Custom, 1 << (int)ShaderUtil.ShaderCompilerPlatformType.D3D11, false);

            typeof(ShaderUtil).GetMethod("OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { shader, (int)ShaderPlatformModes.Custom, 1 << (int)ShaderCompilerPlatformType.D3D11, false });
            try
            {
                CompiledShaderInfo compiledShaderInfo = CompiledShaderInfo.CreateCompiledShaderInfo(shaderText);
                shaderInfo.Path = assetPath;
                //shaderInfo.MaxLOD = ShaderUtil.GetLOD(shader);
                //shaderInfo.Variant = ShaderUtil.GetVariantCount(shader, true);
                shaderInfo.Property    = ShaderUtil.GetPropertyCount(shader);
                shaderInfo.RenderQueue = shader.renderQueue;
                shaderInfo.Pass        = compiledShaderInfo.GetPass();
                shaderInfo.Instruction = compiledShaderInfo.GetInstruction();
                shaderInfo.SubShader   = compiledShaderInfo.GetSubShaderCount();
                shaderInfo.Sample      = compiledShaderInfo.GetSample();
                shaderInfo.RenderType  = compiledShaderInfo.GetRenderType();
                shaderInfo.CompiledShaderInfoList.Add(compiledShaderInfo);
            }
            catch (Exception ex)
            {
                Debug.LogError(ex.Message);
                return(null);
            }
            return(shaderInfo);
        }
Пример #16
0
        public static List <TextureInfo> GetTextureInfoByDirectory(string dir)
        {
            List <TextureInfo> texInfoList = new List <TextureInfo>();
            List <string>      list        = new List <string>();

            EditorPath.ScanDirectoryFile(dir, true, list);
            for (int i = 0; i < list.Count; ++i)
            {
                string assetPath = EditorPath.FormatAssetPath(list[i]);
                string name      = System.IO.Path.GetFileName(assetPath);
                EditorUtility.DisplayProgressBar("获取贴图数据", name, (i * 1.0f) / list.Count);
                TextureInfo texInfo = CreateTextureInfo(assetPath);
                if (texInfo != null)
                {
                    texInfoList.Add(texInfo);
                }
            }
            EditorUtility.ClearProgressBar();
            return(texInfoList);
        }
Пример #17
0
 protected override void _RefreshList(List <string> list)
 {
     m_aniInfo = new List <AnimationInfo>();
     for (int i = 0; i < list.Count; ++i)
     {
         string path = EditorPath.FormatAssetPath(list[i]);
         string name = System.IO.Path.GetFileName(path);
         EditorUtility.DisplayProgressBar("获取动作数据", name, (i * 1.0f) / list.Count);
         if (!EditorPath.IsAnimation(path))
         {
             continue;
         }
         AnimationInfo aniInfo = AnimationInfo.CreateAnimationInfo(path);
         if (aniInfo != null)
         {
             m_aniInfo.Add(aniInfo);
         }
     }
     EditorUtility.ClearProgressBar();
     RefreshDataWithSelect();
 }
        private void EditorPath_Init(object sender, EventArgs e)
        {
            var ini = new INIFile();

            ini.Load(appconfig + "LauncherConfig.ini");

            // Check if a key exists in an INI file
            if (ini.HasSetting("ProjectConfiguration", "EditorExeFile"))
            {
                var editorExe = ini.GetValue("ProjectConfiguration", "EditorExeFile").ToString();

                editorExeFile = editorExe;

                EditorPath.AppendText(editorExe);
                Console.WriteLine("Populated element: EditorPath");
            }
            else
            {
                Console.WriteLine("WARNING: No key defined in configuration file.");
            }
        }
Пример #19
0
    void Start()
    {
        JellikZluta = Resources.Load("Units/JellikZluta") as GameObject;
        JellikCerna = Resources.Load("Units/JellikCerna") as GameObject;
        JellikBila  = Resources.Load("Units/JellikBila") as GameObject;
        golem       = Resources.Load("Units/Golem") as GameObject;
        FinalGolem  = Resources.Load("Units/FinalGolem") as GameObject;



        PathLeft1       = Resources.Load("Paths/PathLeft1") as GameObject;
        PathLeft1Editor = PathLeft1.GetComponent <EditorPath>();

        PathLeft2       = Resources.Load("Paths/PathLeft2") as GameObject;
        PathLeft2Editor = PathLeft2.GetComponent <EditorPath>();

        PathRight2       = Resources.Load("Paths/PathRight2") as GameObject;
        PathRight2Editor = PathRight2.GetComponent <EditorPath>();

        PathRight1       = Resources.Load("Paths/PathRight1") as GameObject;
        PathRight1Editor = PathRight1.GetComponent <EditorPath>();


        arrayPoints = GetComponentsInChildren <Transform>();
        WaveNummber = 1;

        foreach (Transform path_obj in arrayPoints)
        {
            if (path_obj != this.transform)
            {
                checkpoints.Add(path_obj);


                if (checkpoints.Count == arrayPoints.Length - 1)
                {
                    AddCollider(path_obj.gameObject);
                }
            }
        }
    }
Пример #20
0
        protected override void _RefreshList(List <string> list)
        {
            m_texInfoList = new List <TextureInfo>();
            for (int i = 0; i < list.Count; ++i)
            {
                string path = EditorPath.FormatAssetPath(list[i]);
                string name = System.IO.Path.GetFileName(path);
                EditorUtility.DisplayProgressBar("获取贴图数据", name, (i * 1.0f) / list.Count);
                if (!EditorPath.IsTexture(path))
                {
                    continue;
                }
                TextureInfo texInfo = TextureInfo.CreateTextureInfo(path);
                if (texInfo != null)
                {
                    m_texInfoList.Add(texInfo);
                }
            }
            EditorUtility.ClearProgressBar();

            RefreshDataWithSelect();
        }
        private static bool GenerateMetadataEntityScript(MetadataAssetSettings settings, string entityScriptName, List <MetadataEntityRawInfo> rawInfoList)
        {
            try
            {
                entityScriptName = entityScriptName.ToTitleCase();
                var scriptTextContent = ScriptTemplate.LoadScriptTemplateFile("NewMetadataEntityScriptTemplate.txt", UnityPackageName);
                scriptTextContent = scriptTextContent.Replace(ScriptTemplate.Placeholders.Namespace, settings.EntityScriptNamespace);
                scriptTextContent = scriptTextContent.Replace(ScriptTemplate.Placeholders.ScriptName, entityScriptName);
                scriptTextContent = scriptTextContent.Replace(ScriptTemplate.Placeholders.EnumInsideOfClass, GenerateEntityScriptEnumString(rawInfoList));
                scriptTextContent = scriptTextContent.Replace(ScriptTemplate.Placeholders.Properties, GenerateEntityScriptPropertiesString(rawInfoList));

                var scriptStorePath = EditorPath.ConvertToAbsolutePath(settings.EntityScriptsStorePath, $"{entityScriptName}.cs");
                var assetPath       = EditorPath.ConvertToAssetPath(scriptStorePath);
                File.WriteAllText(scriptStorePath, scriptTextContent, new UTF8Encoding(true));
                AssetDatabase.ImportAsset(assetPath);
                return(true);
            }
            catch (Exception ex)
            {
                UnityDebug.LogError(ex.ToString());
                return(false);
            }
        }
Пример #22
0
        public BundleImportData GetPathImportData(string path)
        {
            path = EditorPath.FormatAssetPath(path);
            path = EditorPath.NormalizePathSplash(path);
            AssetPathInfo pathInfo = AssetPathInfo.CreatePathInfo(path);

            if (pathInfo == null)
            {
                return(null);
            }

            if (pathInfo.Index >= 0 && pathInfo.Index < m_dataList.Count)
            {
                return(m_dataList[pathInfo.Index]);
            }
            for (int i = m_dataList.Count - 1; i >= 0; --i)
            {
                if (m_dataList[i].IsMatch(path))
                {
                    return(m_dataList[i]);
                }
            }
            return(null);
        }
Пример #23
0
        public override bool IsMatch(string path)
        {
            if (AlwaysMatch)
            {
                return(true);
            }
            bool pathMatch = EditorPath.IsTexture(path) && base.IsMatch(path);

            if (!pathMatch || ForceSet)
            {
                return(pathMatch);
            }
            TextureImporter texureImporter = AssetImporter.GetAtPath(path) as TextureImporter;

#pragma warning disable 0618
            if (TexType == TextureImporterType.Cubemap)
            {
#pragma warning restore 0618
                if (texureImporter.textureShape != TextureImporterShape.TextureCube)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                if (texureImporter.textureShape == TextureImporterShape.TextureCube)
                {
                    return(false);
                }
            }
            return(texureImporter.textureType == TexType);
        }
Пример #24
0
    void Start()
    {
        //userSkipped = false;//TESTING
        //isVRMode = true;

        userSkipped = GameObject.Find("PersistentData").GetComponent <PersistentManagaer>().skip;
        isVRMode    = GameObject.Find("PersistentData").GetComponent <PersistentManagaer>().vr;

        if (!isVRMode)
        {
            GvrCardboardHelpers.Recenter();
        }

        errorHud = GameObject.Find("errorHUD").GetComponent <ErrorHUDManager>();

        thePlayer    = GameObject.Find("Player");//Main camera is a child
        pathToFollow = GameObject.Find("PathForCamera").GetComponent <EditorPath>();
        theLights    = GameObject.FindGameObjectsWithTag("aLight");

        eyeVideoScreen = GameObject.Find("videoScreen");
        eyeVideoScreen.SetActive(false);

        footVideoScreen    = GameObject.Find("videoScreenFeet");
        footVideoMat       = footVideoScreen.GetComponent <Renderer>().material;
        footVideoMat.color = new Color(1, 1, 1, 0);
        footVideoScreen.SetActive(false);

        audioManager = GetComponent <AudioManager>();

        hallProbe = GameObject.Find("hallProbe").GetComponent <ReflectionProbe>();
        roomProbe = GameObject.Find("roomProbe").GetComponent <ReflectionProbe>();

        blurCanvas      = GameObject.Find("blurImage");
        blurMat         = blurCanvas.GetComponent <Image>().material;
        blurCanvasPhone = GameObject.Find("blurImagePhone");
        blurMatPhone    = blurCanvasPhone.GetComponent <Image>().material;

        arrowManager       = GameObject.Find("arrows").GetComponent <ArrowManager>();
        gridObjectsManager = GameObject.Find("gridObjects").GetComponent <GridObjectsManager>();
        luxMeterManager    = GameObject.Find("LUXMeter").GetComponent <LuxMeterManager>();

        mainCamera = Camera.main.GetComponent <Transform>();

        inTheRoom = false;
        hallProbe.RenderProbe();//probe set to scripted update
        roomProbe.RenderProbe();

        //starCanvas
        theStars = GameObject.Find("theStars");//for setActive
        theStars.GetComponent <CanvasGroup>().alpha = 0;
        theStars.SetActive(false);
        theStarsPhone = GameObject.Find("theStarsPhone");//for setActive
        theStarsPhone.GetComponent <CanvasGroup>().alpha = 0;
        theStarsPhone.SetActive(false);
        coverLeft       = GameObject.Find("coverLeft");
        coverRight      = GameObject.Find("coverRight");
        coverLeftPhone  = GameObject.Find("coverLeftPhone");
        coverRightPhone = GameObject.Find("coverRightPhone");
        coverLeft.GetComponent <CanvasGroup>().alpha       = 0;
        coverRight.GetComponent <CanvasGroup>().alpha      = 0;
        coverLeftPhone.GetComponent <CanvasGroup>().alpha  = 0;
        coverRightPhone.GetComponent <CanvasGroup>().alpha = 0;
        coverLeft.SetActive(false);
        coverRight.SetActive(false);
        coverLeftPhone.SetActive(false);
        coverRightPhone.SetActive(false);

        luxMeterManager.hideMeter(true);
        errorHud.hideHUD(true);
        blurCanvas.SetActive(false);
        blurCanvasPhone.SetActive(false);
        LeanTween.delayedCall(2f, openIntroDoor);
        normalLightLevel();

        //did user skip to lux level chapter
        if (userSkipped)
        {
            inTheRoom = true;
            //User skipped to LUX levels - only play lux info
            currentPathNodeIndex = 6;
            //last node will give us time of flight to the next node
            lastNodeData = pathToFollow.pathNodes[currentPathNodeIndex - 1].GetComponent <NodeData>();
            //data from the node the camera will move TO
            nextNodeData = pathToFollow.pathNodes[currentPathNodeIndex].GetComponent <NodeData>();

            thePlayer.transform.position = pathToFollow.pathNodes[currentPathNodeIndex - 1].transform.position;
            LeanTween.delayedCall(1f, gridObjectsManager.showItAll);
            upTheArrow();
            LeanTween.delayedCall(1.2f, arrowManager.showArrows10);
            // LeanTween.delayedCall(4.2f, upTheArrow);
            LeanTween.delayedCall(1.5f, playAud15);
        }
        else
        {
            currentPathNodeIndex = 1;
            //last node will give us time of flight to the next node
            lastNodeData = pathToFollow.pathNodes[currentPathNodeIndex - 1].GetComponent <NodeData>();
            //data from the node the camera will move TO
            nextNodeData = pathToFollow.pathNodes[currentPathNodeIndex].GetComponent <NodeData>();

            moveToNextNode();
        }
    }
Пример #25
0
 public override bool IsMatch(string path)
 {
     return(EditorPath.IsAnimation(path) && base.IsMatch(path));
 }
Пример #26
0
        public static long CalcAssetSize(string assetPath, BundleType type)
        {
            assetPath = EditorPath.FormatAssetPath(assetPath);
            assetPath = EditorPath.NormalizePathSplash(assetPath);

            long ret = 0;

            if (m_pathFileSize.TryGetValue(assetPath, out ret))
            {
                return(ret);
            }

            BundleImportData assetImportData = BundleDataControl.Instance.GetPathImportData(assetPath);

            UnityEngine.Object[] assets = null;

            switch (type)
            {
            case BundleType.Texture:
                assets = AssetDatabase.LoadAllAssetsAtPath(assetPath);
                for (int i = 0; i < assets.Length; ++i)
                {
                    if (assets[i] is Texture)
                    {
                        ret += EditorTool.GetRuntimeMemorySize(assets[i]);
                    }
                }

                break;

            case BundleType.Material:
                string[] deps = AssetDepot.GetDependenciesCache(assetPath);
                for (int i = 0; i < deps.Length; ++i)
                {
                    if (EditorPath.IsTexture(deps[i]))
                    {
                        BundleImportData data = BundleDataControl.Instance.GetPathImportData(deps[i]);
                        if (assetImportData == null || data == null || assetImportData.Index < data.Index || data.SkipData)
                        {
                            ret += EditorTool.CalculateTextureSizeBytes(deps[i]);
                        }
                    }
                }
                ret += 512;
                break;

            case BundleType.FBX:
            case BundleType.Controller:
            case BundleType.Animation:
                assets = AssetDatabase.LoadAllAssetsAtPath(assetPath);
                List <UnityEngine.Object> list = AssetFilter.FilterObjectByType(assets, type, assetPath);
                for (int i = 0; i < list.Count; ++i)
                {
                    ret += EditorTool.GetRuntimeMemorySize(list[i]);
                }
                break;

            default:
                FileInfo fileInfo = new FileInfo(assetPath);
                ret = fileInfo.Length;
                break;
            }

            for (int i = 0; assets != null && i < assets.Length; ++i)
            {
                if ((!(assets[i] is GameObject)) && (!(assets[i] is Component)))
                {
                    Resources.UnloadAsset(assets[i]);
                }
            }

            m_pathFileSize.Add(assetPath, ret);
            return(ret);
        }
Пример #27
0
        public virtual void RefreshDataByRootPath(string path)
        {
            List <string> list = EditorPath.GetAssetPathList(FormatConfig.ResourceRootPath + "/" + path);

            _RefreshList(list);
        }
Пример #28
0
        public static void ExportBundleDictToOutput()
        {
            EditorTool.CreateDirectory(BuildConfig.InterpretedOutputPath);

            BundleDataControl dataControl    = BundleDataControl.Instance;
            BundleMainfest    bundleMainfest = new BundleMainfest();

            BundleData[] bundleData = BundleDataAccessor.Datas.ToArray();

            Dictionary <string, string> dict = new Dictionary <string, string>();

            for (int i = 0; i < bundleData.Length; ++i)
            {
                for (int j = 0; j < bundleData[i].includs.Count; ++j)
                {
                    string path = bundleData[i].includs[j];
                    if (string.IsNullOrEmpty(path))
                    {
                        continue;
                    }

                    if (!dict.ContainsKey(path))
                    {
                        dict.Add(path, bundleData[i].name);
                    }
                    else
                    {
                        Debug.LogWarningFormat("[BundleExport] Path to bundle name have same path {0} : {1} _ {2}", path, bundleData[i].name, dict[path]);
                    }

                    BundleImportData data = dataControl.GetPathImportData(path);
                    if (data == null || !data.Publish || !path.StartsWith("Assets", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    string bundlePath = path; // format path to load path!!!
                    bundleMainfest.AddPathToBundle(bundlePath, bundleData[i].name);
                }
            }

            for (int i = 0; i < bundleData.Length; ++i)
            {
                for (int j = 0; j < bundleData[i].includs.Count; ++j)
                {
                    string[] dep = AssetDepot.GetDependenciesCache(bundleData[i].includs[j]);
                    for (int k = 0; k < dep.Length; ++k)
                    {
                        if (EditorPath.IsScript(dep[k]) || EditorPath.IsShader(dep[k]))
                        {
                            continue;
                        }

                        string bundleName = null;
                        dict.TryGetValue(EditorPath.NormalizePathSplash(dep[k]), out bundleName);
                        if (string.IsNullOrEmpty(bundleName) || bundleName == bundleData[i].name)
                        {
                            continue;
                        }

                        BundleState childBuildState = BundleDataManager.GetBundleState(bundleName);
                        if (childBuildState.loadState == BundleLoadState.Preload || childBuildState.size == -1)
                        {
                            continue;
                        }

                        bundleMainfest.AddBundleDepend(bundleData[i].name, bundleName);
                    }
                }
            }

            List <BundleState> stateList = new List <BundleState>(BundleDataAccessor.States);

            bundleMainfest.AddBundleState(stateList);

            bundleMainfest.SaveBytes(BuildConfig.BundleMainfestOutputPath);

            AssetDatabase.ImportAsset(BuildConfig.BundleMainfestOutputPath, ImportAssetOptions.ForceSynchronousImport);
        }
Пример #29
0
        public void RefreshBaseData()
        {
            List <string> list = EditorPath.GetAssetPathList(BuildConfig.ResourceRootPath);

            RefreshList(list);
        }
Пример #30
0
        public void RefreshDataByRootPath(string path)
        {
            List <string> list = EditorPath.GetAssetPathList(BuildConfig.ResourceRootPath + "/" + path);

            RefreshList(list);
        }