/// <summary> /// 根据字节数组获取资源包版本信息 /// </summary> /// <param name="buffer">字节数组</param> /// <param name="version">版本号</param> /// <returns></returns> public static Dictionary <string, AssetBundleInfoEntity> GetAssetBundleVersionList(byte[] buffer, ref string version) { buffer = ZlibHelper.DeCompressBytes(buffer); Dictionary <string, AssetBundleInfoEntity> dic = new Dictionary <string, AssetBundleInfoEntity>(); MMO_MemoryStream ms = new MMO_MemoryStream(buffer); int len = ms.ReadInt(); for (int i = 0; i < len; i++) { if (i == 0) { version = ms.ReadUTF8String().Trim(); } else { AssetBundleInfoEntity entity = new AssetBundleInfoEntity(); entity.AssetBundleName = ms.ReadUTF8String(); entity.MD5 = ms.ReadUTF8String(); entity.Size = ms.ReadULong(); entity.IsFirstData = ms.ReadByte() == 1; entity.IsEncrypt = ms.ReadByte() == 1; dic[entity.AssetBundleName] = entity; } } return(dic); }
public static Goods_SearchEquipDetailReturnProto GetProto(byte[] buffer) { Goods_SearchEquipDetailReturnProto proto = new Goods_SearchEquipDetailReturnProto(); MMO_MemoryStream ms = GameEntry.Socket.SocketReceiveMS; ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.EnchantLevel = ms.ReadInt(); proto.BaseAttr1Type = (byte)ms.ReadByte(); proto.BaseAttr1Value = ms.ReadInt(); proto.BaseAttr2Type = (byte)ms.ReadByte(); proto.BaseAttr2Value = ms.ReadInt(); proto.HP = ms.ReadInt(); proto.MP = ms.ReadInt(); proto.Attack = ms.ReadInt(); proto.Defense = ms.ReadInt(); proto.Hit = ms.ReadInt(); proto.Dodge = ms.ReadInt(); proto.Cri = ms.ReadInt(); proto.Res = ms.ReadInt(); proto.IsPutOn = (byte)ms.ReadByte(); return(proto); }
/// <summary> /// 初始化资源信息 /// </summary> private void InitAssetInfo(byte[] buffer) { buffer = ZlibHelper.DeCompressBytes(buffer); MMO_MemoryStream ms = new MMO_MemoryStream(buffer); int len = ms.ReadInt(); int depLen = 0; for (int i = 0; i < len; i++) { AssetEntity entity = new AssetEntity(); entity.Category = (AssetCategory)ms.ReadByte(); entity.AssetFullName = ms.ReadUTF8String(); entity.AssetBundleName = ms.ReadUTF8String(); depLen = ms.ReadInt(); if (depLen > 0) { entity.DependsAssetList = new List <AssetDependsEntity>(depLen); for (int j = 0; j < depLen; j++) { AssetDependsEntity assetDepends = new AssetDependsEntity(); assetDepends.Category = (AssetCategory)ms.ReadByte(); assetDepends.AssetFullName = ms.ReadUTF8String(); entity.DependsAssetList.Add(assetDepends); } } //Debug.LogError("entity.Category=" + entity.Category); //Debug.LogError("entity.AssetFullName=" + entity.AssetFullName); m_AssetInfoDic[entity.Category][entity.AssetFullName] = entity; } }
public static GameLevel_VictoryProto ToProto(byte[] buffer) { using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { GameLevel_VictoryProto proto = new GameLevel_VictoryProto(); proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); proto.Star = (byte)ms.ReadByte(); proto.Exp = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.KillMonsterCount = ms.ReadInt(); for (int i = 0; i < proto.KillMonsterCount; i++) { MonsterItem monsterItem = new MonsterItem(); monsterItem.MonsterId = ms.ReadInt(); monsterItem.MonsterCount = ms.ReadInt(); proto.KillMonsterList.Add(monsterItem); } proto.ReceiveGoodsCount = ms.ReadInt(); for (int i = 0; i < proto.ReceiveGoodsCount; i++) { ReceiveGoodsItem goodsItem = new ReceiveGoodsItem(); goodsItem.GoodsType = (byte)ms.ReadByte(); goodsItem.GoodsId = ms.ReadInt(); goodsItem.GoodsCount = ms.ReadInt(); proto.ReceiveGoodsList.Add(goodsItem); } return(proto); } }
public static Backpack_GoodsChangeReturnProto GetProto(byte[] buffer) { Backpack_GoodsChangeReturnProto proto = new Backpack_GoodsChangeReturnProto(); MMO_MemoryStream ms = GameEntry.Socket.SocketReceiveMS; ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.BackpackItemChangeCount = ms.ReadInt(); proto.ItemList = new List <ChangeItem>(); for (int i = 0; i < proto.BackpackItemChangeCount; i++) { ChangeItem _Item = new ChangeItem(); _Item.BackpackId = ms.ReadInt(); _Item.ChangeType = (byte)ms.ReadByte(); _Item.GoodsType = (byte)ms.ReadByte(); _Item.GoodsId = ms.ReadInt(); _Item.GoodsCount = ms.ReadInt(); _Item.GoodsServerId = ms.ReadInt(); proto.ItemList.Add(_Item); } return(proto); }
public static GameLevel_VictoryProto GetProto(byte[] buffer) { GameLevel_VictoryProto proto = new GameLevel_VictoryProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); proto.Star = (byte)ms.ReadByte(); proto.Exp = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.KillTotalMonsterCount = ms.ReadInt(); proto.KillMonsterList = new List <MonsterItem>(); for (int i = 0; i < proto.KillTotalMonsterCount; i++) { MonsterItem _KillMonster = new MonsterItem(); _KillMonster.MonsterId = ms.ReadInt(); _KillMonster.MonsterCount = ms.ReadInt(); proto.KillMonsterList.Add(_KillMonster); } proto.GoodsTotalCount = ms.ReadInt(); proto.GetGoodsList = new List <GoodsItem>(); for (int i = 0; i < proto.GoodsTotalCount; i++) { GoodsItem _GetGoods = new GoodsItem(); _GetGoods.GoodsType = (byte)ms.ReadByte(); _GetGoods.GoodsId = ms.ReadInt(); _GetGoods.GoodsCount = ms.ReadInt(); proto.GetGoodsList.Add(_GetGoods); } } return(proto); }
public static GameLevel_ResurgenceProto GetProto(byte[] buffer) { GameLevel_ResurgenceProto proto = new GameLevel_ResurgenceProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); proto.Type = (byte)ms.ReadByte(); } return(proto); }
public static GameLevel_ResurgenceProto GetProto(MMO_MemoryStream ms, byte[] buffer) { GameLevel_ResurgenceProto proto = new GameLevel_ResurgenceProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); proto.Type = (byte)ms.ReadByte(); return(proto); }
public static RoleOperation_CreateRoleProto GetProto(byte[] buffer, bool isChild = false) { RoleOperation_CreateRoleProto proto = new RoleOperation_CreateRoleProto(); MMO_MemoryStream ms = null; if (!isChild) { ms = GameEntry.Socket.SocketSendMS; } else { ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>(); } ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.JobId = (byte)ms.ReadByte(); proto.RoleNickName = ms.ReadUTF8String(); if (isChild) { GameEntry.Pool.EnqueueClassObject(ms); } return(proto); }
public static Goods_EquipPutReturnProto GetProto(byte[] buffer, bool isChild = false) { Goods_EquipPutReturnProto proto = new Goods_EquipPutReturnProto(); MMO_MemoryStream ms = null; if (!isChild) { ms = GameEntry.Socket.SocketSendMS; } else { ms = GameEntry.Pool.DequeueClassObject<MMO_MemoryStream>(); } ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.IsSuccess = ms.ReadBool(); if (proto.IsSuccess) { proto.Type = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); proto.GoodsServerId = ms.ReadInt(); } else { } proto.MsgCode = ms.ReadInt(); if (isChild) { GameEntry.Pool.EnqueueClassObject(ms); } return proto; }
public static RoleData_MondeyChangeReturnProto GetProto(byte[] buffer) { RoleData_MondeyChangeReturnProto proto = new RoleData_MondeyChangeReturnProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.OldMoney = ms.ReadInt(); proto.CurrMoney = ms.ReadInt(); proto.ChangeType = (byte)ms.ReadByte(); proto.AddType = (byte)ms.ReadByte(); proto.ReduceType = (byte)ms.ReadByte(); proto.GoodsType = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); } return(proto); }
public static Goods_SellToSysProto GetProto(byte[] buffer, bool isChild = false) { Goods_SellToSysProto proto = new Goods_SellToSysProto(); MMO_MemoryStream ms = null; if (!isChild) { ms = GameEntry.Socket.SocketSendMS; } else { ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>(); } ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.roleBackpackId = ms.ReadInt(); proto.GoodsType = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); proto.GoodsServerId = ms.ReadInt(); proto.SellCount = ms.ReadInt(); if (isChild) { GameEntry.Pool.EnqueueClassObject(ms); } return(proto); }
public static WorldMap_OtherRoleUseSkillProto GetProto(byte[] buffer) { WorldMap_OtherRoleUseSkillProto proto = new WorldMap_OtherRoleUseSkillProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.AttackRoleId = ms.ReadInt(); proto.SkillId = ms.ReadInt(); proto.SkillLevel = ms.ReadInt(); proto.RolePosX = ms.ReadFloat(); proto.RolePosY = ms.ReadFloat(); proto.RolePosZ = ms.ReadFloat(); proto.RoleYAngle = ms.ReadFloat(); proto.BeAttackCount = ms.ReadInt(); proto.ItemList = new List <BeAttackItem>(); for (int i = 0; i < proto.BeAttackCount; i++) { BeAttackItem _Item = new BeAttackItem(); _Item.BeAttackRoleId = ms.ReadInt(); _Item.ReduceHp = ms.ReadInt(); _Item.IsCri = (byte)ms.ReadByte(); proto.ItemList.Add(_Item); } } return(proto); }
public static RoleOperation_SelectRoleInfoReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.IsSuccess = ms.ReadBool(); if (proto.IsSuccess) { proto.RoldId = ms.ReadInt(); proto.RoleNickName = ms.ReadUTF8String(); proto.JobId = (byte)ms.ReadByte(); proto.Level = ms.ReadInt(); proto.TotalRechargeMoney = ms.ReadInt(); proto.Money = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.Exp = ms.ReadInt(); proto.MaxHP = ms.ReadInt(); proto.MaxMP = ms.ReadInt(); proto.CurrHP = ms.ReadInt(); proto.CurrMP = ms.ReadInt(); proto.ToSpeed = ms.ReadInt(); proto.WeaponDamageMin = ms.ReadInt(); proto.WeaponDamageMax = ms.ReadInt(); proto.AttackNumber = ms.ReadInt(); proto.StrikePower = ms.ReadInt(); proto.PiercingPower = ms.ReadInt(); proto.MagicPower = ms.ReadInt(); proto.LastInWorldMapId = ms.ReadInt(); proto.LastInWorldMapPos = ms.ReadUTF8String(); proto.Equip_Weapon = ms.ReadInt(); proto.Equip_Pants = ms.ReadInt(); proto.Equip_Clothes = ms.ReadInt(); proto.Equip_Belt = ms.ReadInt(); proto.Equip_Cuff = ms.ReadInt(); proto.Equip_Necklace = ms.ReadInt(); proto.Equip_Shoe = ms.ReadInt(); proto.Equip_Ring = ms.ReadInt(); proto.Equip_WeaponTableId = ms.ReadInt(); proto.Equip_PantsTableId = ms.ReadInt(); proto.Equip_ClothesTableId = ms.ReadInt(); proto.Equip_BeltTableId = ms.ReadInt(); proto.Equip_CuffTableId = ms.ReadInt(); proto.Equip_NecklaceTableId = ms.ReadInt(); proto.Equip_ShoeTableId = ms.ReadInt(); proto.Equip_RingTableId = ms.ReadInt(); proto.ChoppingDefense = ms.ReadInt(); proto.PuncturDefense = ms.ReadInt(); proto.MagicDefense = ms.ReadInt(); } else { proto.MsgCode = ms.ReadInt(); } return(proto); }
public static RoleOperation_SelectRoleInfoReturnProto GetProto(byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); MMO_MemoryStream ms = GameEntry.Socket.SocketReceiveMS; ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.IsSuccess = ms.ReadBool(); if (proto.IsSuccess) { proto.RoldId = ms.ReadInt(); proto.RoleNickName = ms.ReadUTF8String(); proto.JobId = (byte)ms.ReadByte(); proto.Level = ms.ReadInt(); proto.TotalRechargeMoney = ms.ReadInt(); proto.Money = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.Exp = ms.ReadInt(); proto.MaxHP = ms.ReadInt(); proto.MaxMP = ms.ReadInt(); proto.CurrHP = ms.ReadInt(); proto.CurrMP = ms.ReadInt(); proto.Attack = ms.ReadInt(); proto.Defense = ms.ReadInt(); proto.Hit = ms.ReadInt(); proto.Dodge = ms.ReadInt(); proto.Cri = ms.ReadInt(); proto.Res = ms.ReadInt(); proto.Fighting = ms.ReadInt(); proto.LastInWorldMapId = ms.ReadInt(); proto.LastInWorldMapPos = ms.ReadUTF8String(); proto.Equip_Weapon = ms.ReadInt(); proto.Equip_Pants = ms.ReadInt(); proto.Equip_Clothes = ms.ReadInt(); proto.Equip_Belt = ms.ReadInt(); proto.Equip_Cuff = ms.ReadInt(); proto.Equip_Necklace = ms.ReadInt(); proto.Equip_Shoe = ms.ReadInt(); proto.Equip_Ring = ms.ReadInt(); proto.Equip_WeaponTableId = ms.ReadInt(); proto.Equip_PantsTableId = ms.ReadInt(); proto.Equip_ClothesTableId = ms.ReadInt(); proto.Equip_BeltTableId = ms.ReadInt(); proto.Equip_CuffTableId = ms.ReadInt(); proto.Equip_NecklaceTableId = ms.ReadInt(); proto.Equip_ShoeTableId = ms.ReadInt(); proto.Equip_RingTableId = ms.ReadInt(); } else { proto.MsgCode = ms.ReadInt(); } return(proto); }
public static RoleData_MondeyChangeReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer) { RoleData_MondeyChangeReturnProto proto = new RoleData_MondeyChangeReturnProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.OldMoney = ms.ReadInt(); proto.CurrMoney = ms.ReadInt(); proto.ChangeType = (byte)ms.ReadByte(); proto.AddType = (byte)ms.ReadByte(); proto.ReduceType = (byte)ms.ReadByte(); proto.GoodsType = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); return(proto); }
public static RoleSkillDataResponseProto GetProto(byte[] buffer) { RoleSkillDataResponseProto proto = new RoleSkillDataResponseProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.SkillCount = (byte)ms.ReadByte(); proto.CurrSkillDataList = new List <SkillData>(); for (int i = 0; i < proto.SkillCount; i++) { SkillData _CurrSkillData = new SkillData(); _CurrSkillData.SkillId = ms.ReadInt(); _CurrSkillData.SkillLevel = ms.ReadInt(); _CurrSkillData.SlotsNode = (byte)ms.ReadByte(); proto.CurrSkillDataList.Add(_CurrSkillData); } } return(proto); }
public static GameLevel_EnterProto ToProto(byte[] buffer) { using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { GameLevel_EnterProto proto = new GameLevel_EnterProto(); proto.GameLevelId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); return(proto); } }
public static Backpack_GoodsAddProto GetProto(byte[] buffer) { Backpack_GoodsAddProto proto = new Backpack_GoodsAddProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.GoodsInType = (byte)ms.ReadByte(); proto.GoodsKindCount = ms.ReadInt(); proto.ItemList = new List <GoodsKindItem>(); for (int i = 0; i < proto.GoodsKindCount; i++) { GoodsKindItem _Item = new GoodsKindItem(); _Item.GoodsType = (byte)ms.ReadByte(); _Item.GoodsId = ms.ReadInt(); _Item.GoodsCount = ms.ReadInt(); proto.ItemList.Add(_Item); } } return(proto); }
public static RoleOperation_CreateRoleProto GetProto(byte[] buffer) { RoleOperation_CreateRoleProto proto = new RoleOperation_CreateRoleProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.JobId = (byte)ms.ReadByte(); proto.RoleNickName = ms.ReadUTF8String(); } return(proto); }
public static GameLevelEnterRequestProto GetProto(byte[] buffer) { GameLevelEnterRequestProto proto = new GameLevelEnterRequestProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.GameChapterId = ms.ReadInt(); proto.Grade = (byte)ms.ReadByte(); proto.GameLevelId = ms.ReadInt(); } return(proto); }
public static RoleData_RechargeProductReturnProto GetProto(byte[] buffer) { RoleData_RechargeProductReturnProto proto = new RoleData_RechargeProductReturnProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.RechargeProductCount = ms.ReadInt(); proto.CurrItemList = new List <RechargeProductItem>(); for (int i = 0; i < proto.RechargeProductCount; i++) { RechargeProductItem _CurrItem = new RechargeProductItem(); _CurrItem.RechargeProductId = ms.ReadInt(); _CurrItem.ProductDesc = ms.ReadUTF8String(); _CurrItem.CanBuy = (byte)ms.ReadByte(); _CurrItem.RemainDay = ms.ReadInt(); _CurrItem.DoubleFlag = (byte)ms.ReadByte(); proto.CurrItemList.Add(_CurrItem); } } return(proto); }
public static RoleData_SkillReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer) { RoleData_SkillReturnProto proto = new RoleData_SkillReturnProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.SkillCount = (byte)ms.ReadByte(); proto.CurrSkillDataList = new List <SkillData>(); for (int i = 0; i < proto.SkillCount; i++) { SkillData _CurrSkillData = new SkillData(); _CurrSkillData.SkillId = ms.ReadInt(); _CurrSkillData.SkillLevel = ms.ReadInt(); _CurrSkillData.SlotsNo = (byte)ms.ReadByte(); proto.CurrSkillDataList.Add(_CurrSkillData); } return(proto); }
public static Goods_EquipPutProto GetProto(byte[] buffer) { Goods_EquipPutProto proto = new Goods_EquipPutProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.Type = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); proto.GoodsServerId = ms.ReadInt(); } return(proto); }
public static Goods_SearchEquipDetailReturnProto GetProto(byte[] buffer, bool isChild = false) { Goods_SearchEquipDetailReturnProto proto = new Goods_SearchEquipDetailReturnProto(); MMO_MemoryStream ms = null; if (!isChild) { ms = GameEntry.Socket.SocketSendMS; } else { ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>(); } ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.EnchantLevel = ms.ReadInt(); proto.BaseAttr1Type = (byte)ms.ReadByte(); proto.BaseAttr1Value = ms.ReadInt(); proto.BaseAttr2Type = (byte)ms.ReadByte(); proto.BaseAttr2Value = ms.ReadInt(); proto.HP = ms.ReadInt(); proto.MP = ms.ReadInt(); proto.Attack = ms.ReadInt(); proto.Defense = ms.ReadInt(); proto.Hit = ms.ReadInt(); proto.Dodge = ms.ReadInt(); proto.Cri = ms.ReadInt(); proto.Res = ms.ReadInt(); proto.IsPutOn = (byte)ms.ReadByte(); if (isChild) { GameEntry.Pool.EnqueueClassObject(ms); } return(proto); }
/// <summary> /// 加载列表 /// </summary> protected override void LoadList(MMO_MemoryStream ms) { int rows = ms.ReadInt(); int columns = ms.ReadInt(); for (int i = 0; i < rows; i++) { Sys_PrefabEntity entity = new Sys_PrefabEntity(); entity.Id = ms.ReadInt(); entity.Desc = ms.ReadUTF8String(); entity.AssetCategory = ms.ReadInt(); entity.AssetPath = ms.ReadUTF8String(); entity.PoolId = (byte)ms.ReadByte(); entity.CullDespawned = (byte)ms.ReadByte(); entity.CullAbove = ms.ReadInt(); entity.CullDelay = ms.ReadInt(); entity.CullMaxPerPass = ms.ReadInt(); m_List.Add(entity); m_Dic[entity.Id] = entity; } }
public static Backpack_GoodsChangeReturnProto GetProto(byte[] buffer) { Backpack_GoodsChangeReturnProto proto = new Backpack_GoodsChangeReturnProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.BackpackItemChangeCount = ms.ReadInt(); proto.ItemList = new List <ChangeItem>(); for (int i = 0; i < proto.BackpackItemChangeCount; i++) { ChangeItem _Item = new ChangeItem(); _Item.BackpackId = ms.ReadInt(); _Item.ChangeType = (byte)ms.ReadByte(); _Item.GoodsType = (byte)ms.ReadByte(); _Item.GoodsId = ms.ReadInt(); _Item.GoodsCount = ms.ReadInt(); _Item.GoodsServerId = ms.ReadInt(); proto.ItemList.Add(_Item); } } return(proto); }
public static RoleOperation_CreateRoleProto GetProto(MMO_MemoryStream ms, byte[] buffer) { RoleOperation_CreateRoleProto proto = new RoleOperation_CreateRoleProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.JobId = (byte)ms.ReadByte(); proto.RoleNickName = ms.ReadUTF8String(); return(proto); }
public static Backpack_GoodsChangeReturnProto GetProto(byte[] buffer, bool isChild = false) { Backpack_GoodsChangeReturnProto proto = new Backpack_GoodsChangeReturnProto(); MMO_MemoryStream ms = null; if (!isChild) { ms = GameEntry.Socket.SocketSendMS; } else { ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>(); } ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.BackpackItemChangeCount = ms.ReadInt(); proto.ItemList = new List <ChangeItem>(); for (int i = 0; i < proto.BackpackItemChangeCount; i++) { ChangeItem _Item = new ChangeItem(); _Item.BackpackId = ms.ReadInt(); _Item.ChangeType = (byte)ms.ReadByte(); _Item.GoodsType = (byte)ms.ReadByte(); _Item.GoodsId = ms.ReadInt(); _Item.GoodsCount = ms.ReadInt(); _Item.GoodsServerId = ms.ReadInt(); proto.ItemList.Add(_Item); } if (isChild) { GameEntry.Pool.EnqueueClassObject(ms); } return(proto); }
public static Goods_EquipPutProto GetProto(MMO_MemoryStream ms, byte[] buffer) { Goods_EquipPutProto proto = new Goods_EquipPutProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.Type = (byte)ms.ReadByte(); proto.GoodsId = ms.ReadInt(); proto.GoodsServerId = ms.ReadInt(); return(proto); }