mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-16 10:04:49 +08:00
Dat151 progress
This commit is contained in:
@@ -16,6 +16,9 @@ namespace CodeWalker.Project.Panels
|
||||
public ProjectForm ProjectForm;
|
||||
public RelFile CurrentFile { get; set; }
|
||||
|
||||
private bool populatingui = false;
|
||||
|
||||
|
||||
public EditAudioFilePanel(ProjectForm owner)
|
||||
{
|
||||
ProjectForm = owner;
|
||||
@@ -27,6 +30,7 @@ namespace CodeWalker.Project.Panels
|
||||
CurrentFile = file;
|
||||
Tag = file;
|
||||
UpdateFormTitle();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void UpdateFormTitle()
|
||||
@@ -34,5 +38,66 @@ namespace CodeWalker.Project.Panels
|
||||
Text = CurrentFile?.Name ?? "";
|
||||
}
|
||||
|
||||
private void UpdateUI()
|
||||
{
|
||||
if (CurrentFile == null)
|
||||
{
|
||||
populatingui = true;
|
||||
FileTypeComboBox.Text = string.Empty;
|
||||
UnkVersionUpDown.Value = 0;
|
||||
FileLocationTextBox.Text = string.Empty;
|
||||
ProjectPathTextBox.Text = string.Empty;
|
||||
populatingui = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
populatingui = true;
|
||||
FileTypeComboBox.Text = CurrentFile.RelType.ToString();
|
||||
UnkVersionUpDown.Value = CurrentFile.DataUnkVal;
|
||||
var project = ProjectForm?.CurrentProjectFile;
|
||||
FileLocationTextBox.Text = CurrentFile.RpfFileEntry?.Path ?? CurrentFile.FilePath;
|
||||
ProjectPathTextBox.Text = (project != null) ? project.GetRelativePath(CurrentFile.FilePath) : CurrentFile.FilePath;
|
||||
populatingui = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ProjectItemChanged()
|
||||
{
|
||||
if (CurrentFile != null)
|
||||
{
|
||||
ProjectForm.SetAudioFileHasChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void FileTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (populatingui) return;
|
||||
if (CurrentFile == null) return;
|
||||
|
||||
var type = RelDatFileType.Dat151;
|
||||
if (Enum.TryParse(FileTypeComboBox.Text, out type))
|
||||
{
|
||||
if (CurrentFile.RelType != type)
|
||||
{
|
||||
CurrentFile.RelType = type;
|
||||
|
||||
ProjectItemChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UnkVersionUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (populatingui) return;
|
||||
if (CurrentFile == null) return;
|
||||
|
||||
byte unk = (byte)UnkVersionUpDown.Value;
|
||||
if (CurrentFile.DataUnkVal != unk)
|
||||
{
|
||||
CurrentFile.DataUnkVal = unk;
|
||||
|
||||
ProjectItemChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user