forked from noxious/client
Updated tiles, improved folder & file structure, npm update, more progress on zone editor
This commit is contained in:
326
src/screens/Characters.vue
Normal file
326
src/screens/Characters.vue
Normal file
@ -0,0 +1,326 @@
|
||||
<template>
|
||||
<div class="character-select-screen">
|
||||
<div class="ui-wrapper">
|
||||
<div class="characters-wrapper" v-if="!isLoading">
|
||||
<div v-for="character in characters" :key="character.id" class="character" :class="{ active: selected_character == character.id }">
|
||||
<input type="radio" :id="character.id" name="character" :value="character.id" v-model="selected_character" />
|
||||
<label :for="character.id">{{ character.name }}</label>
|
||||
<!-- @TODO : Add a confirmation dialog -->
|
||||
<button class="delete" @click="delete_character(character.id)">
|
||||
<img draggable="false" src="/assets/icons/trashcan.svg" />
|
||||
</button>
|
||||
|
||||
<div class="sprite-container">
|
||||
<img draggable="false" src="/assets/avatar/default/0.png" />
|
||||
</div>
|
||||
<span>Lvl. {{ character.level }}</span>
|
||||
</div>
|
||||
|
||||
<div class="character new-character" v-if="characters.length < 4">
|
||||
<button @click="isModalOpen = true">
|
||||
<img draggable="false" src="/assets/icons/plus-icon.svg" />
|
||||
<span>Create new</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="loading-spinner">
|
||||
<img src="/assets/icons/loading-icon1.svg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-wrapper" v-if="!isLoading">
|
||||
<button class="btn-cyan" :disabled="!selected_character" @click="select_character()">
|
||||
PLAY
|
||||
<img draggable="false" src="/assets/icons/arrow.svg" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Modal :isModalOpen="isModalOpen" @modal:close="isModalOpen = false">
|
||||
<template #modalHeader>
|
||||
<h3 class="modal-title">Create your character</h3>
|
||||
</template>
|
||||
|
||||
<template #modalBody>
|
||||
<form method="post" @submit.prevent="create" class="modal-form">
|
||||
<div class="form-fields">
|
||||
<label for="name">Name</label>
|
||||
<input v-model="name" name="name" id="name" />
|
||||
</div>
|
||||
<div class="submit">
|
||||
<button class="btn-cyan" type="submit">CREATE</button>
|
||||
</div>
|
||||
</form>
|
||||
<button class="btn-cyan" @click="isModalOpen = false">CANCEL</button>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSocketStore } from '@/stores/socket'
|
||||
import { onBeforeMount, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import Modal from '@/components/utilities/Modal.vue'
|
||||
import { type Character as CharacterT } from '@/types'
|
||||
|
||||
const isLoading = ref(true)
|
||||
const characters = ref([])
|
||||
const socket = useSocketStore()
|
||||
|
||||
// Fetch characters
|
||||
socket.connection.on('character:list', (data: any) => {
|
||||
characters.value = data
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// wait 1.5 sec
|
||||
setTimeout(() => {
|
||||
socket.connection.emit('character:list')
|
||||
isLoading.value = false
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
// Select character logics
|
||||
const selected_character = ref(null)
|
||||
function select_character() {
|
||||
if (!selected_character.value) return
|
||||
socket.connection.emit('character:connect', { character_id: selected_character.value })
|
||||
socket.connection.on('character:connect', (data: CharacterT) => socket.setCharacter(data))
|
||||
}
|
||||
|
||||
// Delete character logics
|
||||
function delete_character(character_id: number) {
|
||||
if (!character_id) return
|
||||
socket.connection.emit('character:delete', { character_id: character_id })
|
||||
}
|
||||
|
||||
// Create character logics
|
||||
const isModalOpen = ref(false)
|
||||
const name = ref('')
|
||||
function create() {
|
||||
socket.connection.on('character:create:success', (data: CharacterT) => {
|
||||
socket.setCharacter(data)
|
||||
isModalOpen.value = false
|
||||
})
|
||||
socket.connection.emit('character:create', { name: name.value })
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
socket.connection.off('character:list')
|
||||
socket.connection.off('character:connect')
|
||||
socket.connection.off('character:create:success')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/assets/scss/main';
|
||||
|
||||
.character-select-screen {
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background-image: url('/assets/shapes/select-screen-bg-shape.svg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100% cover;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
background-color: $dark-gray;
|
||||
position: relative;
|
||||
|
||||
.ui-wrapper {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 80px;
|
||||
padding: 0 80px;
|
||||
&::before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.loading-spinner img {
|
||||
width: 5rem;
|
||||
// css color
|
||||
filter: invert(1);
|
||||
// white
|
||||
filter: invert(80%);
|
||||
}
|
||||
|
||||
.characters-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 60px;
|
||||
width: 100%;
|
||||
max-height: 650px;
|
||||
overflow: auto;
|
||||
|
||||
.character {
|
||||
margin: 15px;
|
||||
width: 170px;
|
||||
height: 275px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 20px;
|
||||
position: relative;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('/assets/shapes/character-select-shape-2.svg');
|
||||
box-shadow: 0 4px 30px rgba($black, 0.1);
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
max-width: 0;
|
||||
width: 65%;
|
||||
height: 3px;
|
||||
background-color: $white;
|
||||
border-radius: 3px;
|
||||
left: 50%;
|
||||
bottom: -15px;
|
||||
transform: translateX(-50%);
|
||||
transition: ease-in-out max-width 0.3s;
|
||||
}
|
||||
|
||||
&.active::after {
|
||||
max-width: 170px;
|
||||
}
|
||||
|
||||
&.new-character {
|
||||
background-color: rgba($light-gray, 0.5);
|
||||
background-image: none;
|
||||
|
||||
button {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 40px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
&::before {
|
||||
content: '';
|
||||
}
|
||||
img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
span {
|
||||
align-self: center;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input[type='radio'] {
|
||||
opacity: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 20px;
|
||||
max-width: 130px;
|
||||
transform: translateY(-50%) translateX(-50%);
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-shadow: 1px 1px 5px rgba($black, 0.25);
|
||||
}
|
||||
|
||||
button.delete {
|
||||
background-color: $red;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding: 3px;
|
||||
border-radius: 100%;
|
||||
position: absolute;
|
||||
right: -15px;
|
||||
top: 0;
|
||||
transform: translateY(-50%);
|
||||
z-index: 1;
|
||||
border: 2px solid $white;
|
||||
|
||||
&:hover {
|
||||
background-color: $dark-red;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
transform: translateY(50%);
|
||||
z-index: 1;
|
||||
text-shadow: 1px 1px 5px rgba($black, 0.25);
|
||||
}
|
||||
|
||||
.sprite-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
|
||||
img {
|
||||
filter: drop-shadow(0 3px 6px rgba($black, 0.25));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-wrapper {
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
|
||||
button {
|
||||
padding: 8px 10px 8px 30px;
|
||||
min-width: 100px;
|
||||
position: relative;
|
||||
border-radius: 5px;
|
||||
font-size: 1.25rem;
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
align-items: center;
|
||||
transition: ease-in-out gap 0.2s;
|
||||
|
||||
span {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 30px;
|
||||
filter: drop-shadow(0 4px 6px rgba($black, 0.25));
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background-color: rgba($cyan, 0.5);
|
||||
cursor: not-allowed;
|
||||
&:hover {
|
||||
gap: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
gap: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
120
src/screens/Game.vue
Normal file
120
src/screens/Game.vue
Normal file
@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div class="game-container">
|
||||
<Game class="game" :config="gameConfig" @create="createGame">
|
||||
<Scene name="main" @preload="preloadScene" @create="createScene">
|
||||
<GmTools />
|
||||
<div v-if="!zoneEditorStore.active">
|
||||
<div class="top-ui"><Hud /></div>
|
||||
<World />
|
||||
<div class="bottom-ui"><Chat /> <Menubar /></div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<ZoneEditor />
|
||||
</div>
|
||||
</Scene>
|
||||
</Game>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import 'phaser'
|
||||
import { Game, Scene } from 'phavuer'
|
||||
import World from '@/components/World.vue'
|
||||
import Hud from '@/components/gui/Hud.vue'
|
||||
import Chat from '@/components/gui/Chat.vue'
|
||||
import Menubar from '@/components/gui/Menu.vue'
|
||||
import { onUnmounted } from 'vue'
|
||||
import GmTools from '@/components/utilities/GmTools.vue'
|
||||
import { useSocketStore } from '@/stores/socket'
|
||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
import ZoneEditor from '@/components/utilities/zoneEditor/ZoneEditor.vue'
|
||||
|
||||
const socket = useSocketStore()
|
||||
const zoneEditorStore = useZoneEditorStore()
|
||||
|
||||
onUnmounted(() => {
|
||||
socket.disconnectSocket()
|
||||
})
|
||||
|
||||
// on page close
|
||||
addEventListener('beforeunload', () => {
|
||||
socket.disconnectSocket()
|
||||
})
|
||||
|
||||
const gameConfig = {
|
||||
name: 'New Quest',
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
type: Phaser.WEBGL,
|
||||
pixelArt: true
|
||||
}
|
||||
|
||||
const createGame = (game: Phaser.Game) => {
|
||||
addEventListener('resize', () => {
|
||||
game.scale.resize(window.innerWidth, window.innerHeight)
|
||||
})
|
||||
}
|
||||
|
||||
const preloadScene = (scene: Phaser.Scene) => {
|
||||
/**
|
||||
* @TODO
|
||||
* Write logic that downloads all assets from out websocket or http server in base64 format
|
||||
* Don't forget to check how intensive that operation is with sockets for performance
|
||||
*/
|
||||
scene.load.image('tiles', '/assets/tiles/default.png')
|
||||
scene.load.image('waypoint', '/assets/waypoint.png')
|
||||
scene.textures.addBase64(
|
||||
'character',
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAABeCAYAAAAwnXTzAAAHWUlEQVR4nLVaQUhcRxj+DCuILruHXdbnYkBimkdFdouwFBdWKCWHHkoChragmAo9pKG3ltQGWrGHkEpzS0t7Mgn2EiIYcvQiLurBIF0RYYtbFiK6Lhqyiy4BBXt4+8/OzHvz3ryN/eCx782bN9/8//z/P//MbMvHP/wJXXTMTJ45lR+PT7XothHwQzQ8OIBUpt/2fmLaeq9D7EnYMTN5Njw4ALM3iFC8B0Y6ifZYWKjzKJ1EaSWHienJMy/SCzpkqUy/QNZqJISrPRaGkU7i/p0xpdq1CAHA7A0CAIx0UlnHD6mSkKQLxXu8+iTArWOuhCrUyhWclDZc67hJqWWlTqTt2LCV6aApQj8EMjxVWt0tAgBOD8tNEcjwlDBfOAIKm/jE7NJq8Mvr374b4affjwA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et('characterW', '/assets/avatar/default/walk.png', { frameWidth: 36, frameHeight: 94 })
|
||||
}
|
||||
|
||||
const playScene = (scene: Phaser.Scene) => {}
|
||||
|
||||
const createScene = (scene: Phaser.Scene) => {
|
||||
scene.anims.create({
|
||||
key: 'walk',
|
||||
frameRate: 7,
|
||||
frames: scene.anims.generateFrameNumbers('characterW', { start: 0, end: 3 }),
|
||||
repeat: -1
|
||||
})
|
||||
|
||||
// const grid = scene.add.grid(0, 0, window.innerWidth, window.innerHeight, 64, 32, 0, 0, 0xff0000, 0.5).setOrigin(0, 0);
|
||||
//
|
||||
// window.addEventListener('resize', () => {
|
||||
// grid.setSize(window.innerWidth, window.innerHeight);
|
||||
// });
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.game-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
padding: 30px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-ui,
|
||||
.bottom-ui {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 48px;
|
||||
}
|
||||
|
||||
.top-ui {
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.bottom-ui {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
bottom: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
212
src/screens/Login.vue
Normal file
212
src/screens/Login.vue
Normal file
@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div class="login-screen">
|
||||
<div class="content-wrapper">
|
||||
<h1 class="main-title">NEW QUEST</h1>
|
||||
<form @submit.prevent="loginFunc">
|
||||
<div class="content-elements">
|
||||
<div class="login-form">
|
||||
<div class="form-field">
|
||||
<label for="username">Username</label>
|
||||
<input id="username" v-model="username" type="text" name="username" required autofocus />
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<label for="password">Password</label>
|
||||
<input id="password" v-model="password" type="password" name="password" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-buttons">
|
||||
<button class="button btn-cyan" type="submit"><span>PLAY</span></button>
|
||||
<button class="button btn-cyan" type="button" @click.prevent="registerFunc"><span>REGISTER</span></button>
|
||||
<button class="button btn-cyan"><span>CREDITS</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<audio ref="bgm" id="bgm" src="/assets/music/bgm.mp3" loop autoplay></audio>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { login, register } from '@/services/authentication'
|
||||
import { useNotificationStore } from '@/stores/notifications'
|
||||
import { useSocketStore } from '@/stores/socket'
|
||||
|
||||
const bgm = ref('bgm')
|
||||
if (bgm.value.paused) {
|
||||
addEventListener('click', () => bgm.value.play())
|
||||
addEventListener('keydown', () => bgm.value.play())
|
||||
}
|
||||
|
||||
const socket = useSocketStore()
|
||||
const notifications = useNotificationStore()
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
|
||||
// automatic login because of development
|
||||
onMounted(async () => {
|
||||
const response = await login('ethereal', 'kanker123')
|
||||
|
||||
if (response.success === undefined) {
|
||||
notifications.addNotification({ message: response.error })
|
||||
}
|
||||
|
||||
socket.setToken(response.token)
|
||||
socket.initConnection()
|
||||
})
|
||||
|
||||
async function loginFunc() {
|
||||
// check if username and password are valid
|
||||
if (username.value === '' || password.value === '') {
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' })
|
||||
return
|
||||
}
|
||||
|
||||
// send login event to server
|
||||
const response = await login(username.value, password.value)
|
||||
|
||||
if (response.success === undefined) {
|
||||
notifications.addNotification({ message: response.error })
|
||||
return
|
||||
}
|
||||
|
||||
socket.setToken(response.token)
|
||||
socket.initConnection()
|
||||
}
|
||||
|
||||
async function registerFunc() {
|
||||
// check if username and password are valid
|
||||
if (username.value === '' || password.value === '') {
|
||||
notifications.addNotification({ message: 'Please enter a valid username and password' })
|
||||
return
|
||||
}
|
||||
|
||||
// send register event to server
|
||||
const response = await register(username.value, password.value)
|
||||
|
||||
if (response.success === undefined) {
|
||||
notifications.addNotification({ message: response.error })
|
||||
return
|
||||
}
|
||||
|
||||
socket.setToken(response.token)
|
||||
socket.initConnection()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/assets/scss/main';
|
||||
|
||||
.login-screen {
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background-image: url('/assets/shapes/select-screen-bg-shape.svg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100% cover;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
background-color: $dark-gray;
|
||||
|
||||
.content-wrapper {
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
&::before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.content-elements {
|
||||
margin: 80px 0;
|
||||
width: inherit;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
|
||||
.login-form {
|
||||
width: inherit;
|
||||
display: grid;
|
||||
gap: 15px;
|
||||
|
||||
.form-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: rgba($white, 0.5);
|
||||
border-radius: 3px;
|
||||
border: $light-gray 1px solid;
|
||||
min-width: 500px;
|
||||
margin: 0 auto;
|
||||
|
||||
label {
|
||||
color: $black;
|
||||
background-color: rgba($white, 0.5);
|
||||
padding: 4px;
|
||||
font-size: 0.875rem;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 4px;
|
||||
font-size: 0.875rem;
|
||||
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.row-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
|
||||
.button {
|
||||
padding: 8px 0;
|
||||
min-width: 100px;
|
||||
|
||||
span {
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-title {
|
||||
margin-top: 115px;
|
||||
text-align: center;
|
||||
font-size: 4rem;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
// Mobile screens (< 450px)
|
||||
@media screen and (max-width: 550px) {
|
||||
.content-wrapper {
|
||||
.content-elements {
|
||||
.login-form {
|
||||
.form-field {
|
||||
width: 100%;
|
||||
min-width: unset;
|
||||
}
|
||||
}
|
||||
.row-buttons {
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
1
src/screens/Register.vue
Normal file
1
src/screens/Register.vue
Normal file
@ -0,0 +1 @@
|
||||
<template></template>
|
Reference in New Issue
Block a user