Ejemplo n.º 1
0
    /// <summary>
    /// 背包list中的装备配件功能
    /// </summary>
    /// <param name="_prop"></param>
    void PutOnParts(aSong_PlayerData.Prop _prop)
    {
        aSongUI_BackpackWeapon curentBackpackWeapon = GetCurrent_aSongUI_BackpackWeapon();

        if (!curentBackpackWeapon)
        {
            return;
        }
        //当前没拿武器
        if (!curentBackpackWeapon.CanPartsOn())
        {
            curentBackpackWeapon.Reset();
            return;
        }
        //先从数据中背包List删除
        //再将道具引用放到aSongUI_BackpackWeapon对应的槽中
        //aSongUI_Contact.m_instance

        PropBaseModel _model = aSongUI_Controller.Instance.playerData.GetBagProp(_prop.propID);

        Debug.Log("装配件_model = " + _model.prop.name);
        aSongUI_Controller.Instance.RemovePropFromBag(_model);
        _model = curentBackpackWeapon.PutOnParts(_model);
        if (_model)
        {
            Debug.Log("卸下来的道具 = " + _model.prop.name);
            aSongUI_Controller.Instance.AddPropToBag(_model);
        }
        HideBtnItem();
    }
Ejemplo n.º 2
0
    aSongUI_BackpackWeapon GetCurrent_aSongUI_BackpackWeapon()
    {
        aSongUI_BackpackWeapon backpackWeapon = null;

        if (rightWeapon.CanPartsOn() && rightWeapon.GetWeaponModel() == aSongUI_Controller.Instance.CurrentModel)
        {
            backpackWeapon = rightWeapon;
        }

        if (leftWeapon.CanPartsOn() && leftWeapon.GetWeaponModel() == aSongUI_Controller.Instance.CurrentModel)
        {
            backpackWeapon = leftWeapon;
        }
        return(backpackWeapon);
    }