Пример #1
0
    //显示套装属性
    public void ShowEquipSetAttr(GameItem item)
    {
        ClearInfo();
        int setId = item.GetEquipSetId();

        if (setId >= 0)
        {
            Tab_EquipSet line = TableManager.GetEquipSetByID(setId, 0);
            if (line != null)
            {
                for (int index = 0; index < 8; index++)
                {
                    m_Attr[index].text = "[626262]";
                }
                GameItemContainer equipPack = GameManager.gameManager.PlayerDataPool.EquipPack;

                //显示套装名称
                int labelIndex = 0;
                m_Attr[labelIndex].text = "[FF9933]" + line.Name;
                m_AttrWhole[labelIndex].SetActive(true);
                labelIndex++;

                for (int index = 0; index < line.getEquipIdCount(); index++)
                {
                    int equipid = line.GetEquipIdbyIndex(index);
                    if (equipid != -1)
                    {
                        Tab_CommonItem lineCommonitem = TableManager.GetCommonItemByID(equipid, 0);
                        if (lineCommonitem != null)
                        {
                            int relatedId = ItemTool.GetEquipIdByTransferSetId(equipid);
                            if (equipPack.GetItemCountByDataId(equipid) > 0 ||
                                equipPack.GetItemCountByDataId(relatedId) > 0)
                            {
                                m_Attr[labelIndex].text += "[FF9933]";
                            }
                            else
                            {
                                m_Attr[labelIndex].text += "[626262]";
                            }
                            m_Attr[labelIndex].text += lineCommonitem.Name;
                            m_AttrWhole[labelIndex].SetActive(true);
                            labelIndex++;
                        }
                    }
                }

                //m_Attr[labelIndex].text = "[FF9933]套装属性:";
                m_Attr[labelIndex].text = StrDictionary.GetClientDictionaryString("#{2878}");
                m_AttrWhole[labelIndex].SetActive(true);
                labelIndex++;

                int    equipCount = equipPack.GetEquipCountBySetId(setId);
                string color      = "[626262]";
                //显示两件套效果
                if (line.GetEffectTypebyIndex(0) != -1)
                {
                    if (equipCount >= 2)
                    {
                        color += "[FF9933]";
                    }
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += StrDictionary.GetClientDictionaryString("#{1448}");
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                    string text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString((COMBATATTE)line.GetEffectTypebyIndex(0)), line.GetEffectValuebyIndex(0));
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += "    " + text;
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                }
                color = "[626262]";
                //显示三件套效果
                if (line.GetEffectTypebyIndex(1) != -1)
                {
                    if (equipCount >= 3)
                    {
                        color += "[FF9933]";
                    }
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += StrDictionary.GetClientDictionaryString("#{1449}");
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                    string text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString((COMBATATTE)line.GetEffectTypebyIndex(1)), line.GetEffectValuebyIndex(1));
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += "    " + text;
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                }
                color = "[626262]";
                //显示四件套效果
                if (line.GetEffectTypebyIndex(2) != -1)
                {
                    if (equipCount >= 4)
                    {
                        color += "[FF9933]";
                    }
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += StrDictionary.GetClientDictionaryString("#{1450}");
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                    string text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString((COMBATATTE)line.GetEffectTypebyIndex(2)), line.GetEffectValuebyIndex(2));
                    m_Attr[labelIndex].text += color;
                    m_Attr[labelIndex].text += "    " + text;
                    m_AttrWhole[labelIndex].SetActive(true);
                    labelIndex++;
                }
                //m_Grid.Reposition();
                // m_TopGrid.Recenter(true);
                m_Table.sorted          = true;
                m_Table.hideInactive    = true;
                m_Table.keepWithinPanel = true;
                m_Table.repositionNow   = true;
            }
        }
    }