Ejemplo n.º 1
0
    public static void BuildGameData()
    {
        Debug.Log("GameDataBuilder (BuildGameData) :: Building game data");

        string processGameDBPath = BinaryDataPath;

        string json = JSONMinifyTool.Minify(File.ReadAllText(GameDataImporter.GameDBJsonPath));

        byte[] encrypted = GameDataUtils.EncryptGameData(json, Encoding.Default);
        if (encrypted != null)
        {
            using (FileStream fs = new FileStream(processGameDBPath, FileMode.Create, FileAccess.Write))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    ms.Write(encrypted, 0, encrypted.Length);
                    ms.WriteTo(fs);
                }
            }
        }
        else
        {
            throw new Exception("Cannot encrypt gameDB! Failing the build.");
        }
        AssetDatabase.Refresh();
    }
 public void Execute(BuildTarget target, BuildType type, string path)
 {
     foreach (var item in m_pathsToMinify)
     {
         string fullpath = Application.dataPath + item;
         JSONMinifyTool.MinifyFile(fullpath);
     }
 }