mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 13:58:12 +00:00
feature: info o elektryfikacji spawnu na scenerii
This commit is contained in:
@@ -1,52 +1,65 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="info-spawn-list">
|
<section class="info-spawn-list">
|
||||||
<h3 class="spawn-header section-header">
|
<h3 class="spawn-header section-header">
|
||||||
<img :src="getIcon('spawn')" alt="icon-spawn" />
|
<img :src="getIcon('spawn')" alt="icon-spawn" />
|
||||||
{{ $t('scenery.spawns') }}
|
{{ $t('scenery.spawns') }}
|
||||||
<span class="text--primary">{{ station.onlineInfo?.spawns.length || '0' }}</span>
|
<span class="text--primary">{{ station.onlineInfo?.spawns.length || '0' }}</span>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<span v-if="station.onlineInfo">
|
<span v-if="station.onlineInfo">
|
||||||
<span
|
<span
|
||||||
class="badge spawn"
|
class="badge spawn"
|
||||||
v-for="(spawn, i) in station.onlineInfo.spawns"
|
v-for="(spawn, i) in sortedSpawns"
|
||||||
:key="spawn.spawnName + station.onlineInfo?.dispatcherName + i"
|
:key="spawn.spawnName + station.onlineInfo?.dispatcherName + i"
|
||||||
>
|
:data-electrified="spawn.isElectrified"
|
||||||
<span class="spawn_name">{{ spawn.spawnName }}</span>
|
>
|
||||||
<span class="spawn_length">{{ spawn.spawnLength }}m</span>
|
<span class="spawn_name">{{ spawn.spawnName }}</span>
|
||||||
</span>
|
<span class="spawn_length">{{ spawn.spawnLength }}m</span>
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
<span class="badge spawn badge-none" v-if="!station.onlineInfo || station.onlineInfo.spawns.length == 0"
|
|
||||||
>{{ $t('scenery.no-spawns') }}
|
<span class="badge spawn badge-none" v-if="!station.onlineInfo || station.onlineInfo.spawns.length == 0"
|
||||||
</span>
|
>{{ $t('scenery.no-spawns') }}
|
||||||
</section>
|
</span>
|
||||||
</template>
|
</section>
|
||||||
|
</template>
|
||||||
<script lang="ts">
|
|
||||||
import { defineComponent } from 'vue';
|
<script lang="ts">
|
||||||
import imageMixin from '../../../mixins/imageMixin';
|
import { defineComponent } from 'vue';
|
||||||
import Station from '../../../scripts/interfaces/Station';
|
import imageMixin from '../../../mixins/imageMixin';
|
||||||
|
import Station from '../../../scripts/interfaces/Station';
|
||||||
export default defineComponent({
|
|
||||||
mixins: [imageMixin],
|
export default defineComponent({
|
||||||
|
mixins: [imageMixin],
|
||||||
props: {
|
|
||||||
station: {
|
props: {
|
||||||
type: Object as () => Station,
|
station: {
|
||||||
default: {},
|
type: Object as () => Station,
|
||||||
},
|
default: {},
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
</script>
|
|
||||||
|
computed: {
|
||||||
<style lang="scss" scoped>
|
sortedSpawns() {
|
||||||
@import '../../../styles/variables.scss';
|
return this.station.onlineInfo?.spawns.sort((s1, s2) => (s1.spawnLength < s2.spawnLength ? 1 : -1));
|
||||||
|
},
|
||||||
.spawn {
|
},
|
||||||
&_length {
|
});
|
||||||
background: $accentCol;
|
</script>
|
||||||
color: black;
|
|
||||||
}
|
<style lang="scss" scoped>
|
||||||
}
|
@import '../../../styles/variables.scss';
|
||||||
</style>
|
|
||||||
|
.spawn {
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
&_length {
|
||||||
|
background-color: #404040;
|
||||||
|
color: #cfcfcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-electrified='true'] > &_name {
|
||||||
|
background-color: #007599;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default interface Station {
|
|||||||
maxUsers: number;
|
maxUsers: number;
|
||||||
currentUsers: number;
|
currentUsers: number;
|
||||||
|
|
||||||
spawns: { spawnName: string; spawnLength: number }[];
|
spawns: { spawnName: string; spawnLength: number; isElectrified: boolean }[];
|
||||||
dispatcherRate: number;
|
dispatcherRate: number;
|
||||||
dispatcherName: string;
|
dispatcherName: string;
|
||||||
dispatcherExp: number;
|
dispatcherExp: number;
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ export const parseSpawns = (spawnString: string) => {
|
|||||||
const spawnArray = spawn.split(',');
|
const spawnArray = spawn.split(',');
|
||||||
const spawnName = spawnArray[6] ? spawnArray[6] : spawnArray[0];
|
const spawnName = spawnArray[6] ? spawnArray[6] : spawnArray[0];
|
||||||
const spawnLength = parseInt(spawnArray[2]);
|
const spawnLength = parseInt(spawnArray[2]);
|
||||||
|
const isElectrified = spawnArray[3] == 'True';
|
||||||
|
|
||||||
return { spawnName, spawnLength };
|
return { spawnName, spawnLength, isElectrified };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user