Skip to content

Commit f2f3709

Browse files
committed
remove unecessary height, rename buildContext and remove double entity check
1 parent cabb5f3 commit f2f3709

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Intersect.Client.Core/Interface/Game/TargetContextMenu.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public TargetContextMenu(Canvas gameCanvas) : base(gameCanvas, nameof(TargetCont
4343
_nameDivider = new MenuDivider(this)
4444
{
4545
Dock = Pos.Top,
46-
Margin = new Margin(IconMarginDisabled ? 0 : 24, 0, 4, 0),
47-
Height = 1,
4846
MinimumSize = new Point(0, 1),
4947
};
5048

@@ -64,7 +62,7 @@ public TargetContextMenu(Canvas gameCanvas) : base(gameCanvas, nameof(TargetCont
6462
_privateMessageMenuItem.Clicked += privateMessageRequest_Clicked;
6563

6664
LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer?.GetResolutionString());
67-
_buildContextMenu();
65+
BuildContextMenu();
6866
}
6967

7068
public void ToggleHidden(object? target)
@@ -128,7 +126,7 @@ public void ToggleHidden(object? target)
128126

129127
if (IsHidden)
130128
{
131-
_buildContextMenu(shouldShowTargetNameMenuItem);
129+
BuildContextMenu(shouldShowTargetNameMenuItem);
132130
SizeToChildren();
133131
Open(Pos.None);
134132
SetPosition(newX, newY);
@@ -139,7 +137,7 @@ public void ToggleHidden(object? target)
139137
}
140138
}
141139

142-
private void _buildContextMenu(bool shouldShowTargetName = false)
140+
private void BuildContextMenu(bool shouldShowTargetName = false)
143141
{
144142
ClearChildren();
145143

@@ -155,17 +153,17 @@ private void _buildContextMenu(bool shouldShowTargetName = false)
155153
AddChild(_partyMenuItem);
156154
AddChild(_friendMenuItem);
157155

158-
if (_entity is Player player && player != _me && string.IsNullOrWhiteSpace(player.Guild))
156+
if (_entity is Player player)
159157
{
160-
if (_me?.GuildRank?.Permissions?.Invite ?? false)
158+
if (player != _me && string.IsNullOrWhiteSpace(player.Guild) && (_me?.GuildRank?.Permissions?.Invite ?? false))
161159
{
162160
AddChild(_guildMenuItem);
163161
}
164-
}
165162

166-
if (_entity is Player plyr && plyr != _me)
167-
{
168-
AddChild(_privateMessageMenuItem);
163+
if (player != _me)
164+
{
165+
AddChild(_privateMessageMenuItem);
166+
}
169167
}
170168
}
171169

0 commit comments

Comments
 (0)