コード例 #1
0
        /// <summary>
        /// Loads from a file, and returns a Model for a UI screen
        /// </summary>
        /// <param name="fileToLoad">The actual file to load</param>
        /// <returns>Returns the deserialized json file</returns>
        public UiScreenModel LoadUiScreenJson(string fileToLoad)
        {
            var jsonReader = GameJsonLoader.CreateJsonStreamReader(fileToLoad, GameJsonLoader.ConfigFileToRead.UiScreenFile);
            var data       = jsonReader.ReadToEnd();

            return(JsonSerializer.Deserialize <UiScreenModel>(data));
        }
コード例 #2
0
 /// <summary>
 /// Reads the music json file to get the sound banks
 /// </summary>
 /// <param name="fileName">This is the filename that shoud be searched for</param>
 /// <returns>Returns all of the banks in a bankfilelist</returns>
 BankfileList ReadMusicJsonFile(string fileName)
 {
     using var streamreader =
               GameJsonLoader.CreateJsonStreamReader(fileName, GameJsonLoader.ConfigFileToRead.MusicFile);
     try
     {
         var data = streamreader.ReadToEnd();
         return(System.Text.Json.JsonSerializer.Deserialize <BankfileList>(data));
     }
     catch
     {
         SendDebugMessage($"Just failed to gather json data from the file {fileName} for some reason", LogLevel.Critical);
         return(null);
     }
 }