Exemple #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();
    }
Exemple #2
0
    public void SetZhuangBeiList(List <int> listItemID)
    {
        bool bRedPot = false;


        for (int i = 0; i < listItemID.Count; i++)
        {
            int itemTypeID        = 0;
            EquipmentPutType type = SoldierM.CheckCanPutEquip(Info, listItemID[i], i, ref itemTypeID);
            EquipPutType = type;
            if (type == EquipmentPutType.CanPut || type == EquipmentPutType.CanCombine || type == EquipmentPutType.CanCombinePut)
            {
                NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_002ic");
            }
            else if (type == EquipmentPutType.HaveCannot)
            {
                NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_003ic");
            }
            else if (type == EquipmentPutType.HavePut)
            {
                ItemTypeInfo info1 = ItemDC.GetItem(listItemID[i]);
                if (info1 == null || info1.Positon == 0)
                {
                    NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + listItemID[i]);
                    MyHead.SprZhuangBeiList[i].sprite2D = null;
                    continue;
                }
                else
                {
                    NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", info1.m_Icon.ToString());
                }
            }
            else
            {
                MyHead.SprZhuangBeiList[i].sprite2D = null;
            }
            if (!bRedPot)
            {
                bRedPot = (type == EquipmentPutType.CanPut) || (type == EquipmentPutType.CanCombinePut);
            }
        }

        MyHead.SprLittleRed.gameObject.SetActive(bRedPot);
    }