diff --git a/src/assets/gui/border_dark.png b/src/assets/gui/border_dark.png index 6033206..0b012dc 100644 Binary files a/src/assets/gui/border_dark.png and b/src/assets/gui/border_dark.png differ diff --git a/src/assets/gui/border_light.png b/src/assets/gui/border_light.png index 3f45dc0..6449dc0 100644 Binary files a/src/assets/gui/border_light.png and b/src/assets/gui/border_light.png differ diff --git a/src/assets/gui/border_steel.png b/src/assets/gui/border_steel.png index 3e0a14d..9d4c5e8 100644 Binary files a/src/assets/gui/border_steel.png and b/src/assets/gui/border_steel.png differ diff --git a/src/assets/gui/btn_monochrome.png b/src/assets/gui/btn_monochrome.png new file mode 100644 index 0000000..e178522 Binary files /dev/null and b/src/assets/gui/btn_monochrome.png differ diff --git a/src/assets/gui/btn_monochrome_light.png b/src/assets/gui/btn_monochrome_light.png new file mode 100644 index 0000000..e105ab6 Binary files /dev/null and b/src/assets/gui/btn_monochrome_light.png differ diff --git a/src/assets/gui/btn_monochrome_pressed.png b/src/assets/gui/btn_monochrome_pressed.png new file mode 100644 index 0000000..5aa0d64 Binary files /dev/null and b/src/assets/gui/btn_monochrome_pressed.png differ diff --git a/src/components/CropField.vue b/src/components/CropField.vue index 735994c..9c36a7d 100644 --- a/src/components/CropField.vue +++ b/src/components/CropField.vue @@ -38,7 +38,7 @@ diff --git a/src/components/CropShopView.vue b/src/components/CropShopView.vue index 3960d9a..48f9ebc 100644 --- a/src/components/CropShopView.vue +++ b/src/components/CropShopView.vue @@ -2,41 +2,64 @@
-
Buy
+
Buy
-
Sell
+
Sell
-
-
-
-
-
+
+ +
+ +
@@ -46,21 +69,43 @@ import ItemService from "@/services/ItemService"; import {ItemTypes} from "@/data/ItemTypes"; +import {openModal} from "@/helpers"; export default { name: "CropShopView", data() { return { - active: 'buy' + active: 'buy', + selectedItem: null, + quantity: 1 } }, methods: { - getMaxQuantity(seed) { - return Math.floor(this.$store.state.player.money / seed.economy.buy).toFixed(0) + selectQuantity(item) { + this.selectedItem = item; + openModal('quantityModal'); + console.log(item); + }, + getMaxQuantity(item) { + return Math.floor(this.$store.state.player.money / item.economy.buy).toFixed(0); } }, mounted() { }, + watch: { + selectedItem() { + this.quantity = 1; + }, + quantity() { + if (this.quantity < 1) { + this.quantity = 1; + } + + if (this.quantity > this.getMaxQuantity(this.selectedItem)) { + this.quantity = this.getMaxQuantity(this.selectedItem); + } + } + }, computed: { items() { return ItemService.getItemsByType([ItemTypes.Seeds, ItemTypes.AnimalProducts]); @@ -74,22 +119,18 @@ export default { padding: 4.9em 1em; } -.item-card { - font-size: 0.75em; - margin-bottom: 1em; -} - .item-icon { + display: inline-block; max-height: 3.5em; width: 42px; - background-color: rgba(255, 255, 255, 0.2); + background-color: rgba(100, 100, 100, 0.2); padding: 5px; border-radius: 5px; border: 1px solid saddlebrown; - margin-top: 1em; + margin-right: 0.4em; } -.btn-pixel-border { +.btn-pixel { margin: 0 0 0.5em; font-size: 0.8em; white-space: nowrap; @@ -102,11 +143,6 @@ export default { width: 100%; } -hr { - margin-top: 1em; - color: white; -} - .shop-tab { text-align: center; padding : 0.1em; @@ -116,13 +152,43 @@ hr { .shop-tab:not(.active) { display: inline-block; - opacity: 0.7; } .shop-front { background-color: white; - margin-top: 1em; + margin-top: 0.5em; border-radius: 20px; } +.buy-button { + width: 100%; + text-align: center; +} + +.price-view { + padding-top: 0.5em; + color: green; +} + +#quantityModal .btn-pixel { + text-align: center; +} + +.quantity-input { + text-align: right; + max-width: 100%; + height: 2.7em; +} + +.quantity-button { + height: 2.7em; + width: auto; + margin: 0 0.1em; + display: inline-block; +} + +.number-marker { + color: green; + text-decoration: underline; +} \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js new file mode 100644 index 0000000..56cc6dc --- /dev/null +++ b/src/helpers.js @@ -0,0 +1,6 @@ +import Modal from "bootstrap/js/src/modal"; + +export const openModal = (modalName) => { + const modal = new Modal(document.getElementById(modalName)) + modal.toggle(); +} diff --git a/src/style/_gui-elements.scss b/src/style/_gui-elements.scss new file mode 100644 index 0000000..5b081e3 --- /dev/null +++ b/src/style/_gui-elements.scss @@ -0,0 +1,92 @@ +.grass-border { + background-position: 64px 64px; + + border: 16px solid transparent; + border-image: url(@/assets/border.png) 10% round; + padding-left: 0; + padding-right: 0; + padding-bottom: 10px; +} + +.steel-border { + border: 10px solid transparent; + border-image: url(@/assets/gui/border_steel.png) 36 repeat; + padding-left: 0; + padding-right: 0; +} + +.pixel-border-static { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_light.png) 36 repeat; +} + +.pixel-border-green { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_green.png) 36 repeat; +} + +.pixel-border-red { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_red.png) 36 repeat; +} + +.pixel-border-blue { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_blue.png) 36 repeat; +} + +.pixel-border-magenta { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_magenta.png) 36 repeat; +} + +.pixel-border { + padding: 0; + border: 12px solid transparent; + border-image: url(@/assets/gui/border_light.png) 36 repeat; +} + +.pixel-border:hover { + border-image: url(@/assets/gui/border_dark.png) 36 repeat; +} + +.btn-pixel { + margin-bottom: 5px; + padding: 0 15px; + + background-color: #C9A46A; + border: 12px solid transparent; + border-radius: 7px; + border-image: url('@/assets/gui/btn_light.png') 15 repeat; +} + +.btn-pixel:hover { + border-image: url('@/assets/gui/btn_dark.png') 15 repeat; +} + +.btn-pixel:active { + border-image: url('@/assets/gui/btn_light_pressed.png') 15 repeat; +} + +.btn-pixel-mono { + margin-bottom: 5px; + padding: 0 15px; + + border: 12px solid transparent; + border-radius: 7px; + background-color: #A8A8A8; + border-image: url('@/assets/gui/btn_monochrome_light.png') 15 repeat; +} + +.btn-pixel-mono:hover { + border-image: url('@/assets/gui/btn_monochrome.png') 15 repeat; +} + +.btn-pixel-mono:active { + border-image: url('@/assets/gui/btn_monochrome_pressed.png') 15 repeat; +} diff --git a/src/style/app.scss b/src/style/app.scss index 491bed9..29891db 100644 --- a/src/style/app.scss +++ b/src/style/app.scss @@ -1,5 +1,6 @@ @import "bootswatch/dist/simplex/bootstrap.min.css"; @import "izitoast/dist/css/iziToast.min.css"; +@import "gui-elements"; @font-face { font-family: Pixellari; @@ -7,76 +8,9 @@ } body { - cursor: url("@/assets/cursor/cursor.png"); font-family: 'Pixellari', sans-serif; } - -.grass-border { - background-position: 64px 64px; - - border: 16px solid transparent; - border-image: url(@/assets/border.png) 10% round; - padding-left: 0; - padding-right: 0; - padding-bottom: 10px; -} - -.steel-border { - border: 10px solid transparent; - border-image: url(@/assets/gui/border_steel.png) 36 repeat; - padding-left: 0; - padding-right: 0; -} - -.pixel-border-static { - padding: 0; - border: 12px solid transparent; - border-image: url(@/assets/gui/border_light.png) 36 repeat; -} - -.pixel-border-green { - padding: 0; - border: 12px solid transparent; - border-image: url(@/assets/gui/border_green.png) 36 repeat; -} - -.pixel-border-red { - padding: 0; - border: 12px solid transparent; - border-image: url(@/assets/gui/border_red.png) 36 repeat; -} - -.pixel-border-blue { - padding: 0; - border: 12px solid transparent; - border-image: url(@/assets/gui/border_blue.png) 36 repeat; -} - -.pixel-border { - padding: 0; - border: 12px solid transparent; - border-image: url(@/assets/gui/border_light.png) 36 repeat; -} - -.pixel-border:hover { - border-image: url(@/assets/gui/border_dark.png) 36 repeat; -} - -.btn-pixel-border { - margin-bottom: 5px; - padding: 0 15px; - - background-color: #C9A46A; - border: 12px solid transparent; - border-radius: 7px; - border-image: url('@/assets/gui/btn_light.png') 15 repeat; -} - -.btn-pixel-border:hover { - border-image: url('@/assets/gui/btn_dark.png') 15 repeat; -} - -.btn-pixel-border:active { - border-image: url('@/assets/gui/btn_light_pressed.png') 15 repeat; -} +.text-right { + text-align: right; +} \ No newline at end of file