Merge pull request #321 from hydroflame/buy-aug-setting

moved the suppress buy aug confirmation to settings, will now persist
This commit is contained in:
danielyxie 2018-06-25 19:42:17 -05:00 committed by GitHub
commit 60c308a28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 32 deletions

@ -886,6 +886,17 @@
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation"> <input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
</fieldset> </fieldset>
<!-- Suppress buy aug confirmation -->
<fieldset>
<label for="settingsSuppressBuyAugmentationConfirmation" class="tooltip">Suppress buy augmentation confirmation:
<span class="tooltiptext">
If this is set, the confirmation message before buying augmentation will not show up.
</span>
</label>
<input type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation">
</fieldset>
<!-- Disable Terminal and Navigation Shortcuts --> <!-- Disable Terminal and Navigation Shortcuts -->
<fieldset> <fieldset>
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys: <label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:

@ -439,7 +439,6 @@ function displayFactionContent(factionName) {
} }
} }
var confirmingPurchases = true;
var sortOption = null; var sortOption = null;
function displayFactionAugmentations(factionName) { function displayFactionAugmentations(factionName) {
var faction = Factions[factionName]; var faction = Factions[factionName];
@ -468,19 +467,6 @@ function displayFactionAugmentations(factionName) {
"Augmentations are powerful upgrades that will enhance your abilities." "Augmentations are powerful upgrades that will enhance your abilities."
})); }));
//Confirming not confirming button
elements.push(createElement("label", {
for:"faction-augmentations-confirming-checkbox",innerText:"Confirm Purchases",
color:"white", margin:"4px", padding:"4px",
}));
var confirmingPurchasesCheckbox = createElement("input", {
type:"checkbox", id:"faction-augmentations-confirming-checkbox", checked:confirmingPurchases,
margin:"4px", padding:"4px",
clickListener:()=>{
confirmingPurchases = confirmingPurchasesCheckbox.checked;
}
});
elements.push(confirmingPurchasesCheckbox);
elements.push(createElement("br")); elements.push(createElement("br"));
elements.push(createElement("br")); elements.push(createElement("br"));
@ -585,7 +571,8 @@ function createFactionAugmentationDisplayElements(augmentationsList, augs, facti
var aElem = createElement("a", { var aElem = createElement("a", {
innerText:aug.name, display:"inline", innerText:aug.name, display:"inline",
clickListener:()=>{ clickListener:()=>{
if (confirmingPurchases) { console.log('sup buy in fac: '+Settings.SuppressBuyAugmentationConfirmation);
if (!Settings.SuppressBuyAugmentationConfirmation) {
purchaseAugmentationBoxCreate(aug, faction); purchaseAugmentationBoxCreate(aug, faction);
} else { } else {
purchaseAugmentation(aug, faction); purchaseAugmentation(aug, faction);
@ -723,10 +710,12 @@ function purchaseAugmentation(aug, fac, sing=false) {
if (sing) { if (sing) {
return "You purchased " + aug.name; return "You purchased " + aug.name;
} else { } else {
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " + if(!Settings.SuppressBuyAugmentationConfirmation){
"effect until they are installed. To install your augmentations, go to the " + dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " + "effect until they are installed. To install your augmentations, go to the " +
"augmentations will now be more expensive."); "'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
"augmentations will now be more expensive.");
}
} }
displayFactionAugmentations(fac.name); displayFactionAugmentations(fac.name);

@ -2,19 +2,20 @@ import {Engine} from "./engine.js";
/* Settings.js */ /* Settings.js */
let Settings = { let Settings = {
CodeInstructionRunTime: 50, CodeInstructionRunTime: 50,
MaxLogCapacity: 50, MaxLogCapacity: 50,
MaxPortCapacity: 50, MaxPortCapacity: 50,
SuppressMessages: false, SuppressMessages: false,
SuppressFactionInvites: false, SuppressFactionInvites: false,
SuppressTravelConfirmation: false, SuppressTravelConfirmation: false,
AutosaveInterval: 60, SuppressBuyAugmentationConfirmation: false,
DisableHotkeys: false, AutosaveInterval: 60,
ThemeHighlightColor: "#ffffff", DisableHotkeys: false,
ThemeFontColor: "#66ff33", ThemeHighlightColor: "#ffffff",
ThemeBackgroundColor: "#000000", ThemeFontColor: "#66ff33",
EditorTheme: "Monokai", ThemeBackgroundColor: "#000000",
EditorKeybinding: "ace", EditorTheme: "Monokai",
EditorKeybinding: "ace",
} }
function loadSettings(saveString) { function loadSettings(saveString) {
@ -28,6 +29,7 @@ function initSettings() {
Settings.SuppressMessages = false; Settings.SuppressMessages = false;
Settings.SuppressFactionInvites = false; Settings.SuppressFactionInvites = false;
Settings.SuppressTravelConfirmation = false, Settings.SuppressTravelConfirmation = false,
Settings.SuppressBuyAugmentationConfirmation = false,
Settings.AutosaveInterval = 60; Settings.AutosaveInterval = 60;
Settings.DisableHotkeys = false; Settings.DisableHotkeys = false;
} }
@ -39,6 +41,7 @@ function setSettingsLabels() {
var suppressMsgs = document.getElementById("settingsSuppressMessages"); var suppressMsgs = document.getElementById("settingsSuppressMessages");
var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites") var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation"); var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation");
var suppressBuyAugmentationConfirmation = document.getElementById("settingsSuppressBuyAugmentationConfirmation");
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel"); var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
var disableHotkeys = document.getElementById("settingsDisableHotkeys"); var disableHotkeys = document.getElementById("settingsDisableHotkeys");
@ -49,6 +52,7 @@ function setSettingsLabels() {
suppressMsgs.checked = Settings.SuppressMessages; suppressMsgs.checked = Settings.SuppressMessages;
suppressFactionInv.checked = Settings.SuppressFactionInvites; suppressFactionInv.checked = Settings.SuppressFactionInvites;
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation; suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation;
autosaveInterval.innerHTML = Settings.AutosaveInterval; autosaveInterval.innerHTML = Settings.AutosaveInterval;
disableHotkeys.checked = Settings.DisableHotkeys; disableHotkeys.checked = Settings.DisableHotkeys;
@ -99,6 +103,11 @@ function setSettingsLabels() {
Settings.SuppressTravelConfirmation = this.checked; Settings.SuppressTravelConfirmation = this.checked;
}; };
suppressBuyAugmentationConfirmation.onclick = function() {
Settings.SuppressBuyAugmentationConfirmation = this.checked;
console.log('sup buy: '+Settings.SuppressBuyAugmentationConfirmation);
};
disableHotkeys.onclick = function() { disableHotkeys.onclick = function() {
Settings.DisableHotkeys = this.checked; Settings.DisableHotkeys = this.checked;
} }