Ejemplo n.º 1
0
        public void SaveMaybeOverwrite(SaveLoadController saveLoad, string id, GameBundle.Metadata metadata, Texture2D thumbnail, System.Action onSaveComplete)
        {
            string dir = GetBundleDirectory(id);

            Util.SetNormalFileAttributes(dir);
            Directory.CreateDirectory(dir);

            GameBundle bundle = new GameBundle(dir);

            if (thumbnail != null)
            {
                Util.SetNormalFileAttributes(bundle.GetThumbnailPath());
                Util.SaveTextureToPng(thumbnail, bundle.GetThumbnailPath());
            }

            Util.SetNormalFileAttributes(bundle.GetMetadataPath());
            File.WriteAllText(bundle.GetMetadataPath(), JsonUtility.ToJson(metadata));

            Util.SetNormalFileAttributes(bundle.GetVoosPath());
            saveLoad.RequestSave(bundle.GetVoosPath(), onSaveComplete);

#if !USE_STEAMWORKS
            workshop.Save(bundle.GetAssetsPath());
#endif
        }
Ejemplo n.º 2
0
        public IEnumerable <Entry> Enumerate()
        {
            foreach (string absolutePath in Directory.EnumerateDirectories(location.GetAbsolute()))
            {
                string     id     = Path.GetFileName(absolutePath);
                GameBundle bundle = new GameBundle(GetBundleDirectory(id));
                // Assume that if a scene is there, that's all we really care about.
                // That's the most important data, after all.
                if (!File.Exists(bundle.GetVoosPath()))
                {
                    Debug.LogWarning($"A directory '{id}' inside '{location.GetAbsolute()}' seems like an invalid bundle directory. File is missing: {bundle.GetVoosPath()}. Skipping it.");
                    continue;
                }

                yield return(new Entry {
                    id = id, bundle = bundle
                });
            }
        }