public static ItemAsset.ItemObject GetBagItemObj(this PeEntity entity, int prototypeId) { NpcPackageCmpt pkg = entity.packageCmpt as NpcPackageCmpt; if (null == pkg) { return(null); } SlotList useList = pkg.GetSlotList(); if (null != useList.FindItemByProtoId(prototypeId)) { return(useList.FindItemByProtoId(prototypeId)); } useList = pkg.GetHandinList(); return(useList.FindItemByProtoId(prototypeId)); }
void UpdateItemGrid() { if (m_InteractionGrids1.Count == 0 || m_InteractionGrids2.Count == 0 || m_PrivateGrids.Count == 0)//格子数量为0 { return; } //先清空格子 for (int i = 0; i < m_Interaction1Count; i++) { m_InteractionGrids1[i].SetItem(null); } for (int i = 0; i < m_Interaction2Count; i++) { m_InteractionGrids2[i].SetItem(null); } for (int i = 0; i < 10; i++) { m_PrivateGrids[i].SetItem(null); } if (m_RefNpc == null)//当传进来的npc为空,则直接返回 { return; } //lz-2016.11.22 错误 #6885 Crush bug if (m_RefNpc != null && null != m_RefNpc.m_Npc) { cmpt = m_RefNpc.m_Npc.GetCmpt <NpcCmpt>(); if (null != cmpt) { packageCmpt = cmpt.GetComponent <NpcPackageCmpt>(); if (null != packageCmpt) { if (mInteractionPackage1 != null) { mInteractionPackage1.eventor.Unsubscribe(InteractionpackageChange); } mInteractionPackage1 = packageCmpt.GetSlotList(); mInteractionPackage1.eventor.Subscribe(InteractionpackageChange); if (mInteractionPackage2 != null) { mInteractionPackage2.eventor.Unsubscribe(Interactionpackage2Change); } mInteractionPackage2 = packageCmpt.GetHandinList(); mInteractionPackage2.eventor.Subscribe(Interactionpackage2Change); if (mPrivatePakge != null) { mPrivatePakge.eventor.Unsubscribe(PrivatepackageChange); } mPrivatePakge = packageCmpt.GetPrivateSlotList(); mPrivatePakge.eventor.Subscribe(PrivatepackageChange); } } } Reflashpackage(); }