コード例 #1
0
ファイル: EmojiPanel.cs プロジェクト: zuojiashun/src
    void ShowPets()
    {
        //获取数据
        Dictionary <uint, Client.IPet> petDic = DataManager.Manager <PetDataManager>().GetPetDic();

        m_lstUIItemCommondata.Clear();
        if (null != petDic && petDic.Count > 0)
        {
            foreach (var item in petDic.Values)
            {
                table.PetDataBase petdb = DataManager.Manager <PetDataManager>().GetPetDataBase(item.PetBaseID);
                if (petdb != null)
                {
                    m_lstUIItemCommondata.Add(
                        new ItemDefine.UIItemCommonData()
                    {
                        IconName   = petdb.icon,
                        ShowGetWay = false,
                        Qulity     = petdb.petQuality,
                        ItemThisId = item.GetID(),
                        Name       = petdb.petName,
                    });
                }
            }
        }

        //生成UI
        gridCreator.CreateGrids(m_lstUIItemCommondata.Count);
    }
コード例 #2
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);
        m_data = null;

        if (data is GameCmd.PetData)
        {
            m_data = (GameCmd.PetData)data;

            if (!string.IsNullOrEmpty(m_data.name))
            {
                SetName(m_data.name);
            }

            table.PetDataBase petdataDb = GameTableManager.Instance.GetTableItem <table.PetDataBase>(m_data.base_id);
            if (petdataDb != null)
            {
                UIManager.GetTextureAsyn(petdataDb.icon, ref m_curIconAsynSeed, () =>
                {
                    if (null != m_spriteIcon)
                    {
                        m_spriteIcon.mainTexture = null;
                    }
                }, m_spriteIcon);
                string borderName = ItemDefine.GetItemFangBorderIconByItemID(petdataDb.ItemID);
                SetFrame(borderName);
                if (string.IsNullOrEmpty(m_data.name))
                {
                    SetName(petdataDb.petName);
                }
            }

            SetLevel(m_data.lv.ToString());
        }
        else if (data is  RideData)
        {
            m_rideData = (RideData)data;
            UIManager.GetTextureAsyn(m_rideData.icon, ref m_curIconAsynSeed, () =>
            {
                if (null != m_spriteIcon)
                {
                    m_spriteIcon.mainTexture = null;
                }
            }, m_spriteIcon);
            SetFrame(m_rideData.QualityBorderIcon);
            SetName(m_rideData.name);
            SetLevel(DataManager.Manager <RideManager>().GetRideQualityStr(m_rideData.quality));
        }
    }
コード例 #3
0
 public override void SetGridData(object data)
 {
     base.SetGridData(data);
     if (data == null)
     {
         petData = null;
         return;
     }
     petData = data as IPet;
     table.PetDataBase petdb = DataManager.Manager <PetDataManager>().GetPetDataBase(petData.PetBaseID);
     if (petdb != null)
     {
         //Icon.atlas = DataManager.Manager<UIManager>().GetAtlasByIconName(DynamicAtlasType.DTAitem , petdb.icon);
         Icon.spriteName = petdb.icon;
     }
 }
コード例 #4
0
ファイル: PetAbandonPanel.cs プロジェクト: zuojiashun/src
 protected override void OnShow(object data)
 {
     base.OnShow(data);
     if (petDataManager.CurPet != null)
     {
         string petName = petDataManager.GetCurPetName();
         m_label_diuqi_petshowname.text = petName;
         m_label_Level.text             = petDataManager.GetCurPetLevelStr();
         m_label_life.text = petDataManager.CurPet.GetProp((int)PetProp.Life).ToString();
         int costLife = GameTableManager.Instance.GetGlobalConfig <int>("PetLifeCost");
         m_label_costlife.text = costLife.ToString();
         table.PetDataBase db = petDataManager.GetPetDataBase(petDataManager.CurPet.PetBaseID);
         if (db != null)
         {
             //m_sprite_Icon.spriteName = db.icon;
         }
     }
 }
コード例 #5
0
 public void UpdatePetItemData(IPet data, PetItemShowType type = PetItemShowType.Normal)
 {
     selectPet = data;
     ShowPet(type);
     if (data != null)
     {
         table.PetDataBase petdb = petDataManager.GetPetDataBase(data.PetBaseID);
         if (petdb != null)
         {
             petNameLabel.text = petDataManager.GetPetName(data);
             if (selectPet != null)
             {
                 m_levelLabel.text = petDataManager.GetPetLvelStr(selectPet.GetID());
             }
             if (petIconBtn != null)
             {
                 //UIButton spr = petIconBtn.GetComponent<UIButton>();
                 //if (spr != null)
                 {
                     UITexture petspr = petIconBtn.GetComponent <UITexture>();
                     if (petspr)
                     {
                         //  DataManager.Manager<UIManager>().SetSpriteDynamicIcon(petspr, petdb.icon);
                         UIManager.GetTextureAsyn(petdb.icon, ref m_curIconAsynSeed, () =>
                         {
                             if (null != petspr)
                             {
                                 petspr.mainTexture = null;
                             }
                         }, petspr, false);
                         Transform bgTrans = petspr.transform.Find("Pingzhi_bg");
                         if (bgTrans)
                         {
                             UISprite bgSpr = bgTrans.GetComponent <UISprite>();
                             if (bgSpr)
                             {
                                 string bgName = ItemDefine.GetItemFangBorderIconByItemID(petdb.ItemID);
                                 UIManager.GetAtlasAsyn(bgName, ref m_curQualityAsynSeed, () =>
                                 {
                                     if (null != bgSpr)
                                     {
                                         bgSpr.atlas = null;
                                     }
                                 }, bgSpr);
                             }
                         }
                     }
                     // spr.normalSprite = petdb.icon;
                 }
             }
         }
         if (petDataManager.CurFightingPet == selectPet.GetID())
         {
             fightFlag.gameObject.SetActive(true);
         }
         else
         {
             fightFlag.gameObject.SetActive(false);
         }
     }
     else
     {
         if (fightFlag == null)
         {
             return;
         }
         fightFlag.gameObject.SetActive(false);
         m_levelLabel.text = "";
         if (type == PetItemShowType.Add)
         {
             UISprite spr = addPetBtn.Find("iconspr").GetComponent <UISprite>();
             if (spr != null)
             {
                 spr.gameObject.SetActive(false);
             }
             petNameLabel.text = "";
         }
         else if (type == PetItemShowType.Lock)
         {
             petNameLabel.color = Color.white;
             petNameLabel.text  = ColorManager.GetColorString(0, 144, 255, 255, "[u]" + CommonData.GetLocalString("增加珍兽上限") + "[/u]");
         }
         Transform gaoliangSpr = transform.Find("Sprite");
         if (gaoliangSpr != null)
         {
             if (selectPet == null)
             {
                 gaoliangSpr.gameObject.SetActive(false);
                 return;
             }
             if (petDataManager.CurPetThisID == selectPet.GetID())
             {
                 gaoliangSpr.gameObject.SetActive(true);
             }
             else
             {
                 gaoliangSpr.gameObject.SetActive(false);
             }
         }
     }
 }