Skip to content

Commit

Permalink
Adjust SFX references, add nameplate export (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonko0493 authored Jul 12, 2024
1 parent a51e0fd commit 242155d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SerialLoops/Dialogs/ItemReferenceDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ private void InitializeComponent()
MinimumSize = new Size(400, 275);
Padding = 10;

List<ItemDescription> results = Project.Items.FindAll(i => !IGNORED_ORPHAN_TYPES.Contains(i.Type) && i.GetReferencesTo(Project).Count == 0);
List<ItemDescription> results = Project.Items.FindAll(i => !IGNORED_ORPHAN_TYPES.Contains(i.Type) && i.GetReferencesTo(Project).Count == 0
&& !(i.Type == ItemDescription.ItemType.SFX && ((SfxItem)i).Name.Contains("SSE") && ((SfxItem)i).AssociatedGroups.Count > 0)); // assume SFX that are in groups are referenced in code
Content = new StackLayout
{
Orientation = Orientation.Vertical,
Expand Down
15 changes: 15 additions & 0 deletions src/SerialLoops/Editors/CharacterEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eto.Forms;
using HaruhiChokuretsuLib.Archive.Graphics;
using HaruhiChokuretsuLib.Util;
using SerialLoops.Controls;
using SerialLoops.Lib;
Expand Down Expand Up @@ -35,11 +36,25 @@ public override Container GetEditorPanel()
using SKCanvas baseCanvas = new(nameplatePreview);
baseCanvas.DrawBitmap(_project.NameplateBitmap, new SKRect(0, 16 * ((int)_character.MessageInfo.Character - 1), 64, 16 * ((int)_character.MessageInfo.Character)), new SKRect(0, 0, 64, 16));
baseCanvas.Flush();
Button exportNameplatePreviewButton = new() { Text = "Export" };
exportNameplatePreviewButton.Click += (sender, args) =>
{
SaveFileDialog saveFileDialog = new();
saveFileDialog.Filters.Add(new() { Name = Application.Instance.Localize(this, "PNG image"), Extensions = [".png"] });
if (saveFileDialog.ShowAndReportIfFileSelected(this))
{
using FileStream fs = new(saveFileDialog.FileName, FileMode.Create);
nameplatePreview.Encode(fs, SKEncodedImageFormat.Png, GraphicsFile.PNG_QUALITY);
}
};
StackLayout nameplatePreviewLayout = new()
{
Orientation = Orientation.Horizontal,
Spacing = 5,
Items =
{
new SKGuiImage(nameplatePreview),
exportNameplatePreviewButton,
},
};

Expand Down

0 comments on commit 242155d

Please sign in to comment.