Added reset to default button for tree items
This commit is contained in:
@@ -60,14 +60,17 @@ namespace PlayerTags.Configuration
|
||||
|
||||
public void Save(PluginData pluginData)
|
||||
{
|
||||
AllTagsChanges = pluginData.AllTags.GetChanges(pluginData.Default.AllTagsChanges);
|
||||
AllRoleTagsChanges = pluginData.AllRoleTags.GetChanges(pluginData.Default.AllRoleTagsChanges);
|
||||
AllTagsChanges = pluginData.AllTags.GetChanges(pluginData.Default.AllTags.GetChanges());
|
||||
AllRoleTagsChanges = pluginData.AllRoleTags.GetChanges(pluginData.Default.AllRoleTags.GetChanges());
|
||||
|
||||
RoleTagsChanges = new Dictionary<Role, Dictionary<string, InheritableData>>();
|
||||
foreach ((var role, var roleTag) in pluginData.RoleTags)
|
||||
{
|
||||
Dictionary<string, InheritableData>? defaultChanges;
|
||||
pluginData.Default.RoleTagsChanges.TryGetValue(role, out defaultChanges);
|
||||
Dictionary<string, InheritableData>? defaultChanges = new Dictionary<string, InheritableData>();
|
||||
if (pluginData.Default.RoleTags.TryGetValue(role, out var defaultTag))
|
||||
{
|
||||
defaultChanges = defaultTag.GetChanges();
|
||||
}
|
||||
|
||||
var changes = roleTag.GetChanges(defaultChanges);
|
||||
if (changes.Any())
|
||||
@@ -79,8 +82,11 @@ namespace PlayerTags.Configuration
|
||||
DpsRoleTagsChanges = new Dictionary<DpsRole, Dictionary<string, InheritableData>>();
|
||||
foreach ((var dpsRole, var dpsRoleTag) in pluginData.DpsRoleTags)
|
||||
{
|
||||
Dictionary<string, InheritableData>? defaultChanges;
|
||||
pluginData.Default.DpsRoleTagsChanges.TryGetValue(dpsRole, out defaultChanges);
|
||||
Dictionary<string, InheritableData>? defaultChanges = new Dictionary<string, InheritableData>();
|
||||
if (pluginData.Default.DpsRoleTags.TryGetValue(dpsRole, out var defaultTag))
|
||||
{
|
||||
defaultChanges = defaultTag.GetChanges();
|
||||
}
|
||||
|
||||
var changes = dpsRoleTag.GetChanges(defaultChanges);
|
||||
if (changes.Any())
|
||||
@@ -92,8 +98,11 @@ namespace PlayerTags.Configuration
|
||||
RangedDpsRoleTagsChanges = new Dictionary<RangedDpsRole, Dictionary<string, InheritableData>>();
|
||||
foreach ((var rangedDpsRole, var rangedDpsRoleTag) in pluginData.RangedDpsRoleTags)
|
||||
{
|
||||
Dictionary<string, InheritableData>? defaultChanges;
|
||||
pluginData.Default.RangedDpsRoleTagsChanges.TryGetValue(rangedDpsRole, out defaultChanges);
|
||||
Dictionary<string, InheritableData>? defaultChanges = new Dictionary<string, InheritableData>();
|
||||
if (pluginData.Default.RangedDpsRoleTags.TryGetValue(rangedDpsRole, out var defaultTag))
|
||||
{
|
||||
defaultChanges = defaultTag.GetChanges();
|
||||
}
|
||||
|
||||
var changes = rangedDpsRoleTag.GetChanges(defaultChanges);
|
||||
if (changes.Any())
|
||||
@@ -105,8 +114,11 @@ namespace PlayerTags.Configuration
|
||||
LandHandRoleTagsChanges = new Dictionary<LandHandRole, Dictionary<string, InheritableData>>();
|
||||
foreach ((var landHandRole, var landHandRoleTag) in pluginData.LandHandRoleTags)
|
||||
{
|
||||
Dictionary<string, InheritableData>? defaultChanges;
|
||||
pluginData.Default.LandHandRoleTagsChanges.TryGetValue(landHandRole, out defaultChanges);
|
||||
Dictionary<string, InheritableData>? defaultChanges = new Dictionary<string, InheritableData>();
|
||||
if (pluginData.Default.LandHandRoleTags.TryGetValue(landHandRole, out var defaultTag))
|
||||
{
|
||||
defaultChanges = defaultTag.GetChanges();
|
||||
}
|
||||
|
||||
var changes = landHandRoleTag.GetChanges(defaultChanges);
|
||||
if (changes.Any())
|
||||
@@ -118,8 +130,11 @@ namespace PlayerTags.Configuration
|
||||
JobTagsChanges = new Dictionary<string, Dictionary<string, InheritableData>>();
|
||||
foreach ((var jobAbbreviation, var jobTag) in pluginData.JobTags)
|
||||
{
|
||||
Dictionary<string, InheritableData>? defaultChanges;
|
||||
pluginData.Default.JobTagsChanges.TryGetValue(jobAbbreviation, out defaultChanges);
|
||||
Dictionary<string, InheritableData>? defaultChanges = new Dictionary<string, InheritableData>();
|
||||
if (pluginData.Default.JobTags.TryGetValue(jobAbbreviation, out var defaultTag))
|
||||
{
|
||||
defaultChanges = defaultTag.GetChanges();
|
||||
}
|
||||
|
||||
var changes = jobTag.GetChanges(defaultChanges);
|
||||
if (changes.Any())
|
||||
@@ -128,7 +143,7 @@ namespace PlayerTags.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
AllCustomTagsChanges = pluginData.AllCustomTags.GetChanges(pluginData.Default.AllCustomTagsChanges);
|
||||
AllCustomTagsChanges = pluginData.AllCustomTags.GetChanges(pluginData.Default.AllCustomTags.GetChanges());
|
||||
|
||||
CustomTagsChanges = new List<Dictionary<string, InheritableData>>();
|
||||
foreach (var customTag in pluginData.CustomTags)
|
||||
|
||||
@@ -567,6 +567,22 @@ namespace PlayerTags.Configuration
|
||||
ImGui.SetTooltip(Strings.Loc_Static_AddPropertyOverride_Description);
|
||||
}
|
||||
|
||||
if (tag.HasDefaults)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPos().X + ImGui.GetContentRegionAvail().X - 23);
|
||||
if (ImGui.Button(FontAwesomeIcon.Recycle.ToIconString()))
|
||||
{
|
||||
tag.SetDefaults();
|
||||
}
|
||||
ImGui.PopFont();
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip(Strings.Loc_Static_ResetDefault_Description);
|
||||
}
|
||||
}
|
||||
|
||||
// Render all the property overrides, and optionally allow the inherited properties to be rendered
|
||||
IEnumerable<KeyValuePair<string, IInheritable>> inheritables = tag.Inheritables;
|
||||
if (!m_PluginConfiguration.IsShowInheritedPropertiesEnabled)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using PlayerTags.Inheritables;
|
||||
using PlayerTags.PluginStrings;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -9,20 +7,20 @@ namespace PlayerTags.Data
|
||||
{
|
||||
public class DefaultPluginData
|
||||
{
|
||||
public Dictionary<string, InheritableData> AllTagsChanges { get; }
|
||||
public Tag AllTags { get; }
|
||||
|
||||
public Dictionary<string, InheritableData> AllRoleTagsChanges { get; }
|
||||
public Dictionary<Role, Dictionary<string, InheritableData>> RoleTagsChanges { get; }
|
||||
public Dictionary<DpsRole, Dictionary<string, InheritableData>> DpsRoleTagsChanges { get; }
|
||||
public Dictionary<RangedDpsRole, Dictionary<string, InheritableData>> RangedDpsRoleTagsChanges { get; }
|
||||
public Dictionary<LandHandRole, Dictionary<string, InheritableData>> LandHandRoleTagsChanges { get; }
|
||||
public Dictionary<string, Dictionary<string, InheritableData>> JobTagsChanges { get; }
|
||||
public Tag AllRoleTags { get; }
|
||||
public Dictionary<Role, Tag> RoleTags { get; }
|
||||
public Dictionary<DpsRole, Tag> DpsRoleTags { get; }
|
||||
public Dictionary<RangedDpsRole, Tag> RangedDpsRoleTags { get; }
|
||||
public Dictionary<LandHandRole, Tag> LandHandRoleTags { get; }
|
||||
public Dictionary<string, Tag> JobTags { get; }
|
||||
|
||||
public Dictionary<string, InheritableData> AllCustomTagsChanges { get; }
|
||||
public Tag AllCustomTags { get; }
|
||||
|
||||
public DefaultPluginData()
|
||||
{
|
||||
AllTagsChanges = new Tag(new LiteralPluginString(""))
|
||||
AllTags = new Tag()
|
||||
{
|
||||
IsSelected = true,
|
||||
IsExpanded = true,
|
||||
@@ -41,9 +39,9 @@ namespace PlayerTags.Data
|
||||
IsVisibleForAlliancePlayers = true,
|
||||
IsVisibleForEnemyPlayers = true,
|
||||
IsVisibleForOtherPlayers = true,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
AllRoleTagsChanges = new Tag(new LiteralPluginString(""))
|
||||
AllRoleTags = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = true,
|
||||
@@ -51,109 +49,109 @@ namespace PlayerTags.Data
|
||||
IsTextVisibleInChat = true,
|
||||
IsTextVisibleInNameplates = true,
|
||||
IsTextColorAppliedToChatName = true
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RoleTagsChanges = new Dictionary<Role, Dictionary<string, InheritableData>>();
|
||||
RoleTagsChanges[Role.LandHand] = new Tag(new LiteralPluginString(""))
|
||||
RoleTags = new Dictionary<Role, Tag>();
|
||||
RoleTags[Role.LandHand] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
Icon = BitmapFontIcon.Crafter,
|
||||
TextColor = 3,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RoleTagsChanges[Role.Tank] = new Tag(new LiteralPluginString(""))
|
||||
RoleTags[Role.Tank] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
Icon = BitmapFontIcon.Tank,
|
||||
TextColor = 546,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RoleTagsChanges[Role.Healer] = new Tag(new LiteralPluginString(""))
|
||||
RoleTags[Role.Healer] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
Icon = BitmapFontIcon.Healer,
|
||||
TextColor = 43,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RoleTagsChanges[Role.Dps] = new Tag(new LiteralPluginString(""))
|
||||
RoleTags[Role.Dps] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = true,
|
||||
Icon = BitmapFontIcon.DPS,
|
||||
TextColor = 508,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
DpsRoleTagsChanges = new Dictionary<DpsRole, Dictionary<string, InheritableData>>();
|
||||
DpsRoleTagsChanges[DpsRole.Melee] = new Tag(new LiteralPluginString(""))
|
||||
DpsRoleTags = new Dictionary<DpsRole, Tag>();
|
||||
DpsRoleTags[DpsRole.Melee] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
DpsRoleTagsChanges[DpsRole.Ranged] = new Tag(new LiteralPluginString(""))
|
||||
DpsRoleTags[DpsRole.Ranged] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RangedDpsRoleTagsChanges = new Dictionary<RangedDpsRole, Dictionary<string, InheritableData>>();
|
||||
RangedDpsRoleTagsChanges[RangedDpsRole.Magical] = new Tag(new LiteralPluginString(""))
|
||||
RangedDpsRoleTags = new Dictionary<RangedDpsRole, Tag>();
|
||||
RangedDpsRoleTags[RangedDpsRole.Magical] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
RangedDpsRoleTagsChanges[RangedDpsRole.Physical] = new Tag(new LiteralPluginString(""))
|
||||
RangedDpsRoleTags[RangedDpsRole.Physical] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
LandHandRoleTagsChanges = new Dictionary<LandHandRole, Dictionary<string, InheritableData>>();
|
||||
LandHandRoleTagsChanges[LandHandRole.Land] = new Tag(new LiteralPluginString(""))
|
||||
LandHandRoleTags = new Dictionary<LandHandRole, Tag>();
|
||||
LandHandRoleTags[LandHandRole.Land] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
LandHandRoleTagsChanges[LandHandRole.Hand] = new Tag(new LiteralPluginString(""))
|
||||
LandHandRoleTags[LandHandRole.Hand] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
}.GetChanges();
|
||||
};
|
||||
|
||||
JobTagsChanges = new Dictionary<string, Dictionary<string, InheritableData>>();
|
||||
JobTags = new Dictionary<string, Tag>();
|
||||
|
||||
var classJobs = PluginServices.DataManager.GetExcelSheet<ClassJob>();
|
||||
if (classJobs != null)
|
||||
{
|
||||
foreach ((var role, var roleTagChanges) in RoleTagsChanges)
|
||||
foreach ((var role, var roleTagChanges) in RoleTags)
|
||||
{
|
||||
foreach (var classJob in classJobs.Where(classJob => RoleHelper.RolesByRoleId[classJob.Role] == role && !string.IsNullOrEmpty(classJob.Abbreviation.RawString)))
|
||||
{
|
||||
if (!JobTagsChanges.ContainsKey(classJob.Abbreviation.RawString))
|
||||
if (!JobTags.ContainsKey(classJob.Abbreviation.RawString))
|
||||
{
|
||||
JobTagsChanges[classJob.Abbreviation.RawString] = new Tag(new LiteralPluginString(""))
|
||||
JobTags[classJob.Abbreviation.RawString] = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = false,
|
||||
Text = classJob.Abbreviation.RawString,
|
||||
}.GetChanges();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AllCustomTagsChanges = new Tag(new LiteralPluginString(""))
|
||||
AllCustomTags = new Tag()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsExpanded = true,
|
||||
IsTextVisibleInChat = true,
|
||||
IsTextVisibleInNameplates = true,
|
||||
}.GetChanges();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,100 +23,81 @@ namespace PlayerTags.Data
|
||||
Default = new DefaultPluginData();
|
||||
|
||||
// Set the default changes and saved changes
|
||||
AllTags = new Tag(new LocalizedPluginString(nameof(AllTags)));
|
||||
AllTags.SetChanges(Default.AllTagsChanges);
|
||||
AllTags = new Tag(new LocalizedPluginString(nameof(AllTags)), Default.AllTags);
|
||||
AllTags.SetChanges(pluginConfiguration.AllTagsChanges);
|
||||
|
||||
AllRoleTags = new Tag(new LocalizedPluginString(nameof(AllRoleTags)));
|
||||
AllRoleTags.SetChanges(Default.AllRoleTagsChanges);
|
||||
AllRoleTags = new Tag(new LocalizedPluginString(nameof(AllRoleTags)), Default.AllRoleTags);
|
||||
AllRoleTags.SetChanges(pluginConfiguration.AllRoleTagsChanges);
|
||||
|
||||
RoleTags = new Dictionary<Role, Tag>();
|
||||
foreach (var role in Enum.GetValues<Role>())
|
||||
{
|
||||
RoleTags[role] = new Tag(new LocalizedPluginString(Localizer.GetName(role)));
|
||||
|
||||
if (Default.RoleTagsChanges.TryGetValue(role, out var defaultChanges))
|
||||
if (Default.RoleTags.TryGetValue(role, out var defaultTag))
|
||||
{
|
||||
RoleTags[role].SetChanges(defaultChanges);
|
||||
}
|
||||
|
||||
if (pluginConfiguration.RoleTagsChanges.TryGetValue(role, out var savedChanges))
|
||||
{
|
||||
RoleTags[role].SetChanges(savedChanges);
|
||||
RoleTags[role] = new Tag(new LocalizedPluginString(Localizer.GetName(role)), defaultTag);
|
||||
if (pluginConfiguration.RoleTagsChanges.TryGetValue(role, out var savedChanges))
|
||||
{
|
||||
RoleTags[role].SetChanges(savedChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DpsRoleTags = new Dictionary<DpsRole, Tag>();
|
||||
foreach (var dpsRole in Enum.GetValues<DpsRole>())
|
||||
{
|
||||
DpsRoleTags[dpsRole] = new Tag(new LocalizedPluginString(Localizer.GetName(dpsRole)));
|
||||
|
||||
if (Default.DpsRoleTagsChanges.TryGetValue(dpsRole, out var defaultChanges))
|
||||
if (Default.DpsRoleTags.TryGetValue(dpsRole, out var defaultTag))
|
||||
{
|
||||
DpsRoleTags[dpsRole].SetChanges(defaultChanges);
|
||||
}
|
||||
|
||||
if (pluginConfiguration.DpsRoleTagsChanges.TryGetValue(dpsRole, out var savedChanges))
|
||||
{
|
||||
DpsRoleTags[dpsRole].SetChanges(savedChanges);
|
||||
DpsRoleTags[dpsRole] = new Tag(new LocalizedPluginString(Localizer.GetName(dpsRole)), defaultTag);
|
||||
if (pluginConfiguration.DpsRoleTagsChanges.TryGetValue(dpsRole, out var savedChanges))
|
||||
{
|
||||
DpsRoleTags[dpsRole].SetChanges(savedChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RangedDpsRoleTags = new Dictionary<RangedDpsRole, Tag>();
|
||||
foreach (var rangedDpsRole in Enum.GetValues<RangedDpsRole>())
|
||||
{
|
||||
RangedDpsRoleTags[rangedDpsRole] = new Tag(new LocalizedPluginString(Localizer.GetName(rangedDpsRole)));
|
||||
|
||||
if (Default.RangedDpsRoleTagsChanges.TryGetValue(rangedDpsRole, out var defaultChanges))
|
||||
if (Default.RangedDpsRoleTags.TryGetValue(rangedDpsRole, out var defaultTag))
|
||||
{
|
||||
RangedDpsRoleTags[rangedDpsRole].SetChanges(defaultChanges);
|
||||
}
|
||||
|
||||
if (pluginConfiguration.RangedDpsRoleTagsChanges.TryGetValue(rangedDpsRole, out var savedChanges))
|
||||
{
|
||||
RangedDpsRoleTags[rangedDpsRole].SetChanges(savedChanges);
|
||||
RangedDpsRoleTags[rangedDpsRole] = new Tag(new LocalizedPluginString(Localizer.GetName(rangedDpsRole)), defaultTag);
|
||||
if (pluginConfiguration.RangedDpsRoleTagsChanges.TryGetValue(rangedDpsRole, out var savedChanges))
|
||||
{
|
||||
RangedDpsRoleTags[rangedDpsRole].SetChanges(savedChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LandHandRoleTags = new Dictionary<LandHandRole, Tag>();
|
||||
foreach (var landHandRole in Enum.GetValues<LandHandRole>())
|
||||
{
|
||||
LandHandRoleTags[landHandRole] = new Tag(new LocalizedPluginString(Localizer.GetName(landHandRole)));
|
||||
|
||||
if (Default.LandHandRoleTagsChanges.TryGetValue(landHandRole, out var defaultChanges))
|
||||
if (Default.LandHandRoleTags.TryGetValue(landHandRole, out var defaultChanges))
|
||||
{
|
||||
LandHandRoleTags[landHandRole].SetChanges(defaultChanges);
|
||||
}
|
||||
|
||||
if (pluginConfiguration.LandHandRoleTagsChanges.TryGetValue(landHandRole, out var savedChanges))
|
||||
{
|
||||
LandHandRoleTags[landHandRole].SetChanges(savedChanges);
|
||||
LandHandRoleTags[landHandRole] = new Tag(new LocalizedPluginString(Localizer.GetName(landHandRole)), defaultChanges);
|
||||
if (pluginConfiguration.LandHandRoleTagsChanges.TryGetValue(landHandRole, out var savedChanges))
|
||||
{
|
||||
LandHandRoleTags[landHandRole].SetChanges(savedChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JobTags = new Dictionary<string, Tag>();
|
||||
foreach ((var jobAbbreviation, var role) in RoleHelper.RolesByJobAbbreviation)
|
||||
{
|
||||
JobTags[jobAbbreviation] = new Tag(new LiteralPluginString(jobAbbreviation));
|
||||
|
||||
if (Default.JobTagsChanges.TryGetValue(jobAbbreviation, out var defaultChanges))
|
||||
if (Default.JobTags.TryGetValue(jobAbbreviation, out var defaultChanges))
|
||||
{
|
||||
JobTags[jobAbbreviation].SetChanges(defaultChanges);
|
||||
}
|
||||
|
||||
if (pluginConfiguration.JobTagsChanges.TryGetValue(jobAbbreviation, out var savedChanges))
|
||||
{
|
||||
JobTags[jobAbbreviation].SetChanges(savedChanges);
|
||||
JobTags[jobAbbreviation] = new Tag(new LiteralPluginString(jobAbbreviation), defaultChanges);
|
||||
if (pluginConfiguration.JobTagsChanges.TryGetValue(jobAbbreviation, out var savedChanges))
|
||||
{
|
||||
JobTags[jobAbbreviation].SetChanges(savedChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AllCustomTags = new Tag(new LocalizedPluginString(nameof(AllCustomTags)));
|
||||
CustomTags = new List<Tag>();
|
||||
|
||||
AllCustomTags.SetChanges(Default.AllCustomTagsChanges);
|
||||
AllCustomTags = new Tag(new LocalizedPluginString(nameof(AllCustomTags)), Default.AllCustomTags);
|
||||
AllCustomTags.SetChanges(pluginConfiguration.AllCustomTagsChanges);
|
||||
|
||||
CustomTags = new List<Tag>();
|
||||
foreach (var savedChanges in pluginConfiguration.CustomTagsChanges)
|
||||
{
|
||||
var tag = new Tag(new LocalizedPluginString(nameof(CustomTags)));
|
||||
|
||||
@@ -185,9 +185,29 @@ namespace PlayerTags.Data
|
||||
}
|
||||
}
|
||||
|
||||
private Tag? m_Defaults;
|
||||
public bool HasDefaults
|
||||
{
|
||||
get { return m_Defaults != null; }
|
||||
}
|
||||
|
||||
public Tag()
|
||||
{
|
||||
Name = new LiteralPluginString("");
|
||||
m_Defaults = null;
|
||||
}
|
||||
|
||||
public Tag(IPluginString name)
|
||||
{
|
||||
Name = name;
|
||||
m_Defaults = null;
|
||||
}
|
||||
|
||||
public Tag(IPluginString name, Tag defaults)
|
||||
{
|
||||
Name = name;
|
||||
m_Defaults = defaults;
|
||||
SetChanges(defaults.GetChanges());
|
||||
}
|
||||
|
||||
public bool CanAddToIdentity(Identity identity)
|
||||
@@ -241,12 +261,33 @@ namespace PlayerTags.Data
|
||||
return changes;
|
||||
}
|
||||
|
||||
public void SetChanges(Dictionary<string, InheritableData> changes)
|
||||
public void SetChanges(IEnumerable<KeyValuePair<string, InheritableData>> changes)
|
||||
{
|
||||
foreach ((var name, var inheritableData) in changes)
|
||||
{
|
||||
Inheritables[name].SetData(inheritableData);
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, InheritableData> GetAllAsChanges()
|
||||
{
|
||||
Dictionary<string, InheritableData> changes = new Dictionary<string, InheritableData>();
|
||||
|
||||
foreach ((var name, var inheritable) in Inheritables)
|
||||
{
|
||||
changes[name] = inheritable.GetData();
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
public void SetDefaults()
|
||||
{
|
||||
if (m_Defaults != null)
|
||||
{
|
||||
// Exclude IsSelected and IsExpanded for UX purposes
|
||||
SetChanges(m_Defaults.GetAllAsChanges().Where(change => change.Key != nameof(IsSelected) && change.Key != nameof(IsExpanded)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
PlayerTags/Resources/Strings.Designer.cs
generated
20
PlayerTags/Resources/Strings.Designer.cs
generated
@@ -1213,7 +1213,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove this property override. The value will be inherited from the parent tag..
|
||||
/// Looks up a localized string similar to Remove this property override. The value will be inherited from the parent item..
|
||||
/// </summary>
|
||||
public static string Loc_Static_RemovePropertyOverride_Description {
|
||||
get {
|
||||
@@ -1221,6 +1221,24 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reset all items to their defaults..
|
||||
/// </summary>
|
||||
public static string Loc_Static_ResetAllDefault_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_ResetAllDefault_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reset this item to its defaults..
|
||||
/// </summary>
|
||||
public static string Loc_Static_ResetDefault_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_ResetDefault_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tagged Players.
|
||||
/// </summary>
|
||||
|
||||
@@ -267,6 +267,12 @@
|
||||
<data name="Loc_IsLinkSelfInChatEnabled_Description" xml:space="preserve">
|
||||
<value>Attempts to detect references to self in chat. This allows tags to appear in chat for yourself.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_ResetDefault_Description" xml:space="preserve">
|
||||
<value>Reset this item to its defaults.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_ResetAllDefault_Description" xml:space="preserve">
|
||||
<value>Reset all items to their defaults.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_Tags" xml:space="preserve">
|
||||
<value>Tags</value>
|
||||
</data>
|
||||
@@ -322,7 +328,7 @@
|
||||
<value>Add a property override.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_RemovePropertyOverride_Description" xml:space="preserve">
|
||||
<value>Remove this property override. The value will be inherited from the parent tag.</value>
|
||||
<value>Remove this property override. The value will be inherited from the parent item.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_NewTag" xml:space="preserve">
|
||||
<value>New tag</value>
|
||||
|
||||
Reference in New Issue
Block a user