Skip to content

Commit

Permalink
Merge pull request #59 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
фикс редактора персонажа
  • Loading branch information
Evgencheg authored Sep 3, 2024
2 parents 55ef926 + 3c67a09 commit 11536bf
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
17 changes: 17 additions & 0 deletions Content.Client/Humanoid/MarkingPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
#if LPP_Sponsors // _LostParadise-Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Humanoid;

Expand All @@ -18,6 +21,9 @@ public sealed partial class MarkingPicker : Control
{
[Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
#if LPP_Sponsors // _LostParadise-Sponsors
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
#endif

public Action<MarkingSet>? OnMarkingAdded;
public Action<MarkingSet>? OnMarkingRemoved;
Expand Down Expand Up @@ -224,6 +230,17 @@ public void Populate(string filter)

var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", marking.Sprites[0].Frame0());
item.Metadata = marking;

#if LPP_Sponsors // _LostParadise-Sponsors
if (marking.SponsorOnly)
{
item.Disabled = true;
if (_sponsorsManager.TryGetInfo(out var sponsor))
{
item.Disabled = !(sponsor.AllowedMarkings.Contains(marking.ID) || sponsor.AllowedMarkings.Contains("ALL"));
}
}
#endif
}

CMarkingPoints.Visible = _currentMarkings.PointsLeft(_selectedMarkingCategory) != -1;
Expand Down
17 changes: 17 additions & 0 deletions Content.Client/Humanoid/SingleMarkingPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
#if LPP_Sponsors // _LostParadise-Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Humanoid;

[GenerateTypedNameReferences]
public sealed partial class SingleMarkingPicker : BoxContainer
{
[Dependency] private readonly MarkingManager _markingManager = default!;
#if LPP_Sponsors // _LostParadise-Sponsors
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
#endif

/// <summary>
/// What happens if a marking is selected.
Expand Down Expand Up @@ -191,6 +197,17 @@ public void PopulateList(string filter)
var item = MarkingList.AddItem(Loc.GetString($"marking-{id}"), marking.Sprites[0].Frame0());
item.Metadata = marking.ID;

#if LPP_Sponsors // _LostParadise-Sponsors
if (marking.SponsorOnly)
{
item.Disabled = true;
if (_sponsorsManager.TryGetInfo(out var sponsor))
{
item.Disabled = !(sponsor.AllowedMarkings.Contains(marking.ID) || sponsor.AllowedMarkings.Contains("ALL"));
}
}
#endif

if (_markings[Slot].MarkingId == id)
{
_ignoreItemSelected = true;
Expand Down
20 changes: 10 additions & 10 deletions Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ private void UpdateUI()
Loc.GetString("character-setup-gui-create-new-character-button-tooltip",
("maxCharacters", _preferencesManager.Settings!.MaxCharacterSlots));

#if LPP_Sponsors
var isDisplayedMaxSlots = false; // _LostParadise-Sponsors возможно использование дополнительных слотов
#endif
#if LPP_Sponsors
var isDisplayedMaxSlots = false; // _LostParadise-Sponsors возможно использование дополнительных слотов
#endif

foreach (var (slot, character) in _preferencesManager.Preferences!.Characters)
{
Expand All @@ -122,10 +122,10 @@ private void UpdateUI()
continue;
}

#if LPP_Sponsors // _LostParadise-Sponsors
#if LPP_Sponsors // _LostParadise-Sponsors
isDisplayedMaxSlots = numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
if (isDisplayedMaxSlots) break;
#endif
if (isDisplayedMaxSlots) break;
#endif

numberOfFullSlots++;
var characterPickerButton = new CharacterPickerButton(_entityManager,
Expand All @@ -147,12 +147,12 @@ private void UpdateUI()
};
}

#if LPP_Sponsors // _LostParadise-Sponsors
_createNewCharacterButton.Disabled = isDisplayedMaxSlots;
#else
#if LPP_Sponsors // _LostParadise-Sponsors
_createNewCharacterButton.Disabled = isDisplayedMaxSlots;
#else
_createNewCharacterButton.Disabled =
numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
#endif
#endif
Characters.AddChild(_createNewCharacterButton);
// TODO: Move this shit to the Lobby UI controller
}
Expand Down
12 changes: 6 additions & 6 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@

<TabContainer Name="CLoadoutsTabs" VerticalExpand="True" />
</BoxContainer>
<BoxContainer Name="CMarkingsTab" Orientation="Vertical" Margin="10">
<!-- Markings -->
<ScrollContainer VerticalExpand="True">
<humanoid:MarkingPicker Name="CMarkings" IgnoreCategories="Hair,FacialHair" />
</ScrollContainer>
</BoxContainer>
<!-- Lost Paradise Donate Preferences Begin -->
<BoxContainer Orientation="Vertical" Margin="10" Name="LPPDonate">
<!-- Donate -->
Expand All @@ -205,6 +199,12 @@
</ScrollContainer>
</BoxContainer>
<!-- Lost Paradise Donate Preferences End -->
<BoxContainer Name="CMarkingsTab" Orientation="Vertical" Margin="10">
<!-- Markings -->
<ScrollContainer VerticalExpand="True">
<humanoid:MarkingPicker Name="CMarkings" IgnoreCategories="Hair,FacialHair" />
</ScrollContainer>
</BoxContainer>
</TabContainer>
</BoxContainer>
<!-- Right side -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt
#endregion Save

#region Markings
_tabContainer.SetTabTitle(5, Loc.GetString("humanoid-profile-editor-markings-tab"));
_tabContainer.SetTabTitle(6, Loc.GetString("humanoid-profile-editor-markings-tab"));

CMarkings.OnMarkingAdded += OnMarkingChange;
CMarkings.OnMarkingRemoved += OnMarkingChange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
bodyPart: HeadTop
markingCategory: HeadTop
speciesRestriction: [Human]
sponsorOnly: true
coloring:
default:
type:
Expand All @@ -26,6 +27,7 @@
bodyPart: Tail
markingCategory: Tail
speciesRestriction: [Human]
sponsorOnly: true
coloring:
default:
type:
Expand Down
8 changes: 4 additions & 4 deletions Resources/Prototypes/Species/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@
points: 1
required: false
Tail: # the cat tail joke
points: 0
points: 1
required: false
HeadTop: # the cat ear joke
points: 0
points: 1
required: false
Chest:
points: 1
required: false
Legs:
points: 6
points: 4
required: false
Arms:
points: 6
points: 4
required: false

- type: humanoidBaseSprite
Expand Down

0 comments on commit 11536bf

Please sign in to comment.