party: remove overlay

This is rarely used because the information is duplicated in the panel, and not very useful. Also the toggling behavior is confusing to people.
This commit is contained in:
Adam
2022-05-27 14:34:07 -04:00
parent 9fe186cad2
commit 282eab1a4c
5 changed files with 1 additions and 159 deletions

View File

@@ -67,17 +67,6 @@ public interface PartyConfig extends Config
return true;
}
@ConfigItem(
keyName = "autoOverlay",
name = "Auto overlay",
description = "Automatically add an overlay with player data when a member joins",
position = 5
)
default boolean autoOverlay()
{
return false;
}
@ConfigItem(
keyName = "previousPartyId",
name = "",

View File

@@ -32,15 +32,12 @@ import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.client.ws.PartyMember;
import net.runelite.client.plugins.party.data.PartyData;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout;
@@ -48,6 +45,7 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.components.MouseDragEventForwarder;
import net.runelite.client.ui.components.ProgressBar;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.ws.PartyMember;
class PartyMemberBox extends JPanel
{
@@ -83,15 +81,6 @@ class PartyMemberBox extends JPanel
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
container.setBorder(new EmptyBorder(5, 5, 5, 5));
// Create Toggle overlay
final JMenuItem overlay = new JMenuItem("Toggle overlay");
overlay.addActionListener(e -> memberPartyData.setShowOverlay(!memberPartyData.isShowOverlay()));
// Create popup menu
final JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5));
popupMenu.add(overlay);
// create a line border with the specified color and width
Border border = BorderFactory.createLineBorder(Color.gray, 1);
avatar.setBorder(border);
@@ -136,8 +125,6 @@ class PartyMemberBox extends JPanel
container.add(headerPanel, BorderLayout.NORTH);
container.add(progressWrapper, BorderLayout.SOUTH);
container.setComponentPopupMenu(popupMenu);
// forward mouse drag events to parent panel for drag and drop reordering
MouseDragEventForwarder mouseDragEventForwarder = new MouseDragEventForwarder(panel);
container.addMouseListener(mouseDragEventForwarder);

View File

@@ -110,9 +110,6 @@ public class PartyPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private PartyStatsOverlay partyStatsOverlay;
@Inject
private PartyPingOverlay partyPingOverlay;
@@ -173,7 +170,6 @@ public class PartyPlugin extends Plugin
clientToolbar.addNavigation(navButton);
overlayManager.add(partyStatsOverlay);
overlayManager.add(partyPingOverlay);
wsClient.registerMessage(SkillUpdate.class);
wsClient.registerMessage(TilePing.class);
@@ -193,7 +189,6 @@ public class PartyPlugin extends Plugin
partyDataMap.clear();
pendingTilePings.clear();
worldMapManager.removeIf(PartyWorldMapPoint.class::isInstance);
overlayManager.remove(partyStatsOverlay);
overlayManager.remove(partyPingOverlay);
wsClient.unregisterMessage(SkillUpdate.class);
wsClient.unregisterMessage(TilePing.class);
@@ -549,7 +544,6 @@ public class PartyPlugin extends Plugin
}
PartyData partyData = new PartyData(memberById, worldMapPoint);
partyData.setShowOverlay(config.autoOverlay());
SwingUtilities.invokeLater(() -> panel.addMember(partyData));
return partyData;

View File

@@ -1,127 +0,0 @@
/*
* Copyright (c) 2019, Tomas Slusny <slusnucky@gmail.com>
* Copyright (c) 2021, Jonathan Rousseau <https://github.com/JoRouss>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.party;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Map;
import java.util.UUID;
import javax.inject.Inject;
import net.runelite.api.MenuAction;
import net.runelite.client.plugins.party.data.PartyData;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.components.ComponentConstants;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import net.runelite.client.ws.PartyMember;
public class PartyStatsOverlay extends OverlayPanel
{
private static final Color HP_FG = new Color(0, 146, 54, 230);
private static final Color HP_BG = new Color(102, 15, 16, 230);
private static final Color PRAY_FG = new Color(0, 149, 151);
private static final Color PRAY_BG = Color.black;
private final PartyPlugin plugin;
private final PartyConfig config;
@Inject
private PartyStatsOverlay(final PartyPlugin plugin, final PartyConfig config)
{
super(plugin);
this.plugin = plugin;
this.config = config;
panelComponent.setBorder(new Rectangle());
panelComponent.setGap(new Point(0, ComponentConstants.STANDARD_BORDER / 2));
getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_OVERLAY, "Leave", "Party"));
}
@Override
public Dimension render(Graphics2D graphics)
{
final Map<UUID, PartyData> partyDataMap = plugin.getPartyDataMap();
if (partyDataMap.isEmpty())
{
return null;
}
panelComponent.setBackgroundColor(null);
synchronized (plugin.getPartyDataMap())
{
partyDataMap.forEach((k, v) ->
{
final PartyMember member = v.getMember();
if (!v.isShowOverlay())
{
return;
}
final PanelComponent panel = v.getPanel();
panel.getChildren().clear();
final TitleComponent name = TitleComponent.builder()
.text(member.getDisplayName())
.color(config.recolorNames() ? v.getColor() : Color.WHITE)
.build();
panel.getChildren().add(name);
if (v.getMaxHitpoints() > 0)
{
final ProgressBarComponent hpBar = new ProgressBarComponent();
hpBar.setBackgroundColor(HP_BG);
hpBar.setForegroundColor(HP_FG);
hpBar.setMaximum(v.getMaxHitpoints());
hpBar.setValue(v.getHitpoints());
hpBar.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL);
panel.getChildren().add(hpBar);
}
if (v.getMaxPrayer() > 0)
{
final ProgressBarComponent prayBar = new ProgressBarComponent();
prayBar.setBackgroundColor(PRAY_BG);
prayBar.setForegroundColor(PRAY_FG);
prayBar.setMaximum(v.getMaxPrayer());
prayBar.setValue(v.getPrayer());
prayBar.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL);
panel.getChildren().add(prayBar);
}
panelComponent.getChildren().add(panel);
});
}
return super.render(graphics);
}
}

View File

@@ -47,5 +47,4 @@ public class PartyData
private int maxHitpoints;
private int prayer;
private int maxPrayer;
private boolean showOverlay;
}