Ejemplo n.º 1
0
 public static void RecountCollectibles(Tub.TubLevel level)
 {
     level.Collectibles = level.gameObject.scene.GetRootGameObjects()
                          .SelectMany(x => x.GetComponentsInChildren <Tub.Collectable>())
                          .Select(x => new Tub.CollectableInformation
     {
         Coin   = x,
         Sprite = x.HudIcon
     })
                          .OrderBy(x => System.Guid.NewGuid())
                          .ToArray();
 }
Ejemplo n.º 2
0
        private static void CopyPreviewImage(string v, TubLevel tubLevel)
        {
            string assetPath = AssetDatabase.GetAssetPath(tubLevel.Icon);
            var    tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;

            tImporter.isReadable         = true;
            tImporter.textureCompression = TextureImporterCompression.Uncompressed;
            AssetDatabase.ImportAsset(assetPath);
            AssetDatabase.Refresh();

            var pngData = tubLevel.Icon.EncodeToPNG();

            System.IO.File.WriteAllBytes(v, pngData);
        }
Ejemplo n.º 3
0
        static void CreateMetaFile(string filename, TubLevel tubLevel)
        {
            var meta = new MetaFile
            {
                AppId       = 790910,
                Title       = tubLevel.Title,
                Description = tubLevel.Description,
                Meta        = "{}",
                Tags        = new[] { "Mission", "v2" },
                KeyValues   = new Dictionary <string, string[]>()
            };

            meta.KeyValues["env"] = new[] { $"unity{Application.unityVersion}" };

            System.IO.File.WriteAllText(filename, JsonUtility.ToJson(meta, true));
        }
Ejemplo n.º 4
0
 static void CheckExport(TubLevel level)
 {
     if (level == null)
     {
         throw new System.Exception("No TubLevel component");
     }
     if (string.IsNullOrEmpty(level.UniqueIdentifier))
     {
         throw new System.Exception("TubLevel.UniqueIdentifier is blank - it needs to be a unique indientier");
     }
     if (string.IsNullOrEmpty(level.Title))
     {
         throw new System.Exception("TubLevel.Title is empty");
     }
     if (level.Icon != null && (level.Icon.width != 512 || level.Icon.height != 512))
     {
         throw new System.Exception("TubLevel.Icon should be 512x512");
     }
 }