dev
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
<template>
|
||||
<slot name="activator" v-bind="activatorProps" @click="dialog = !dialog"></slot>
|
||||
<v-dialog transition="dialog-bottom-transition" fullscreen v-model="dialog">
|
||||
<v-card title="Assets">
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col v-for="(v, i) in items" :key="i" cols="12" xs="6" sm="4" md="3" xl="2"
|
||||
class="position-relative">
|
||||
<v-img :src="`/asset/thumb/${v.asset?.thumb}`" @click="select(v)"
|
||||
class="cursor-pointer"></v-img>
|
||||
<div class="d-flex">
|
||||
<span class="flex-grow-1">{{ v.name }}</span>
|
||||
<v-icon color="primary" size="x-large" class="position-absolute top-0 left-0 ma-6">mdi-{{
|
||||
$p.objectTypes.find(t=>t.value == v.type).icon }}</v-icon>
|
||||
<!-- <v-btn density="compact" variant="text" icon="mdi-pencil-outline" :to="`/game-objects/${v.id}`" color="primary"></v-btn> -->
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<v-card-actions>
|
||||
<v-btn text="Close" color="primary" @click="dialog = false"></v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props:[
|
||||
'modelValue', 'type'
|
||||
],
|
||||
emits:['select'],
|
||||
data(){
|
||||
return {
|
||||
items: [],
|
||||
activatorProps:{},
|
||||
dialog: false
|
||||
}
|
||||
},
|
||||
|
||||
async created(){
|
||||
this.items = (await this.$api.gameObject.search({
|
||||
type: { $in: this.$p.objectTypes.filter(t=>t.type == this.type || !this.type).map(t=>t.value) }
|
||||
})).data.data
|
||||
},
|
||||
|
||||
methods:{
|
||||
select(v){
|
||||
this.$emit('select', { id: v.id, name: v.name });
|
||||
this.dialog = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,20 +1,24 @@
|
||||
<template>
|
||||
<teleport to=".scene-designer .game-objects" v-if="active">
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{gameObject: true, selected}" v-show="visible && parent.visible">
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{gameObject: true, selected}"
|
||||
v-show="showInView">
|
||||
<line :x1="vd.x1" :y1="vd.y1" :x2="parent.vd.x1" :y2="parent.vd.y1"></line>
|
||||
<svg-icon :src="`/asset/thumb/${modelValue.go||0}.webp`" :x="vd.x1" :y="vd.y1" :size="37"></svg-icon>
|
||||
<text :x="vd.x1" :y="vd.y1" dy="58">{{ modelValue.title }}</text>
|
||||
<image v-if="modelValue.go" href="/static/svg/play-circle.svg" width="20" class="cursor-pointer"
|
||||
:x="vd.x1 + 37 - 10" :y="vd.y1 + 37 - 10" @click="$emit('preview', modelValue.go)">
|
||||
</image>
|
||||
</g>
|
||||
</teleport>
|
||||
<v-card v-if="selected" :title="modelValue.title">
|
||||
<v-card v-if="selected" :title="modelValue.title" class="mx-2" variant="text">
|
||||
<asset-selector @select="assignGameObject" type="GameObject">
|
||||
<template v-slot:activator="props">
|
||||
<v-btn v-bind="props" prepend-icon="mdi-panorama-outline" color="success" block>Choose game object</v-btn>
|
||||
</template>
|
||||
</asset-selector>
|
||||
<v-form class="py-4">
|
||||
<v-text-field density="compact" :label="$l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="$l.description" v-model="modelValue.description"></v-textarea>
|
||||
<v-text-field density="compact" :label="l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="l.description" v-model="modelValue.description"></v-textarea>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -24,7 +28,7 @@ import SvgIcon from './SvgIcon.vue';
|
||||
import Utils from '@/lib/utils';
|
||||
|
||||
export default {
|
||||
emits:['target'],
|
||||
emits:['target', 'preview'],
|
||||
components: { SvgIcon },
|
||||
data(){
|
||||
return {
|
||||
@@ -43,6 +47,12 @@ export default {
|
||||
visible: Boolean,
|
||||
parent: Object
|
||||
},
|
||||
computed:{
|
||||
showInView(){
|
||||
this.vd.__showInView = this.visible && this.parent.visible;
|
||||
return this.vd.__showInView;
|
||||
}
|
||||
},
|
||||
steps: [['x1', 'y1']],
|
||||
name: 'game-object',
|
||||
modifiers: ['x1', 'y1'],
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<template>
|
||||
<teleport to=".scene-designer .scenes" v-if="active">
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{scene: true, selected}" v-show="visible">
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{scene: true, selected}" v-show="showInView">
|
||||
<svg-icon :src="`/asset/thumb/${modelValue.environment||0}.webp`" :x="vd.x1" :y="vd.y1" :size="65"></svg-icon>
|
||||
<text :x="vd.x1" :y="vd.y1" dy="86">{{ modelValue.title }}</text>
|
||||
<image v-if="modelValue.environment" href="/static/svg/play-circle.svg" width="20" class="cursor-pointer"
|
||||
:x="vd.x1 + 60 - 10" :y="vd.y1 + 60 - 10" @click="$emit('preview', modelValue.environment)">
|
||||
</image>
|
||||
</g>
|
||||
</teleport>
|
||||
<v-card :title="modelValue.title" v-if="selected">
|
||||
<v-card :title="modelValue.title" v-if="selected" class="mx-2" variant="text">
|
||||
<asset-selector @select="assignEnvironment" type="Scene">
|
||||
<template v-slot:activator="props">
|
||||
<v-btn v-bind="props" prepend-icon="mdi-panorama-outline" block color="success" class="py-4">Choose environment</v-btn>
|
||||
@@ -13,8 +16,8 @@
|
||||
</asset-selector>
|
||||
|
||||
<v-form class="py-4">
|
||||
<v-text-field density="compact" :label="$l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="$l.description" v-model="modelValue.description"></v-textarea>
|
||||
<v-text-field density="compact" :label="l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="l.description" v-model="modelValue.description"></v-textarea>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -22,10 +25,10 @@
|
||||
<script>
|
||||
import SvgIcon from './SvgIcon.vue';
|
||||
import Utils from '@/lib/utils';
|
||||
import AssetSelector from './AssetSelector.vue';
|
||||
import AssetSelector from '../AssetsManagement/AssetSelector.vue';
|
||||
|
||||
export default {
|
||||
emits:['target'],
|
||||
emits:['target', 'preview'],
|
||||
components: { SvgIcon, AssetSelector },
|
||||
data(){
|
||||
return {
|
||||
@@ -47,6 +50,12 @@ export default {
|
||||
steps: [['x1', 'y1']],
|
||||
name: 'scene',
|
||||
modifiers: ['x1', 'y1'],
|
||||
computed:{
|
||||
showInView(){
|
||||
this.vd.__showInView = this.visible;
|
||||
return this.vd.__showInView;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
intersect(v){
|
||||
return Utils.intersectPointRect([this.vd.x1, this.vd.y1], v);
|
||||
|
||||
@@ -26,12 +26,13 @@
|
||||
<g class="scenes"></g>
|
||||
</svg>
|
||||
</div>
|
||||
<v-navigation-drawer location="right" :width="!selectedItem.length ? 400 : expandDrawer ? 800 : 400">
|
||||
<v-btn :icon="expandDrawer ? 'mdi-arrow-expand-right' : 'mdi-arrow-expand-left'" variant="plain" size="small"
|
||||
@click="expandDrawer = !expandDrawer" v-if="selectedItem.length"></v-btn>
|
||||
<v-navigation-drawer location="right" :width="expandDrawer ? 800 : 400">
|
||||
<v-btn :icon="expandDrawer ? 'mdi-arrow-expand-right' : 'mdi-arrow-expand-left'" variant="plain" size="x-small" density="compact"
|
||||
@click="expandDrawer = !expandDrawer" v-if="selectedItem.length" class="position-absolute z-100 ma-1"></v-btn>
|
||||
<template v-for="(item, i) in flatItems" :key="i">
|
||||
<component :is="components[item.__type]" :ref="'sc-' + item.__path" :vd="item.vd" v-model="item.data"
|
||||
@target="setTarget($event, item)" :visible="item.visible" :cid="item.id" :parent="item.__parent"
|
||||
<component :is="components[item.__type]" :ref="`sc-${item.__path}`" :vd="item.vd" v-model="item.data"
|
||||
@target="setTarget($event, item)" @preview="preview"
|
||||
:visible="item.visible" :cid="item.id" :parent="item.__parent"
|
||||
:selected="selectedItem.includes(item)">
|
||||
</component>
|
||||
</template>
|
||||
@@ -41,7 +42,8 @@
|
||||
:select-strategy="mode == 'select' ? 'leaf' : 'single-leaf'">
|
||||
<v-list-item v-for="(item, i) in flatItems.toSorted((a,b)=>a.__path.localeCompare(b.__path))"
|
||||
:key="i" :title="item.data.title" :value="item" :style="`padding-left:${item.__level}rem`"
|
||||
v-show="!item.__parent || item.__parent.vd.expanded" :color="[0,'secondary', 'primary', 'success'][item.__level]">
|
||||
v-show="!item.__parent || item.__parent.vd.expanded" :base-color="item.vd.__showInView ? '' : 'grey'"
|
||||
:color="[0,'secondary', 'primary', 'success'][item.__level]">
|
||||
<template v-slot:prepend>
|
||||
<v-btn variant="plain" density="comfortable" size="small"
|
||||
:icon="`mdi-eye${item.visible ? '' : '-off'}`"
|
||||
@@ -58,6 +60,9 @@
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
</div>
|
||||
<v-dialog v-model="previewDialog" width="auto" max-width="1200">
|
||||
<AssetPreview :objectId="previewObject" autoplay></AssetPreview>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -65,7 +70,7 @@ import GameObject from './GameObject.vue';
|
||||
import Scene from './Scene.vue';
|
||||
import SvgRectangle from './SvgRectangle.vue';
|
||||
import Utils from '@/lib/utils';
|
||||
import AssetSelector from './AssetSelector.vue';
|
||||
import AssetSelector from '../AssetsManagement/AssetSelector.vue';
|
||||
import Task from './Task.vue';
|
||||
|
||||
const components = {
|
||||
@@ -104,7 +109,9 @@ export default {
|
||||
type: 'Scene'
|
||||
},
|
||||
dialog: false,
|
||||
expandDrawer: false
|
||||
expandDrawer: false,
|
||||
previewObject: null,
|
||||
previewDialog: false
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
@@ -354,57 +361,11 @@ export default {
|
||||
//console.log(item);
|
||||
let p = item.__parent?.data?.items || this.items;
|
||||
p.splice(p.indexOf(item), 1);
|
||||
},
|
||||
preview(v){
|
||||
this.previewObject = v;
|
||||
this.previewDialog = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
:root {
|
||||
--svg-scale: 1;
|
||||
}
|
||||
|
||||
.svg-container{
|
||||
svg{
|
||||
image{
|
||||
clip-path: circle(50% at 50% 50%);
|
||||
}
|
||||
circle {
|
||||
stroke: rgba(var(--v-theme-primary), .7);
|
||||
fill:rgba(255,255,255,.5);
|
||||
stroke-width: 2px;
|
||||
}
|
||||
g{
|
||||
&.selected circle{
|
||||
fill: rgba(var(--v-theme-secondary), .9);
|
||||
}
|
||||
}
|
||||
line, path{
|
||||
stroke: rgb(213, 226, 231);
|
||||
stroke-width: calc( 2px * var(--svg-scale) );
|
||||
}
|
||||
g.selector {
|
||||
line {
|
||||
stroke-dasharray: 0 calc(8 * var(--svg-scale)) 0;
|
||||
}
|
||||
}
|
||||
text {
|
||||
text-anchor: middle;
|
||||
fill:rgb(var(--v-theme-on-surface));
|
||||
stroke-width: 0;//calc( .1px * var(--svg-scale) );;
|
||||
}
|
||||
background-color: rgba(128,128,128,.05);
|
||||
}
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
max-width: 100vw;
|
||||
height: calc(100vh - 244px);
|
||||
&.pan {
|
||||
cursor: grab;
|
||||
}
|
||||
&.Scene, &.GameObject, &.Task {
|
||||
cursor: grabbing;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -1,16 +1,19 @@
|
||||
<template>
|
||||
<teleport to=".scene-designer .tasks" v-if="active">
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{task: true, selected}"
|
||||
v-show="visible && parent.visible && parent.__parent.visible">
|
||||
v-show="showInView">
|
||||
<line :x1="vd.x1" :y1="vd.y1" :x2="parent.vd.x1" :y2="parent.vd.y1"></line>
|
||||
<svg-icon :src="`/asset/thumb/${modelValue.intro || 0}.webp`" :x="vd.x1" :y="vd.y1" :size="22"></svg-icon>
|
||||
<text :x="vd.x1" :y="vd.y1" dy="44">{{ modelValue.title }}</text>
|
||||
<image v-if="modelValue.intro" href="/static/svg/play-circle.svg" width="20" class="cursor-pointer"
|
||||
:x="vd.x1 + 25 - 10" :y="vd.y1 + 25 - 10" @click="$emit('preview', modelValue.intro)">
|
||||
</image>
|
||||
</g>
|
||||
</teleport>
|
||||
<v-card v-if="selected" :title="modelValue.title">
|
||||
<v-card v-if="selected" :title="modelValue.title" class="mx-2" variant="text">
|
||||
<v-form class="py-4">
|
||||
<v-text-field density="compact" :label="$l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="$l.description" v-model="modelValue.description"></v-textarea>
|
||||
<v-text-field density="compact" :label="l.name" v-model="modelValue.title"></v-text-field>
|
||||
<v-textarea :label="l.description" v-model="modelValue.description"></v-textarea>
|
||||
</v-form>
|
||||
<asset-selector @select="assignTaskIntro" type="Descriptive">
|
||||
<template v-slot:activator="props">
|
||||
@@ -25,7 +28,7 @@ import SvgIcon from './SvgIcon.vue';
|
||||
import Utils from '@/lib/utils';
|
||||
|
||||
export default {
|
||||
emits:['target'],
|
||||
emits:['target', 'preview'],
|
||||
components: { SvgIcon },
|
||||
data(){
|
||||
return {
|
||||
@@ -44,6 +47,12 @@ export default {
|
||||
visible: Boolean,
|
||||
parent: Object
|
||||
},
|
||||
computed:{
|
||||
showInView(){
|
||||
this.vd.__showInView = this.visible && this.parent.visible && this.parent.__parent.visible;
|
||||
return this.vd.__showInView;
|
||||
}
|
||||
},
|
||||
steps: [['x1', 'y1']],
|
||||
name: 'task',
|
||||
modifiers: ['x1', 'y1'],
|
||||
|
||||
Reference in New Issue
Block a user