mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-24 09:21:46 +00:00
Fixed side layers being unclickable, more performance
This commit is contained in:
parent
53dc795806
commit
0f59bd7be6
8 changed files with 87 additions and 58 deletions
|
@ -6,6 +6,7 @@
|
|||
- Added support for bulk challenge completions.
|
||||
- "Best" is updated automatically.
|
||||
- Fixed keeping Decimal values on reset.
|
||||
- Code reorganization and style improvements by fudo.
|
||||
|
||||
## v2.3.5 - 12/21/20
|
||||
- Added resetTime, which tracks the time since a layer prestiged or was reset.
|
||||
|
|
89
demo.html
89
demo.html
|
@ -1,27 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="popup.css" />
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
|
||||
<script type="text/javascript" src="js/technical/break_eternity.js"></script>
|
||||
<script type="text/javascript" src="js/technical/layerSupport.js"></script>
|
||||
<script type="text/javascript" src="js/demo/demoTree.js"></script>
|
||||
<script type="text/javascript" src="js/demo/demoLayers.js"></script>
|
||||
<script type="text/javascript" src="js/demo/demoMod.js"></script>
|
||||
<script type="text/javascript" src="js/technical/temp.js"></script>
|
||||
<script type="text/javascript" src="js/game.js"></script>
|
||||
<script type="text/javascript" src="js/utils.js"></script>
|
||||
<script type="text/javascript" src="js/technical/systemComponents.js"></script>
|
||||
<script type="text/javascript" src="js/components.js"></script>
|
||||
<script type="text/javascript" src="js/technical/canvas.js"></script>
|
||||
<script src="js/technical/break_eternity.js"></script>
|
||||
<script src="js/technical/layerSupport.js"></script>
|
||||
<script src="js/demo/demoTree.js"></script>
|
||||
<script src="js/demo/demoLayers.js"></script>
|
||||
<script src="js/demo/demoMod.js"></script>
|
||||
<script src="js/technical/temp.js"></script>
|
||||
<script src="js/game.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/technical/systemComponents.js"></script>
|
||||
<script src="js/components.js"></script>
|
||||
<script src="js/technical/canvas.js"></script>
|
||||
<script src="js/utils/NumberFormating.js"></script>
|
||||
<script src="js/utils/options.js"></script>
|
||||
<script src="js/utils/save.js"></script>
|
||||
<script src="js/utils/themes.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="load()">
|
||||
<div id="app">
|
||||
<canvas id="treeCanvas" class="canvas" v-if ="!(gameEnded && !player.keepGoing)"></canvas>
|
||||
<canvas id="treeCanvas" class="canvas" v-if="!(gameEnded && !player.keepGoing)"></canvas>
|
||||
|
||||
<div v-if="false" id="loadingSection" class="fullWidth">
|
||||
<h1>Loading... (If this takes too long it means there was a serious error!)←</h1>
|
||||
|
@ -34,34 +41,51 @@
|
|||
<h3>Please check the Discord to see if there are new content updates!</h3><br><br>
|
||||
<div v-if="!player.timePlayedReset">It took you {{formatTime(player.timePlayed)}} to beat the game.</div>
|
||||
<br>
|
||||
<button class="longUpg can" onclick="hardReset(true)">Play Again</button> <button class="longUpg can" onclick="keepGoing()">Keep Going</button>
|
||||
<button class="longUpg can" onclick="hardReset(true)">Play Again</button> <button
|
||||
class="longUpg can" onclick="keepGoing()">Keep Going</button>
|
||||
<br><br><br>
|
||||
<span v-if="modInfo.discordLink"><a class="link" v-bind:href="modInfo.discordLink" target="_blank">{{modInfo.discordName}}</a><br></span>
|
||||
<a class="link" href="https://discord.gg/F3xveHV" target="_blank" v-bind:style="modInfo.discordLink ? {'font-size': '16px'} : {}">The Modding Tree Discord</a><br>
|
||||
<a class="link" href="http://discord.gg/wwQfgPa" target="_blank" v-bind:style="{'font-size': '16px'}">Main Prestige Tree server</a><br>
|
||||
<span v-if="modInfo.discordLink"><a class="link" v-bind:href="modInfo.discordLink"
|
||||
target="_blank">{{modInfo.discordName}}</a><br></span>
|
||||
<a class="link" href="https://discord.gg/F3xveHV" target="_blank"
|
||||
v-bind:style="modInfo.discordLink ? {'font-size': '16px'} : {}">The Modding Tree Discord</a><br>
|
||||
<a class="link" href="http://discord.gg/wwQfgPa" target="_blank" v-bind:style="{'font-size': '16px'}">Main
|
||||
Prestige Tree server</a><br>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<div id="treeOverlay" v-if="!(gameEnded && !player.keepGoing)" class="treeOverlay" onscroll="resizeCanvas()" v-bind:class="{ fullWidth: (player.tab == 'none' || player.navTab == 'none'), col: (player.tab !== 'none' && player.navTab !== 'none'), left: (player.tab !== 'none' && player.navTab !== 'none')}">
|
||||
<div id="version" onclick="showTab('changelog-tab')" class="overlayThing" style="margin-right: 13px">{{(VERSION.withoutName)}}</div>
|
||||
<button v-if= "player.navTab == 'none' && (tmp[player.tab].row == 'side' || tmp[player.tab].row == 'otherside')" class="other-back overlayThing" onclick="goBack()">←</button>
|
||||
<img id="optionWheel" class="overlayThing" v-if="player.tab!='options-tab'" src="options_wheel.png" onclick="showTab('options-tab')"></img>
|
||||
<div id="treeOverlay" v-if="!(gameEnded && !player.keepGoing)" class="treeOverlay" onscroll="resizeCanvas()"
|
||||
v-bind:class="{ fullWidth: (player.tab == 'none' || player.navTab == 'none'), col: (player.tab !== 'none' && player.navTab !== 'none'), left: (player.tab !== 'none' && player.navTab !== 'none')}">
|
||||
<div id="version" onclick="showTab('changelog-tab')" class="overlayThing" style="margin-right: 13px">
|
||||
{{VERSION.withoutName}}</div>
|
||||
<button
|
||||
v-if="player.navTab == 'none' && (tmp[player.tab].row == 'side' || tmp[player.tab].row == 'otherside')"
|
||||
class="other-back overlayThing" onclick="goBack()">←</button>
|
||||
<img id="optionWheel" class="overlayThing" v-if="player.tab!='options-tab'" src="options_wheel.png"
|
||||
onclick="showTab('options-tab')"></img>
|
||||
<div id="info" v-if="player.tab!='info-tab'" class="overlayThing" onclick="showTab('info-tab')"><br>i</div>
|
||||
<div id="discord" class="overlayThing">
|
||||
<img onclick="window.open((modInfo.discordLink ? modInfo.discordLink : 'https://discord.gg/F3xveHV'),'mywindow')" src="discord.png" target="_blank"></img>
|
||||
<img onclick="window.open((modInfo.discordLink ? modInfo.discordLink : 'https://discord.gg/F3xveHV'),'mywindow')"
|
||||
src="discord.png" target="_blank"></img>
|
||||
<ul id="discord-links">
|
||||
<li v-if="modInfo.discordLink"><a class="link" v-bind:href="modInfo.discordLink" target="_blank">{{modInfo.discordName}}</a><br></li>
|
||||
<li><a class="link" href="https://discord.gg/F3xveHV" target="_blank" v-bind:style="modInfo.discordLink ? {'font-size': '16px'} : {}">The Modding Tree Discord</a><br></li>
|
||||
<li><a class="link" href="http://discord.gg/wwQfgPa" target="_blank" v-bind:style="{'font-size': '16px'}">Main Prestige Tree server</a></li>
|
||||
<li v-if="modInfo.discordLink"><a class="link" v-bind:href="modInfo.discordLink"
|
||||
target="_blank">{{modInfo.discordName}}</a><br></li>
|
||||
<li><a class="link" href="https://discord.gg/F3xveHV" target="_blank"
|
||||
v-bind:style="modInfo.discordLink ? {'font-size': '16px'} : {}">The Modding Tree
|
||||
Discord</a><br></li>
|
||||
<li><a class="link" href="http://discord.gg/wwQfgPa" target="_blank"
|
||||
v-bind:style="{'font-size': '16px'}">Main Prestige Tree server</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<overlay-head v-if="!(gameEnded && !player.keepGoing)"></overlay-head>
|
||||
<div class="sideLayers" >
|
||||
<div v-for="(node, index) in OTHER_LAYERS['side']"><tree-node :layer='node' :abb='tmp[node].symbol' :size="'small'" :key="'side' + index"></tree-node></div>
|
||||
<div class="sideLayers">
|
||||
<div v-for="(node, index) in OTHER_LAYERS['side']">
|
||||
<tree-node :layer='node' :abb='tmp[node].symbol' :size="'small'" :key="'side' + index"></tree-node>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!(gameEnded && !player.keepGoing)" id="treeTab" v-bind:style="{'z-index': (tmp.scrolled ? '999999999999' : '0')}" onscroll="resizeCanvas()" v-bind:class="{ fullWidth: (player.tab == 'none' || player.navTab == 'none'), col: (player.tab !== 'none' && player.navTab !== 'none'), left: (player.tab !== 'none' && player.navTab !== 'none')}">
|
||||
<div v-if="!(gameEnded && !player.keepGoing)" id="treeTab" v-bind:style="{'z-index': (tmp.scrolled ? '1' : '5000')}" onscroll="resizeCanvas()"
|
||||
v-bind:class="{ fullWidth: (player.tab == 'none' || player.navTab == 'none'), col: (player.tab !== 'none' && player.navTab !== 'none'), left: (player.tab !== 'none' && player.navTab !== 'none')}">
|
||||
<br><br><br><br>
|
||||
<overlay-head id="fakeHead" style="visibility: hidden;">
|
||||
</overlay-head>
|
||||
|
@ -73,16 +97,19 @@
|
|||
<!-- Popups -->
|
||||
<div class="popup-container">
|
||||
<transition-group name="fade">
|
||||
<div v-for="popup,index in activePopups" class="popup" v-bind:class="popup.type" v-bind:key="'p' + popup.id" v-bind:style="popup.color ? {'background-color': popup.color} : {}">
|
||||
<div v-for="popup,index in activePopups" class="popup" v-bind:class="popup.type"
|
||||
v-bind:key="'p' + popup.id" v-bind:style="popup.color ? {'background-color': popup.color} : {}">
|
||||
<h3>{{popup.title}}</h3><br>
|
||||
<h2 v-html="popup.message"></h2>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
|
||||
<div v-if="player.navTab !== 'none' && player.tab !== 'none' && !(gameEnded && !player.keepGoing)" onscroll="resizeCanvas()" v-bind:class="{ fullWidth: player.navTab == 'none', col: player.navTab != 'none', right: player.navTab != 'none', fast: true, tab: true}">
|
||||
<div v-for="layer in LAYERS" >
|
||||
<div v-if="player.tab==layer" >
|
||||
<div v-if="player.navTab !== 'none' && player.tab !== 'none' && !(gameEnded && !player.keepGoing)"
|
||||
onscroll="resizeCanvas()"
|
||||
v-bind:class="{ fullWidth: player.navTab == 'none', col: player.navTab != 'none', right: player.navTab != 'none', fast: true, tab: true}">
|
||||
<div v-for="layer in LAYERS">
|
||||
<div v-if="player.tab==layer">
|
||||
<layer-tab :layer="layer" :back="'none'" :spacing="'50px'" :key="'left'"></layer-tab>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!(gameEnded && !player.keepGoing)" id="treeTab" v-bind:style="{'z-index': (tmp.scrolled ? '999999999999' : '0')}" onscroll="resizeCanvas()"
|
||||
<div v-if="!(gameEnded && !player.keepGoing)" id="treeTab" v-bind:style="{'z-index': (tmp.scrolled ? '1' : '5000')}" onscroll="resizeCanvas()"
|
||||
v-bind:class="{ fullWidth: (player.tab == 'none' || player.navTab == 'none'), col: (player.tab !== 'none' && player.navTab !== 'none'), left: (player.tab !== 'none' && player.navTab !== 'none')}">
|
||||
<br><br><br><br>
|
||||
<overlay-head id="fakeHead" style="visibility: hidden;">
|
||||
|
|
|
@ -357,7 +357,6 @@ addLayer("c", {
|
|||
tooltip() { // Optional, tooltip displays when the layer is unlocked
|
||||
let tooltip = formatWhole(player[this.layer].points) + " " + this.resource
|
||||
if (player[this.layer].buyables[11].gt(0)) tooltip += "\n" + formatWhole(player[this.layer].buyables[11]) + " Exhancers"
|
||||
tooltip += "\nmomomo\m oo\nommom\nyeyeyeye"
|
||||
return tooltip
|
||||
},
|
||||
shouldNotify() { // Optional, layer will be highlighted on the tree if true.
|
||||
|
@ -514,8 +513,3 @@ addLayer("a", {
|
|||
},
|
||||
},
|
||||
)
|
||||
|
||||
addLayer('qq', {row: 2})
|
||||
addLayer('rr', {row: 3})
|
||||
addLayer('ss', {row: 4})
|
||||
addLayer('tt', {row: 5})
|
|
@ -408,7 +408,7 @@ var interval = setInterval(function() {
|
|||
if (needCanvasUpdate){ resizeCanvas();
|
||||
needCanvasUpdate = false;
|
||||
}
|
||||
tmp.scrolled = document.getElementById('treeTab').scrollTop < 30
|
||||
tmp.scrolled = document.getElementById('treeTab').scrollTop > 30
|
||||
updateTemp();
|
||||
gameLoop(diff)
|
||||
fixNaNs()
|
||||
|
|
|
@ -89,7 +89,7 @@ var systemComponents = {
|
|||
|
||||
'overlay-head': {
|
||||
template: `
|
||||
<div class="overlayThing" style="padding-bottom:7px; width: 90%">
|
||||
<div class="overlayThing" style="padding-bottom:7px; width: 90%; z-index: 1000; position: relative">
|
||||
<span v-if="player.devSpeed && player.devSpeed != 1" class="overlayThing">
|
||||
<br>Dev Speed: {{format(player.devSpeed)}}x<br>
|
||||
</span>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var tmp = {}
|
||||
var temp = tmp // Proxy for tmp
|
||||
var funcs = {}
|
||||
var NaNalert = false;
|
||||
|
||||
// Tmp will not call these
|
||||
|
@ -22,8 +23,9 @@ function setupTemp() {
|
|||
tmp.pointGen = {}
|
||||
tmp.displayThings = []
|
||||
tmp.scrolled = 0
|
||||
funcs = {}
|
||||
|
||||
setupTempData(layers, tmp)
|
||||
setupTempData(layers, tmp, funcs)
|
||||
for (layer in layers){
|
||||
tmp[layer].resetGain = {}
|
||||
tmp[layer].nextAt = {}
|
||||
|
@ -38,7 +40,7 @@ function setupTemp() {
|
|||
temp = tmp
|
||||
}
|
||||
|
||||
function setupTempData(layerData, tmpData) {
|
||||
function setupTempData(layerData, tmpData, funcsData) {
|
||||
for (item in layerData){
|
||||
if (layerData[item] == null) {
|
||||
tmpData[item] = null
|
||||
|
@ -47,16 +49,20 @@ function setupTempData(layerData, tmpData) {
|
|||
tmpData[item] = layerData[item]
|
||||
else if (Array.isArray(layerData[item])) {
|
||||
tmpData[item] = []
|
||||
setupTempData(layerData[item], tmpData[item])
|
||||
funcsData[item] = []
|
||||
setupTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
}
|
||||
else if ((!!layerData[item]) && (layerData[item].constructor === Object)) {
|
||||
tmpData[item] = {}
|
||||
setupTempData(layerData[item], tmpData[item])
|
||||
funcsData[item] = []
|
||||
setupTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
}
|
||||
else if ((!!layerData[item]) && (typeof layerData[item] === "object") && traversableClasses.includes(layerData[item].constructor.name)) {
|
||||
tmpData[item] = new layerData[item].constructor()
|
||||
funcsData[item] = new layerData[item].constructor()
|
||||
}
|
||||
else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){
|
||||
funcsData[item] = layerData[item]
|
||||
tmpData[item] = new Decimal(1) // The safest thing to put probably?
|
||||
} else {
|
||||
tmpData[item] = layerData[item]
|
||||
|
@ -68,7 +74,7 @@ function updateTemp() {
|
|||
if (tmp === undefined)
|
||||
setupTemp()
|
||||
|
||||
updateTempData(layers, tmp)
|
||||
updateTempData(layers, tmp, funcs)
|
||||
|
||||
for (layer in layers){
|
||||
tmp[layer].resetGain = getResetGain(layer)
|
||||
|
@ -95,14 +101,14 @@ function updateTemp() {
|
|||
|
||||
}
|
||||
|
||||
function updateTempData(layerData, tmpData) {
|
||||
function updateTempData(layerData, tmpData, funcsData) {
|
||||
|
||||
for (item in layerData){
|
||||
for (item in funcsData){
|
||||
if (Array.isArray(layerData[item])) {
|
||||
updateTempData(layerData[item], tmpData[item])
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
}
|
||||
else if ((!!layerData[item]) && (layerData[item].constructor === Object) || (typeof layerData[item] === "object") && traversableClasses.includes(layerData[item].constructor.name)){
|
||||
updateTempData(layerData[item], tmpData[item])
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
}
|
||||
else if (isFunction(layerData[item]) && !isFunction(tmpData[item])){
|
||||
let value = layerData[item]()
|
||||
|
@ -126,7 +132,7 @@ function updateTempData(layerData, tmpData) {
|
|||
|
||||
function updateChallengeTemp(layer)
|
||||
{
|
||||
updateTempData(layers[layer].challenges, tmp[layer].challenges)
|
||||
updateTempData(layers[layer].challenges, tmp[layer].challenges, funcs[layer].challenges)
|
||||
updateChallengeDisplay(layer)
|
||||
}
|
||||
|
||||
|
@ -144,12 +150,12 @@ function updateChallengeDisplay(layer) {
|
|||
|
||||
function updateBuyableTemp(layer)
|
||||
{
|
||||
updateTempData(layers[layer].buyables, tmp[layer].buyables)
|
||||
updateTempData(layers[layer].buyables, tmp[layer].buyables, funcs[layer].buyables)
|
||||
}
|
||||
|
||||
function updateClickableTemp(layer)
|
||||
{
|
||||
updateTempData(layers[layer].clickables, tmp[layer].clickables)
|
||||
updateTempData(layers[layer].clickables, tmp[layer].clickables, funcs[layer].clickables)
|
||||
}
|
||||
|
||||
function constructNodeStyle(layer){
|
||||
|
|
|
@ -613,17 +613,18 @@ ul {
|
|||
}
|
||||
|
||||
.treeOverlay {
|
||||
z-index: 200000;
|
||||
pointer-events:none;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.overlayThing {
|
||||
z-index: 10000;
|
||||
pointer-events:auto;
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
.sideLayers {
|
||||
z-index: 10000;
|
||||
pointer-events:auto;
|
||||
position: absolute;
|
||||
right: 55px;
|
||||
|
|
Loading…
Reference in a new issue