mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-02 21:08:12 +00:00
feature: info o elektryfikacji spawnu na scenerii
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
<span v-if="station.onlineInfo">
|
||||
<span
|
||||
class="badge spawn"
|
||||
v-for="(spawn, i) in station.onlineInfo.spawns"
|
||||
v-for="(spawn, i) in sortedSpawns"
|
||||
: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>
|
||||
@@ -37,6 +38,12 @@ export default defineComponent({
|
||||
default: {},
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
sortedSpawns() {
|
||||
return this.station.onlineInfo?.spawns.sort((s1, s2) => (s1.spawnLength < s2.spawnLength ? 1 : -1));
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -44,9 +51,15 @@ export default defineComponent({
|
||||
@import '../../../styles/variables.scss';
|
||||
|
||||
.spawn {
|
||||
color: white;
|
||||
|
||||
&_length {
|
||||
background: $accentCol;
|
||||
color: black;
|
||||
background-color: #404040;
|
||||
color: #cfcfcf;
|
||||
}
|
||||
|
||||
&[data-electrified='true'] > &_name {
|
||||
background-color: #007599;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -41,7 +41,7 @@ export default interface Station {
|
||||
maxUsers: number;
|
||||
currentUsers: number;
|
||||
|
||||
spawns: { spawnName: string; spawnLength: number }[];
|
||||
spawns: { spawnName: string; spawnLength: number; isElectrified: boolean }[];
|
||||
dispatcherRate: number;
|
||||
dispatcherName: string;
|
||||
dispatcherExp: number;
|
||||
|
||||
@@ -66,8 +66,9 @@ export const parseSpawns = (spawnString: string) => {
|
||||
const spawnArray = spawn.split(',');
|
||||
const spawnName = spawnArray[6] ? spawnArray[6] : spawnArray[0];
|
||||
const spawnLength = parseInt(spawnArray[2]);
|
||||
const isElectrified = spawnArray[3] == 'True';
|
||||
|
||||
return { spawnName, spawnLength };
|
||||
return { spawnName, spawnLength, isElectrified };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user