-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1119 from osdanova/master
Kh2ObjectEditor - Added effect VSF list to the editor
- Loading branch information
Showing
8 changed files
with
200 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
OpenKh.Tools.Kh2ObjectEditor/Modules/Effects/M_EffectDpdVoice.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<UserControl x:Class="OpenKh.Tools.Kh2ObjectEditor.Modules.Effects.M_EffectDpdVoice_Control" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:OpenKh.Tools.Kh2ObjectEditor.Modules.Effects" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
|
||
<StackPanel Orientation="Vertical" Background="Black"> | ||
<StackPanel Orientation="Horizontal"> | ||
<Label Foreground="White" VerticalAlignment="Center">Number:</Label> | ||
<TextBox MinWidth="30" Margin="10" Text="{Binding Path=VsfNo}"></TextBox> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal"> | ||
<Label Foreground="White" VerticalAlignment="Center">Model:</Label> | ||
<TextBox MinWidth="30" Margin="10" Text="{Binding Path=ModelNumber}"></TextBox> | ||
</StackPanel> | ||
<Label Foreground="White" VerticalAlignment="Center">Indices</Label> | ||
<DataGrid Name="DataTable" | ||
AutoGenerateColumns="False" | ||
ItemsSource="{Binding Indices}" | ||
CanUserAddRows="True"> | ||
<DataGrid.Columns> | ||
<DataGridTextColumn Binding="{Binding Index}" Header="Index" /> | ||
</DataGrid.Columns> | ||
</DataGrid> | ||
<Button Width="100" Click="Button_SaveIndices">Save Indices</Button> | ||
</StackPanel> | ||
</UserControl> |
21 changes: 21 additions & 0 deletions
21
OpenKh.Tools.Kh2ObjectEditor/Modules/Effects/M_EffectDpdVoice.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using OpenKh.Kh2; | ||
using System.Windows.Controls; | ||
|
||
namespace OpenKh.Tools.Kh2ObjectEditor.Modules.Effects | ||
{ | ||
public partial class M_EffectDpdVoice_Control : UserControl | ||
{ | ||
public M_EffectDpdVoice_VM ThisDpdVsf { get; set; } | ||
public M_EffectDpdVoice_Control(DpdVsf dpdVsf) | ||
{ | ||
InitializeComponent(); | ||
ThisDpdVsf = new M_EffectDpdVoice_VM(dpdVsf); | ||
DataContext = ThisDpdVsf; | ||
} | ||
|
||
private void Button_SaveIndices(object sender, System.Windows.RoutedEventArgs e) | ||
{ | ||
ThisDpdVsf.SaveIndices(); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
OpenKh.Tools.Kh2ObjectEditor/Modules/Effects/M_EffectDpdVoiceList_Control.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<UserControl x:Class="OpenKh.Tools.Kh2ObjectEditor.Modules.Effects.M_EffectDpdVoiceList_Control" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:OpenKh.Tools.Kh2ObjectEditor.Modules.Effects" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="auto" /> | ||
<ColumnDefinition Width="100" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<ContentControl Grid.Row="0" Name="Frame_Voice" /> | ||
|
||
<GridSplitter Grid.Column="1" Background="LightGray" HorizontalAlignment="Center" VerticalAlignment="Stretch" ShowsPreview="True" Width="5"/> | ||
|
||
<ListView Grid.Column="2" x:Name="ListView_Vsf" ItemsSource="{Binding VsfWrappers}" MouseDoubleClick="ListView_Vsf_MouseDoubleClick"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<StackPanel Orientation="Vertical"> | ||
<TextBlock Text="{Binding Path=Name}"/> | ||
</StackPanel> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
</Grid> | ||
</UserControl> |
44 changes: 44 additions & 0 deletions
44
OpenKh.Tools.Kh2ObjectEditor/Modules/Effects/M_EffectDpdVoiceList_Control.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using OpenKh.Kh2; | ||
using System.Collections.ObjectModel; | ||
using System.Windows.Controls; | ||
|
||
namespace OpenKh.Tools.Kh2ObjectEditor.Modules.Effects | ||
{ | ||
public partial class M_EffectDpdVoiceList_Control : UserControl | ||
{ | ||
|
||
public ObservableCollection<VsfWrapper> VsfWrappers { get; set; } | ||
|
||
public M_EffectDpdVoiceList_Control(Dpd loadedDpd) | ||
{ | ||
InitializeComponent(); | ||
|
||
VsfWrappers = new ObservableCollection<VsfWrapper>(); | ||
for (int i = 0; i < loadedDpd.VsfList.Count; i++) | ||
{ | ||
VsfWrappers.Add(new VsfWrapper(i, loadedDpd.VsfList[i])); | ||
} | ||
|
||
DataContext = this; | ||
} | ||
|
||
private void ListView_Vsf_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) | ||
{ | ||
Frame_Voice.Content = new M_EffectDpdVoice_Control(VsfWrappers[ListView_Vsf.SelectedIndex].VoiceEffect); | ||
} | ||
|
||
public class VsfWrapper | ||
{ | ||
public int Index { get; set; } | ||
public string Name { get; set; } | ||
public DpdVsf VoiceEffect { get; set; } | ||
|
||
public VsfWrapper(int index, DpdVsf vsf) | ||
{ | ||
Index = index; | ||
VoiceEffect = vsf; | ||
Name = "Vsf " + Index; | ||
} | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
OpenKh.Tools.Kh2ObjectEditor/Modules/Effects/M_EffectDpdVoice_VM.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using OpenKh.Kh2; | ||
using OpenKh.Tools.Kh2ObjectEditor.Utils; | ||
using System.Collections.ObjectModel; | ||
using System.Diagnostics; | ||
|
||
namespace OpenKh.Tools.Kh2ObjectEditor.Modules.Effects | ||
{ | ||
public class M_EffectDpdVoice_VM : NotifyPropertyChangedBase | ||
{ | ||
public DpdVsf Voice { get; set; } | ||
|
||
public int VsfNo | ||
{ | ||
get { return Voice.VsfNo; } | ||
set | ||
{ | ||
Voice.VsfNo = value; | ||
OnPropertyChanged("VsfNo"); | ||
} | ||
} | ||
public int ModelNumber | ||
{ | ||
get { return Voice.ModelNumber; } | ||
set | ||
{ | ||
Voice.ModelNumber = value; | ||
OnPropertyChanged("ModelNumber"); | ||
} | ||
} | ||
|
||
private ObservableCollection<IndexWrapper> _indices; | ||
public ObservableCollection<IndexWrapper> Indices | ||
{ | ||
get { return _indices; } | ||
set | ||
{ | ||
_indices = value; | ||
OnPropertyChanged("Indices"); | ||
} | ||
} | ||
|
||
public M_EffectDpdVoice_VM(DpdVsf vsf) | ||
{ | ||
Voice = vsf; | ||
_indices = new ObservableCollection<IndexWrapper>(); | ||
foreach (ushort value in Voice.Indices) | ||
{ | ||
_indices.Add(new IndexWrapper { Index = value }); | ||
} | ||
} | ||
|
||
public void SaveIndices() | ||
{ | ||
Voice.Indices.Clear(); | ||
foreach (IndexWrapper value in Indices) | ||
{ | ||
Voice.Indices.Add(value.Index); | ||
} | ||
Debug.WriteLine("Indices saved!"); | ||
} | ||
|
||
public class IndexWrapper | ||
{ | ||
public ushort Index { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters