Skip to content

Commit

Permalink
IG Help Picture
Browse files Browse the repository at this point in the history
In TaskBar and by Shortcut
  • Loading branch information
Etuldan committed Dec 22, 2018
1 parent 8295d5c commit da7d27d
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class TaskBarDescriptor implements Serializable {
private boolean inGameDnd;
private String dndResponseText = "Response message";
private HotKeyDescriptor hideoutHotkey = new HotKeyDescriptor();
private HotKeyDescriptor helpIGHotkey = new HotKeyDescriptor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ public void focusLost(FocusEvent e) {
hotKeysPanel.setBorder(BorderFactory.createLineBorder(AppThemeColor.ADR_DEFAULT_BORDER));
root.add(this.componentsFactory.getIconLabel("app/hideout.png", 24, SwingConstants.CENTER));
HotKeyGroup hotKeyGroup = new HotKeyGroup(true);
HotKeyPanel hotKeyPanel = new HotKeyPanel(this.taskBarSnapshot.getHideoutHotkey());
hotKeyGroup.registerHotkey(hotKeyPanel);
root.add(this.componentsFactory.wrapToSlide(hotKeyPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1));
HotKeyPanel hotKeyHideoutPanel = new HotKeyPanel(this.taskBarSnapshot.getHideoutHotkey());
hotKeyGroup.registerHotkey(hotKeyHideoutPanel);
root.add(this.componentsFactory.wrapToSlide(hotKeyHideoutPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1));
this.container.add(this.componentsFactory.wrapToSlide(root));
this.container.add(this.componentsFactory.wrapToSlide(hotKeysPanel));

root.add(this.componentsFactory.getIconLabel("app/helpIG_icon.png", 24, SwingConstants.CENTER));
HotKeyPanel hotKeyHelpIGPanel = new HotKeyPanel(this.taskBarSnapshot.getHelpIGHotkey());
hotKeyGroup.registerHotkey(hotKeyHelpIGPanel);
root.add(this.componentsFactory.wrapToSlide(hotKeyHelpIGPanel, AppThemeColor.SETTINGS_BG, 2, 4, 1, 1));

this.container.add(this.componentsFactory.wrapToSlide(root));
this.container.add(this.componentsFactory.wrapToSlide(hotKeysPanel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.mercury.platform.ui.frame.titled.ChatScannerFrame;
import com.mercury.platform.ui.frame.titled.HistoryFrame;
import com.mercury.platform.ui.frame.titled.SettingsFrame;
import com.mercury.platform.ui.frame.other.HelpIGFrame;
import com.mercury.platform.ui.manager.FramesManager;
import com.mercury.platform.ui.misc.MercuryStoreUI;

Expand Down Expand Up @@ -34,6 +35,11 @@ public void performHideout() {
MercuryStoreCore.chatCommandSubject.onNext("/hideout");
}

@Override
public void showHelpIG() {
FramesManager.INSTANCE.hideOrShowFrame(HelpIGFrame.class);
}

@Override
public void showChatFiler() {
FramesManager.INSTANCE.hideOrShowFrame(ChatScannerFrame.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface TaskBarController {

void performHideout();

void showHelpIG();

void showChatFiler();

void showHistory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class TaskBarPanel extends JPanel implements ViewInit {
private TaskBarController controller;
private PlainConfigurationService<TaskBarDescriptor> taskBarService;
private JButton toHideout;
private JButton showHelpIG;

public TaskBarPanel(@NonNull TaskBarController controller, @NonNull ComponentsFactory factory) {
this.controller = controller;
Expand All @@ -35,6 +36,8 @@ public TaskBarPanel(@NonNull TaskBarController controller, @NonNull ComponentsFa
if (ProdStarter.APP_STATUS.equals(FrameVisibleState.SHOW)) {
if (this.taskBarService.get().getHideoutHotkey().equals(hotkeyDescriptor)) {
this.toHideout.doClick();
} else if (this.taskBarService.get().getHelpIGHotkey().equals(hotkeyDescriptor)) {
this.showHelpIG.doClick();
}
}
});
Expand Down Expand Up @@ -87,6 +90,16 @@ public void mousePressed(MouseEvent e) {
this.toHideout.addActionListener(action -> {
this.controller.performHideout();
});

this.showHelpIG = componentsFactory.getIconButton(
"app/helpIG_icon.png",
24,
AppThemeColor.FRAME,
TooltipConstants.HELPIG);
this.showHelpIG.addActionListener(action -> {
this.controller.showHelpIG();
});

JButton adr = componentsFactory.getIconButton(
"app/overseer_icon.png",
24,
Expand Down Expand Up @@ -184,6 +197,8 @@ public void mousePressed(MouseEvent e) {
this.add(Box.createRigidArea(new Dimension(3, 4)));
this.add(visibleMode);
this.add(Box.createRigidArea(new Dimension(2, 4)));
this.add(this.showHelpIG);
this.add(Box.createRigidArea(new Dimension(2, 4)));
this.add(historyButton);
this.add(Box.createRigidArea(new Dimension(3, 4)));
this.add(itemGrid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ public void showITH() {
public void performHideout() {
}

@Override
public void showHelpIG() {
}

@Override
public void showChatFiler() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.mercury.platform.ui.frame.other;

import com.mercury.platform.ui.frame.AbstractOverlaidFrame;

import javax.swing.*;
import java.awt.*;

public class HelpIGFrame extends AbstractOverlaidFrame {
private int MARGIN = 400;
public HelpIGFrame() {
super();
}

@Override
protected void initialize() {
this.componentsFactory.setScale(1.1f);
}

@Override
public void subscribe() {
}

@Override
protected LayoutManager getFrameLayout() {
return new BorderLayout();
}

@Override
public void onViewInit() {
this.setOpacity(this.applicationConfig.get().getMaxOpacity() / 100f);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

ImageIcon icon = this.componentsFactory.getImage("app/helpIGImg.png");
Image image = icon.getImage(); // transform it
Image newimg = image.getScaledInstance(dim.width - MARGIN, -1, java.awt.Image.SCALE_SMOOTH);
if(dim.height-MARGIN < newimg.getHeight(null)) {
newimg = image.getScaledInstance(-1, dim.height - MARGIN, java.awt.Image.SCALE_SMOOTH);
}
icon = new ImageIcon(newimg);

JLabel img = new JLabel(icon);
this.add(img);
this.pack();
this.setLocation(dim.width/2-this.getSize().width/2, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void start() {
this.framesMap.put(SetUpLocationFrame.class, new SetUpLocationFrame());
this.framesMap.put(SetUpScaleFrame.class, new SetUpScaleFrame());
this.framesMap.put(AlertFrame.class, new AlertFrame());
this.framesMap.put(HelpIGFrame.class, new HelpIGFrame());

this.framesMap.forEach((k, v) -> v.init());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class TooltipConstants {
public static final String TRADE_MODE = "SuperTradeMode. All notifications you receive will be unfolded.";
public static final String CHAT_FILTER = "Chat Scanner. All chat messages with matching words will be displayed in a separate window.";
public static final String HIDEOUT = "Travel to your hideout";
public static final String HELPIG = "See IG help";
public static final String ADR_SETTINGS = "Overseer settings";
public static final String TIMER = "Timer. Just a simple timer.";
public static final String HISTORY = "History. Browse through all notifications you received previously.";
Expand Down
Binary file added app-ui/src/main/resources/app/helpIGImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app-ui/src/main/resources/app/helpIG_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit da7d27d

Please sign in to comment.