Esempio n. 1
0
    public void prepareReplay(RoomHistory room, GameBaseInfo baseInfo)
    {
        reset();

        info.roomid     = room.room_tag;
        info.numofseats = room.info.seats.Count;
        info.numofgames = baseInfo.index + 1;

        int nSeats = room.info.seats.Count;

        state.state = "playing";

        for (int i = 0; i < nSeats; i++)
        {
            PlayerInfo p = new PlayerInfo();
            p.reset();

            HistorySeats hs = room.info.seats[i];
            p.name      = hs.name;
            p.score     = hs.score;
            p.userid    = hs.uid;
            p.seatindex = i;
            p.online    = true;
            p.ip        = "127.0.0.1";
            p.ready     = true;

            players.Add(p);

            SeatInfo s = new SeatInfo();
            s.reset();

            s.holds   = new List <int>(baseInfo.game_seats[i].holds);
            s.flowers = new List <int>(baseInfo.game_seats[i].flowers);
            seats.Add(s);

            if (p.userid == GameMgr.GetInstance().userMgr.userid)
            {
                seatindex = i;
            }
        }

        if (seatindex < 0)
        {
            seatindex = 0;
        }

        conf = baseInfo.conf;

        int button = baseInfo.button;

        state.button = button;
        state.turn   = button;

        int count = baseInfo.mahjongs.Count;

        foreach (GameSeatInfo seat in baseInfo.game_seats)
        {
            count -= seat.holds.Count + seat.flowers.Count;
        }

        state.numofmj = count;
    }