Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust by n-pixels added #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import ninjabrainbot.gui.components.layout.StackPanel;
import ninjabrainbot.gui.components.preferences.DoublePreferencePanel;
import ninjabrainbot.gui.components.preferences.FloatPreferencePanel;
import ninjabrainbot.gui.components.preferences.HotkeyPanel;
import ninjabrainbot.gui.components.preferences.RadioButtonPanel;
import ninjabrainbot.gui.frames.OptionsFrame;
import ninjabrainbot.gui.style.SizePreference;
Expand All @@ -32,9 +33,29 @@ public AngleAdjustmentOptionsPanel(StyleManager styleManager, NinjabrainBotPrefe
column1.setOpaque(false);
add(column1);

column1.add(new RadioButtonPanel(styleManager, I18n.get("settings.angle_adjustment.display_type"), preferences.angleAdjustmentDisplayType, true));
JPanel topCol1 = new StackPanel(2 * OptionsFrame.PADDING);
topCol1.setOpaque(false);
JPanel topCol2 = new StackPanel(3 * OptionsFrame.PADDING);
topCol2.setOpaque(false);
JPanel topGrid = new JPanel();
topGrid.setOpaque(false);
topGrid.setLayout(new GridLayout(1, 2, 2 * OptionsFrame.PADDING, 0));
topGrid.setBorder(new EmptyBorder(2 * OptionsFrame.PADDING, 2 * OptionsFrame.PADDING, 2 * OptionsFrame.PADDING, 2 * OptionsFrame.PADDING));

column1.add(new RadioButtonPanel(styleManager, I18n.get("settings.angle_adjustment.adjustment_type"), preferences.angleAdjustmentType, true));
topGrid.add(topCol1);
topGrid.add(topCol2);

topCol1.add(new RadioButtonPanel(styleManager, I18n.get("settings.angle_adjustment.display_type"), preferences.angleAdjustmentDisplayType, true));

topCol1.add(new RadioButtonPanel(styleManager, I18n.get("settings.angle_adjustment.adjustment_type"), preferences.angleAdjustmentType, true));

FloatPreferencePanel nPixel = new FloatPreferencePanel(styleManager, I18n.get("settings.n_pixels"), preferences.nPixelCount);
nPixel.setDecimals(0);
topCol2.add(nPixel);
topCol2.add(new HotkeyPanel(styleManager, I18n.get("settings.up_n_pixels"), preferences.hotkeyIncrementByN));
topCol2.add(new HotkeyPanel(styleManager, I18n.get("settings.down_n_pixels"), preferences.hotkeyDecrementByN));

column1.add(topGrid);

// Tall Res Section
tallResExplanation = new ThemedLabel(styleManager, "<html>" + I18n.get("settings.tall_resolution_explanation") + "</html>") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class NinjabrainBotPreferences {
public final HotkeyPreference hotkeyAltStd;
public final HotkeyPreference hotkeyLock;
public final HotkeyPreference hotkeyToggleAllAdvancementsMode;
public final HotkeyPreference hotkeyIncrementByN;
public final HotkeyPreference hotkeyDecrementByN;
public final FloatPreference nPixelCount;
public final FloatPreference sensitivityManual;
public final FloatPreference sigma;
public final FloatPreference sigmaAlt;
Expand Down Expand Up @@ -97,7 +100,10 @@ public NinjabrainBotPreferences(IPreferenceSource source) {
hotkeyBoat = new HotkeyPreference("hotkey_boat", source);
hotkeyMod360 = new HotkeyPreference("hotkey_mod_360", source);
hotkeyToggleAllAdvancementsMode = new HotkeyPreference("hotkey_toggle_aa_mode", source);
hotkeyIncrementByN = new HotkeyPreference("hotkey_increment_by_n", source);
hotkeyDecrementByN = new HotkeyPreference("hotkey_decrement_by_n", source);
// Float
nPixelCount = new FloatPreference("n_pixel_count", 13, 0f, 500f, source);
sensitivityManual = new FloatPreference("sensitivity_manual", 0.4341732f, 0f, 1f, source);
sigma = new FloatPreference("sigma", 0.1f, 0.001f, 1f, source);
sigmaAlt = new FloatPreference("sigma_alt", 0.1f, 0.001f, 1f, source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public HotkeyInputHandler(NinjabrainBotPreferences preferences, IDomainModel dom
disposeHandler.add(preferences.hotkeyReset.whenTriggered().subscribe(this::resetIfNotLocked));
disposeHandler.add(preferences.hotkeyUndo.whenTriggered().subscribe(this::undoIfNotLocked));
disposeHandler.add(preferences.hotkeyRedo.whenTriggered().subscribe(this::redoIfNotLocked));
disposeHandler.add(preferences.hotkeyIncrementByN.whenTriggered().subscribe(__ -> changeLastAngleIfNotLocked((int)preferences.nPixelCount.get())));
disposeHandler.add(preferences.hotkeyDecrementByN.whenTriggered().subscribe(__ -> changeLastAngleIfNotLocked((int)-preferences.nPixelCount.get())));
disposeHandler.add(preferences.hotkeyIncrement.whenTriggered().subscribe(__ -> changeLastAngleIfNotLocked(1)));
disposeHandler.add(preferences.hotkeyDecrement.whenTriggered().subscribe(__ -> changeLastAngleIfNotLocked(-1)));
disposeHandler.add(preferences.hotkeyAltStd.whenTriggered().subscribe(this::toggleAltStdIfNotLocked));
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/lang/I18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ settings.boat_standard_deviation=Standard deviation for boat throws:
settings.keyboard_shortcuts=Hotkeys
settings.up_001_to_last_angle=Change the last angle by +0.01
settings.down_001_to_last_angle=Change the last angle by -0.01
settings.up_n_pixels=Change the last angle by +n-pixels
settings.down_n_pixels=Change the last angle by -n-pixels
settings.n_pixels=n-pixels
settings.enter_boat=Indicate boat angle reset on next F3+C
settings.not_in_use=Not in use
settings.overlay=OBS overlay
Expand Down