public static GameSheet LoadSheet(TextAsset sheetFile, Texture2D cover) { Sheet s = SourceLoader.LoadSheetFromBundle(sheetFile); GameSheet gameSheet = new GameSheet(s.name, s.author, s.bpm, s.notes, s.musicOffset, s.size, s.notePreload, s.screenSize); if (s != null) { gameSheet.music = Application.persistentDataPath + "/Editor/" + s.music + ".mp4"; gameSheet.cover = cover; } return(gameSheet); }
/// <summary>get the gamesheet from assetBundle also set the texture and video url</summary> public static GameSheet ConvertBundleToGameSheet(AssetBundle bundle) { TextAsset sheetFile = bundle.LoadAsset <TextAsset> (bundle.name); Sheet s = SourceLoader.LoadSheetFromBundle(sheetFile); GameSheet gameSheet = new GameSheet(s.name, s.author, s.bpm, s.notes, s.musicOffset, s.size, s.notePreload, s.screenSize); if (s != null) { Texture2D tex = bundle.LoadAsset <Texture2D> (s.cover); gameSheet.music = Application.persistentDataPath + "/Bundle/" + s.music + ".mp4"; gameSheet.cover = tex; } return(gameSheet); }
/// <summary>load the scoreboard from option folder</summary> /// <remarks>if the file is not exist will create a new one</remarks> public static ScoreBoard LoadScoreBoard( ) { string path = Application.persistentDataPath + "/Option"; SourceLoader.CheckDirectory(path); path = Application.persistentDataPath + "/Option/scoreBoard.json"; //option no if (!File.Exists(path)) { FileStream fs = new FileStream(path, FileMode.Create); string fileContext = JsonUtility.ToJson(new ScoreBoard( )); StreamWriter file = new StreamWriter(fs); file.Write(fileContext); file.Close( ); } return(JsonUtility.FromJson <ScoreBoard> (File.ReadAllText(path))); }