-
-
-
+
+
+
+
+
+
i
+
+
v{{ version }}
-
i
-
-
v{{ version }}
+
+
+
+
diff --git a/src/components/system/TPS.vue b/src/components/system/TPS.vue
index 45f6c86..f3dcdcd 100644
--- a/src/components/system/TPS.vue
+++ b/src/components/system/TPS.vue
@@ -23,6 +23,6 @@ export default {
position: absolute;
left: 10px;
bottom: 10px;
- z-index: 10000000;
+ z-index: 100;
}
diff --git a/src/components/system/Tabs.vue b/src/components/system/Tabs.vue
index 7d4141a..93c2015 100644
--- a/src/components/system/Tabs.vue
+++ b/src/components/system/Tabs.vue
@@ -2,7 +2,9 @@
@@ -10,13 +12,19 @@
+
+
+
+
diff --git a/src/components/system/fields/Toggle.vue b/src/components/system/fields/Toggle.vue
new file mode 100644
index 0000000..194e676
--- /dev/null
+++ b/src/components/system/fields/Toggle.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
diff --git a/src/components/system/fields/fields.css b/src/components/system/fields/fields.css
new file mode 100644
index 0000000..3a00431
--- /dev/null
+++ b/src/components/system/fields/fields.css
@@ -0,0 +1,8 @@
+.field {
+ display: flex;
+ position: relative;
+ height: 2em;
+ margin: 10px 0;
+ user-select: none;
+ justify-content: space-between;
+}
diff --git a/src/data/layers.js b/src/data/layers.js
new file mode 100644
index 0000000..aa30201
--- /dev/null
+++ b/src/data/layers.js
@@ -0,0 +1,9 @@
+// TODO create example layer and import it
+
+export const layers = {
+
+};
+
+export const hotkeys = [
+
+];
diff --git a/src/data/mod.js b/src/data/mod.js
index 2629787..a1aef1c 100644
--- a/src/data/mod.js
+++ b/src/data/mod.js
@@ -1,14 +1,12 @@
-// import TreeTab from '../components/system/TreeTab.vue';
// Import Decimal and numberUtils from a different file to globally change which big num library gets used
import Decimal, * as numberUtils from '../util/break_eternity.js';
-export default {
+const modInfo = {
// General Info
title: "The Modding Tree X",
- banner: null,
id: "tmt-x",
author: "thepaperpilot",
- discordName: "TMT-X Server",
+ discordName: "TMT-X",
discordLink: "https://discord.gg/WzejVAx",
// Gameplay Options
@@ -17,10 +15,14 @@ export default {
points: new Decimal(10),
}
},
- // TODO getPointGen or some abstract version?
hasWon() {
return false;
},
+ update(delta) {
+ let gain = new Decimal(1);
+ // TODO add gain to player.deltas
+ gain.times(delta);
+ },
// Version
versionNumber: "0.0",
@@ -28,8 +30,11 @@ export default {
// UI options
allowSmall: false,
- useHeader: true,
- //defaultTab: TreeTab
+ defaultDecimalsShown: 2,
+ useHeader: false,
+ banner: null,
+ logo: null,
+ initialTabs: ["tree-tab", "info-tab", "dummy"],
// Advanced Options
/* eslint-disable-next-line no-unused-vars */
@@ -38,3 +43,7 @@ export default {
bigNum: { Decimal, ...numberUtils },
maxTickLength: 3600
};
+
+document.title = modInfo.title;
+
+export default modInfo;
diff --git a/src/data/themes.js b/src/data/themes.js
index 6312c4a..fa331e2 100644
--- a/src/data/themes.js
+++ b/src/data/themes.js
@@ -1,12 +1,15 @@
const defaultTheme = {
"--background": "#0f0f0f",
- "--background_tooltip": "rgba(0, 0, 0, 0.75)",
- "--background_nav": "#0f0f0f",
+ "--background-tooltip": "rgba(0, 0, 0, 0.75)",
+ "--secondary-background": "#0f0f0f",
"--color": "#dfdfdf",
"--points": "#ffffff",
"--locked": "#bf8f8f",
"--link": "#02f2f2",
- "--separator": "#dfdfdf"
+ "--separator": "#dfdfdf",
+ "--border-radius": "25%",
+ "--danger": "rgb(220, 53, 69)",
+ "--modal-border": "solid 2px var(--color)"
};
export default {
@@ -14,14 +17,16 @@ export default {
paper: {
...defaultTheme,
"--background": "#2a323d",
- "--background_nav": "#333c4a",
- "--separator": "#333c4a"
+ "--secondary-background": "#333c4a",
+ "--separator": "#333c4a",
+ "--border-radius": "4px",
+ "--modal-border": ""
},
- aquad: {
+ aqua: {
...defaultTheme,
"--background": "#001f3f",
- "--background_tooltip": "rgba(0, 15, 31, 0.75)",
- "--background_nav": "#001f3f",
+ "--background-tooltip": "rgba(0, 15, 31, 0.75)",
+ "--secondary-background": "#001f3f",
"--color": "#bfdfff",
"--points": "#dfefff",
"--locked": "#c4a7b3",
diff --git a/src/main.js b/src/main.js
index cccd020..2d60b3a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,12 +1,17 @@
import Vue from 'vue';
import App from './App.vue';
import store from './store';
+import { layers, hotkeys } from './data/layers.js';
+// Setup
Vue.config.productionTip = false;
-
window.player = store.state;
-new Vue({
+// Create Vue
+window.vue = new Vue({
store,
- render: h => h(App)
+ render: h => h(App),
+ data: { layers, hotkeys }
}).$mount('#app');
+
+// Start game loop
diff --git a/src/store/index.js b/src/store/index.js
index 14b938e..9462b38 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,15 +1,11 @@
import Vue from 'vue'
import Vuex from 'vuex'
import { getInitialStore } from '../util/load.js';
+import mutations from './mutations';
Vue.use(Vuex)
export default new Vuex.Store({
state: getInitialStore(),
- mutations: {
- },
- actions: {
- },
- modules: {
- }
+ mutations
})
diff --git a/src/store/mutations.js b/src/store/mutations.js
new file mode 100644
index 0000000..7aa1d0d
--- /dev/null
+++ b/src/store/mutations.js
@@ -0,0 +1,16 @@
+import Vue from 'vue';
+
+export const SET_TABS = 'SET_TABS';
+export const SET_SETTING = 'SET_SETTING';
+
+export default {
+ [SET_TABS](state, tabs) {
+ Vue.set(state, 'tabs', tabs);
+ },
+ [SET_SETTING](state, { setting, value }) {
+ if (value == null) {
+ value = !state[setting];
+ }
+ state[setting] = value;
+ }
+};
diff --git a/src/util/break_eternity.js b/src/util/break_eternity.js
index bc03dcc..0137331 100644
--- a/src/util/break_eternity.js
+++ b/src/util/break_eternity.js
@@ -12,7 +12,7 @@ export function exponentialFormat(num, precision, mantissa = true) {
m = decimalOne;
e = e.add(1);
}
- e = (e.gte(1e9) ? format(e, 3) : (e.gte(10000) ? commaFormat(e, 0) : e.toStringWithDecimalPlaces(0)))
+ e = (e.gte(1e9) ? format(e, Math.max(Math.max(precision, 3), modInfo.defaultDecimalsShown)) : (e.gte(10000) ? commaFormat(e, 0) : e.toStringWithDecimalPlaces(0)))
if (mantissa) {
return m.toStringWithDecimalPlaces(precision)+"e"+e;
} else {
@@ -42,12 +42,13 @@ export function regularFormat(num, precision) {
return (0).toFixed(precision);
}
if (num.mag < 0.1 && precision !== 0) {
- precision = Math.max(precision, 4);
+ precision = Math.max(Math.max(precision, 4), modInfo.defaultDecimalsShown);
}
return num.toStringWithDecimalPlaces(precision);
}
-export function format(decimal, precision=2, small) {
+export function format(decimal, precision = null, small) {
+ if (precision == null) precision = modInfo.defaultDecimalsShown;
small = small || modInfo.allowSmall;
decimal = new Decimal(decimal);
if (isNaN(decimal.sign)||isNaN(decimal.layer)||isNaN(decimal.mag)) {
@@ -96,10 +97,10 @@ export function formatWhole(decimal) {
return "-"+formatWhole(decimal.neg());
}
if (decimal.gte(1e9)) {
- return format(decimal, 2);
+ return format(decimal);
}
if (decimal.lte(0.98) && !decimal.eq(0)) {
- return format(decimal, 2);
+ return format(decimal);
}
return format(decimal, 0);
}
@@ -128,7 +129,7 @@ export function toPlaces(x, precision, maxAccepted) {
}
// Will also display very small numbers
-export function formatSmall(x, precision=2) {
+export function formatSmall(x, precision = null) {
return format(x, precision, true);
}
diff --git a/src/util/common.js b/src/util/common.js
new file mode 100644
index 0000000..140e5ab
--- /dev/null
+++ b/src/util/common.js
@@ -0,0 +1,6 @@
+// Reference: https://stackoverflow.com/questions/7225407/convert-camelcasetext-to-sentence-case-text
+export function camelToTitle(camel) {
+ let title = camel.replace(/([A-Z])/g, " $1");
+ title = title.charAt(0).toUpperCase() + title.slice(1);
+ return title;
+}
diff --git a/src/util/load.js b/src/util/load.js
index cef2997..2306b90 100644
--- a/src/util/load.js
+++ b/src/util/load.js
@@ -2,7 +2,7 @@ import modInfo from '../data/mod.js';
export function getInitialStore() {
return {
- tabs: ["tree-tab", "info-tab", "dummy"],
+ tabs: modInfo.initialTabs.slice(),
time: Date.now(),
autosave: true,
offlineProd: true,
@@ -11,6 +11,7 @@ export function getInitialStore() {
hasNaN: false,
lastTenTicks: [],
showTPS: true,
+ theme: "paper",
...modInfo.getStartingData()
}
}