Exemplo n.º 1
0
    public bool IsSelectedWonderfulPet()
    {
        bool bResult = false;

        foreach (DictionaryEntry info in petIconList)
        {
            sdUIPetSaleSelectCard icon = info.Value as sdUIPetSaleSelectCard;
            if (icon.m_bSelect == true && icon.m_uuDBID != UInt64.MaxValue && icon.m_uuDBID != 0)
            {
                SClientPetInfo Info = sdNewPetMgr.Instance.GetPetInfo(icon.m_uuDBID);
                if (Info == null)
                {
                    continue;
                }

                if (Info.m_iAbility >= 3)
                {
                    bResult = true;
                    break;
                }
            }
        }

        return(bResult);
    }
Exemplo n.º 2
0
    public void ReflashPetSaleMoneyUI()
    {
        int iMoney    = 0;
        int iCraystal = 0;
        int iTemp     = 0;
        int iUp       = 0;

        foreach (DictionaryEntry info in petIconList)
        {
            sdUIPetSaleSelectCard icon = info.Value as sdUIPetSaleSelectCard;
            if (icon.m_bSelect == true && icon.m_uuDBID != UInt64.MaxValue && icon.m_uuDBID != 0)
            {
                SClientPetInfo Info = sdNewPetMgr.Instance.GetPetInfo(icon.m_uuDBID);
                if (Info == null)
                {
                    continue;
                }

                Hashtable Info2 = sdConfDataMgr.Instance().GetPetTemplate(Info.m_uiTemplateID.ToString());
                if (Info2 == null)
                {
                    continue;
                }

                iTemp   = int.Parse(Info2["SellMoney"].ToString());
                iMoney += iTemp;
                iTemp   = int.Parse(Info2["Crystal"].ToString());
                iUp     = Info.m_iUp;
                if (Info.m_iUp == 0)
                {
                    iUp = 1;
                }
                else if (Info.m_iUp == 1)
                {
                    iUp = 2;
                }
                else if (Info.m_iUp == 2)
                {
                    iUp = 4;
                }
                else if (Info.m_iUp == 3)
                {
                    iUp = 8;
                }

                iTemp      = iTemp * iUp;
                iCraystal += iTemp;
            }
        }

        if (m_moneyNum)
        {
            m_moneyNum.GetComponent <UILabel>().text = iMoney.ToString();
        }

        if (m_craystalNum)
        {
            m_craystalNum.GetComponent <UILabel>().text = iCraystal.ToString();
        }
    }
Exemplo n.º 3
0
 public void SetAllPetItemUnSelected()
 {
     foreach (DictionaryEntry info in petIconList)
     {
         sdUIPetSaleSelectCard icon = info.Value as sdUIPetSaleSelectCard;
         icon.SetPetSelect(false);
     }
 }
Exemplo n.º 4
0
    public void OnClickPetAutoSale(int iAbility, bool bAllSelect)
    {
        foreach (DictionaryEntry info in petIconList)
        {
            sdUIPetSaleSelectCard icon = info.Value as sdUIPetSaleSelectCard;
            if (icon.m_uuDBID != UInt64.MaxValue && icon.m_uuDBID != 0)
            {
                SClientPetInfo Info = sdNewPetMgr.Instance.GetPetInfo(icon.m_uuDBID);
                if (Info == null)
                {
                    continue;
                }

                if (Info.m_iAbility == iAbility)
                {
                    icon.SetPetSelect(bAllSelect);
                }
            }
        }

        ReflashPetSaleMoneyUI();
    }
Exemplo n.º 5
0
    public void OnClickPetSaleOk()
    {
        int iCount = 0;

        foreach (DictionaryEntry info in petIconList)
        {
            sdUIPetSaleSelectCard icon = info.Value as sdUIPetSaleSelectCard;
            if (icon.m_bSelect == true && icon.m_uuDBID != UInt64.MaxValue && icon.m_uuDBID != 0)
            {
                sdPetMsg.Send_CS_PET_EVENT_REQ((byte)HeaderProto.EPetEvent.PET_EVENT_SELL, icon.m_uuDBID);
                iCount++;
            }
        }

        sdPetMsg.m_iPetSaleNum = iCount;
        if (iCount == 0)
        {
            sdUICharacter.Instance.ShowOkMsg("请选择需要出售的战魂", null);
        }
        else
        {
            OnClickPetSaleCancel();
        }
    }
Exemplo n.º 6
0
    public void UpdatePetSaleSelectList()
    {
        if (m_spet == null)
        {
            return;
        }

        Hashtable listPet = null;

        listPet = sdNewPetMgr.Instance.GetPetList();

        Hashtable list = new Hashtable();

        foreach (DictionaryEntry info in listPet)
        {
            string         key1     = info.Key.ToString();
            SClientPetInfo petvalue = info.Value as SClientPetInfo;
            if (sdNewPetMgr.Instance.GetIsInBattleAllTeam(UInt64.Parse(key1)) == 0 && petvalue.m_Lock != 1)
            {
                list.Add(key1, petvalue);
            }
        }

        //将宠物数据填充到List中,用来排序..
        List <SClientPetInfo> listOther = new List <SClientPetInfo>();

        foreach (DictionaryEntry info in list)
        {
            SClientPetInfo info1 = info.Value as SClientPetInfo;
            listOther.Add(info1);
        }
        listOther.Sort(SClientPetInfo.PetSortByAbilityBeginBig);

        int num   = listOther.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 <sdUIPetSaleSelectCard>().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 <sdUIPetSaleSelectCard>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petIconList.GetEnumerator();

        foreach (SClientPetInfo infoEntry in listOther)
        {
            if (iter.MoveNext())
            {
                sdUIPetSaleSelectCard icon = iter.Value as sdUIPetSaleSelectCard;
                icon.ReflashPetIconUI(infoEntry.m_uuDBID);
            }
        }

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

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

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