wip
This commit is contained in:
@ -4,11 +4,12 @@ import * as merge from 'object-assign-deep';
|
||||
|
||||
import { host, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config';
|
||||
import Progress from './scripts/loading';
|
||||
import HomeStreamManager from './scripts/streaming/home-stream-manager';
|
||||
import DriveStreamManager from './scripts/streaming/drive-stream-manager';
|
||||
import ServerStreamManager from './scripts/streaming/server-stream-manager';
|
||||
import RequestsStreamManager from './scripts/streaming/requests-stream-manager';
|
||||
import MessagingIndexStreamManager from './scripts/streaming/messaging-index-stream-manager';
|
||||
import { HomeStreamManager } from './scripts/streaming/home';
|
||||
import { DriveStreamManager } from './scripts/streaming/drive';
|
||||
import { ServerStreamManager } from './scripts/streaming/server';
|
||||
import { RequestsStreamManager } from './scripts/streaming/requests';
|
||||
import { MessagingIndexStreamManager } from './scripts/streaming/messaging-index';
|
||||
import { OthelloStreamManager } from './scripts/streaming/othello';
|
||||
|
||||
import Err from '../common/views/components/connect-failed.vue';
|
||||
|
||||
@ -117,11 +118,13 @@ export default class MiOS extends EventEmitter {
|
||||
serverStream: ServerStreamManager;
|
||||
requestsStream: RequestsStreamManager;
|
||||
messagingIndexStream: MessagingIndexStreamManager;
|
||||
othelloStream: OthelloStreamManager;
|
||||
} = {
|
||||
driveStream: null,
|
||||
serverStream: null,
|
||||
requestsStream: null,
|
||||
messagingIndexStream: null
|
||||
messagingIndexStream: null,
|
||||
othelloStream: null
|
||||
};
|
||||
|
||||
/**
|
||||
@ -169,6 +172,7 @@ export default class MiOS extends EventEmitter {
|
||||
// Init other stream manager
|
||||
this.streams.driveStream = new DriveStreamManager(this.i);
|
||||
this.streams.messagingIndexStream = new MessagingIndexStreamManager(this.i);
|
||||
this.streams.othelloStream = new OthelloStreamManager(this.i);
|
||||
});
|
||||
|
||||
if (this.debug) {
|
||||
|
@ -1,20 +0,0 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Connection from './drive-stream';
|
||||
|
||||
export default class DriveStreamManager extends StreamManager<Connection> {
|
||||
private me;
|
||||
|
||||
constructor(me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new Connection(this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import Stream from './stream';
|
||||
|
||||
/**
|
||||
* Drive stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
constructor(me) {
|
||||
super('drive', {
|
||||
i: me.token
|
||||
});
|
||||
}
|
||||
}
|
31
src/web/app/common/scripts/streaming/drive.ts
Normal file
31
src/web/app/common/scripts/streaming/drive.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import Stream from './stream';
|
||||
import StreamManager from './stream-manager';
|
||||
|
||||
/**
|
||||
* Drive stream connection
|
||||
*/
|
||||
export class DriveStream extends Stream {
|
||||
constructor(me) {
|
||||
super('drive', {
|
||||
i: me.token
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DriveStreamManager extends StreamManager<DriveStream> {
|
||||
private me;
|
||||
|
||||
constructor(me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new DriveStream(this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Connection from './home-stream';
|
||||
import MiOS from '../../mios';
|
||||
|
||||
export default class HomeStreamManager extends StreamManager<Connection> {
|
||||
private me;
|
||||
private os: MiOS;
|
||||
|
||||
constructor(os: MiOS, me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new Connection(this.os, this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
import * as merge from 'object-assign-deep';
|
||||
|
||||
import Stream from './stream';
|
||||
import StreamManager from './stream-manager';
|
||||
import MiOS from '../../mios';
|
||||
|
||||
/**
|
||||
* Home stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
export class HomeStream extends Stream {
|
||||
constructor(os: MiOS, me) {
|
||||
super('', {
|
||||
i: me.token
|
||||
@ -34,3 +35,23 @@ export default class Connection extends Stream {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class HomeStreamManager extends StreamManager<HomeStream> {
|
||||
private me;
|
||||
private os: MiOS;
|
||||
|
||||
constructor(os: MiOS, me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new HomeStream(this.os, this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Connection from './messaging-index-stream';
|
||||
|
||||
export default class MessagingIndexStreamManager extends StreamManager<Connection> {
|
||||
private me;
|
||||
|
||||
constructor(me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new Connection(this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import Stream from './stream';
|
||||
|
||||
/**
|
||||
* Messaging index stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
constructor(me) {
|
||||
super('messaging-index', {
|
||||
i: me.token
|
||||
});
|
||||
}
|
||||
}
|
31
src/web/app/common/scripts/streaming/messaging-index.ts
Normal file
31
src/web/app/common/scripts/streaming/messaging-index.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import Stream from './stream';
|
||||
import StreamManager from './stream-manager';
|
||||
|
||||
/**
|
||||
* Messaging index stream connection
|
||||
*/
|
||||
export class MessagingIndexStream extends Stream {
|
||||
constructor(me) {
|
||||
super('messaging-index', {
|
||||
i: me.token
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class MessagingIndexStreamManager extends StreamManager<MessagingIndexStream> {
|
||||
private me;
|
||||
|
||||
constructor(me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new MessagingIndexStream(this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ import Stream from './stream';
|
||||
/**
|
||||
* Messaging stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
export class MessagingStream extends Stream {
|
||||
constructor(me, otherparty) {
|
||||
super('messaging', {
|
||||
i: me.token,
|
10
src/web/app/common/scripts/streaming/othello-game.ts
Normal file
10
src/web/app/common/scripts/streaming/othello-game.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import Stream from './stream';
|
||||
|
||||
export class OthelloGameStream extends Stream {
|
||||
constructor(me, game) {
|
||||
super('othello-game', {
|
||||
i: me.token,
|
||||
game: game.id
|
||||
});
|
||||
}
|
||||
}
|
28
src/web/app/common/scripts/streaming/othello.ts
Normal file
28
src/web/app/common/scripts/streaming/othello.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Stream from './stream';
|
||||
|
||||
export class OthelloStream extends Stream {
|
||||
constructor(me) {
|
||||
super('othello', {
|
||||
i: me.token
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class OthelloStreamManager extends StreamManager<OthelloStream> {
|
||||
private me;
|
||||
|
||||
constructor(me) {
|
||||
super();
|
||||
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new OthelloStream(this.me);
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Connection from './requests-stream';
|
||||
|
||||
export default class RequestsStreamManager extends StreamManager<Connection> {
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new Connection();
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import Stream from './stream';
|
||||
|
||||
/**
|
||||
* Requests stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
constructor() {
|
||||
super('requests');
|
||||
}
|
||||
}
|
21
src/web/app/common/scripts/streaming/requests.ts
Normal file
21
src/web/app/common/scripts/streaming/requests.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import Stream from './stream';
|
||||
import StreamManager from './stream-manager';
|
||||
|
||||
/**
|
||||
* Requests stream connection
|
||||
*/
|
||||
export class RequestsStream extends Stream {
|
||||
constructor() {
|
||||
super('requests');
|
||||
}
|
||||
}
|
||||
|
||||
export class RequestsStreamManager extends StreamManager<RequestsStream> {
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new RequestsStream();
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import StreamManager from './stream-manager';
|
||||
import Connection from './server-stream';
|
||||
|
||||
export default class ServerStreamManager extends StreamManager<Connection> {
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new Connection();
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import Stream from './stream';
|
||||
|
||||
/**
|
||||
* Server stream connection
|
||||
*/
|
||||
export default class Connection extends Stream {
|
||||
constructor() {
|
||||
super('server');
|
||||
}
|
||||
}
|
21
src/web/app/common/scripts/streaming/server.ts
Normal file
21
src/web/app/common/scripts/streaming/server.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import Stream from './stream';
|
||||
import StreamManager from './stream-manager';
|
||||
|
||||
/**
|
||||
* Server stream connection
|
||||
*/
|
||||
export class ServerStream extends Stream {
|
||||
constructor() {
|
||||
super('server');
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerStreamManager extends StreamManager<ServerStream> {
|
||||
public getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = new ServerStream();
|
||||
}
|
||||
|
||||
return this.connection;
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import MessagingStreamConnection from '../../scripts/streaming/messaging-stream';
|
||||
import { MessagingStream } from '../../scripts/streaming/messaging';
|
||||
import XMessage from './messaging-room.message.vue';
|
||||
import XForm from './messaging-room.form.vue';
|
||||
import { url } from '../../../config';
|
||||
@ -66,7 +66,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = new MessagingStreamConnection((this as any).os.i, this.user.id);
|
||||
this.connection = new MessagingStream((this as any).os.i, this.user.id);
|
||||
|
||||
this.connection.on('message', this.onMessage);
|
||||
this.connection.on('read', this.onRead);
|
||||
|
@ -1,29 +1,131 @@
|
||||
<template>
|
||||
<div>
|
||||
<header>黒:{{ game.black_user.name }} 白:{{ game.white_user.name }}</header>
|
||||
<div class="root">
|
||||
<header><b>{{ game.black_user.name }}</b>(黒) vs <b>{{ game.white_user.name }}</b>(白)</header>
|
||||
<p class="turn">{{ turn ? 'あなたのターンです' : '相手のターンです' }}<mk-ellipsis v-if="!turn"/></p>
|
||||
<div>
|
||||
<div v-for="(stone, i) in o.board"
|
||||
:class="{ empty: stone == null, myTurn: turn, can: o.canReverse(turn ? myColor : opColor, i) }"
|
||||
@click="set(i)"
|
||||
>
|
||||
<img v-if="stone == 'black'" :src="`${game.black_user.avatar_url}?thumbnail&size=64`" alt="">
|
||||
<img v-if="stone == 'white'" :src="`${game.white_user.avatar_url}?thumbnail&size=64`" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { OthelloGameStream } from '../../scripts/streaming/othello-game';
|
||||
import Othello from '../../../../../common/othello';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['game'],
|
||||
data() {
|
||||
return {
|
||||
game: null,
|
||||
connection: null,
|
||||
connectionId: null
|
||||
o: new Othello(),
|
||||
turn: null,
|
||||
connection: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.connection = (this as any).os.streams.othelloGameStream.getConnection();
|
||||
this.connectionId = (this as any).os.streams.othelloGameStream.use();
|
||||
computed: {
|
||||
myColor(): string {
|
||||
return this.game.black_user_id == (this as any).os.i.id ? 'black' : 'white';
|
||||
},
|
||||
opColor(): string {
|
||||
return this.myColor == 'black' ? 'white' : 'black';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.game.logs.forEach(log => {
|
||||
this.o.set(log.color, log.pos);
|
||||
});
|
||||
|
||||
this.turn = this.game.turn_user_id == (this as any).os.i.id;
|
||||
},
|
||||
mounted() {
|
||||
this.connection = new OthelloGameStream((this as any).os.i, this.game);
|
||||
this.connection.on('set', this.onSet);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.connection.off('set', this.onSet);
|
||||
(this as any).streams.othelloGameStream.dispose(this.connectionId);
|
||||
this.connection.close();
|
||||
},
|
||||
methods: {
|
||||
set(pos) {
|
||||
if (!this.turn) return;
|
||||
if (!this.o.canReverse(this.myColor, pos)) return;
|
||||
this.o.set(this.myColor, pos);
|
||||
if (this.o.getPattern(this.opColor).length > 0) {
|
||||
this.turn = !this.turn;
|
||||
}
|
||||
this.connection.send({
|
||||
type: 'set',
|
||||
pos
|
||||
});
|
||||
this.$forceUpdate();
|
||||
},
|
||||
onSet(x) {
|
||||
this.o.set(x.color, x.pos);
|
||||
if (this.o.getPattern(this.myColor).length > 0) {
|
||||
this.turn = true;
|
||||
}
|
||||
this.$forceUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~const.styl'
|
||||
|
||||
.root
|
||||
text-align center
|
||||
|
||||
> header
|
||||
padding 8px
|
||||
border-bottom dashed 1px #c4cdd4
|
||||
|
||||
> div
|
||||
display grid
|
||||
grid-template-rows repeat(8, 1fr)
|
||||
grid-template-columns repeat(8, 1fr)
|
||||
grid-gap 4px
|
||||
width 300px
|
||||
height 300px
|
||||
margin 0 auto
|
||||
|
||||
> div
|
||||
background transparent
|
||||
border-radius 6px
|
||||
overflow hidden
|
||||
|
||||
*
|
||||
pointer-events none
|
||||
user-select none
|
||||
|
||||
&.empty
|
||||
border solid 2px #f5f5f5
|
||||
|
||||
&.empty.can
|
||||
background #f5f5f5
|
||||
|
||||
&.empty.myTurn
|
||||
border-color #eee
|
||||
|
||||
&.can
|
||||
background #eee
|
||||
cursor pointer
|
||||
|
||||
&:hover
|
||||
border-color darken($theme-color, 10%)
|
||||
background $theme-color
|
||||
|
||||
&:active
|
||||
background darken($theme-color, 10%)
|
||||
|
||||
> img
|
||||
display block
|
||||
width 100%
|
||||
height 100%
|
||||
</style>
|
||||
|
@ -1,21 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="mk-othello">
|
||||
<div v-if="game">
|
||||
<x-game :game="game"/>
|
||||
</div>
|
||||
<div v-if="matching">
|
||||
<div class="matching" v-else-if="matching">
|
||||
<h1><b>{{ matching.name }}</b>を待っています<mk-ellipsis/></h1>
|
||||
<div class="cancel">
|
||||
<el-button round @click="cancel">キャンセル</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<h1>Misskey Othello</h1>
|
||||
<p>他のMisskeyユーザーとオセロで対戦しよう。</p>
|
||||
<button>フリーマッチ(準備中)</button>
|
||||
<button @click="match">指名</button>
|
||||
<section>
|
||||
<h2>対局の招待があります:</h2>
|
||||
<div class="index" v-else>
|
||||
<h1>Misskey %fa:circle%thell%fa:circle R%</h1>
|
||||
<p>他のMisskeyユーザーとオセロで対戦しよう</p>
|
||||
<div class="play">
|
||||
<el-button round>フリーマッチ(準備中)</el-button>
|
||||
<el-button type="primary" round @click="match">指名</el-button>
|
||||
<details>
|
||||
<summary>遊び方</summary>
|
||||
<div>
|
||||
<p>オセロは、相手と交互に石をボードに置いてゆき、相手の石を挟んでひっくり返しながら、最終的に残った石が多い方が勝ちというボードゲームです。</p>
|
||||
<dl>
|
||||
<dt><b>フリーマッチ</b></dt>
|
||||
<dd>ランダムなユーザーと対戦するモードです。</dd>
|
||||
<dt><b>指名</b></dt>
|
||||
<dd>指定したユーザーと対戦するモードです。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<section v-if="invitations.length > 0">
|
||||
<h2>対局の招待があります!:</h2>
|
||||
<div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)">
|
||||
<img :src="`${i.parent.avatar_url}?thumbnail&size=32`" alt="">
|
||||
<span class="name"><b>{{ i.parent.name }}</b></span>
|
||||
<span class="username">@{{ i.parent.username }}</span>
|
||||
<mk-time :time="i.created_at"/>
|
||||
</div>
|
||||
</section>
|
||||
<section v-if="myGames.length > 0">
|
||||
<h2>自分の対局</h2>
|
||||
<div class="game" v-for="g in myGames" tabindex="-1" @click="game = g">
|
||||
<img :src="`${g.black_user.avatar_url}?thumbnail&size=32`" alt="">
|
||||
<img :src="`${g.white_user.avatar_url}?thumbnail&size=32`" alt="">
|
||||
<span><b>{{ g.black_user.name }}</b> vs <b>{{ g.white_user.name }}</b></span>
|
||||
<span class="state">{{ g.winner ? '終了' : '進行中' }}</span>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2>過去の対局</h2>
|
||||
<h2>みんなの対局</h2>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@ -35,7 +67,8 @@ export default Vue.extend({
|
||||
games: [],
|
||||
gamesFetching: true,
|
||||
gamesMoreFetching: false,
|
||||
matching: false,
|
||||
myGames: [],
|
||||
matching: null,
|
||||
invitations: [],
|
||||
connection: null,
|
||||
connectionId: null
|
||||
@ -45,9 +78,15 @@ export default Vue.extend({
|
||||
this.connection = (this as any).os.streams.othelloStream.getConnection();
|
||||
this.connectionId = (this as any).os.streams.othelloStream.use();
|
||||
|
||||
this.connection.on('macthed', this.onMatched);
|
||||
this.connection.on('matched', this.onMatched);
|
||||
this.connection.on('invited', this.onInvited);
|
||||
|
||||
(this as any).api('othello/games', {
|
||||
my: true
|
||||
}).then(games => {
|
||||
this.myGames = games;
|
||||
});
|
||||
|
||||
(this as any).api('othello/games').then(games => {
|
||||
this.games = games;
|
||||
this.gamesFetching = false;
|
||||
@ -58,9 +97,9 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.connection.off('macthed', this.onMatched);
|
||||
this.connection.off('matched', this.onMatched);
|
||||
this.connection.off('invited', this.onInvited);
|
||||
(this as any).streams.othelloStream.dispose(this.connectionId);
|
||||
(this as any).os.streams.othelloStream.dispose(this.connectionId);
|
||||
},
|
||||
methods: {
|
||||
match() {
|
||||
@ -82,6 +121,19 @@ export default Vue.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
this.matching = null;
|
||||
(this as any).api('othello/match/cancel');
|
||||
},
|
||||
accept(invitation) {
|
||||
(this as any).api('othello/match', {
|
||||
user_id: invitation.parent.id
|
||||
}).then(game => {
|
||||
if (game) {
|
||||
this.game = game;
|
||||
}
|
||||
});
|
||||
},
|
||||
onMatched(game) {
|
||||
this.game = game;
|
||||
},
|
||||
@ -92,3 +144,126 @@ export default Vue.extend({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~const.styl'
|
||||
|
||||
.mk-othello
|
||||
color #677f84
|
||||
|
||||
> .matching
|
||||
> h1
|
||||
margin 0
|
||||
padding 24px
|
||||
font-size 20px
|
||||
text-align center
|
||||
font-weight normal
|
||||
|
||||
> .cancel
|
||||
margin 0 auto
|
||||
padding 24px 0 0 0
|
||||
max-width 200px
|
||||
text-align center
|
||||
border-top dashed 1px #c4cdd4
|
||||
|
||||
> .index
|
||||
> h1
|
||||
margin 0
|
||||
padding 24px
|
||||
font-size 24px
|
||||
text-align center
|
||||
font-weight normal
|
||||
color #fff
|
||||
background linear-gradient(to bottom, #8bca3e, #d6cf31)
|
||||
|
||||
& + p
|
||||
margin 0
|
||||
padding 12px
|
||||
margin-bottom 12px
|
||||
text-align center
|
||||
font-size 14px
|
||||
border-bottom solid 1px #d3d9dc
|
||||
|
||||
> .play
|
||||
margin 0 auto
|
||||
padding 0 16px
|
||||
max-width 500px
|
||||
text-align center
|
||||
|
||||
> details
|
||||
margin 8px 0
|
||||
|
||||
> div
|
||||
padding 16px
|
||||
font-size 14px
|
||||
text-align left
|
||||
background #f5f5f5
|
||||
border-radius 8px
|
||||
|
||||
> section
|
||||
margin 0 auto
|
||||
padding 0 16px 16px 16px
|
||||
max-width 500px
|
||||
border-top solid 1px #d3d9dc
|
||||
|
||||
> h2
|
||||
margin 0
|
||||
padding 16px 0 8px 0
|
||||
font-size 16px
|
||||
font-weight bold
|
||||
|
||||
.invitation
|
||||
margin 8px 0
|
||||
padding 8px
|
||||
border solid 1px #e1e5e8
|
||||
border-radius 6px
|
||||
cursor pointer
|
||||
|
||||
*
|
||||
pointer-events none
|
||||
user-select none
|
||||
|
||||
&:focus
|
||||
border-color $theme-color
|
||||
|
||||
&:hover
|
||||
background #f5f5f5
|
||||
|
||||
&:active
|
||||
background #eee
|
||||
|
||||
> img
|
||||
vertical-align bottom
|
||||
border-radius 100%
|
||||
|
||||
> span
|
||||
margin 0 8px
|
||||
line-height 32px
|
||||
|
||||
.game
|
||||
margin 8px 0
|
||||
padding 8px
|
||||
border solid 1px #e1e5e8
|
||||
border-radius 6px
|
||||
cursor pointer
|
||||
|
||||
*
|
||||
pointer-events none
|
||||
user-select none
|
||||
|
||||
&:focus
|
||||
border-color $theme-color
|
||||
|
||||
&:hover
|
||||
background #f5f5f5
|
||||
|
||||
&:active
|
||||
background #eee
|
||||
|
||||
> img
|
||||
vertical-align bottom
|
||||
border-radius 100%
|
||||
|
||||
> span
|
||||
margin 0 8px
|
||||
line-height 32px
|
||||
</style>
|
||||
|
24
src/web/app/desktop/views/components/game-window.vue
Normal file
24
src/web/app/desktop/views/components/game-window.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<mk-window ref="window" width="500px" height="560px" @closed="$destroy">
|
||||
<span slot="header" :class="$style.header">%fa:gamepad%オセロ</span>
|
||||
<mk-othello :class="$style.content"/>
|
||||
</mk-window>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
export default Vue.extend({
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" module>
|
||||
.header
|
||||
> [data-fa]
|
||||
margin-right 4px
|
||||
|
||||
.content
|
||||
height 100%
|
||||
overflow auto
|
||||
|
||||
</style>
|
@ -15,6 +15,13 @@
|
||||
<template v-if="hasUnreadMessagingMessages">%fa:circle%</template>
|
||||
</a>
|
||||
</li>
|
||||
<li class="game">
|
||||
<a @click="game">
|
||||
%fa:gamepad%
|
||||
<p>ゲーム</p>
|
||||
<template v-if="hasGameInvitations">%fa:circle%</template>
|
||||
</a>
|
||||
</li>
|
||||
</template>
|
||||
<li class="ch">
|
||||
<a :href="chUrl" target="_blank">
|
||||
@ -22,12 +29,6 @@
|
||||
<p>%i18n:desktop.tags.mk-ui-header-nav.ch%</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="info">
|
||||
<a href="https://twitter.com/misskey_xyz" target="_blank">
|
||||
%fa:info%
|
||||
<p>%i18n:desktop.tags.mk-ui-header-nav.info%</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
@ -36,11 +37,13 @@
|
||||
import Vue from 'vue';
|
||||
import { chUrl } from '../../../config';
|
||||
import MkMessagingWindow from './messaging-window.vue';
|
||||
import MkGameWindow from './game-window.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
hasUnreadMessagingMessages: false,
|
||||
hasGameInvitations: false,
|
||||
connection: null,
|
||||
connectionId: null,
|
||||
chUrl
|
||||
@ -80,6 +83,10 @@ export default Vue.extend({
|
||||
|
||||
messaging() {
|
||||
(this as any).os.new(MkMessagingWindow);
|
||||
},
|
||||
|
||||
game() {
|
||||
(this as any).os.new(MkGameWindow);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import ChannelStream from '../../../common/scripts/streaming/channel-stream';
|
||||
import ChannelStream from '../../../common/scripts/streaming/channel';
|
||||
import XForm from './channel.channel.form.vue';
|
||||
import XPost from './channel.channel.post.vue';
|
||||
|
||||
|
Reference in New Issue
Block a user