コード例 #1
0
ファイル: PetListPanel.cs プロジェクト: zuojiashun/src
 private void OnUIGridEventDlg(UIEventType eventType, object data, object param)
 {
     if (null == data)
     {
         return;
     }
     switch (eventType)
     {
     case UIEventType.Click:
     {
         if (data is UIPetSettingGrid)
         {
             UIPetSettingGrid gridData = data as UIPetSettingGrid;
             uint             petID    = gridData.PetID;
             if (gridData.IsSetting())
             {
                 TipsManager.Instance.ShowTips("已经设置过了");
             }
             else
             {
                 m_petDataManager.SetUserQuickList(petID);
                 m_petDataManager.SendQuickListMsg();
             }
         }
     }
     break;
     }
 }
コード例 #2
0
ファイル: PetListPanel.cs プロジェクト: zuojiashun/src
    void OnUpdateUIGrid(UIGridBase grid, int index)
    {
        Dictionary <uint, IPet> petDic = m_petDataManager.GetPetDic();

        if (petDic != null)
        {
            List <IPet> petList = petDic.Values.ToList <IPet>();
            if (petList == null)
            {
                return;
            }
            if (index < petList.Count)
            {
                IPet pet = petList[index];
                if (pet != null)
                {
                    int         baseID = pet.GetProp((int)PetProp.BaseID);
                    PetDataBase pdb    = GameTableManager.Instance.GetTableItem <PetDataBase>((uint)baseID);
                    if (pdb != null)
                    {
                        UIPetSettingGrid petgrid = grid as UIPetSettingGrid;
                        if (petgrid != null)
                        {
                            petgrid.SetIcon(pdb.icon);
                            List <uint> quickList = m_petDataManager.PetQuickList;
                            // foreach ( var petid in quickList )
                            {
                                if (quickList.Contains(pet.GetID()))
                                {
                                    petgrid.SetStatus(true);
                                }
                                else
                                {
                                    petgrid.SetStatus(false);
                                }
                            }
                            petgrid.SetPetID(pet.GetID());
                        }
                    }
                }
            }
        }
    }