mirror of
https://github.com/thepaperpilot/Dream-Hero.git
synced 2024-11-21 16:13:53 +00:00
Fixed scaling issues on mobile
This commit is contained in:
parent
1af91bd60f
commit
bed86140ee
6 changed files with 39 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div v-bind:style="{ '--height': $store.windowHeight + 'px' }">
|
||||||
<transition name="victory" v-if="$store.cycle >= 5 && !$store.keepPlaying">
|
<transition name="victory" v-if="$store.cycle >= 5 && !$store.keepPlaying">
|
||||||
<div class="victory">
|
<div class="victory">
|
||||||
<h1>You Win!</h1>
|
<h1>You Win!</h1>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
<img src="assets/logo.png" alt="Dream Hero" />
|
<img src="assets/logo.png" alt="Dream Hero" />
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<scroll class="dream" ref="scroll">
|
<scroll class="dream" ref="scroll">
|
||||||
<Floor v-for="(tile, index) in $store.path" :key="index" :index="index" />
|
<Floor v-for="(tile, index) in $store.path" :key="index" :index="index" />
|
||||||
<div v-if="$store.upgrades.Cot >= 1" class="endAtLoop" v-on:click="toggleEndAtLoop">
|
<div v-if="$store.upgrades.Cot >= 1" class="endAtLoop" v-on:pointerdown="toggleEndAtLoop">
|
||||||
<h2 v-if="$store.endAtLoop">Waking up at end of this sleep cycle</h2>
|
<h2 v-if="$store.endAtLoop">Waking up at end of this sleep cycle</h2>
|
||||||
<h2 v-else>Entering deeper sleep at end of this sleep cycle</h2>
|
<h2 v-else>Entering deeper sleep at end of this sleep cycle</h2>
|
||||||
<span>Click to toggle</span>
|
<span>Click to toggle</span>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<button v-on:click="$actions.endDream">Wake Up</button>
|
<button v-on:pointerdown="$actions.endDream">Wake Up</button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</scroll>
|
</scroll>
|
||||||
|
@ -53,11 +53,13 @@ export default {
|
||||||
right: 0;
|
right: 0;
|
||||||
background: var(--bg-color);
|
background: var(--bg-color);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
min-width: 640px;
|
||||||
|
height: calc(var(--height) - 50px);
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.endAtLoop {
|
.endAtLoop {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
max-width: 90vw;
|
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
background: var(--raised-color);
|
background: var(--raised-color);
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:key="index" :action="action" :index="index" />
|
:key="index" :action="action" :index="index" />
|
||||||
</span>
|
</span>
|
||||||
<span v-bind:style="{ width: $store.upgrades.Cot >= 2 && $store.position === index ? '15%' : '0%' }"
|
<span v-bind:style="{ width: $store.upgrades.Cot >= 2 && $store.position === index ? '15%' : '0%' }"
|
||||||
class="endAtFloor" v-on:click="toggleEndAtFloor">
|
class="endAtFloor" v-on:pointerdown="toggleEndAtFloor">
|
||||||
Wake up early:<br/><b>{{ $store.endAtFloor ? "On" : "Off" }}</b>
|
Wake up early:<br/><b>{{ $store.endAtFloor ? "On" : "Off" }}</b>
|
||||||
</span>
|
</span>
|
||||||
<Action :tile="$store.path[index]" />
|
<Action :tile="$store.path[index]" />
|
||||||
|
@ -48,7 +48,6 @@ export default {
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.tile {
|
.tile {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
max-width: 90vw;
|
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
background: var(--raised-color);
|
background: var(--raised-color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="modal">
|
<transition name="modal">
|
||||||
<div class="modal-mask" v-if="show">
|
<div class="modal-mask" v-if="show">
|
||||||
<div class="modal-wrapper" v-on:click.self="$emit('close')">
|
<div class="modal-wrapper" v-on:pointerdown.self="$emit('close')">
|
||||||
<div class="modal-container">
|
<div class="modal-container">
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -45,7 +45,8 @@ export default {
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
min-width: 640px;
|
||||||
|
height: var(--height);
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
display: table;
|
display: table;
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
|
|
|
@ -5,19 +5,19 @@
|
||||||
<div class="town">
|
<div class="town">
|
||||||
<h1 class="background">World Map</h1>
|
<h1 class="background">World Map</h1>
|
||||||
<div v-bind:class="{ building: true, highlight: $store.tutorialOne }" style="top: 500px; left: 700px;"
|
<div v-bind:class="{ building: true, highlight: $store.tutorialOne }" style="top: 500px; left: 700px;"
|
||||||
v-on:click="$actions.openBuilding('Cot')">
|
v-on:pointerdown="$actions.openBuilding('Cot')">
|
||||||
Cot
|
Cot
|
||||||
</div>
|
</div>
|
||||||
<div class="building" v-if="!$store.tutorialOne" style="top: 200px; left: 600px;"
|
<div class="building" v-if="!$store.tutorialOne" style="top: 200px; left: 600px;"
|
||||||
v-on:click="$actions.openBuilding('Bank')">
|
v-on:pointerdown="$actions.openBuilding('Bank')">
|
||||||
Bank
|
Bank
|
||||||
</div>
|
</div>
|
||||||
<div class="building" v-if="!$store.tutorialOne" style="top: 800px; left: 200px;"
|
<div class="building" v-if="!$store.tutorialOne" style="top: 800px; left: 200px;"
|
||||||
v-on:click="$actions.openBuilding('Apothecary')">
|
v-on:pointerdown="$actions.openBuilding('Apothecary')">
|
||||||
Apothecary
|
Apothecary
|
||||||
</div>
|
</div>
|
||||||
<div class="building" v-if="!$store.tutorialOne" style="top: 750px; left: 800px;"
|
<div class="building" v-if="!$store.tutorialOne" style="top: 750px; left: 800px;"
|
||||||
v-on:click="$actions.openBuilding('Armory')">
|
v-on:pointerdown="$actions.openBuilding('Armory')">
|
||||||
Armory
|
Armory
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,6 +113,8 @@ export default {
|
||||||
right: 0;
|
right: 0;
|
||||||
background: var(--bg-color);
|
background: var(--bg-color);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
min-width: 640px;
|
||||||
|
height: calc(var(--height) - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.town-enter {
|
.town-enter {
|
||||||
|
|
|
@ -11,6 +11,7 @@ const storageKey = "thepaperpilot-dream";
|
||||||
|
|
||||||
// Load data from localStorage
|
// Load data from localStorage
|
||||||
const startData = {
|
const startData = {
|
||||||
|
windowHeight: window.innerHeight,
|
||||||
timePlayed: 0,
|
timePlayed: 0,
|
||||||
keepPlaying: false,
|
keepPlaying: false,
|
||||||
points: new Decimal(0),
|
points: new Decimal(0),
|
||||||
|
@ -296,6 +297,7 @@ const actions = window.actions = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Vue.prototype.$actions = actions;
|
Vue.prototype.$actions = actions;
|
||||||
|
Vue.prototype.window = window;
|
||||||
|
|
||||||
// Add utility functions to Vue
|
// Add utility functions to Vue
|
||||||
Vue.prototype.format = format;
|
Vue.prototype.format = format;
|
||||||
|
@ -307,6 +309,10 @@ Vue.config.productionTip = false;
|
||||||
Vue.use(panZoom);
|
Vue.use(panZoom);
|
||||||
Vue.use(PerfectScrollbar, { name: 'scroll' });
|
Vue.use(PerfectScrollbar, { name: 'scroll' });
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
store.windowHeight = window.innerHeight;
|
||||||
|
});
|
||||||
|
|
||||||
// Start Vue
|
// Start Vue
|
||||||
window.vue = new Vue({
|
window.vue = new Vue({
|
||||||
render: h => h(App),
|
render: h => h(App),
|
||||||
|
|
Loading…
Reference in a new issue