mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-31 10:35:43 +00:00
slight change to audio file classes
this also fixes the "Include Overworld songs in Creative" feature. The code for that functionality was already perfect, so that hasn't been touched at all. Just needed to adjust the class a little. (:
This commit is contained in:
@@ -47,17 +47,13 @@ namespace PckStudio.Classes.FileTypes
|
||||
public EAudioType audioType { get; }
|
||||
public List<string> SongNames { get; } = new List<string>();
|
||||
|
||||
public AudioCategory(EAudioParameterType parameterType, EAudioType audioType)
|
||||
public AudioCategory(string name, EAudioParameterType parameterType, EAudioType audioType)
|
||||
{
|
||||
this.Name = name;
|
||||
this.parameterType = parameterType;
|
||||
this.audioType = audioType;
|
||||
}
|
||||
|
||||
public AudioCategory(string name, EAudioParameterType parameterType, EAudioType audioType) : this(parameterType, audioType)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string[] GetCredits() => Credits.Values.ToArray();
|
||||
public string GetCreditsString() => string.Join("\n", Credits.Values.ToArray());
|
||||
@@ -135,13 +131,13 @@ namespace PckStudio.Classes.FileTypes
|
||||
|
||||
/// <returns>True when category was created, otherwise false</returns>
|
||||
/// <exception cref="InvalidCategoryException"></exception>
|
||||
public bool AddCategory(AudioCategory.EAudioParameterType parameterType, AudioCategory.EAudioType category)
|
||||
public bool AddCategory(AudioCategory.EAudioParameterType parameterType, AudioCategory.EAudioType category, string name = "")
|
||||
{
|
||||
if (category < AudioCategory.EAudioType.Overworld ||
|
||||
category > AudioCategory.EAudioType.Unused)
|
||||
throw new InvalidCategoryException(nameof(category));
|
||||
bool exists = HasCategory(category);
|
||||
if (!exists) _categories[(int)category] = new AudioCategory(parameterType, category);
|
||||
if (!exists) _categories[(int)category] = new AudioCategory(name, parameterType, category);
|
||||
return !exists;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ namespace PckStudio.Classes.IO.PCK
|
||||
var parameterType = (PCKAudioFile.AudioCategory.EAudioParameterType)ReadInt(stream);
|
||||
var audioType = (PCKAudioFile.AudioCategory.EAudioType)ReadInt(stream);
|
||||
string name = ReadString(stream);
|
||||
Console.WriteLine(name);
|
||||
_file.AddCategory(parameterType, audioType);
|
||||
_file.AddCategory(parameterType, audioType, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user