Exemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="dItemID"></param>
    /// <param name="posIndex">装备索引 0~5</param>
    /// <param name="solderierInfo"></param>
    public void SetData(int dItemID, int posIndex, SoldierInfo solderierInfo)
    {
        m_iItemID     = dItemID;
        m_soldierInfo = solderierInfo;
        m_iPosIndex   = posIndex;
        m_itemTypeID  = SoldierM.GetSoldierEquip(solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex);
        if (m_itemTypeID == 0)
        {
            NGUIUtil.DebugLog(string.Format(" SoldierTypeID={0},Quality={1},EquipIndex={2} 装备静态数据未配置", solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex));
            return;
        }
        if (m_iItemID == 0)//当未穿装备时
        {
            ItemTypeInfo info = ItemDC.SearchItem(m_itemTypeID);
            if (info != null)
            {
                m_iItemID    = info.ID;
                m_itemTypeID = info.itemType;
                m_icon       = info.m_Icon;
            }
            else
            {
                s_itemtypeInfo sInfo = ItemM.GetItemInfo(m_itemTypeID);
                if (sInfo != null)
                {
                    m_icon = sInfo.icon;
                }
                else
                {
                    NGUIUtil.DebugLog("itemTypeID =" + m_itemTypeID + " 未配置");
                }
            }
        }
        else//已装备
        {
            ItemTypeInfo info1 = ItemDC.GetItem(m_iItemID);
            if (info1 == null || info1.Positon == 0)
            {
                NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + m_iItemID);
                return;
            }
            m_icon = info1.m_Icon;
            if (info1 != null)
            {
                m_iEquipQuality = info1.m_Quality;
            }
        }
        int itemTypeid = 0;

        m_equipmentPutType = SoldierM.CheckCanPutEquip(solderierInfo, dItemID, posIndex, ref itemTypeid);
        SetUI();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 检测炮弹兵是否满足进阶条件
    /// </summary>
    public bool CheckSoldierJinJie()
    {
        Dictionary <int, int> l = new Dictionary <int, int>();

        // 是否最高阶
        if (ConfigM.GetNextQuality(Quality) == 0)
        {
            return(false);
        }
        int levelLimit = 0;
        int equipID1   = 0;
        int equipID2   = 0;
        int equipID3   = 0;
        int equipID4   = 0;
        int equipID5   = 0;
        int equipID6   = 0;

        SoldierM.GetUpQualityNeed(SoldierTypeID, Quality, ref levelLimit,
                                  ref equipID1, ref equipID2, ref equipID3,
                                  ref equipID4, ref equipID5, ref equipID6);
        // 等级限制
        if (Level < levelLimit)
        {
            return(false);
        }

        //需要的装备
        List <int> lEquipsID = new List <int>();

        if (Equipment0 <= 0)
        {
            lEquipsID.Add(equipID1);
        }
        if (Equipment1 <= 0)
        {
            lEquipsID.Add(equipID2);
        }
        if (Equipment2 <= 0)
        {
            lEquipsID.Add(equipID3);
        }
        if (Equipment3 <= 0)
        {
            lEquipsID.Add(equipID4);
        }
        if (Equipment4 <= 0)
        {
            lEquipsID.Add(equipID5);
        }
        if (Equipment5 <= 0)
        {
            lEquipsID.Add(equipID6);
        }
        // 不缺装备
        if (lEquipsID.Count == 0)
        {
            return(true);
        }
        //统计需要的装备
        foreach (int itemid in lEquipsID)
        {
            ItemTypeInfo ItemInfo = ItemDC.SearchItem(itemid);            //检测装备道具是否存在
            //检测装备是否存在
            if (ItemInfo == null)
            {
                return(false);
            }
            //检测等级是否满足装备要求
            if (Level < ItemInfo.m_level)
            {
                return(false);
            }

            if (l.ContainsKey(itemid) == false)
            {
                l.Add(itemid, 1);
            }
            else
            {
                l[itemid] = l[itemid] + 1;
            }
        }
        //判断装备数量是否够
        foreach (int itemid in l.Keys)
        {
            int num = ItemDC.CheckItem(itemid);
            if (num < l[itemid])
            {
                return(false);
            }
        }
        return(true);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 炮弹兵装备格的状态
    /// </summary>
    /// <returns>The can put equip.</returns>
    /// <param name="info">Info.</param>
    /// <param name="EquipID">Equip I.</param>
    /// <param name="index">Index.</param>
    /// <param name="itemTypeID">Item type I.</param>
    public static EquipmentPutType CheckCanPutEquip(SoldierInfo info, int EquipID, int index, ref int itemTypeID)
    {
        itemTypeID = SoldierM.GetSoldierEquip(info.SoldierTypeID, info.Quality, index);

        if (EquipID == 0)
        {
            ItemTypeInfo ItemInfo = ItemDC.SearchItem(itemTypeID);
            if (ItemInfo != null)
            {
                if (info.Level >= ItemInfo.m_level)
                {
                    return(EquipmentPutType.CanPut);
                }
                else
                {
                    return(EquipmentPutType.HaveCannot);
                }
            }
            else
            {
                s_itemtypeInfo sInfo = ItemM.GetItemInfo(itemTypeID);

                List <KeyValue> needSubEquip = new List <KeyValue>();
                int             needCoin     = 0;
                bool            canCombine   = ItemM.GetCombineEquipNeed(itemTypeID, ref needSubEquip, ref needCoin);
                if (canCombine)
                {
                    if (ItemDC.CheckItemsEnough(needSubEquip))
                    {
                        if (needCoin < UserDC.GetCoin())
                        {
                            if (info.Level >= sInfo.level)
                            {
                                return(EquipmentPutType.CanCombinePut);
                            }
                            else
                            {
                                return(EquipmentPutType.CanCombine);
                            }
                        }
                        else
                        {
                            return(EquipmentPutType.CanCombine);
                        }
                    }
                    else if (!ItemDC.CheckItemsEnough(needSubEquip))
                    {
                        return(EquipmentPutType.ReadyCombine);
                    }
                    else
                    {
                        return(EquipmentPutType.None);
                    }
                }
                else
                {
                    return(EquipmentPutType.NoCanCombine);
                }
            }
        }
        else
        {
            return(EquipmentPutType.HavePut);
        }
    }