using System.Collections; using System.Collections.Generic; using AX.Network.Protocols; using AX.Serialization; using UnityEngine; public class BAG_DATA_SYNC : NetworkMessageBehaviour { protected override void Execute(BinaryMessage message) { BagDataSync data = message.Body.Deserialize(); // 根据id找到消防员或者机器人 GameObject selectobj = EntitiesManager.Instance.GetEntityByID(data.GameObjectID); // 同步背包数据 不适用添加的方法,因为这样会不停累加数量 Bags bagData = selectobj.GetComponent(); bagData.EquipData = data.BagData; // 重新加载背包装备信息,没有穿戴装备的逻辑,在背包就要检测自动穿戴 bagData.ReloadingSync(); // 给对应消防员赋值对应水带信息 if (selectobj.GetComponent()) { selectobj.GetComponent().AddEquip(); } else if (selectobj.GetComponent()) { selectobj.GetComponent().AddEquip(); } } }