diff --git a/src/api/models/othello-game.ts b/src/api/models/othello-game.ts
index a8c3025108..ab90cffa44 100644
--- a/src/api/models/othello-game.ts
+++ b/src/api/models/othello-game.ts
@@ -33,6 +33,8 @@ export interface IGame {
can_put_everywhere: boolean;
looped_board: boolean;
};
+ form1: any;
+ form2: any;
}
/**
diff --git a/src/api/stream/othello-game.ts b/src/api/stream/othello-game.ts
index 5f61f0cc2c..888c599338 100644
--- a/src/api/stream/othello-game.ts
+++ b/src/api/stream/othello-game.ts
@@ -31,6 +31,21 @@ export default function(request: websocket.request, connection: websocket.connec
updateSettings(msg.settings);
break;
+ case 'init-form':
+ if (msg.body == null) return;
+ initForm(msg.body);
+ break;
+
+ case 'update-form':
+ if (msg.id == null || msg.value === undefined) return;
+ updateForm(msg.id, msg.value);
+ break;
+
+ case 'message':
+ if (msg.body == null) return;
+ message(msg.body);
+ break;
+
case 'set':
if (msg.pos == null) return;
set(msg.pos);
@@ -55,6 +70,67 @@ export default function(request: websocket.request, connection: websocket.connec
publishOthelloGameStream(gameId, 'update-settings', settings);
}
+ async function initForm(form) {
+ const game = await Game.findOne({ _id: gameId });
+
+ if (game.is_started) return;
+ if (!game.user1_id.equals(user._id) && !game.user2_id.equals(user._id)) return;
+
+ const set = game.user1_id.equals(user._id) ? {
+ form1: form
+ } : {
+ form2: form
+ };
+
+ await Game.update({ _id: gameId }, {
+ $set: set
+ });
+
+ publishOthelloGameStream(gameId, 'init-form', {
+ user_id: user._id,
+ form
+ });
+ }
+
+ async function updateForm(id, value) {
+ const game = await Game.findOne({ _id: gameId });
+
+ if (game.is_started) return;
+ if (!game.user1_id.equals(user._id) && !game.user2_id.equals(user._id)) return;
+
+ const form = game.user1_id.equals(user._id) ? game.form2 : game.form1;
+
+ const item = form.find(i => i.id == id);
+
+ if (item == null) return;
+
+ item.value = value;
+
+ const set = game.user1_id.equals(user._id) ? {
+ form2: form
+ } : {
+ form1: form
+ };
+
+ await Game.update({ _id: gameId }, {
+ $set: set
+ });
+
+ publishOthelloGameStream(gameId, 'update-form', {
+ user_id: user._id,
+ id,
+ value
+ });
+ }
+
+ async function message(message) {
+ message.id = Math.random();
+ publishOthelloGameStream(gameId, 'message', {
+ user_id: user._id,
+ message
+ });
+ }
+
async function accept(accept: boolean) {
const game = await Game.findOne({ _id: gameId });
diff --git a/src/web/app/common/views/components/othello.room.vue b/src/web/app/common/views/components/othello.room.vue
index dfdc43ef96..bdefcdc49f 100644
--- a/src/web/app/common/views/components/othello.room.vue
+++ b/src/web/app/common/views/components/othello.room.vue
@@ -2,37 +2,77 @@
{{ game.user1.name }} vs {{ game.user2.name }}
-
ゲームの設定
+
+
ゲームの設定
-
-
-
-
- {{ m.name }}
- (by {{ m.author }})
-
-
-
+
+
+
+
+
+
+ {{ m.name }}
+ (by {{ m.author }})
+
+
+
+
+
+
+ %fa:circle%
+ %fa:circle R%
+
+
+
-
-
- %fa:circle%
- %fa:circle R%
-
-
-
-
-
-
-
-
+
+
+ 先手/後手
+
ランダム
{{ game.user1.name }}が黒
{{ game.user2.name }}が黒
-
+
+
+
+
+ ルール
+
+
+
+
+
+
+
+
+ Botの設定
+
+
+
+ {{ item.desc || '' }}
+
+
+
+ {{ item.label }}
+
+ {{ r.label }}
+
+
+
+
+ {{ item.label }}
+
+
+
+
+