1
0
mirror of synced 2024-12-05 04:17:59 +01:00
Switch-Toolbox/File_Format_Library/FileFormats/Layout/PartsManager.cs
KillzXGaming a8e6d104f2 A few improvements.
Panes can now be selected and moved around.
Panes can be resized from corners or edges.
Improved hit detection for panes.
Mouse left click now selects and moves panes. Use middle mouse or hold shift + left mouse to pan/move camera.
More progress on timeline, but currently not functional so currently disabled atm.
Multiple layout animations can be selected and played at once. Goes to the highest amount of frames.
Start to impliment a parts manager. Will allow editing external layout and animation data, and saving back properly.
2019-10-05 13:25:28 -04:00

54 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Toolbox.Library;
namespace LayoutBXLYT
{
/// <summary>
/// A class that manages parts for layout files
/// </summary>
public class PartsManager : IDisposable
{
public Dictionary<string, BxlytHeader> PartLayouts = new Dictionary<string, BxlytHeader>();
public Dictionary<string, BxlanHeader> PartAnimations = new Dictionary<string, BxlanHeader>();
public Dictionary<string, IArchiveFile> PartArchives = new Dictionary<string, IArchiveFile>();
public void AddLayout(BxlytHeader header)
{
if (!PartLayouts.ContainsKey(header.FileName))
PartLayouts.Add(header.FileName, header);
}
public void AddAnimation(BxlanHeader header)
{
if (!PartAnimations.ContainsKey(header.FileName))
PartAnimations.Add(header.FileName, header);
}
public void AddArchive(IArchiveFile archive)
{
if (!PartArchives.ContainsKey(((IFileFormat)archive).FileName))
PartArchives.Add(((IFileFormat)archive).FileName, archive);
}
public void Dispose()
{
foreach (var file in PartLayouts.Values)
file.Dispose();
foreach (var file in PartAnimations.Values)
file.Dispose();
foreach (var file in PartArchives.Values)
((IFileFormat)file).Unload();
PartLayouts.Clear();
PartAnimations.Clear();
PartArchives.Clear();
}
}
}