This commit is contained in:
syuilo 2018-08-02 22:54:52 +09:00
parent 0df093383d
commit 3f29a0382b
4 changed files with 165 additions and 61 deletions

View file

@ -5,8 +5,8 @@
<div> <div>
<p>%i18n:@settings-of-the-game%</p> <p>%i18n:@settings-of-the-game%</p>
<el-card class="map"> <div class="card">
<div slot="header"> <header>
<el-select :class="$style.mapSelect" v-model="mapName" placeholder="%i18n:@choose-map%" @change="onMapChange"> <el-select :class="$style.mapSelect" v-model="mapName" placeholder="%i18n:@choose-map%" @change="onMapChange">
<el-option label="%i18n:@random%" :value="null"/> <el-option label="%i18n:@random%" :value="null"/>
<el-option-group v-for="c in mapCategories" :key="c" :label="c"> <el-option-group v-for="c in mapCategories" :key="c" :label="c">
@ -16,63 +16,80 @@
</el-option> </el-option>
</el-option-group> </el-option-group>
</el-select> </el-select>
</div> </header>
<div :class="$style.board" v-if="game.settings.map != null" :style="{ 'grid-template-rows': `repeat(${ game.settings.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.settings.map[0].length }, 1fr)` }">
<div v-for="(x, i) in game.settings.map.join('')" <div>
:data-none="x == ' '" <div :class="$style.board" v-if="game.settings.map != null" :style="{ 'grid-template-rows': `repeat(${ game.settings.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.settings.map[0].length }, 1fr)` }">
@click="onPixelClick(i, x)" <div v-for="(x, i) in game.settings.map.join('')"
> :data-none="x == ' '"
<template v-if="x == 'b'">%fa:circle%</template> @click="onPixelClick(i, x)">
<template v-if="x == 'w'">%fa:circle R%</template> <template v-if="x == 'b'">%fa:circle%</template>
<template v-if="x == 'w'">%fa:circle R%</template>
</div>
</div> </div>
</div> </div>
</el-card> </div>
<el-card class="bw"> <div class="card">
<div slot="header"> <header>
<span>%i18n:@black-or-white%</span> <span>%i18n:@black-or-white%</span>
</div> </header>
<el-radio v-model="game.settings.bw" label="random" @change="updateSettings">%i18n:@random%</el-radio>
<el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user1 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
<el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user2 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
</el-card>
<el-card class="rules"> <div>
<div slot="header"> <el-radio v-model="game.settings.bw" label="random" @change="updateSettings">%i18n:@random%</el-radio>
<el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user1 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
<el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user2 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
</div>
</div>
<div class="card">
<header>
<span>%i18n:@rules%</span> <span>%i18n:@rules%</span>
</div> </header>
<mk-switch v-model="game.settings.isLlotheo" @change="updateSettings" text="%i18n:@is-llotheo%"/>
<mk-switch v-model="game.settings.loopedBoard" @change="updateSettings" text="%i18n:@looped-map%"/>
<mk-switch v-model="game.settings.canPutEverywhere" @change="updateSettings" text="%i18n:@can-put-everywhere%"/>
</el-card>
<el-card class="bot-form" v-if="form"> <div>
<div slot="header"> <mk-switch v-model="game.settings.isLlotheo" @change="updateSettings" text="%i18n:@is-llotheo%"/>
<mk-switch v-model="game.settings.loopedBoard" @change="updateSettings" text="%i18n:@looped-map%"/>
<mk-switch v-model="game.settings.canPutEverywhere" @change="updateSettings" text="%i18n:@can-put-everywhere%"/>
</div>
</div>
<div class="card" v-if="form">
<header>
<span>%i18n:@settings-of-the-bot%</span> <span>%i18n:@settings-of-the-bot%</span>
</header>
<div>
<el-alert v-for="message in messages"
:title="message.text"
:type="message.type"
:key="message.id"/>
<template v-for="item in form">
<mk-switch v-if="item.type == 'button'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
<div class="card" v-if="item.type == 'radio'" :key="item.id">
<header>
<span>{{ item.label }}</span>
</header>
<div>
<el-radio v-for="(r, i) in item.items" :key="item.id + ':' + i" v-model="item.value" :label="r.value" @change="onChangeForm($event, item)">{{ r.label }}</el-radio>
</div>
</div>
<div class="card" v-if="item.type == 'textbox'" :key="item.id">
<header>
<span>{{ item.label }}</span>
</header>
<div>
<el-input v-model="item.value" @change="onChangeForm($event, item)"/>
</div>
</div>
</template>
</div> </div>
<el-alert v-for="message in messages" </div>
:title="message.text"
:type="message.type"
:key="message.id"
/>
<template v-for="item in form">
<mk-switch v-if="item.type == 'button'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
<el-card v-if="item.type == 'radio'" :key="item.id">
<div slot="header">
<span>{{ item.label }}</span>
</div>
<el-radio v-for="(r, i) in item.items" :key="item.id + ':' + i" v-model="item.value" :label="r.value" @change="onChangeForm($event, item)">{{ r.label }}</el-radio>
</el-card>
<el-card v-if="item.type == 'textbox'" :key="item.id">
<div slot="header">
<span>{{ item.label }}</span>
</div>
<el-input v-model="item.value" @change="onChangeForm($event, item)"/>
</el-card>
</template>
</el-card>
</div> </div>
<footer> <footer>
@ -244,13 +261,24 @@ export default Vue.extend({
> div > div
padding 0 16px padding 0 16px
> .map > .card
> .bw
> .rules
> .bot-form
max-width 400px
margin 0 auto 16px auto margin 0 auto 16px auto
.card
max-width 400px
border-radius 4px
border 1px solid #ebeef5
background #fff
color #303133
box-shadow 0 2px 12px 0 rgba(#000, 0.1)
> header
padding 18px 20px
border-bottom 1px solid #ebeef5
> div
padding 20px
> footer > footer
position sticky position sticky
bottom 0 bottom 0
@ -290,8 +318,3 @@ export default Vue.extend({
border-color transparent border-color transparent
</style> </style>
<style lang="stylus">
.el-alert__content
position initial !important
</style>

View file

@ -14,7 +14,7 @@
<p>%i18n:@sub-title%</p> <p>%i18n:@sub-title%</p>
<div class="play"> <div class="play">
<!--<el-button round>フリーマッチ(準備中)</el-button>--> <!--<el-button round>フリーマッチ(準備中)</el-button>-->
<el-button type="primary" round @click="match">%i18n:@invite%</el-button> <form-button primary round @click="match">%i18n:@invite%</form-button>
<details> <details>
<summary>%i18n:@rule%</summary> <summary>%i18n:@rule%</summary>
<div> <div>

View file

@ -37,6 +37,7 @@ import uiTextarea from './ui/textarea.vue';
import uiSwitch from './ui/switch.vue'; import uiSwitch from './ui/switch.vue';
import uiRadio from './ui/radio.vue'; import uiRadio from './ui/radio.vue';
import uiSelect from './ui/select.vue'; import uiSelect from './ui/select.vue';
import formButton from './ui/form/button.vue';
Vue.component('mk-analog-clock', analogClock); Vue.component('mk-analog-clock', analogClock);
Vue.component('mk-menu', menu); Vue.component('mk-menu', menu);
@ -75,3 +76,4 @@ Vue.component('ui-textarea', uiTextarea);
Vue.component('ui-switch', uiSwitch); Vue.component('ui-switch', uiSwitch);
Vue.component('ui-radio', uiRadio); Vue.component('ui-radio', uiRadio);
Vue.component('ui-select', uiSelect); Vue.component('ui-select', uiSelect);
Vue.component('form-button', formButton);

View file

@ -0,0 +1,79 @@
<template>
<div class="nvemkhtwcnnpkdrwfcbzuwhfulejhmzg" :class="{ round, primary }">
<button :type="type" @click="$emit('click')">
<slot></slot>
</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: {
round: {
type: Boolean,
required: false,
default: false
},
primary: {
type: Boolean,
required: false,
default: false
}
}
});
</script>
<style lang="stylus" scoped>
@import '~const.styl'
root(isDark)
> button
display inline-block
margin 0
padding 12px 20px
font-size 14px
border 1px solid #dcdfe6
border-radius 4px
outline none
box-shadow none
color #606266
transition 0.1s
&:hover
&:focus
color $theme-color
background rgba($theme-color, 0.12)
border-color rgba($theme-color, 0.3)
&:active
color darken($theme-color, 20%)
background rgba($theme-color, 0.12)
border-color $theme-color
transition all 0s
&.primary
> button
border none
background $theme-color
color $theme-color-foreground
&:hover
&:focus
background lighten($theme-color, 20%)
&:active
background darken($theme-color, 20%)
transition all 0s
&.round
> button
border-radius 64px
.nvemkhtwcnnpkdrwfcbzuwhfulejhmzg[data-darkmode]
root(true)
.nvemkhtwcnnpkdrwfcbzuwhfulejhmzg:not([data-darkmode])
root(false)
</style>