Exemplo n.º 1
0
 public void SetAllPetItemUnSelected()
 {
     foreach (DictionaryEntry info in petIconList)
     {
         sdUIPetRongheSelectCard icon = info.Value as sdUIPetRongheSelectCard;
         icon.SetPetSelect(false);
     }
 }
Exemplo n.º 2
0
    public void UpdatePetSelectList()
    {
        if (m_spet == null)
        {
            return;
        }

        Hashtable listPet = null;

        listPet = sdNewPetMgr.Instance.GetPetList();

        Hashtable list = new Hashtable();

        if (m_uuHasSelectID != UInt64.MaxValue)
        {
            SClientPetInfo hasSInfo = sdNewPetMgr.Instance.GetPetInfo(m_uuHasSelectID);
            if (hasSInfo != null)
            {
                foreach (DictionaryEntry info in listPet)
                {
                    string         key1     = info.Key.ToString();
                    SClientPetInfo petvalue = info.Value as SClientPetInfo;
                    if (petvalue.m_uuDBID != m_uuHasSelectID && petvalue.m_iAbility == hasSInfo.m_iAbility &&
                        sdNewPetMgr.Instance.GetIsInBattleTeam(UInt64.Parse(key1)) == 0 && petvalue.m_iUp == 3 &&
                        petvalue.m_Lock != 1 && petvalue.m_iAbility < 4)
                    {
                        list.Add(key1, petvalue);
                    }
                }
            }
        }
        else
        {
            foreach (DictionaryEntry info in listPet)
            {
                string         key1     = info.Key.ToString();
                SClientPetInfo petvalue = info.Value as SClientPetInfo;
                if (sdNewPetMgr.Instance.GetIsInBattleTeam(UInt64.Parse(key1)) == 0 && petvalue.m_iUp == 3 && petvalue.m_Lock != 1 && petvalue.m_iAbility < 4)
                {
                    list.Add(key1, petvalue);
                }
            }
        }

        int num   = list.Count;
        int iZero = 0;

        if (num < 8)
        {
            iZero = 8 - num;
        }
        else
        {
            int iLast = num % 4;
            if (iLast > 0)
            {
                iZero = 4 - iLast;
            }
        }

        num = num + iZero;
        int count = petIconList.Count;

        if (num > count)
        {
            num = num - count;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(m_spet) as GameObject;
                tempItem.GetComponent <sdUIPetRongheSelectCard>().index = count;
                tempItem.transform.parent        = m_spet.transform.parent;
                tempItem.transform.localPosition = m_spet.transform.localPosition;
                tempItem.transform.localScale    = m_spet.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (276 * (count / 4));
                int iX = (count % 4) * 221;
                pos.x += iX;
                tempItem.transform.localPosition = pos;
                petIconList.Add(petIconList.Count, tempItem.GetComponent <sdUIPetRongheSelectCard>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petIconList.GetEnumerator();

        foreach (DictionaryEntry info in list)
        {
            string key1 = info.Key.ToString();
            if (iter.MoveNext())
            {
                sdUIPetRongheSelectCard icon = iter.Value as sdUIPetRongheSelectCard;
                icon.ReflashPetIconUI(UInt64.Parse(key1));
            }
        }

        //只显示底板的卡片..
        for (int i = 0; i < iZero; i++)
        {
            if (iter.MoveNext())
            {
                sdUIPetRongheSelectCard icon = iter.Value as sdUIPetRongheSelectCard;
                icon.ReflashPetIconUI(0);
            }
        }

        while (iter.MoveNext())
        {
            sdUIPetRongheSelectCard icon = iter.Value as sdUIPetRongheSelectCard;
            icon.ReflashPetIconUI(UInt64.MaxValue);
        }

        if (m_spet != null)
        {
            m_spet.transform.parent.GetComponent <UIDraggablePanel>().ResetPosition();
        }
    }