Example #1
0
    public void OnGameStart(int clientID)
    {
        room.StartGame();
        NetworkMsg msg = new ReplyStart(room.isGameStart);

        room.roomBroadCast(msg);
    }
Example #2
0
    public void Start()
    {
        NetworkMsg msg = new ReplyStart(true);

        gameMap.Start(players);
        roomBroadCast(msg);
        bStart = true;
        //  preTimer.Start();
    }
 public static void BufferReplyStart(ReplyStart replyStart)
 {
     p_AllMsg.ReplyStart.start = replyStart.start;
     p_AllMsg.ReplyStart.type  = replyStart.type;
 }
    public static byte[] SerializeData(BaseProtocol baseProtocol, NetworkMsg networkMsg, ReplyGetRooms replyGetRooms = null, ReplyJoin replyJoin = null,
                                       ReplyAskFrame replyAskFrame = null, ReplyID replyID = null, ReplyStart replyStart = null)
    {
        p_AllMsg = new p_AllMsg();
        if (baseProtocol != null)
        {
            Buffer_BaseProtocol(baseProtocol);
        }
        if (networkMsg != null)
        {
            Buffer_NetworkMsg(networkMsg);
        }
        if (networkMsg.type == (int)CmdType.REPLYGETROOMS)
        {
            replyGetRooms = networkMsg as ReplyGetRooms;
            Buffer_ReplyGetRooms(replyGetRooms);
        }
        else if (networkMsg.type == (int)CmdType.REPLYJOIN)
        {
            replyJoin = networkMsg as ReplyJoin;
            Buffer_ReplyJoin(replyJoin);
        }
        else if (networkMsg.type == (int)CmdType.REPLYASKFRAME)
        {
            replyAskFrame = networkMsg as ReplyAskFrame;
            Buffer_ReplyAskFrame(replyAskFrame);
        }
        else if (networkMsg.type == (int)CmdType.REPLYSTART)
        {
            replyStart = networkMsg as ReplyStart;
            BufferReplyStart(replyStart);
        }
        else if (networkMsg.type == (int)CmdType.REPLYID)
        {
            replyID = networkMsg as ReplyID;
            Buffer_ReplyID(replyID);
        }

        return(Serialize <p_AllMsg>(p_AllMsg));
    }
 private void Reply_Start_Click(object sender, RoutedEventArgs e)
 {
     ReplyStart?.Invoke();
 }