diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index e82f038..77b71a6 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -102,6 +102,13 @@ export class GeneralRoom extends Room { msgLog('change pet from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new ChangePetCommand(), {client, pos: message.pos, petId: message.petId}); }); + /** + * broadcast_c2s的消息, 原样广播出去 + */ + this.onMessage("broadcast_c2s", (client, message) => { + msgLog('broadcast_c2s from ', client.sessionId, JSON.stringify(message)); + this.broadcast("broadcast_s2c", message, {except: client}); + }); this.onMessage("*", (client, type, message) => { // diff --git a/src/rooms/commands/BeginGameCommand.ts b/src/rooms/commands/BeginGameCommand.ts index 6537844..e6a9892 100644 --- a/src/rooms/commands/BeginGameCommand.ts +++ b/src/rooms/commands/BeginGameCommand.ts @@ -18,6 +18,9 @@ export class BeginGameCommand extends Command { let card1 = gameUtil.initCardQue(card0.length + 1); let cardAll = card0.concat(card1); cardAll.randomSort(); + //FixMe:: 移除 + // let card0 = gameUtil.initSampleCards(1) + // this.state.cardQueue = card0; this.state.cardQueue = cardAll; let i = 0; for (let [id] of this.state.players) { diff --git a/src/utils/game.util.ts b/src/utils/game.util.ts index 477b08b..948debb 100644 --- a/src/utils/game.util.ts +++ b/src/utils/game.util.ts @@ -4,7 +4,7 @@ import {Player} from "../rooms/schema/Player"; import {BaseConst} from "../constants/BaseConst"; import {SystemCardCfg} from "../cfg/parsers/SystemCardCfg"; import {EffectCardCfg} from "../cfg/parsers/EffectCardCfg"; -import {cardLog, error} from "../common/Debug"; +import { cardLog, debugRoom, error } from '../common/Debug' import {Room} from "colyseus"; import {PlayerStateConst} from "../constants/PlayerStateConst"; import {GameEnv} from "../cfg/GameEnv"; @@ -39,6 +39,17 @@ let gameUtil = { cards.randomSort(); return cards; }, + initSampleCards(beginNum: number) { + let cardArr = [[1, 1, 20012, 1], [2, 3, 20102, 11], [3, 4, 20032, 1], [4, 10, 20102, 11], [5, 10, 20042, 1], [6, 1, 20012, 1], [7, 3, 20102, 11], [8, 4, 20032, 1], [9, 5, 20102, 11], [10, 6, 20102, 11], [11, 1, 20012, 1], [12, 5, 20102, 11], [13, 5, 20032, 1], [14, 5, 20102, 11], [15, 5, 20102, 11], [16, 6, 20102, 11], [17, 1, 20012, 1], [18, 3, 20102, 11], [19, 5, 20102, 11], [20, 7, 20102, 11], [21, 8, 20042, 1], [22, 10, 20102, 11], [23, 4, 20102, 11], [24, 7, 20052, 1], [25, 3, 20102, 11], [26, 7, 20052, 1], [27, 6, 20072, 1], [28, 1, 20052, 1], [29, 5, 20102, 11], [30, 4, 20052, 1], [31, 0, 20112, 2], [32, 5, 20102, 11], [33, 5, 20062, 1], [34, 2, 20102, 11], [35, 4, 20062, 1], [36, 1, 20072, 1], [37, 1, 20102, 11], [38, 1, 20062, 1], [39, 9, 20042, 1], [40, 0, 20112, 2], [41, 6, 20102, 11], [42, 8, 20072, 1], [43, 0, 20112, 2], [44, 0, 20112, 2], [45, 0, 20112, 2], [46, 0, 20112, 2], [47, 0, 20112, 2], [48, 0, 20112, 2], [49, 10, 20042, 1], [50, 0, 20112, 2], [51, 5, 20102, 11], [52, 5, 20082, 1], [53, 5, 20102, 11], [54, 5, 20052, 1], [55, 0, 20122, 3], [56, 0, 20122, 3], [57, 0, 20122, 3], [58, 0, 20122, 3], [59, 0, 20122, 3], [60, 0, 20122, 3], [61, 0, 20122, 3], [62, 0, 20122, 3], [63, 0, 20112, 2], [64, 0, 20112, 2], [65, 0, 20112, 2], [66, 0, 20112, 2], [67, 0, 20112, 2], [68, 0, 20112, 2]] + let cards: Card[] = []; + for (let i = cardArr.length - 1; i >=0; i--) { + let subarr = cardArr[i] + let card = new Card(subarr[0], subarr[1], subarr[3], subarr[2]) + cards.push(card) + } + debugRoom(cards) + return cards + }, /** * 随机生成一张指定效果的卡 * @param effectId