mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-02-17 18:12:45 +00:00
More bar optimizations, compatibility improvement
This commit is contained in:
parent
51f9e2f1a7
commit
cc953e0b6b
3 changed files with 40 additions and 44 deletions
|
@ -1,6 +1,10 @@
|
||||||
# The Modding Tree changelog:
|
# The Modding Tree changelog:
|
||||||
|
|
||||||
|
# v2.5.3 - 5/8/21
|
||||||
|
- Improved performance of bars.
|
||||||
- Respec confirmation settings are now kept on resets.
|
- Respec confirmation settings are now kept on resets.
|
||||||
|
- Improved compatibility with older browsers.
|
||||||
|
- Fixed missing pixel on vertical bars.
|
||||||
|
|
||||||
# v2.5.2.1 - 5/7/21
|
# v2.5.2.1 - 5/7/21
|
||||||
- Fixed microtabs making layers highlight incorrectly.
|
- Fixed microtabs making layers highlight incorrectly.
|
||||||
|
|
|
@ -86,3 +86,36 @@ function updateOomps(diff)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function constructBarStyle(layer, id) {
|
||||||
|
let bar = tmp[layer].bars[id]
|
||||||
|
let style = {}
|
||||||
|
if (bar.progress instanceof Decimal)
|
||||||
|
bar.progress = bar.progress.toNumber()
|
||||||
|
bar.progress = (1 -Math.min(Math.max(bar.progress, 0), 1)) * 100
|
||||||
|
|
||||||
|
style.dims = {'width': bar.width + "px", 'height': bar.height + "px"}
|
||||||
|
let dir = bar.direction
|
||||||
|
style.fillDims = {'width': (bar.width + 0.5) + "px", 'height': (bar.height + 0.5) + "px"}
|
||||||
|
|
||||||
|
switch(bar.direction) {
|
||||||
|
case UP:
|
||||||
|
style.fillDims['clip-path'] = 'inset(' + bar.progress + '% 0% 0% 0%)'
|
||||||
|
style.fillDims.width = bar.width + 1 + 'px'
|
||||||
|
break;
|
||||||
|
case DOWN:
|
||||||
|
style.fillDims['clip-path'] = 'inset(0% 0% ' + bar.progress + '% 0%)'
|
||||||
|
style.fillDims.width = bar.width + 1 + 'px'
|
||||||
|
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
style.fillDims['clip-path'] = 'inset(0% ' + bar.progress + '% 0% 0%)'
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + bar.progress + '%)'
|
||||||
|
break;
|
||||||
|
case DEFAULT:
|
||||||
|
style.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'
|
||||||
|
}
|
||||||
|
return style
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ var activeFunctions = [
|
||||||
"buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress", "onClick", "onHold", "masterButtonPress",
|
"buy", "buyMax", "respec", "onComplete", "onPurchase", "onPress", "onClick", "onHold", "masterButtonPress",
|
||||||
"sellOne", "sellAll", "pay", "actualCostFunction", "actualEffectFunction",
|
"sellOne", "sellAll", "pay", "actualCostFunction", "actualEffectFunction",
|
||||||
"effectDescription", "display", "fullDisplay", "effectDisplay", "rewardDisplay",
|
"effectDescription", "display", "fullDisplay", "effectDisplay", "rewardDisplay",
|
||||||
|
"tabFormat", "content",
|
||||||
]
|
]
|
||||||
|
|
||||||
var noCall = doNotCallTheseFunctionsEveryTick
|
var noCall = doNotCallTheseFunctionsEveryTick
|
||||||
|
@ -35,7 +36,6 @@ function setupTemp() {
|
||||||
tmp[layer].notify = {}
|
tmp[layer].notify = {}
|
||||||
tmp[layer].prestigeNotify = {}
|
tmp[layer].prestigeNotify = {}
|
||||||
tmp[layer].computedNodeStyle = []
|
tmp[layer].computedNodeStyle = []
|
||||||
setupBarStyles(layer)
|
|
||||||
setupBuyables(layer)
|
setupBuyables(layer)
|
||||||
tmp[layer].trueGlowColor = []
|
tmp[layer].trueGlowColor = []
|
||||||
}
|
}
|
||||||
|
@ -156,59 +156,18 @@ function updateClickableTemp(layer)
|
||||||
updateTempData(layers[layer].clickables, tmp[layer].clickables, funcs[layer].clickables)
|
updateTempData(layers[layer].clickables, tmp[layer].clickables, funcs[layer].clickables)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function constructBarStyle(layer, id) {
|
|
||||||
let bar = tmp[layer].bars[id]
|
|
||||||
let style = {}
|
|
||||||
if (bar.progress instanceof Decimal)
|
|
||||||
bar.progress = bar.progress.toNumber()
|
|
||||||
bar.progress = (1 -Math.min(Math.max(bar.progress, 0), 1)) * 100
|
|
||||||
|
|
||||||
style.dims = {'width': bar.width + "px", 'height': bar.height + "px"}
|
|
||||||
let dir = bar.direction
|
|
||||||
style.fillDims = {'width': (bar.width + 0.5) + "px", 'height': (bar.height + 0.5) + "px"}
|
|
||||||
if (dir !== undefined)
|
|
||||||
{
|
|
||||||
style.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'
|
|
||||||
if(dir == UP){
|
|
||||||
style.fillDims['clip-path'] = 'inset(' + bar.progress + '% 0% 0% 0%)'
|
|
||||||
}
|
|
||||||
else if(dir == DOWN){
|
|
||||||
style.fillDims['clip-path'] = 'inset(0% 0% ' + bar.progress + '% 0%)'
|
|
||||||
}
|
|
||||||
else if(dir == RIGHT){
|
|
||||||
style.fillDims['clip-path'] = 'inset(0% ' + bar.progress + '% 0% 0%)'
|
|
||||||
}
|
|
||||||
else if(dir == LEFT){
|
|
||||||
style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + bar.progress + '%)'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return style
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupBarStyles(layer){
|
|
||||||
if (layers[layer].bars === undefined)
|
|
||||||
return
|
|
||||||
for (id in layers[layer].bars){
|
|
||||||
let bar = tmp[layer].bars[id]
|
|
||||||
bar.dims = {}
|
|
||||||
bar.fillDims = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupBuyables(layer) {
|
function setupBuyables(layer) {
|
||||||
for (id in layers[layer].buyables) {
|
for (id in layers[layer].buyables) {
|
||||||
if (!isNaN(id)) {
|
if (!isNaN(id)) {
|
||||||
let b = layers[layer].buyables[id]
|
let b = layers[layer].buyables[id]
|
||||||
b.actualCostFunction = b.cost
|
b.actualCostFunction = b.cost
|
||||||
b.cost = function(x) {
|
b.cost = function(x) {
|
||||||
x = x ?? player[this.layer].buyables[this.id]
|
x = (x === undefined ? player[this.layer].buyables[this.id] : x)
|
||||||
return layers[this.layer].buyables[this.id].actualCostFunction(x)
|
return layers[this.layer].buyables[this.id].actualCostFunction(x)
|
||||||
}
|
}
|
||||||
b.actualEffectFunction = b.effect
|
b.actualEffectFunction = b.effect
|
||||||
b.effect = function(x) {
|
b.effect = function(x) {
|
||||||
x = x ?? player[this.layer].buyables[this.id]
|
x = (x === undefined ? player[this.layer].buyables[this.id] : x)
|
||||||
return layers[this.layer].buyables[this.id].actualEffectFunction(x)
|
return layers[this.layer].buyables[this.id].actualEffectFunction(x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue