- Masa: {{ totalMass }}t | Długość:
- {{ totalLength }}m
- | Vmax pociągu: {{ maxStockSpeed }} km/h
+ Masa: {{ store.totalMass }}t | Długość:
+ {{ store.totalLength }}m
+ | Vmax pociągu: {{ store.maxStockSpeed }} km/h
-
@@ -131,42 +131,16 @@ import subIcon from '../assets/sub-icon.svg';
import removeIcon from '../assets/remove-icon.svg';
import lowerIcon from '../assets/lower-icon.svg';
import higherIcon from '../assets/higher-icon.svg';
+import { useStore } from '../store';
export default defineComponent({
components: { RandomizerCard, TrainImage },
setup() {
- const store = inject('Store') as IStore;
-
- const isRandomizerCardOpen = ref(false);
-
- provide('isCardOpen', isRandomizerCardOpen);
- provide('chosenLength', ref(350));
- provide('chosenMass', ref(1000));
- provide('chosenLocoType', ref('loco-e'));
- provide('chosenCarTypes', reactive([]));
- provide('includeSupporterVehicles', ref(false));
+ const store = useStore();
return {
store,
- locoDataList: inject('locoDataList') as ILocomotive[],
- carDataList: inject('carDataList') as ICarWagon[],
- isTrainPassenger: inject('isTrainPassenger') as boolean,
- totalLength: inject('totalLength') as number,
- totalMass: inject('totalMass') as number,
- maxStockSpeed: inject('maxStockSpeed') as number,
- maxAllowedSpeed: inject('maxAllowedSpeed') as number,
-
- warnings: inject('warnings') as {
- locoNotSuitable: ComputedRef;
- trainTooLong: ComputedRef;
- trainTooHeavy: ComputedRef;
- tooManyLocos: ComputedRef;
- },
-
- isRandomizerCardOpen,
-
- hasSupporterOnlyVehicle: computed(() => store.stockList.some((stock) => stock.supportersOnly)),
};
},
@@ -221,10 +195,10 @@ export default defineComponent({
methods: {
copyToClipboard() {
- if (Object.values(this.warnings).some((v) => v.value == true)) {
- alert('Jazda tym pociągiem jest niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
- return;
- }
+ // if (Object.values(this.warnings).some((v) => v.value == true)) {
+ // alert('Jazda tym pociągiem jest niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
+ // return;
+ // }
navigator.clipboard.writeText(this.stockString);
@@ -247,7 +221,7 @@ export default defineComponent({
if (vehicle.isLoco) {
this.store.chosenLocoPower = vehicle.useType;
- this.store.chosenLoco = this.locoDataList.find((v) => v.type == vehicle.type) || null;
+ this.store.chosenLoco = this.store.locoDataList.find((v) => v.type == vehicle.type) || null;
this.store.chosenCar = null;
this.store.chosenCargo = null;
@@ -255,7 +229,7 @@ export default defineComponent({
this.store.chosenCarUseType = vehicle.useType;
this.store.chosenLoco = null;
- this.store.chosenCar = this.carDataList.find((v) => v.type == vehicle.type) || null;
+ this.store.chosenCar = this.store.carDataList.find((v) => v.type == vehicle.type) || null;
this.store.chosenCargo = vehicle.cargo || null;
}
@@ -333,15 +307,11 @@ export default defineComponent({
}
},
- openRandomizerCard() {
- this.isRandomizerCardOpen = true;
- },
-
downloadStock() {
- if (Object.values(this.warnings).some((v) => v.value == true)) {
- alert('Jazda tym pociągiem może być niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
- return;
- }
+ // if (Object.values(this.warnings).some((v) => v.value == true)) {
+ // alert('Jazda tym pociągiem może być niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
+ // return;
+ // }
const fileName = prompt('Nazwij plik:', 'pociag');
diff --git a/src/components/RandomizerCard.vue b/src/components/RandomizerCard.vue
index 3b5f4dc..df71b09 100644
--- a/src/components/RandomizerCard.vue
+++ b/src/components/RandomizerCard.vue
@@ -57,7 +57,7 @@
Wybierz preferowaną długość składu (m) i (opcjonalnie) max. masę (t)
-
+