mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-10 06:02:13 +00:00
Make some automator styling/UX improvements
This commit is contained in:
parent
4d18af6d40
commit
2e950a19f0
@ -46,6 +46,7 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
.l-lost-text {
|
||||
font-weight: bold;
|
||||
color: var(--color-bad);
|
||||
}
|
||||
</style>
|
||||
|
@ -39,6 +39,9 @@ export default {
|
||||
}
|
||||
return Math.clampMin(this.constantNames.length + newCount - AutomatorData.MAX_ALLOWED_CONSTANT_COUNT, 0);
|
||||
},
|
||||
willNotImport(index) {
|
||||
return this.presets.length - index < this.missedImports();
|
||||
},
|
||||
// Shorten the string to less than 55 characters for UI purposes - but we shorten the middle since the
|
||||
// beginning and end are both potentially useful to see
|
||||
shortenString(str) {
|
||||
@ -65,6 +68,7 @@ export default {
|
||||
<div
|
||||
v-for="i in presets.length"
|
||||
:key="i"
|
||||
:class="{ 'l-not-imported' : willNotImport(i) }"
|
||||
>
|
||||
Name: {{ presets[i-1].name }} ➜ <b>{{ names[i-1] }}</b>
|
||||
<br>
|
||||
@ -83,7 +87,8 @@ export default {
|
||||
v-if="missedImports() > 0"
|
||||
class="l-warn-text"
|
||||
>
|
||||
Due to the limit on constant count, {{ quantify("constant", missedImports()) }} will not be imported!
|
||||
{{ quantify("preset", missedImports()) }} in this list cannot be imported as new constants
|
||||
due to the limit on constant count.
|
||||
</div>
|
||||
</div>
|
||||
<template #confirm-text>
|
||||
@ -94,6 +99,11 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
.l-warn-text {
|
||||
font-weight: bold;
|
||||
color: var(--color-bad);
|
||||
}
|
||||
|
||||
.l-not-imported {
|
||||
color: var(--color-disabled);
|
||||
}
|
||||
</style>
|
||||
|
@ -23,6 +23,9 @@ export default {
|
||||
maxValueLength() {
|
||||
return AutomatorData.MAX_ALLOWED_CONSTANT_VALUE_LENGTH;
|
||||
},
|
||||
hasConstants() {
|
||||
return this.constants.length > 1 || this.constants[0] !== "";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
@ -30,7 +33,7 @@ export default {
|
||||
this.constants = existingValues.length < this.maxConstantCount ? [...existingValues, ""] : [...existingValues];
|
||||
},
|
||||
deleteAllConstants() {
|
||||
if (this.constants.length > 0) Modal.clearAutomatorConstants.show();
|
||||
if (this.hasConstants) Modal.clearAutomatorConstants.show();
|
||||
},
|
||||
importPresets() {
|
||||
Modal.importTSConstants.show();
|
||||
@ -56,7 +59,9 @@ export default {
|
||||
<br>
|
||||
<br>
|
||||
<PrimaryButton
|
||||
v-tooltip="hasConstants ? null : 'You have no valid constants to delete!'"
|
||||
class="c-delete-margin o-primary-btn--subtab-option"
|
||||
:class="{ 'o-primary-btn--disabled' : !hasConstants }"
|
||||
@click="deleteAllConstants"
|
||||
>
|
||||
Delete all constants
|
||||
|
@ -44,7 +44,7 @@ export default {
|
||||
template generator <div class="fas fa-file-code c-automator-button-icon" />. You can undo or redo a limited
|
||||
number of edits using <div class="fas fa-arrow-rotate-left c-automator-button-icon" /> or
|
||||
<div class="fas fa-arrow-rotate-right c-automator-button-icon" />, or by using the respective hotkeys. Edit history
|
||||
is cleared upon switching or converting scripts.
|
||||
is cleared upon switching, converting, or deleting scripts.
|
||||
<br>
|
||||
<br>
|
||||
<b>Debugging:</b> The two main tools you have for fixing your scripts are the Error Log
|
||||
|
@ -116,7 +116,7 @@ export default {
|
||||
background-color: #626262;
|
||||
border: var(--var-border-width, 0.2rem) solid #767676;
|
||||
border-radius: var(--var-border-radius, 0.3rem);
|
||||
margin: 0.3rem 0.4rem 0.3rem auto;
|
||||
margin: 0.3rem 0.4rem 0.3rem 0.5rem;
|
||||
padding: 0.3rem 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -21,18 +21,22 @@ export const AutomatorCommands = ((() => {
|
||||
EventHub.logic.on(GAME_EVENT.ETERNITY_RESET_AFTER, () => prestigeNotify(T.Eternity.$prestigeLevel));
|
||||
EventHub.logic.on(GAME_EVENT.REALITY_RESET_AFTER, () => prestigeNotify(T.Reality.$prestigeLevel));
|
||||
|
||||
// Used by while and until
|
||||
function compileConditionLoop(evalComparison, commands, ctx) {
|
||||
// Used by while and until - in order to get the text corrext, we need to invert the boolean if it's an until
|
||||
// eslint-disable-next-line max-params
|
||||
function compileConditionLoop(evalComparison, commands, ctx, isUntil) {
|
||||
return {
|
||||
run: () => {
|
||||
const loopStr = isUntil ? "UNTIL" : "WHILE";
|
||||
if (!evalComparison()) {
|
||||
AutomatorData.logCommandEvent(`Checked ${parseConditionalIntoText(ctx)} (false), exiting loop at
|
||||
line ${AutomatorBackend.translateLineNumber(ctx.RCurly[0].startLine + 1)} (end of loop)`, ctx.startLine);
|
||||
AutomatorData.logCommandEvent(`Checked ${parseConditionalIntoText(ctx)} (${isUntil}),
|
||||
exiting loop at line ${AutomatorBackend.translateLineNumber(ctx.RCurly[0].startLine + 1) - 1}
|
||||
(end of ${loopStr} loop)`, ctx.startLine);
|
||||
return AUTOMATOR_COMMAND_STATUS.NEXT_TICK_NEXT_INSTRUCTION;
|
||||
}
|
||||
AutomatorBackend.push(commands);
|
||||
AutomatorData.logCommandEvent(`Checked ${parseConditionalIntoText(ctx)} (true), moving to
|
||||
line ${AutomatorBackend.translateLineNumber(ctx.LCurly[0].startLine + 1)} (start of loop)`, ctx.startLine);
|
||||
AutomatorData.logCommandEvent(`Checked ${parseConditionalIntoText(ctx)} (${!isUntil}),
|
||||
moving to line ${AutomatorBackend.translateLineNumber(ctx.LCurly[0].startLine + 1) - 1}
|
||||
(start of ${loopStr} loop)`, ctx.startLine);
|
||||
return AUTOMATOR_COMMAND_STATUS.SAME_INSTRUCTION;
|
||||
},
|
||||
blockCommands: commands,
|
||||
@ -864,7 +868,7 @@ export const AutomatorCommands = ((() => {
|
||||
const commands = C.visit(ctx.block);
|
||||
if (ctx.comparison) {
|
||||
const evalComparison = C.visit(ctx.comparison);
|
||||
return compileConditionLoop(() => !evalComparison(), commands, ctx);
|
||||
return compileConditionLoop(() => !evalComparison(), commands, ctx, true);
|
||||
}
|
||||
const prestigeLevel = ctx.PrestigeEvent[0].tokenType.$prestigeLevel;
|
||||
let prestigeName;
|
||||
@ -1059,7 +1063,7 @@ export const AutomatorCommands = ((() => {
|
||||
ctx.startLine = ctx.While[0].startLine;
|
||||
return V.checkBlock(ctx, ctx.While);
|
||||
},
|
||||
compile: (ctx, C) => compileConditionLoop(C.visit(ctx.comparison), C.visit(ctx.block), ctx),
|
||||
compile: (ctx, C) => compileConditionLoop(C.visit(ctx.comparison), C.visit(ctx.block), ctx, false),
|
||||
blockify: (ctx, B) => {
|
||||
const commands = [];
|
||||
B.visit(ctx.block, commands);
|
||||
|
Loading…
Reference in New Issue
Block a user