예제 #1
0
        public void SetData(UTileItemClanSelfHero item, UTileClanSelfHero parentList)
        {
            cmd_clan_request_selfhero cmdData = item.data;

            heroIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_CLAN_SELECTREQUESTCARD, 1, 7, cmdData.nHeroID);
            heroStarItem.SetData(cmdData.nHeroID, cmdData.nHeroStar, false, false);

            float   fValue   = cmdData.nNeedCardCount != 0 ? (float)item.data.nCardCount / item.data.nNeedCardCount : 0.0f;
            Vector2 baseVec2 = cardValue.rectTransform.sizeDelta;

            if (fValue >= 1)
            {
                baseVec2.x       = cardBase.rectTransform.sizeDelta.x;
                cardValue.sprite = parentList.cardValueSprites[1];
            }
            else
            {
                baseVec2.x       = fValue * cardBase.rectTransform.sizeDelta.x;
                cardValue.sprite = parentList.cardValueSprites[0];
            }
            cardValue.rectTransform.sizeDelta = baseVec2;

            int nStarLvLimit = GameLogicAPI.getHeroStarLvLimit(cmdData.nHeroID);

            if (cmdData.nHeroStar >= nStarLvLimit)
            {
                cardText.text = cmdData.nCardCount.ToString();
                maxBg.gameObject.SetActive(true);
            }
            else
            {
                cardText.text = cmdData.nCardCount.ToString() + "/" + cmdData.nNeedCardCount.ToString();
                maxBg.gameObject.SetActive(false);
            }
        }
예제 #2
0
        public void OnClanSelfHero()
        {
            ActorHeroInfo info = LogicDataCenter.playerSystemDataManager.GetActorAllHero();

            if (info.dicEntityHeroInfo.Count <= 0)
            {
                return;
            }

            tileClanRequestCard.DataSource.Clear();
            tileClanRequestCard.DataSource.BeginUpdate();
            foreach (var item in info.dicEntityHeroInfo)
            {
                cmd_clan_request_selfhero data = new cmd_clan_request_selfhero();
                data.nHeroID    = item.Value.nHeroID;
                data.nHeroStar  = item.Value.byStarLv;
                data.nCardCount = item.Value.nCardCount;
                bool bIsLifeHero = LogicDataCenter.lifeHeroDataManager.AllLifeHero.ContainsKey(item.Value.nHeroID);
                data.nNeedCardCount = GameLogicAPI.getHeroStarNeedCard(item.Value.nHeroID, item.Value.byStarLv, bIsLifeHero);

                UTileItemClanSelfHero tileItem = new UTileItemClanSelfHero();
                tileItem.data = data;
                tileClanRequestCard.DataSource.Add(tileItem);
            }
            tileClanRequestCard.DataSource.EndUpdate();
        }