Esempio n. 1
0
        /// <summary>
        /// 更新物品
        /// </summary>
        /// <param name="slot">槽位</param>
        /// <param name="item">物品</param>
        public bool UpdateSwordsMan(int slot, SwordsMan item)
        {
            bool bRet = false;

            if (slot >= 0 && slot < m_Items.Count)
            {
                m_Items[slot] = item;
                bRet          = true;
            }
            return(bRet);
        }
Esempio n. 2
0
        public int GetAllSwordsManCombatValue()
        {
            int CombatValue = 0;

            for (int i = 0; i < m_Items.Count; ++i)
            {
                SwordsMan item = m_Items[i];
                if (null != item && item.IsValid())
                {
                    CombatValue += item.GetCombatValue();
                }
            }
            return(CombatValue);
        }
Esempio n. 3
0
        /// <summary>
        /// 有效物品数量
        /// </summary>
        /// <returns></returns>
        public int GetSwordsManCount()
        {
            int count = 0;

            for (int i = 0; i < m_Items.Count; ++i)
            {
                SwordsMan item = m_Items[i];
                if (null != item && item.IsValid())
                {
                    ++count;
                }
            }
            return(count);
        }
Esempio n. 4
0
        static public List <SwordsMan> ItemFilter(SwordsManContainer oContainer)
        {
            if (null == oContainer)
            {
                return(null);
            }

            List <SwordsMan> resultlist = new List <SwordsMan>();

            for (int nIndex = 0; nIndex < oContainer.ContainerSize; ++nIndex)
            {
                SwordsMan oSwordsMan = oContainer.GetSwordsMan(nIndex);
                if (null != oSwordsMan && oSwordsMan.IsValid())
                {
                    resultlist.Add(oSwordsMan);
                }
            }
            return(ItemSort(resultlist));
        }
Esempio n. 5
0
        /// <summary>
        /// 筛选出高于品质的物品
        /// </summary>
        /// <param name="ItemList"></param>
        /// <param name="nQuality"></param>
        /// <returns></returns>
        static public List <SwordsMan> ItemFilter(List <SwordsMan> ItemList, int nQuality)
        {
            if (null == ItemList)
            {
                return(null);
            }

            List <SwordsMan> resultlist = new List <SwordsMan>();

            for (int nIndex = 0; nIndex < ItemList.Count; ++nIndex)
            {
                SwordsMan item = ItemList[nIndex];
                if (null != item && item.IsValid())
                {
                    if (item.Quality <= nQuality)
                    {
                        resultlist.Add(item);
                    }
                }
            }
            return(ItemSort(resultlist));
        }
Esempio n. 6
0
 /// <summary>
 /// 背包显示排序
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 static public List <SwordsMan> ItemSort(List <SwordsMan> list)
 {
     if (list == null)
     {
         return(null);
     }
     for (int i = 0; i < list.Count - 1; ++i)
     {
         int flag = 0;
         for (int j = 0; j < list.Count - i - 1; ++j)
         {
             //排序等级高的排前面
             if (list[j].Quality < list[j + 1].Quality)
             {
                 SwordsMan temp = list[j];
                 list[j]     = list[j + 1];
                 list[j + 1] = temp;
                 flag        = 1;
             }
             else if (list[j].Quality == list[j + 1].Quality)
             {
                 //装备等级小的排后面
                 if (list[j].Level < list[j + 1].Level)
                 {
                     SwordsMan temp = list[j];
                     list[j]     = list[j + 1];
                     list[j + 1] = temp;
                     flag        = 1;
                 }
             }
         }
         if (flag == 0)
         {
             break;
         }
     }
     return(list);
 }