示例#1
0
    public void DeleteSeedResult(CSEntity entity, int objId, int index)
    {
        if (m_Entity == entity)
        {
            for (int i = 0; i < m_SeedsGrids.Count; i++)
            {
                if (m_SeedsGrids[i].m_Grid.ItemObj != null && m_ToolsGrids[i].m_Grid.ItemObj.instanceId == objId)
                {
                    m_SeedsGrids[i].m_Grid.SetItem(null);
                }
            }

            //// Event
            ItemAsset.ItemObject io = m_Farm.GetPlantSeed(index);
            if (io != null)
            {
                io.DecreaseStackCount(1);
                if (io.GetCount() <= 0)
                {
                    m_Farm.ExcuteEvent(CSConst.eetFarm_OnPlant, index);
                }
            }

            m_Farm.SetPlantSeed(index, null);
        }
    }
示例#2
0
    public override void InitEquipment(PeEntity entity, ItemAsset.ItemObject itemObj)
    {
        base.InitEquipment(entity, itemObj);
        m_Anim         = GetComponentInChildren <Animator>();
        m_MotionEquip  = m_Entity.GetCmpt <Motion_Equip>();
        m_ItemAmmoAttr = itemObj.GetCmpt <ItemAsset.Arrow>();
        if (null != m_ItemAmmoAttr)
        {
            m_CurIndex = m_ItemAmmoAttr.index;
        }

        if (null != m_ArrowBagTrans)
        {
            m_ArrowBagTrans.gameObject.SetActive(true);
            m_View.AttachObject(m_ArrowBagTrans.gameObject, m_ArrowBagBone);
            m_ArrowBagTrans.localPosition = Vector3.zero;
            m_ArrowBagTrans.localRotation = Quaternion.identity;
            m_ArrowBagTrans.localScale    = Vector3.one;
        }

        m_FingerBone = PETools.PEUtil.GetChild(m_View.modelTrans, m_ArrowFinger);
        if (null != m_LineBone)
        {
            m_LineBoneDefaultPos = m_LineBone.localPosition;
        }

        if (m_ArrowModel.Length != m_CostItemID.Length || m_SkillID.Length != m_CostItemID.Length)
        {
            Debug.LogError("ArrowModelNum, ItemNum, SkillNum not match");
        }

        m_StartTime = 0f;
        m_BowOpen   = false;
    }
示例#3
0
 private void RPC_S2C_Item(uLink.BitStream stream, uLink.NetworkMessageInfo info)
 {
     ItemAsset.ItemObject item       = stream.Read <ItemAsset.ItemObject>();
     Pathea.PeEntity      mainplayer = Pathea.MainPlayer.Instance.entity;
     if (null != mainplayer)
     {
         (mainplayer.packageCmpt as Pathea.PlayerPackageCmpt).NetOnItemUpdate(item);
     }
 }
示例#4
0
            public static bool RemoveFromBag(this PeEntity entity, ItemAsset.ItemObject item)
            {
                NpcPackageCmpt pkg = entity.packageCmpt as NpcPackageCmpt;

                if (null == pkg)
                {
                    return(false);
                }

                return(pkg.Remove(item));
            }
示例#5
0
            public static bool AddToBag(this PeEntity entity, ItemAsset.ItemObject item, bool isnew = false)
            {
                NpcPackageCmpt pkg = entity.packageCmpt as NpcPackageCmpt;

                if (null == pkg)
                {
                    return(false);
                }

                return(pkg.Add(item, isnew));
            }
示例#6
0
    public override void InitEquipment(PeEntity entity, ItemAsset.ItemObject itemObj)
    {
        base.InitEquipment(entity, itemObj);

        m_ItemAmmoAttr = itemObj.GetCmpt <ItemAsset.GunAmmo>();
        if (null != m_ItemAmmoAttr)
        {
            if (null != m_AmmoItemIDList && m_AmmoItemIDList.Length > m_ItemAmmoAttr.index)
            {
                m_CurAmmoItemIndex = m_ItemAmmoAttr.index;
            }

            if (null != m_Magazine)
            {
                if (m_ItemAmmoAttr.count < 0)
                {
                    m_ItemAmmoAttr.count = (int)magazineSize;
                }

                m_Magazine.m_Value = m_ItemAmmoAttr.count;
            }
        }

        m_ShellCaseTrans = PETools.PEUtil.GetChild(transform, "ShellCase");

        m_View = entity.biologyViewCmpt;

        if (null != m_View && null != m_MagazineObj)
        {
            if (null != m_View)
            {
                m_View.AttachObject(m_MagazineObj, "mountOff");
                m_MagazineObj.transform.localPosition = Vector3.zero;
                m_MagazineObj.transform.localRotation = Quaternion.identity;
            }
        }

        if (null != m_ChargeEffectGo)
        {
            EffectLateupdateHelper effect = m_ChargeEffectGo.AddComponent <EffectLateupdateHelper>();
            effect.Init(m_ChargeEffectGo.transform.parent);
            m_ChargeEffectGo.transform.parent = Pathea.Effect.EffectBuilder.Instance.transform;
        }
    }
示例#7
0
    protected virtual void Deserialize(System.IO.BinaryReader br)
    {
        int itemInstanceId = br.ReadInt32();

        ItemAsset.ItemObject itemObj = ItemMgr.Instance.Get(itemInstanceId);
        if (null != itemObj)
        {
            itemDrag = itemObj.GetCmpt <ItemAsset.Drag>();
        }
        else
        {
            Debug.LogError("[Error]Cant find item object by id:" + itemInstanceId);
            itemDrag = null;
        }

        mId  = br.ReadInt32();
        _pos = PETools.Serialize.ReadVector3(br);
        _sca = PETools.Serialize.ReadVector3(br);
        _rot = PETools.Serialize.ReadQuaternion(br);

        Create();
    }
        static void InitEquipment(PeEntity entity, IEnumerable <int> equipmentItemProtoIds)
        {
            if (equipmentItemProtoIds == null)
            {
                return;
            }

            Pathea.EquipmentCmpt equipmentCmpt = entity.GetCmpt <Pathea.EquipmentCmpt>();
            if (null == equipmentCmpt)
            {
                Debug.LogError("no equipment cmpt");
                return;
            }

            PeSex entitySex = entity.ExtGetSex();

            foreach (int equipmentItemProtoId in equipmentItemProtoIds)
            {
                ItemAsset.ItemProto itemProto = ItemAsset.ItemProto.Mgr.Instance.Get(equipmentItemProtoId);
                if (itemProto == null)
                {
                    continue;
                }

                if (!PeGender.IsMatch(itemProto.equipSex, entitySex))
                {
                    continue;
                }

                ItemAsset.ItemObject itemObj = ItemAsset.ItemMgr.Instance.CreateItem(equipmentItemProtoId);
                if (itemObj != null)
                {
                    equipmentCmpt.PutOnEquipment(itemObj);
                }
            }
        }