From: Daniel Karbach Date: Sun, 24 Mar 2024 12:23:37 +0000 (+0100) Subject: tracker medallion controler X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=3213c82ad2dd75e313d15423e25653596c7ce278;p=alttp.git tracker medallion controler --- diff --git a/resources/js/components/tracker/Items.js b/resources/js/components/tracker/Items.js index 712ee6c..2e83565 100644 --- a/resources/js/components/tracker/Items.js +++ b/resources/js/components/tracker/Items.js @@ -49,12 +49,30 @@ const Items = () => {
+ {state['mm-medallion'] === 'bombos' ? + MM + : null} + {state['tr-medallion'] === 'bombos' ? + TR + : null}
+ {state['mm-medallion'] === 'ether' ? + MM + : null} + {state['tr-medallion'] === 'ether' ? + TR + : null}
+ {state['mm-medallion'] === 'quake' ? + MM + : null} + {state['tr-medallion'] === 'quake' ? + TR + : null}
diff --git a/resources/js/components/tracker/ToggleIcon.js b/resources/js/components/tracker/ToggleIcon.js index 49375ef..3f6af96 100644 --- a/resources/js/components/tracker/ToggleIcon.js +++ b/resources/js/components/tracker/ToggleIcon.js @@ -163,7 +163,38 @@ ToggleIcon.medallionController = { getActive: highestActive, getDefault: firstIcon, handlePrimary: nextIcon, - handleSecondary: doNothing, + handleSecondary: (state, setState, icons) => { + const mm = state['mm-medallion']; + const tr = state['tr-medallion']; + const isMM = mm === icons[0]; + const isTR = tr === icons[0]; + console.log({ mm, isMM, tr, isTR }); + if (!isMM && !isTR) { + // empty: set as MM if mire is unset, else set as TR if TR is unset + if (!mm) { + setState(s => ({ ...s, 'mm-medallion': icons[0] })); + } else if (!tr) { + setState(s => ({ ...s, 'tr-medallion': icons[0] })); + } + } else if (isMM && !isTR) { + // MM: if TR is free, switch to TR, otherwise remove MM + if (!tr) { + setState(s => ({ ...s, 'mm-medallion': null, 'tr-medallion': icons[0] })); + } else { + setState(s => ({ ...s, 'mm-medallion': null })); + } + } else if (!isMM && isTR) { + // TR: if MM is free, switch to both, otherwise remove TR + if (!mm) { + setState(s => ({ ...s, 'mm-medallion': icons[0] })); + } else { + setState(s => ({ ...s, 'tr-medallion': null })); + } + } else { + // both: remove both + setState(s => ({ ...s, 'mm-medallion': null, 'tr-medallion': null })); + } + }, }; ToggleIcon.modulusController = ctrl => ({ diff --git a/resources/js/helpers/tracker.js b/resources/js/helpers/tracker.js index 707e3f7..f2be243 100644 --- a/resources/js/helpers/tracker.js +++ b/resources/js/helpers/tracker.js @@ -1620,6 +1620,14 @@ export const makeEmptyState = () => { state[`${dungeon.id}-prize-acquired`] = false; } }); + OVERWORLD_LOCATIONS.forEach(location => { + state[location.id] = false; + }); + UNDERWORLD_LOCATIONS.forEach(location => { + state[location.id] = false; + }); + state['mm-medallion'] = null; + state['tr-medallion'] = null; return state; }; diff --git a/resources/sass/tracker.scss b/resources/sass/tracker.scss index 06f1577..2e75301 100644 --- a/resources/sass/tracker.scss +++ b/resources/sass/tracker.scss @@ -1,5 +1,6 @@ .tracker { - .count-display { + .count-display, + .med-display { background: black; font-weight: bold; text-align: center; @@ -104,12 +105,18 @@ .right { right: 0; } - .count-display { + .count-display, + .med-display { pointer-events: none; &.is-zero { display: none; } } + .med-display { + height: 30%; + font-size: 80%; + line-height: 1; + } } .toggle-icon { &.inactive {