修改协议名
This commit is contained in:
parent
178d72efdd
commit
d2f5fc8315
@ -19,22 +19,22 @@ export class GeneralRoom extends Room {
|
||||
onCreate (options: any) {
|
||||
this.setState(new CardGameState());
|
||||
this.state.gameSate = 0;
|
||||
this.onMessage("play_ready", (client, message) => {
|
||||
this.onMessage("play_ready_c2s", (client, message) => {
|
||||
console.log('play_ready from ', client.sessionId, message);
|
||||
this.dispatcher.dispatch(new PlayReadyCommand(), {client});
|
||||
});
|
||||
|
||||
this.onMessage("discard_card", (client, message) => {
|
||||
this.onMessage("discard_card_c2s", (client, message) => {
|
||||
console.log('discard_card from ', client.sessionId, message);
|
||||
this.dispatcher.dispatch(new DiscardCommand(), {client, cards: message.cards});
|
||||
});
|
||||
|
||||
this.onMessage("give_up_take", (client, message) => {
|
||||
this.onMessage("give_up_take_c2s", (client, message) => {
|
||||
console.log('give_up_take from ', client.sessionId, message);
|
||||
this.dispatcher.dispatch(new NextSubCommand(), {});
|
||||
});
|
||||
|
||||
this.onMessage("select_pet", (client, message) => {
|
||||
this.onMessage("select_pet_c2s", (client, message) => {
|
||||
console.log('select_pet from ', client.sessionId, message);
|
||||
this.dispatcher.dispatch(new SelectPetCommand(), {client, cardId: message.cardId});
|
||||
});
|
||||
|
@ -19,6 +19,6 @@ export class DrawCommand extends Command<CardGameState, {}> {
|
||||
curPlayer.cards.set(card.id, card);
|
||||
curPlayer.cardSet.add(card.id);
|
||||
}
|
||||
curClient.send('draw_card', cards);
|
||||
curClient.send('draw_card_s2c', cards);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class PlayReadyCommand extends Command<CardGameState, {
|
||||
|
||||
execute({ client } : {client: Client}) {
|
||||
this.state.players.get(client.sessionId).state = 1;
|
||||
this.room.broadcast("player_ready", {player: client.sessionId}, {except: client});
|
||||
this.room.broadcast("player_ready_s2c", {player: client.sessionId}, {except: client});
|
||||
let readyCount = 0;
|
||||
for (let [sessionId, player] of this.state.players) {
|
||||
if (player.state === 1) {
|
||||
@ -29,7 +29,7 @@ export class PlayReadyCommand extends Command<CardGameState, {
|
||||
player.cards.set(card.id, card);
|
||||
player.cardSet.add(card.id);
|
||||
}
|
||||
client.send('draw_card', cards);
|
||||
client.send('draw_card_s2c', cards);
|
||||
}
|
||||
let curClient = this.room.clients[0];
|
||||
this.state.currentTurn = curClient.sessionId;
|
||||
@ -42,7 +42,7 @@ export class PlayReadyCommand extends Command<CardGameState, {
|
||||
curPlayer.cards.set(card.id, card);
|
||||
curPlayer.cardSet.add(card.id);
|
||||
}
|
||||
curClient.send('draw_card', cards);
|
||||
curClient.send('draw_card_s2c', cards);
|
||||
this.state.gameState = 2;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user