-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,089 additions
and
27 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
17 changes: 17 additions & 0 deletions
17
SekaiToolsGUI/View/Download/Components/Action/ActionStoryItem.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,17 @@ | ||
<UserControl x:Class="SekaiToolsGUI.View.Download.Components.Action.ActionStoryItem" | ||
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:SekaiToolsGUI.View.Download.Components" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" | ||
mc:Ignorable="d" | ||
d:DataContext="{d:DesignInstance local:DownloadItem}" | ||
HorizontalAlignment="Stretch"> | ||
<ui:CardAction HorizontalAlignment="Stretch" Click="ButtonBase_OnClick"> | ||
<StackPanel Orientation="Vertical"> | ||
<ui:TextBlock Name="KeyText" Text="Key" /> | ||
<StackPanel Orientation="Horizontal" Name="Icons" Margin="0,5,0,0"/> | ||
</StackPanel> | ||
</ui:CardAction> | ||
</UserControl> |
73 changes: 73 additions & 0 deletions
73
SekaiToolsGUI/View/Download/Components/Action/ActionStoryItem.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,73 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using SekaiDataFetch.List; | ||
|
||
namespace SekaiToolsGUI.View.Download.Components.Action; | ||
|
||
public partial class ActionStoryItem : UserControl | ||
{ | ||
public static readonly DependencyProperty AreaStoryProperty = DependencyProperty.Register( | ||
nameof(AreaStory), typeof(AreaStory), typeof(ActionStoryItem), | ||
new PropertyMetadata(null, OnAreaStoryChanged)); | ||
|
||
public AreaStory AreaStory { get; set; } = null!; | ||
|
||
private static void OnAreaStoryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
if (d is ActionStoryItem control && e.NewValue is AreaStory areaStory) control.Initialize(areaStory); | ||
} | ||
|
||
|
||
public ActionStoryItem() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
Dispatcher.Invoke(() => | ||
{ | ||
DependencyObject? parent = this; | ||
while (parent != null && parent is not DownloadPage) parent = VisualTreeHelper.GetParent(parent); | ||
(parent as DownloadPage)?.AddTask(AreaStory.ActionSet.ScriptId, AreaStory.Url()); | ||
}); | ||
} | ||
|
||
|
||
private void Initialize(AreaStory areaStory) | ||
{ | ||
AreaStory = areaStory; | ||
Icons.Children.Clear(); | ||
var cIds = areaStory.CharacterIds.ToList(); | ||
cIds.Sort(); | ||
foreach (var id in cIds) | ||
{ | ||
if (id is < 1 or > 31) | ||
{ | ||
var text = new TextBlock | ||
{ | ||
Text = $"L2d-{id}", | ||
FontSize = 16, | ||
Margin = new Thickness(5, 0, 5, 0) | ||
}; | ||
Icons.Children.Add(text); | ||
} | ||
else | ||
{ | ||
var url = $"pack://application:,,,/Resource/Characters/chr_{id}.png"; | ||
var icon = new Image | ||
{ | ||
Source = new BitmapImage(new Uri(url)), | ||
Width = 36, | ||
Height = 36, | ||
Margin = new Thickness(5, 0, 5, 0) | ||
}; | ||
Icons.Children.Add(icon); | ||
} | ||
} | ||
|
||
KeyText.Text = $"{areaStory.ActionSet.Id} {areaStory.ActionSet.ScenarioId}"; | ||
} | ||
} |
Oops, something went wrong.