2021-05-27 06:14:43 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<span v-if="showPrefix">You have</span>
|
|
|
|
<resource :amount="amount" :color="color" />
|
|
|
|
{{ resource }}<!-- remove whitespace -->
|
2021-07-02 09:50:44 +00:00
|
|
|
<span v-if="effectDisplay">, <component :is="effectDisplay" /></span>
|
2021-05-27 06:14:43 +00:00
|
|
|
<br><br>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { player } from '../../store/proxies';
|
|
|
|
import { layers } from '../../store/layers';
|
|
|
|
import { format, formatWhole } from '../../util/bignum';
|
|
|
|
import { coerceComponent } from '../../util/vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'main-display',
|
2021-06-12 04:38:16 +00:00
|
|
|
inject: [ 'tab' ],
|
2021-05-27 06:14:43 +00:00
|
|
|
props: {
|
2021-06-12 04:38:16 +00:00
|
|
|
layer: String,
|
2021-05-27 06:14:43 +00:00
|
|
|
precision: Number
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
style() {
|
2021-06-12 04:38:16 +00:00
|
|
|
return layers[this.layer || this.tab.layer].componentStyles?.['main-display'];
|
2021-05-27 06:14:43 +00:00
|
|
|
},
|
|
|
|
resource() {
|
2021-06-12 04:38:16 +00:00
|
|
|
return layers[this.layer || this.tab.layer].resource;
|
2021-05-27 06:14:43 +00:00
|
|
|
},
|
2021-07-02 09:50:44 +00:00
|
|
|
effectDisplay() {
|
|
|
|
return coerceComponent(layers[this.layer || this.tab.layer].effectDisplay);
|
2021-05-27 06:14:43 +00:00
|
|
|
},
|
|
|
|
showPrefix() {
|
2021-06-12 04:38:16 +00:00
|
|
|
return player[this.layer || this.tab.layer].points.lt('1e1000');
|
2021-05-27 06:14:43 +00:00
|
|
|
},
|
|
|
|
color() {
|
2021-06-12 04:38:16 +00:00
|
|
|
return layers[this.layer || this.tab.layer].color;
|
2021-05-27 06:14:43 +00:00
|
|
|
},
|
|
|
|
amount() {
|
|
|
|
return this.precision == undefined ?
|
2021-06-12 04:38:16 +00:00
|
|
|
formatWhole(player[this.layer || this.tab.layer].points) :
|
|
|
|
format(player[this.layer || this.tab.layer].points, this.precision);
|
2021-05-27 06:14:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
</style>
|