Skip to content

Commit

Permalink
Rename "Default profile", hide character controls when profile is set…
Browse files Browse the repository at this point in the history
… as default
  • Loading branch information
RisaDev committed Jun 17, 2024
1 parent 6a55ccc commit 8229955
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CustomizePlus/Profiles/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ public IEnumerable<Profile> GetEnabledProfilesByActor(ActorIdentifier actorIdent

bool IsProfileAppliesToCurrentActor(Profile profile)
{
//default profile check is done later
if (profile == DefaultProfile)
return false;

return profile.CharacterName.Text == name &&
(!profile.LimitLookupToOwnedObjects ||
(actorIdentifier.Type == IdentifierType.Owned &&
Expand Down
49 changes: 27 additions & 22 deletions CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ private void DrawEnabledSetting()
{
if (ImGui.Checkbox("##DefaultProfile", ref isDefault))
_manager.SetDefaultProfile(isDefault ? _selector.Selected! : null);
ImGuiUtil.LabeledHelpMarker("Default profile (Players and Retainers only)",
"Whether the templates in this profile are applied to all players and retainers without a specific profile. Only one profile can be default at the same time.");
ImGuiUtil.LabeledHelpMarker("Apply to all players and retainers",
"Whether the templates in this profile are applied to all players and retainers without a specific profile. This setting cannot be applied to multiple profiles.");
}
if(isDefaultOrCurrentProfilesEnabled)
{
ImGui.SameLine();
ImGui.PushStyleColor(ImGuiCol.Text, Constants.Colors.Warning);
ImGuiUtil.PrintIcon(FontAwesomeIcon.ExclamationTriangle);
ImGui.PopStyleColor();
ImGuiUtil.HoverTooltip("Can only be changed when currently selected and the default profiles are disabled.");
ImGuiUtil.HoverTooltip("Can only be changed when both currently selected and profile where this checkbox is checked are disabled.");
}
}
}
Expand Down Expand Up @@ -217,30 +217,35 @@ private void DrawBasicSettings()
name = _newCharacterName ?? _selector.Selected!.CharacterName;
ImGui.SetNextItemWidth(width.X);

if (!_selector.IncognitoMode)
if(_manager.DefaultProfile != _selector.Selected)
{
if (ImGui.InputText("##CharacterName", ref name, 128))
if (!_selector.IncognitoMode)
{
_newCharacterName = name;
_changedProfile = _selector.Selected;
}

if (ImGui.IsItemDeactivatedAfterEdit() && _changedProfile != null)
{
_manager.ChangeCharacterName(_changedProfile, name);
_newCharacterName = null;
_changedProfile = null;
if (ImGui.InputText("##CharacterName", ref name, 128))
{
_newCharacterName = name;
_changedProfile = _selector.Selected;
}

if (ImGui.IsItemDeactivatedAfterEdit() && _changedProfile != null)
{
_manager.ChangeCharacterName(_changedProfile, name);
_newCharacterName = null;
_changedProfile = null;
}
}
else
ImGui.TextUnformatted("Incognito active");

ImGui.SameLine();
var enabled = _selector.Selected?.LimitLookupToOwnedObjects ?? false;
if (ImGui.Checkbox("##LimitLookupToOwnedObjects", ref enabled))
_manager.SetLimitLookupToOwned(_selector.Selected!, enabled);
ImGuiUtil.LabeledHelpMarker("Limit to my creatures",
"When enabled limits the character search to only your own summons, mounts and minions.\nUseful when there is possibility there will be another character with that name owned by another player.\n* For battle chocobo use \"Chocobo\" as character name.");
}
else
ImGui.TextUnformatted("Incognito active");

ImGui.SameLine();
var enabled = _selector.Selected?.LimitLookupToOwnedObjects ?? false;
if (ImGui.Checkbox("##LimitLookupToOwnedObjects", ref enabled))
_manager.SetLimitLookupToOwned(_selector.Selected!, enabled);
ImGuiUtil.LabeledHelpMarker("Limit to my creatures",
"When enabled limits the character search to only your own summons, mounts and minions.\nUseful when there is possibility there will be another character with that name owned by another player.\n* For battle chocobo use \"Chocobo\" as character name.");
ImGui.TextUnformatted("All players and retainers");
}
}
}
Expand Down

0 comments on commit 8229955

Please sign in to comment.