structure edit done

This commit is contained in:
Yanick Champoux 2023-03-27 13:11:38 -04:00
parent 8bb1955dff
commit e36c13bd2d
4 changed files with 24 additions and 18 deletions

View File

@ -1,5 +1,7 @@
<Section label="structure"> <Section label="structure">
<Hull {...hull} /> <Hull {...hull} />
<Screens {...screens} />
<Armor {...armor} />
<Cargo {...cargo} /> <Cargo {...cargo} />
<Streamlining {...streamlining} /> <Streamlining {...streamlining} />
</Section> </Section>
@ -9,8 +11,12 @@
import Streamlining from "./Structure/Streamlining.svelte"; import Streamlining from "./Structure/Streamlining.svelte";
import Cargo from "./Structure/Cargo.svelte"; import Cargo from "./Structure/Cargo.svelte";
import Hull from "./Structure/Hull.svelte"; import Hull from "./Structure/Hull.svelte";
import Screens from "./Structure/Screens.svelte";
import Armor from "./Structure/Armor.svelte";
export let streamlining = {}; export let streamlining = {};
export let cargo = {}; export let cargo = {};
export let hull = {}; export let hull = {};
export let screens = {};
export let armor = {};
</script> </script>

View File

@ -15,9 +15,9 @@
</ShipItem> </ShipItem>
<script> <script>
import { getContext } from 'svelte'; import { getContext } from "svelte";
import ShipItem from "$lib/components/ShipItem/index.svelte"; import ShipItem from "$lib/components/ShipItem.svelte";
import Field from "$lib/components/Field/index.svelte"; import Field from "$lib/components/Field.svelte";
import Layer from "./Armor/Layer.svelte"; import Layer from "./Armor/Layer.svelte";
export let layers = []; export let layers = [];
@ -25,9 +25,9 @@ import { getContext } from 'svelte';
let nbr_layers = layers.length; let nbr_layers = layers.length;
const { dispatch } = getContext('ship'); const api = getContext("api");
$: dispatch.setArmorLayers(nbr_layers); $: api.dispatch.setNbrArmorLayers(nbr_layers);
</script> </script>
<style> <style>

View File

@ -5,14 +5,14 @@
<script> <script>
import { getContext } from "svelte"; import { getContext } from "svelte";
import Field from "$lib/components/Field/index.svelte"; import Field from "$lib/components/Field.svelte";
export let layer = 1; export let layer = 1;
export let rating = 0; export let rating = 0;
const ship = getContext("ship"); export let api = getContext("api");
$: ship.dispatch.setArmorRating({ layer, rating }); $: api?.dispatch?.setArmorRating?.(layer, rating);
</script> </script>
<style> <style>

View File

@ -1,11 +1,11 @@
<ShipItem {...reqs}> <ShipItem {...reqs}>
<div> <div>
<Field label="screens"> <Field label="screens">
<input class='short' type="number" bind:value={standard} min="0" /> <input class="short" type="number" bind:value={standard} min="0" />
</Field> </Field>
<Field label="advanced screens"> <Field label="advanced screens">
<input class='short' type="number" bind:value={advanced} min="0" /> <input class="short" type="number" bind:value={advanced} min="0" />
</Field> </Field>
</div> </div>
</ShipItem> </ShipItem>
@ -13,17 +13,17 @@
<script> <script>
import { getContext } from "svelte"; import { getContext } from "svelte";
import Section from "$lib/components/Section/index.svelte"; import Section from "$lib/components/Section.svelte";
import Field from "$lib/components/Field/index.svelte"; import Field from "$lib/components/Field.svelte";
import ShipItem from "$lib/components/ShipItem/index.svelte"; import ShipItem from "$lib/components/ShipItem.svelte";
export let reqs = {}; export let reqs = {};
export let standard = 0; export let standard = 0;
export let advanced = 0; export let advanced = 0;
const ship = getContext('ship'); const api = getContext("api");
$: ship.dispatch.setScreens({ standard, advanced }); $: api.dispatch?.setScreens?.({ standard, advanced });
</script> </script>
<style> <style>