-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partial support for RSDKv5's hitboxes
- Loading branch information
Showing
13 changed files
with
287 additions
and
17 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Window x:Class="AnimationEditor.Hitbox5Window" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:AnimationEditor" | ||
mc:Ignorable="d" | ||
Title="Hitbox manager" Height="300" Width="200"> | ||
<DockPanel Margin="5"> | ||
<TextBlock DockPanel.Dock="Top" Text="Selected hitbox type"/> | ||
<TextBox DockPanel.Dock="Top" Margin="0 0 0 5" | ||
Text="{Binding SelectedValue, Mode=TwoWay}" LostFocus="TextBox_LostFocus"/> | ||
<Grid DockPanel.Dock="Bottom"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="2*"/> | ||
<ColumnDefinition Width="3*"/> | ||
</Grid.ColumnDefinitions> | ||
<Button x:Name="ButtonAdd" Grid.Column="0" Margin="0 5 5 0" Click="ButtonAdd_Click" | ||
IsEnabled="false"> | ||
<StackPanel Orientation="Horizontal"> | ||
<Image Source="{StaticResource Add_16x}" Width="16"/> | ||
<TextBlock Text="Add" Margin="3 0 3 0"/> | ||
</StackPanel> | ||
</Button> | ||
<Button x:Name="ButtonRemove" Grid.Column="1" Margin="0 5 0 0" Click="ButtonRemove_Click" | ||
IsEnabled="false"> | ||
<StackPanel Orientation="Horizontal"> | ||
<Image Source="{StaticResource Remove_color_16x}" Width="16"/> | ||
<TextBlock Text="Remove" Margin="3 0 3 0"/> | ||
</StackPanel> | ||
</Button> | ||
</Grid> | ||
<ListBox x:Name="List" Grid.Column="0" ItemsSource="{Binding HitboxTypeItems}" | ||
SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}" | ||
SelectedValue="{Binding SelectedValue, Mode=TwoWay}"/> | ||
</DockPanel> | ||
</Window> |
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,50 @@ | ||
using AnimationEditor.ViewModels; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace AnimationEditor | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Hitbox5Window.xaml | ||
/// </summary> | ||
public partial class Hitbox5Window : Window | ||
{ | ||
public HitboxV5EditorViewModel ViewModel => DataContext as HitboxV5EditorViewModel; | ||
|
||
public Hitbox5Window(MainViewModel vm) | ||
{ | ||
InitializeComponent(); | ||
DataContext = new HitboxV5EditorViewModel(vm); | ||
} | ||
|
||
private void ButtonAdd_Click(object sender, RoutedEventArgs e) | ||
{ | ||
ViewModel.HitboxTypeItems.Add("EMPTY"); | ||
} | ||
|
||
private void ButtonRemove_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (ViewModel.IsValueSelected) | ||
ViewModel.HitboxTypeItems.RemoveAt(ViewModel.SelectedIndex); | ||
} | ||
|
||
private void TextBox_LostFocus(object sender, RoutedEventArgs e) | ||
{ | ||
if (sender is TextBox textBox) | ||
{ | ||
ViewModel.UpdateList(textBox.Text); | ||
} | ||
} | ||
} | ||
} |
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
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,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AnimationEditor.ViewModels | ||
{ | ||
public class HitboxV5EditorViewModel : Xe.Tools.Wpf.BaseNotifyPropertyChanged | ||
{ | ||
private string _selectedValue; | ||
private int _selectedIndex; | ||
|
||
public ObservableCollection<string> HitboxTypeItems { get; set; } | ||
|
||
public string SelectedValue | ||
{ | ||
get => _selectedValue; | ||
set | ||
{ | ||
_selectedValue = value; | ||
OnPropertyChanged(nameof(SelectedValue)); | ||
} | ||
} | ||
|
||
public int SelectedIndex | ||
{ | ||
get => _selectedIndex; | ||
set | ||
{ | ||
_selectedIndex = value; | ||
OnPropertyChanged(nameof(IsValueSelected)); | ||
} | ||
} | ||
|
||
public bool IsValueSelected => SelectedIndex >= 0; | ||
|
||
public HitboxV5EditorViewModel(MainViewModel vm) | ||
{ | ||
HitboxTypeItems = vm.HitboxTypes; | ||
} | ||
|
||
public void UpdateList(string value) | ||
{ | ||
var index = SelectedIndex; | ||
if (index >= 0) | ||
{ | ||
HitboxTypeItems.RemoveAt(index); | ||
HitboxTypeItems.Insert(index, value); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.