예제 #1
0
    /// <summary>
    /// 消耗信息
    /// </summary>
    private void SetCostInfo()
    {
        EquipStar star_info = EquipStarConfig.GetEquipStarInfo(cur_equip_info.id, cur_star_num);

        if (star_info == null || string.IsNullOrEmpty(star_info.cost))
        {
            return;
        }
        string[] need_str_arr = star_info.cost.Split(';');
        // 默认打开球队卡牌界面
        List <object> listObj = new List <object>();

        for (int i = 0; i < need_str_arr.Length; i++)
        {
            EquipCostInfo info     = new EquipCostInfo();
            string[]      info_arr = need_str_arr[i].Split(':');
            info.item_id  = GameConvert.IntConvert(info_arr[0]);
            info.need_num = GameConvert.IntConvert(info_arr[1]);
            if (info.item_id == 0)
            {
                continue;
            }
            listObj.Add(info);
        }

        panel.costGrid.AddCustomDataList(listObj);
    }
예제 #2
0
    /// <summary>
    /// 是否材料足够
    /// </summary>
    private bool IsMaterials()
    {
        EquipStar star_info = EquipStarConfig.GetEquipStarInfo(cur_equip_info.id, cur_star_num);

        if (star_info == null || string.IsNullOrEmpty(star_info.cost))
        {
            return(false);
        }

        string[] need_str_arr = star_info.cost.Split(';');
        for (int i = 0; i < need_str_arr.Length; i++)
        {
            string[] info_arr = need_str_arr[i].Split(':');
            int      item_id  = GameConvert.IntConvert(info_arr[0]);
            int      need_num = GameConvert.IntConvert(info_arr[1]);

            int total_num = ItemManager.GetBagItemCount(item_id.ToString());

            if (need_num > total_num)
            {
                return(false);
            }
        }

        return(true);
    }
예제 #3
0
    /// <summary>
    /// 获取属性增加数据
    /// type ==0 升星 ,==1 升级, ==-1 装备当前属性值
    /// </summary>
    /// <returns></returns>

    public static List <EquipAddInfo> GetPropAddDataListByID(int type, int equip_id, int star, int strong)
    {
        EquipAddInfo info = null;

        string[] prop_arr = Define.EquipPropStr.Split(',');

        EquipInfo equip_info     = GetEquipInfo(equip_id);
        int       next_star_num  = star;
        int       next_strong_lv = strong;

        if (type == 0)
        {
            next_star_num = star == equip_info.maxStar ? equip_info.maxStar : star + 1;
        }

        if (type == 1)
        {
            next_strong_lv = strong >= equip_info.maxStrongLevel ? equip_info.maxStrongLevel : strong + 1;
        }

        List <EquipAddInfo> list = new List <EquipAddInfo>();

        for (int i = 0; i < prop_arr.Length; i++)
        {
            info = new EquipAddInfo();

            string prop_str   = prop_arr[i];
            int    prop_value = equip_info == null ? 0 : GameConvert.IntConvert(equip_info.GetType().GetField(prop_str).GetValue(equip_info));
            if (prop_value == 0)
            {
                continue;
            }

            // 获取星级属性
            EquipStar star_info       = EquipStarConfig.GetEquipStarInfo(equip_id, star);
            int       prop_star_value = star_info == null ? 0 : GameConvert.IntConvert(star_info.GetType().GetField(prop_str).GetValue(star_info));

            EquipStar star_next_info       = EquipStarConfig.GetEquipStarInfo(equip_id, next_star_num);
            int       prop_next_star_value = star_next_info == null ? 0 : GameConvert.IntConvert(star_next_info.GetType().GetField(prop_str).GetValue(star_next_info));

            //获取强化
            int         prop_strong_value    = 0;
            int         next_prop_star_value = 0;
            EquipStrong strong_info          = EquipStrongConfig.GetEquipStrongInfo(equip_info.star, strong);
            EquipStrong next_strong_info     = EquipStrongConfig.GetEquipStrongInfo(equip_info.star, next_strong_lv);

            if (strong_info != null)
            {
                prop_strong_value = GameConvert.IntConvert(strong_info.GetType().GetField(prop_str).GetValue(strong_info));
            }

            if (next_strong_info != null)
            {
                next_prop_star_value = GameConvert.IntConvert(next_strong_info.GetType().GetField(prop_str).GetValue(next_strong_info));
            }


            info.prop_name              = prop_str;
            info.prop_base_value        = prop_value;
            info.prop_star_value        = prop_star_value;
            info.prop_next_star_value   = prop_next_star_value;
            info.prop_strong_value      = prop_strong_value;
            info.prop_next_strong_value = next_prop_star_value;

            list.Add(info);
        }
        return(list);
    }