예제 #1
0
        public static bool TakeOffEquip(Pathea.PeEntity entity)
        {
            if (entity == null || entity.motionEquipment == null || entity.motionEquipment.PEHoldAbleEqObj == null)
            {
                return(false);
            }

            if (entity.equipmentCmpt == null)
            {
                return(false);
            }

            EquipmentCmpt.Receiver receiver = entity.packageCmpt;
            if (GameConfig.IsMultiMode)
            {
                if (entity.equipmentCmpt.TryTakeOffEquipment(entity.motionEquipment.PEHoldAbleEqObj, true, receiver))
                {
                    PlayerNetwork.mainPlayer.RequestNpcTakeOffEquip(entity.Id, entity.motionEquipment.PEHoldAbleEqObj.instanceId, -1);
                    return(true);
                }
            }
            else
            {
                return(entity.equipmentCmpt.TakeOffEquipment(entity.motionEquipment.PEHoldAbleEqObj, true, receiver));
            }
            return(false);
        }
예제 #2
0
        //public static bool ChangeEquip(Pathea.PeEntity entity, EeqSelect select)
        //{
        //    List<ItemObject> objs = entity.GetEquipObjs(select);
        //    if (objs.Count > 0 && GameUI.Instance.mServantWndCtrl.ServantIsNotNull)
        //    {
        //        EquipmentCmpt.Receiver receiver = entity.packageCmpt;
        //        if (GameUI.Instance.mServantWndCtrl.EquipItem(objs[0], receiver))
        //        {
        //            return entity.RemoveFromBag(objs[0]);
        //        }
        //    }
        //    return false;
        //}

        public static bool EquipByObj(Pathea.PeEntity entity, ItemObject obj)
        {
            if (obj == null || entity.equipmentCmpt == null)
            {
                return(false);
            }

            EquipmentCmpt.Receiver receiver = entity.packageCmpt;
            if (GameConfig.IsMultiMode)
            {
                if (entity.equipmentCmpt.NetTryPutOnEquipment(obj, true, receiver))
                {
                    entity.netCmpt.RequestUseItem(obj.instanceId);
                    //entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            else
            {
                if (entity.equipmentCmpt.PutOnEquipment(obj, true, receiver))
                {
                    if (SelectItem_N.Instance.ItemObj != null && SelectItem_N.Instance.ItemObj.Equals(obj))
                    {
                        SelectItem_N.Instance.SetItem(null);
                    }

                    entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
 public bool RemoveEqByObj(ItemObject itemObj, bool addToReceiver, EquipmentCmpt.Receiver receiver)
 {
     if (equipmentCmpt.TakeOffEquipment(itemObj, addToReceiver, receiver))
     {
         //lz-2016.08.31 脱下装备成功播放音效
         GameUI.Instance.PlayTakeOffEquipAudio();
         return(true);
     }
     return(false);
 }
예제 #4
0
    public bool EquipItem(ItemObject itemObj, EquipmentCmpt.Receiver receiver)
    {
        if (equipmentCmpt != null)
        {
            if (equipmentCmpt.PutOnEquipment(itemObj, true, receiver))
            {
                //lz-2016.08.31 装备成功播放音效
                GameUI.Instance.PlayPutOnEquipAudio();
                return(true);
            }
        }

        return(false);
    }
예제 #5
0
 public bool EquipItem(ItemObject itemObj)
 {
     if (NpcEquipment != null)
     {
         EquipmentCmpt.Receiver receiver = PeCreature.Instance.mainPlayer == null ? null : PeCreature.Instance.mainPlayer.GetCmpt <PackageCmpt>();
         if (NpcEquipment.PutOnEquipment(itemObj, true, receiver))
         {
             //lz-2016.08.31 装备成功播放音效
             GameUI.Instance.PlayPutOnEquipAudio();
             return(true);
         }
     }
     return(false);
 }