Exemplo n.º 1
0
 private void SetResidueDegree(int count, int costType = 0, int costNum = 0)
 {
     _residueDegree = count;
     if (ResidueDegreeLabel == null)
     {
         return;
     }
     if (count == 0 && RotateBySome)
     {
         CostContainer.SetActive(true);
         ResidueDegreeLabel.gameObject.SetActive(false);
         if (CostContainer)
         {
             CostTypeSprite.TrySetComponentValue(string.Format(CostLabelFormat, costNum));
             CostLabelAdapter.TrySetComponentValue(costNum, costType.ToString(), CostLabelFormat, YxBaseLabelAdapter.YxELabelType.NumberWithUnit);
             CostTypeSprite.TrySetComponentValue(string.Format(CostSpriteFormat, costType));
         }
         return;
     }
     if (CostContainer)
     {
         CostContainer.SetActive(false);
     }
     ResidueDegreeLabel.text = string.Format(ResidueDegreeFormat, count);
 }
Exemplo n.º 2
0
 public void Init(string iconName, int showNum)
 {
     if (ShowIcon)
     {
         ShowIcon.spriteName = iconName;
         ShowIcon.MakePixelPerfect();
     }
     ShowNum.TrySetComponentValue(string.Format("x{0}", showNum));
     ShowNumAdapter.TrySetComponentValue(showNum, iconName, "x{0}");
 }
Exemplo n.º 3
0
        protected override void OnFreshView()
        {
            var rankData = Data as RankItemData;

            if (rankData == null)
            {
                return;
            }
            if (Medal != null)
            {
                var isSpecialRank = rankData.RankNum <= FirstFew && rankData.RankNum != 0;
                if (isSpecialRank)
                {
                    if (!string.IsNullOrEmpty(SpecialRankBg))
                    {
                        Medal.spriteName = string.Format("{0}{1}", SpecialRankBg, rankData.RankNum);
                    }
                    Medal.gameObject.SetActive(true);
                    Medal.MakePixelPerfect();
                    if (RankNum)
                    {
                        if (SpecialRankNeedLabel)
                        {
                            RankNum.gameObject.SetActive(true);
                            RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice;
                        }
                        else
                        {
                            RankNum.gameObject.SetActive(false);
                        }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(NormalRankBg))
                    {
                        Medal.spriteName = NormalRankBg;
                    }
                    Medal.gameObject.SetActive(false);
                    Medal.MakePixelPerfect();
                    if (RankNum)
                    {
                        RankNum.gameObject.SetActive(true);
                        RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice;
                    }
                }
            }
            else
            {
                if (RankNum)
                {
                    RankNum.gameObject.SetActive(true);
                    RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice;
                }
            }
            Nick.TrySetComponentValue(rankData.Nick);
            Value.TrySetComponentValue(rankData.Value, RankType, "{0}", CoinLabelType);
            if (ID)
            {
                ID.text = rankData.ID;
            }
            if (RankIcon)
            {
                RankIcon.spriteName = RankType;
            }

            if (Protrail != null)
            {
                PortraitDb.SetPortrait(rankData.Avator, Protrail, rankData.Sex);
            }
            if (ItemNoticeLabel)
            {
                if (!string.IsNullOrEmpty(ItemNotice))
                {
                    ItemNoticeLabel.text = ItemNotice;
                }
            }

            if (AffiliateNoticeLabel)
            {
                if (rankData.Affiliate == 0)
                {
                    AffiliateNoticeLabel.text = NoAffiliateContent;
                }
                else
                {
                    AffiliateNoticeLabel.text = string.Format("{0}{1}", AffiliateFormat, rankData.Affiliate);
                }
            }

            if (TeaIdLabel)
            {
                TeaIdLabel.text = rankData.TeaId.ToString();
            }

            if (TeaNameLabel)
            {
                TeaNameLabel.text = rankData.TeaName;
            }

            if (TeaSignLabel)
            {
                TeaSignLabel.text = rankData.TeaSign;
            }
        }
Exemplo n.º 4
0
        protected virtual void OnBindDate(UserInfo userInfo)
        {
            var loginName = userInfo.LoginName;

            if (UserId != null)
            {
                UserId.text = string.Format("{0}{1}", IdForm, userInfo.UserId);
            }
            if (UserName != null)
            {
                UserName.text = string.IsNullOrEmpty(loginName) ? "游客" : loginName;
            }
            if (Sex != null)
            {
                switch (userInfo.SexI)
                {
                case 0:
                    Sex.text = "女";
                    break;

                case 1:
                    Sex.text = "男";
                    break;

                default:
                    Sex.text = "保密";
                    break;
                }
            }

            if (UserCoin != null)
            {
                UserCoin.text = YxUtiles.ReduceNumber(userInfo.CoinA);
            }
            if (UserGold != null)
            {
                UserGold.text = userInfo.CashA.ToString();
            }
            UserCoinAdapter.TrySetComponentValue(userInfo.CoinA, "1");
            if (ClienIp != null)
            {
                ClienIp.text = userInfo.ClientIP;
            }
            if (NikeName != null)
            {
                NikeName.text = userInfo.NickM;
            }
            if (PhoneNumber != null)
            {
                PhoneNumber.text = userInfo.PhoneNumber;
            }
            if (Sign != null)
            {
                var uiinput = Sign.GetComponent <UIInput>();
                if (uiinput != null)
                {
                    uiinput.value = userInfo.Signature;
                }
                else
                {
                    Sign.text = userInfo.Signature;
                }
            }
            if (SpreadBtn != null)
            {
                var needShow = userInfo.Promoter != null && userInfo.Promoter == false;
                SpreadBtn.SetActive(needShow);
            }
            if (SpreadStateBtn != null)
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    SpreadStateBtn.transform.parent.gameObject.SetActive(false);
                }
                Spread.text = userInfo.PromoterId ?? PromoterMsg;
                SpreadStateBtn.gameObject.SetActive(string.IsNullOrEmpty(userInfo.PromoterId));
            }

            PortraitDb.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI);
        }