Palette picks a whole object on a click; mod documentation
This commit is contained in:
1 parent
c585960c61
commit
bbdfe95de3
41 files changed
+1114
-179
No files matched your search
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Cthangover.Core.Mods;
|
||||
using Cthangover.Core.Mods.Resolvers;
|
||||
using Cthangover.Mods.Rpg;
|
||||
|
||||
namespace Cthangover.Tools.RpgEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// All map charsets supplied by the loaded mods, including NPC artwork without
|
||||
/// a character entity. Paths stay distinct even when two mods use the same file name.
|
||||
/// These entries describe appearance only and must never be used as battle enemy ids.
|
||||
/// </summary>
|
||||
public static class RpgAppearanceCatalog
|
||||
{
|
||||
/// <summary>Reads charset images anew and builds standing-frame previews for the picker.</summary>
|
||||
public static List<RpgPickerEntry> Load(RpgTextures textures)
|
||||
{
|
||||
var files = Files.Collect(RpgTextures.CharsetGroup);
|
||||
return (files?.Keys.AsEnumerable() ?? Enumerable.Empty<string>())
|
||||
.Where(IsImage)
|
||||
.Select(file => Path.ChangeExtension(file, null))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.OrderBy(path => path, StringComparer.OrdinalIgnoreCase)
|
||||
.Select(path => new RpgPickerEntry
|
||||
{
|
||||
Id = path,
|
||||
Name = Path.GetFileName(path),
|
||||
Look = path,
|
||||
Icon = RpgCharacterCatalog.FrontFrame(textures.Charset(path)),
|
||||
OwnsIcon = true
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static bool IsImage(string path)
|
||||
=> ModConfig.Instance.GetTextureExtensionSet().Contains(Path.GetExtension(path));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user