public void SetAllItemUnSelectByCharacter(int iCharacter)
 {
     foreach (DictionaryEntry info in petItemList)
     {
         sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
         UInt64           uuID = icon.GetId();
         if (uuID != UInt64.MaxValue)
         {
             sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(uuID);
             if (petItem != null && petItem.iCharacter == iCharacter)
             {
                 icon.bSelect = false;
                 icon.ReflashSelectUI();
             }
         }
     }
 }
Example #2
0
    void OnClickSale()
    {
        GameObject wnd = GameObject.Find("NGUIRoot");

        if (wnd)
        {
            sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
            if (petPnl)
            {
                foreach (DictionaryEntry info in petPnl.petItemList)
                {
                    sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
                    if (icon != null)
                    {
                        UInt64 uuID = icon.GetId();
                        if (uuID != UInt64.MaxValue && icon.bSelect == true)
                        {
                            sdPetMsg.Send_CS_PET_EVENT_REQ((byte)HeaderProto.EPetEvent.PET_ITEM_EVENT_SELL, uuID);
                        }
                    }
                }
            }
        }
    }
Example #3
0
 void OnClick()
 {
     if (gameObject.name == "BT_petClose")
     {
         if (sdUIPetControl.m_UIPetEquipPnl != null)
         {
             sdUIPetControl.Instance.ClosePetPnl(sdUIPetControl.m_UIPetEquipPnl);
             if (!sdUIPetControl.Instance.IsReturnLevelPrepare())
             {
                 sdUIPetEquipPnl obj = sdUIPetControl.m_UIPetEquipPnl.GetComponent <sdUIPetEquipPnl>();
                 if (obj != null && obj.m_preWnd != null)
                 {
                     obj.m_preWnd.SetActive(true);
                 }
             }
         }
     }
     else if (gameObject.name == "tab2_all")
     {
         GameObject wnd = GameObject.Find("NGUIRoot");
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 petPnl.m_Type = PetEquipType.Pet_EquipType_all;
                 petPnl.RefreshPetItemListPage();
             }
         }
     }
     else if (gameObject.name == "tab2_armor")
     {
         GameObject wnd = GameObject.Find("NGUIRoot");
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 petPnl.m_Type = PetEquipType.Pet_EquipType_fj;
                 petPnl.RefreshPetItemListPage();
             }
         }
     }
     else if (gameObject.name == "tab2_shipin")
     {
         GameObject wnd = GameObject.Find("NGUIRoot");
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 petPnl.m_Type = PetEquipType.Pet_EquipType_sp;
                 petPnl.RefreshPetItemListPage();
             }
         }
     }
     else if (gameObject.name == "tab2_weapon")
     {
         GameObject wnd = GameObject.Find("NGUIRoot");
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 petPnl.m_Type = PetEquipType.Pet_EquipType_wq;
                 petPnl.RefreshPetItemListPage();
             }
         }
     }
     else if (gameObject.name == "btnSale")
     {
         GameObject wnd = GameObject.Find("NGUIRoot");
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 foreach (DictionaryEntry info in petPnl.petItemList)
                 {
                     sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
                     if (icon != null)
                     {
                         UInt64 uuID = icon.GetId();
                         if (uuID != UInt64.MaxValue && icon.bSelect == true)
                         {
                             sdMsgBox.OnConfirm btn_sale = new sdMsgBox.OnConfirm(OnClickSale);
                             sdUICharacter.Instance.ShowOkCanelMsg("您确定要将已选择的宠物装备出售么?", btn_sale, null);
                             break;
                         }
                     }
                 }
             }
         }
     }
     else if (gameObject.name == "sort_value")
     {
         GameObject wnd = sdGameLevel.instance.NGUIRoot;
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 if (petPnl.m_iSortType != (int)PetItemSortType.PetItem_SortBy_Value)
                 {
                     petPnl.m_iSortType = (int)PetItemSortType.PetItem_SortBy_Value;
                     petPnl.RefreshPetItemListPage();
                 }
             }
         }
     }
     else if (gameObject.name == "sort_color")
     {
         GameObject wnd = sdGameLevel.instance.NGUIRoot;
         if (wnd)
         {
             sdUIPetEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetEquipPnl>();
             if (petPnl)
             {
                 if (petPnl.m_iSortType != (int)PetItemSortType.PetItem_SortBy_Color)
                 {
                     petPnl.m_iSortType = (int)PetItemSortType.PetItem_SortBy_Color;
                     petPnl.RefreshPetItemListPage();
                 }
             }
         }
     }
 }
Example #4
0
    public void RefreshPetItemListPage()
    {
        if (copyItem == null)
        {
            return;
        }

        Hashtable list = null;

        list = sdNewPetMgr.Instance.getAllPetItemByCharacter((int)m_Type);

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

        foreach (DictionaryEntry info in list)
        {
            sdGamePetItem info1 = info.Value as sdGamePetItem;
            listEquip.Add(info1);
        }
        if (m_iSortType == (int)PetItemSortType.PetItem_SortBy_Value)
        {
            listEquip.Sort(sdGamePetItem.PetItemSortByValue);
        }
        else if (m_iSortType == (int)PetItemSortType.PetItem_SortBy_Color)
        {
            listEquip.Sort(sdGamePetItem.PetItemSortByColor);
        }

        int num   = list.Count;
        int count = petItemList.Count;

        if (num > count)
        {
            num = num - count;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                tempItem.GetComponent <sdUIPetEquipIcon>().index = count;
                tempItem.transform.parent        = copyItem.transform.parent;
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (114 * (count / 3));
                int iX = (count % 3) * 400;
                pos.x += iX;
                tempItem.transform.localPosition = pos;
                tempItem.GetComponent <sdUIPetEquipIcon>().bSelect = false;
                petItemList.Add(petItemList.Count, tempItem.GetComponent <sdUIPetEquipIcon>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petItemList.GetEnumerator();

        foreach (sdGamePetItem infoEntry in listEquip)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        while (iter.MoveNext())
        {
            sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
            icon.SetIdAndReflashUI(UInt64.MaxValue);
        }
    }
    void OnClick()
    {
        if (gameObject.name == "BT_petClose")
        {
            if (sdUIPetControl.m_UIPetChangeEquipPnl != null)
            {
                sdUIPetControl.Instance.ClosePetPnl(sdUIPetControl.m_UIPetChangeEquipPnl);
            }

            if (m_preWnd)
            {
                m_preWnd.SetActive(true);
            }

            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetPropPnl petPnl = wnd.GetComponentInChildren <sdUIPetPropPnl>();
                if (petPnl)
                {
                    petPnl.SetPetModelVisible(true);
                }
            }
        }
        else if (gameObject.name == "btnEquip")
        {
            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetChangeEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetChangeEquipPnl>();
                if (petPnl)
                {
                    foreach (DictionaryEntry info in petPnl.petItemList)
                    {
                        sdUIPetEquipIcon icon = info.Value as sdUIPetEquipIcon;
                        if (icon != null)
                        {
                            UInt64 uuID = icon.GetId();
                            if (uuID != UInt64.MaxValue && icon.bSelect == true)
                            {
                                sdPetMsg.Send_CS_PET_EQUIP_REQ(uuID, petPnl.m_uuSelectDBID, 1);
                            }
                        }
                    }
                }
            }
        }
        else if (gameObject.name == "btnUnEquip")
        {
            GameObject wnd = GameObject.Find("NGUIRoot");
            if (wnd)
            {
                sdUIPetChangeEquipPnl petPnl = wnd.GetComponentInChildren <sdUIPetChangeEquipPnl>();
                if (petPnl)
                {
                    SClientPetInfo Info = null;
                    if (petPnl.m_uuSelectDBID != UInt64.MaxValue)
                    {
                        Info = sdNewPetMgr.Instance.GetPetInfo(petPnl.m_uuSelectDBID);
                        if (Info == null)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }

                    foreach (DictionaryEntry equipInfo in Info.m_EquipedDB)
                    {
                        sdGamePetItem petItem = (sdGamePetItem)equipInfo.Value;
                        UInt64        uuID    = petItem.instanceID;
                        if (uuID != UInt64.MaxValue)
                        {
                            sdPetMsg.Send_CS_PET_EQUIP_REQ(uuID, petPnl.m_uuSelectDBID, 0);
                        }
                    }
                }
            }
        }
    }
    public void RefreshPetItemListPage()
    {
        Hashtable list = null;

        list = sdNewPetMgr.Instance.petItemDB;

        //将宠物装备数据填充到List中,用来排序..
        List <sdGamePetItem> listEquip1 = new List <sdGamePetItem>();
        List <sdGamePetItem> listEquip2 = new List <sdGamePetItem>();

        foreach (DictionaryEntry info in list)
        {
            sdGamePetItem item = info.Value as sdGamePetItem;
            if (item.iCharacter == m_iSortSubClass || m_iSortSubClass == (int)PetEquipType.Pet_EquipType_all)
            {
                listEquip1.Add(item);
            }
            else if (item.iCharacter != m_iSortSubClass && m_iSortSubClass != (int)PetEquipType.Pet_EquipType_all)
            {
                listEquip2.Add(item);
            }
        }
        listEquip1.Sort(sdGamePetItem.PetItemSortByValue);
        listEquip2.Sort(sdGamePetItem.PetItemSortByValue);

        int num   = list.Count;
        int count = petItemList.Count;

        if (num > count)
        {
            num = num - count;
            for (int i = 0; i < num; ++i)
            {
                GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                tempItem.GetComponent <sdUIPetEquipIcon>().index = count;
                tempItem.transform.parent        = copyItem.transform.parent;
                tempItem.transform.localPosition = copyItem.transform.localPosition;
                tempItem.transform.localScale    = copyItem.transform.localScale;
                Vector3 pos = tempItem.transform.localPosition;
                pos.y = pos.y - (114 * (count / 2));
                int iX = (count % 2) * 400;
                pos.x += iX;
                tempItem.transform.localPosition = pos;
                tempItem.GetComponent <sdUIPetEquipIcon>().bSelect = false;
                petItemList.Add(petItemList.Count, tempItem.GetComponent <sdUIPetEquipIcon>());
                ++count;
            }
        }

        IDictionaryEnumerator iter = petItemList.GetEnumerator();

        foreach (sdGamePetItem infoEntry in listEquip1)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        foreach (sdGamePetItem infoEntry in listEquip2)
        {
            if (iter.MoveNext())
            {
                sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
                icon.SetIdAndReflashUI(infoEntry.instanceID);
            }
        }

        while (iter.MoveNext())
        {
            sdUIPetEquipIcon icon = iter.Value as sdUIPetEquipIcon;
            icon.SetIdAndReflashUI(UInt64.MaxValue);
        }

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