Exemplo n.º 1
0
    public IEnumerator CreatePatches()
    {
#if SAFETY_CHECK
        HashSet <string> loadedFiles = new HashSet <string>();
#endif

        foreach (var patchFile in patchFiles)
        {
#if SAFETY_CHECK
            string fileWithoutExtension = Path.GetFileNameWithoutExtension(patchFile);
            if (loadedFiles.Contains(fileWithoutExtension))
            {
                Debug.LogError("This shouldn't happen! Data layer duplicate:" + fileWithoutExtension);
                continue;
            }
            loadedFiles.Add(fileWithoutExtension);
#endif

            string type = Patch.GetFileNameType(patchFile);

            if (type.Equals("grid"))
            {
                yield return(Patch.Create(this, patchFile, GridPatch.Create, GridDataIO.GetPatchHeaderLoader, OnPatchCreated));
            }
            else if (type.Equals("graph"))
            {
                yield return(Patch.Create(this, patchFile, GraphPatch.Create, GraphDataIO.GetPatchHeaderLoader, OnPatchCreated));
            }
            else
            {
                Debug.LogError("Found unknown data file type: " + patchFile);
            }
        }
    }
Exemplo n.º 2
0
    public IEnumerator CreatePatch(string filename)
    {
        string type = Patch.GetFileNameType(filename);

        if (type.Equals(GridDataIO.FileSufix))
        {
            yield return(Patch.Create(this, filename, GridPatch.Create, GridDataIO.GetPatchHeaderLoader, OnPatchCreated));
        }
        else if (type.Equals(GraphDataIO.FileSufix))
        {
            yield return(Patch.Create(this, filename, GraphPatch.Create, GraphDataIO.GetPatchHeaderLoader, OnPatchCreated));
        }
        else if (type.Equals(MultiGridDataIO.FileSufix))
        {
            yield return(Patch.Create(this, filename, MultiGridPatch.Create, MultiGridDataIO.GetPatchHeaderLoader, OnPatchCreated));
        }
        else
        {
            Debug.LogError("Found unknown data file type: " + filename);
        }
    }