Пример #1
0
        public void Ryuukyoku(RyuukyokuType type, byte[] ba, IEnumerable <int> scores, bool[] tenpai)
        {
            //1 byte id, 2 byte ba, 2*4*4 byte score, 1 byte ryuukyokuType, 4 byte tenpaiState
            _indexInBlock += 1 + 2 + 8 * 4 + 1 + 4;

            _stream.WriteByte((byte)Node.Ryuukyoku);

            _stream.Write(ba);
            _stream.Write(scores.SelectMany(BitConverter.GetBytes).ToArray());

            _stream.WriteByte((byte)type.Id);

            for (var i = 0; i < 4; i++)
            {
                _stream.WriteByte(tenpai[i] ? (byte)0 : (byte)1);
            }

            Debug.Assert(_indexInBlock == _stream.Length % 1024);
        }