Переглянути джерело

Clear upgrade states when toggling the showing of owned upgrades

This is needed to make sure that all of the buttons get updated - some will
have stale states, otherwise
tags/v0.0.6
Fen Dweller 6 роки тому
джерело
коміт
a1a6b3d2b9
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: E80B35A6F11C3656
1 змінених файлів з 12 додано та 0 видалено
  1. +12
    -0
      gorge.js

+ 12
- 0
gorge.js Переглянути файл

@@ -301,6 +301,9 @@ function spend(cost) {
} }


function switchShowOwnedUpgrades() { function switchShowOwnedUpgrades() {

initializeUpgradeStates();
if (showOwnedUpgrades) { if (showOwnedUpgrades) {
document.querySelector("#upgrades").innerText = "Upgrades"; document.querySelector("#upgrades").innerText = "Upgrades";
} else { } else {
@@ -476,6 +479,11 @@ const states = {};
// we can just check if they've been handled already // we can just check if they've been handled already


function initializeStates() { function initializeStates() {
initializeBuildingStates();
initializeUpgradeStates();
}

function initializeBuildingStates() {
const buildingStates = {}; const buildingStates = {};


Object.keys(buildings).forEach(key => { Object.keys(buildings).forEach(key => {
@@ -486,7 +494,9 @@ function initializeStates() {
}); });


states.buildings = buildingStates; states.buildings = buildingStates;
}


function initializeUpgradeStates() {
const upgradeStates = {}; const upgradeStates = {};


Object.keys(upgrades).forEach(key => { Object.keys(upgrades).forEach(key => {
@@ -498,6 +508,8 @@ function initializeStates() {


states.upgrades = upgradeStates; states.upgrades = upgradeStates;
} }


function unlockAtStart() { function unlockAtStart() {
unlockBuilding("micro"); unlockBuilding("micro");




Завантаження…
Відмінити
Зберегти