1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00

Added subtabs, fixed some issues

This commit is contained in:
Acamaeda 2020-10-04 13:10:04 -04:00
parent 7d1cc514c2
commit 751d596919
6 changed files with 136 additions and 93 deletions

41
changelog.md Normal file
View file

@ -0,0 +1,41 @@
#The Modding Tree changelog:
##v1.2.4 - 10/4/20
- Layers are now highlighted if you can buy an upgrade, and a new feature, shouldNotify,
lets you make it highlight other ways.
- Fixed bugs with hasUpg, hasChall, hasMilestone, and inChallenge.
- Changed the sample code to use the above functions for convenience.
##v1.2.3 - 10/3/20
- Added a row component, which displays a list of objects in a row.
- Added a column component, which displays a list of objects in a column (useful within a row).
- Changed blanks to have a customizable width and height.
#v1.2: This Changes Everything! - 10/3/20
- Many layer features can now be static values or functions. (This made some formats change,
which will break old things)
- You can now use the "this" keyword, to make code easier to transfer when making new layers.
- Also added "this.layer", which is the current layer's name, and works on existing subfeatures
(e.g. individual upgrades) as well! Subfeatures also have "this.id".
- Fixed a big save issue. If you use a unique mod id, your save will never conflict with other mods.
- Added a configurable offline time limit in modinfo at the top of index.html. (default 1 hour)
- Added a few minor features, and updated the docs with new information.
##v1.1.1
- You can define hotkeys directly from layer config.
#v1.1: Enhanced Edition
- Added "Buyables", which can function like Space Buildings or Enhancers.
- Custom CSS can now be used on any component! Make the third argument an object with CSS
parameters.
- Lots of minor good things.
#v1.0:
- First release.

View file

@ -45,46 +45,13 @@
</div> </div>
<div v-if="player.tab=='changelog'" class="col right"> <div v-if="player.tab=='changelog'" class="col right">
<button class="back" onclick="showTab('tree')"></button><br> <button class="back" onclick="showTab('tree')"></button><br>
<h3>v1.2.4</h3> <h3>v1.3: Finally some real progress!</h3>
<ul>
<li>Layers are now highlighted if you can buy an upgrade, and a new feature, shouldNotify, lets you make it highlight other ways.</li>
<li>Fixed bugs with hasUpg, hasChall, hasMilestone, and inChallenge.</li>
<li>Changed the sample code to use the above functions for convenience.</li>
</ul><br>
<h3>v1.2.3</h3>
<ul>
<li>Added a row component, which displays a list of objects in a row.</li>
<li>Added a column component, which displays a list of objects in a column (useful within a row).</li>
<li>Changed blanks to have a customizable width and height.</li>
</ul><br>
<h3>v1.2: This Changes Everything!</h3>
<ul> <ul>
<li>Many layer features can now be static values or functions. (This made some notations change, which will break things)</li> <li>Many layer features can now be static values or functions. (This made some notations change, which will break things)</li>
<li>You can now use the "this" keyword, to make code easier to transfer when making new layers. Also added "this.layer", which is the current layer's name, and works on existing subfeatures (e.g. individual upgrades) as well! Subfeatures also have "this.id".</li>
<li>Fixed a big save issue. If you use a unique mod id, your save will never conflict with other mods.</li>
<li>Added a configurable offline time limit in modinfo at the top of index.html. (default 1 hour)</li>
<li>Added a few minor features, and updated the docs with new information.</li>
</ul><br> </ul><br>
<div class="link" onclick="showTab('old-stuff')">Alpha / Beta</div><br> <a href="https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md" target="_blank" class="link" >Full history</a><br>
</div> </div>
<div v-if="player.tab=='old-stuff'" class="col right">
<button class="back" onclick="showTab('changelog')"></button><br>
<h3>v1.1.1</h3>
<ul>
<li>You can define hotkeys in layer config.</li>
</ul><br>
<h3>v1.1: Enhanced Edition</h3>
<ul>
<li>Added "Buyables", which can function like Space Buildings or Enhancers.</li>
<li>Custom CSS can now be used on any component! Make the third argument an object with the CSS parameters.</li>
<li>Lots of minor good things.</li>
</ul><br>
<h3>v1.0: Technically Something</h3>
<ul>
<li>The first numbered version.</li>
</ul><br>
</div>
<div v-if="player.tab=='info'" class="col right"> <div v-if="player.tab=='info'" class="col right">
<button class="back" onclick="showTab('tree')"></button><br> <button class="back" onclick="showTab('tree')"></button><br>
<h2>{{modInfo.name}}</h2> <h2>{{modInfo.name}}</h2>
@ -175,12 +142,22 @@
<br><br> <br><br>
</div> </div>
<div v-if="layers[layer].tabFormat"> <div v-if="layers[layer].tabFormat">
<div v-for="data in layers[layer].tabFormat"> <div v-if="Array.isArray(layers[layer].tabFormat)">
<div v-if="!Array.isArray(data)" v-bind:is="data" :layer= "layer"></div> <column :layer="layer" :data="layers[layer].tabFormat"></column>
<div v-else-if="data.length==3" v-bind:style="(data[2] ? data[2] : {})" v-bind:is="data[0]" :layer= "layer" :data= "data[1]"></div>
<div v-else-if="data.length==2" v-bind:is="data[0]" :layer= "layer" :data= "data[1]">
</div> </div>
</divs> <div v-else>
<div class="upgTable" v-bind:style="{'margin-top': '-30px', 'margin-bottom': '24px'}">
<div class="upgRow">
<div v-for="tab in Object.keys(layers[layer].tabFormat)">
<button class="tabButton" v-on:click="player[layer].subtab = tab">{{tab}}</button>
</div>
</div>
</div>
<div v-for="tab in Object.keys(layers[layer].tabFormat)">
<column v-if="player[layer].subtab == tab" :layer="layer" :data="layers[layer].tabFormat[tab]"></column>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -5,39 +5,8 @@ var NaNalert = false;
var gameEnded = false; var gameEnded = false;
let VERSION = { let VERSION = {
num: "1.2.4", num: "1.3",
name: "This changes everything!" name: "Finally some real progress!"
}
function startPlayerBase() {
return {
tab: "tree",
time: Date.now(),
autosave: true,
notify: {},
msDisplay: "always",
offlineProd: true,
versionType: "Modding",
version: VERSION.num,
beta: VERSION.beta,
timePlayed: 0,
keepGoing: false,
hasNaN: false,
points: new Decimal(10),
}
}
function getStartPlayer() {
playerdata = startPlayerBase()
for (layer in layers){
playerdata[layer] = layers[layer].startData()
playerdata[layer].buyables = getStartBuyables(layer)
playerdata[layer].spentOnBuyables = new Decimal(0)
playerdata[layer].upgrades = []
playerdata[layer].milestones = []
playerdata[layer].challs = []
}
return playerdata
} }
function getPointGen() { function getPointGen() {

View file

@ -172,23 +172,28 @@ addLayer("c", {
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
// Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js.
tabFormat: ["main-display", tabFormat: {
["prestige-button", function() {return "Melt your points into "}], main:
["blank", "5px"], // Height ["main-display",
["raw-html", function() {return "<button onclick='console.log(`yeet`)'>'HI'</button>"}], ["prestige-button", function() {return "Melt your points into "}],
["display-text", ["blank", "5px"], // Height
function() {return 'I have ' + format(player.points) + ' pointy points!'}, ["raw-html", function() {return "<button onclick='console.log(`yeet`)'>'HI'</button>"}],
{"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}], ["display-text",
["buyables", "150px"], function() {return 'I have ' + format(player.points) + ' pointy points!'},
["row", [ {"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}],
["toggle", ["c", "beep"]], ["blank", ["30px", "10px"]], // Width, height "milestones", "blank", "upgrades", "challs"],
["display-text", function() {return "Beep"}], "blank", thingies: [
["column", [ ["buyables", "150px"], "blank",
["prestige-button", function() {return "Be redundant for "}, {'width': '150px', 'height': '30px'}], ["row", [
["prestige-button", function() {return "Be redundant for "}, {'width': '150px', 'height': '30px'}], ["toggle", ["c", "beep"]], ["blank", ["30px", "10px"]], // Width, height
]], ["display-text", function() {return "Beep"}], "blank",
]], ["column", [
"milestones", "blank", "upgrades", "challs"], ["prestige-button", function() {return "Be redundant for "}, {'width': '150px', 'height': '30px'}],
["prestige-button", function() {return "Be redundant for "}, {'width': '150px', 'height': '30px'}],
]],
]],
],
},
style() {return { style() {return {
'background-color': '#3325CC' 'background-color': '#3325CC'
}}, }},

View file

@ -56,6 +56,40 @@ function save() {
localStorage.setItem(modInfo.id, btoa(JSON.stringify(player))) localStorage.setItem(modInfo.id, btoa(JSON.stringify(player)))
} }
function startPlayerBase() {
return {
tab: "tree",
time: Date.now(),
autosave: true,
notify: {},
msDisplay: "always",
offlineProd: true,
versionType: "Modding",
version: VERSION.num,
beta: VERSION.beta,
timePlayed: 0,
keepGoing: false,
hasNaN: false,
points: new Decimal(10),
}
}
function getStartPlayer() {
playerdata = startPlayerBase()
for (layer in layers){
playerdata[layer] = layers[layer].startData()
playerdata[layer].buyables = getStartBuyables(layer)
playerdata[layer].spentOnBuyables = new Decimal(0)
playerdata[layer].upgrades = []
playerdata[layer].milestones = []
playerdata[layer].challs = []
if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat))
playerdata[layer].subtab = Object.keys(layers[layer].tabFormat)[0]
}
return playerdata
}
function fixSave() { function fixSave() {
defaultData = startPlayerBase() defaultData = startPlayerBase()
for (datum in defaultData){ for (datum in defaultData){
@ -89,6 +123,9 @@ function fixSave() {
player[layer].buyables[id] = new Decimal(0) player[layer].buyables[id] = new Decimal(0)
} }
} }
if (player[layer].subtab == undefined && layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat))
player[layer].subtab = Object.keys(layers[layer].tabFormat)[0]
} }
} }
@ -145,12 +182,12 @@ function versionCheck() {
let setVersion = true let setVersion = true
if (player.versionType===undefined||player.version===undefined) { if (player.versionType===undefined||player.version===undefined) {
player.versionType = "Modding" player.versionType = modInfo.id
player.version = 0 player.version = 0
} }
if (setVersion) { if (setVersion) {
if (player.versionType == "Modding" && VERSION.num > player.version) player.keepGoing = false if (player.versionType == modInfo.id && VERSION.num > player.version) player.keepGoing = false
player.versionType = getStartPlayer().versionType player.versionType = getStartPlayer().versionType
player.version = VERSION.num player.version = VERSION.num
player.beta = VERSION.beta player.beta = VERSION.beta

View file

@ -124,6 +124,20 @@ h1, h2, h3, b, input {
text-shadow: 0px 0px 7px var(--color); text-shadow: 0px 0px 7px var(--color);
} }
.tabButton {
background-color: transparent;
border: none;
color: var(--color);
font-size: 24px;
cursor: pointer;
padding: 10px 50px 10px 50px
}
.tabButton:hover {
transform: scale(1.1, 1.1);
text-shadow: 0px 0px 7px var(--color);
}
.reset { .reset {
height: 120px; height: 120px;
width: 180px; width: 180px;