GameLevel_EnterProto
来源:互联网 发布:淘宝客返利在哪里查看 编辑:程序博客网 时间:2024/06/04 22:46
using System.Collections;using System.Collections.Generic;using System;/// <summary>/// 客户端发送进入游戏关卡消息/// </summary>public struct GameLevel_EnterProto : IProto{ public ushort ProtoCode { get { return 12001; } } public int GameLevelId; //游戏关卡Id public byte Grade; //难度等级 public byte[] ToArray() { using (MMO_MemoryStream ms = new MMO_MemoryStream()) { ms.WriteUShort(ProtoCode); ms.WriteInt(GameLevelId); ms.WriteByte(Grade); return ms.ToArray(); } } public static GameLevel_EnterProto GetProto(byte[] buffer) { GameLevel_EnterProto proto = new GameLevel_EnterProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); } return proto; }}