Beispiel #1
0
        public void SetText(string content)
        {
            if (!Text.gameObject.activeSelf)
            {
                Text.gameObject.SetActive(true);
            }

            Text.text = content;

            Image.Reset();
        }
Beispiel #2
0
        public void SetHair(int sex, string hair)
        {
            // MyLog.InfoWithFrame(name, string.Format("set hair: {0}, {1}", sex, hair));
            if (!HairImage)
            {
                return;
            }

            var defHair   = sex == 1 ? DefBoyHair : DefGirlHair;
            var defHairBg = sex == 1 ? null : DefGirlHairBg;

            var commodityList = _commodityList.Read();
            var data          = GameUtil.GetCommodity(commodityList, hair);

            if (data == null || string.IsNullOrEmpty(data.pic))
            {
                HairImage.SetSprite(defHair, true);

                // 设置默认的HairBg。
                if (HairBgImage)
                {
                    if (sex == 1)
                    {
                        HairBgImage.Reset();
                    }
                    else
                    {
                        HairBgImage.SetSprite(defHairBg, true);
                    }
                }
                return;
            }

            HairImage.SetTargetPic(data.pic, ResourcePath.CommodityPath, data.pic_url, true, defHair);

            if (HairBgImage)
            {
                if (!string.IsNullOrEmpty(data.pic_bg))
                {
                    HairBgImage.SetTargetPic(data.pic_bg, ResourcePath.CommodityPath, data.pic_bg_url, true,
                                             defHairBg);
                }
                else
                {
                    HairBgImage.Reset();
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 清空PlayerFigure的内容。
        /// </summary>
        public void Clear()
        {
            if (BodyImage)
            {
                BodyImage.Reset();
            }

            if (HeadImage)
            {
                HeadImage.sprite = null;
                if (HeadImage.gameObject.activeSelf)
                {
                    HeadImage.gameObject.SetActive(false);
                }
            }

            if (HairImage)
            {
                HairImage.Reset();
            }

            if (HairBgImage)
            {
                HairBgImage.Reset();
            }

            if (DeskItemImage)
            {
                DeskItemImage.Reset();
            }
        }
Beispiel #4
0
        public override void Reset(int currentIndex)
        {
            HeadIcon.Reset();

            if (Nickname && Nickname.gameObject.activeSelf)
            {
                Nickname.gameObject.SetActive(false);
            }

            if (OnlineState && OnlineState.gameObject.activeSelf)
            {
                OnlineState.gameObject.SetActive(false);
            }

            if (FunctionGroup && FunctionGroup.gameObject.activeSelf)
            {
                FunctionGroup.gameObject.SetActive(false);
            }

            if (Layout)
            {
                Layout.preferredWidth  = NormalSize.x;
                Layout.preferredHeight = NormalSize.y;
            }

            if (_expandTweener != null)
            {
                _expandTweener.Kill();
                _expandTweener = null;
            }

            _selected = false;
        }
        public override void Reset(int currentIndex)
        {
            if (Icon)
            {
                Icon.Reset();
            }

            if (PriceTxt)
            {
                PriceTxt.text = "";
            }

            if (LeftCountTxt)
            {
                LeftCountTxt.text = "";
            }

            if (NameGroup && NameGroup.gameObject.activeSelf)
            {
                NameGroup.SetActive(false);
            }

            if (TagGroup && TagGroup.activeSelf)
            {
                TagGroup.SetActive(false);
            }
        }
Beispiel #6
0
        public void SetDeskItem(string deskItem)
        {
            if (!DeskItemImage)
            {
                return;
            }

            var commodityList = _commodityList.Read();
            var data          = GameUtil.GetCommodity(commodityList, deskItem);

            if (data == null || string.IsNullOrEmpty(data.pic))
            {
                DeskItemImage.Reset();
                return;
            }

            DeskItemImage.SetTargetPic(data.pic, ResourcePath.CommodityPath, data.pic_url, true);
        }
Beispiel #7
0
 private void ResetContent()
 {
     HeadIcon.Reset();
     Nickname.text = "";
     WechatTag.SetActive(false);
     Level.text       = "";
     WinRate.text     = "";
     SecondMoney.text = "";
     Money.text       = "";
 }
        public override void Reset(int currentIndex)
        {
            AwardImage.Reset();
            DayCount.text         = "";
            AwardDescription.text = "";

            if (FinishTag.activeSelf)
            {
                FinishTag.SetActive(false);
            }
        }
Beispiel #9
0
 public override void Reset(int currentIndex)
 {
     AwardIcon.Reset();
     AwardCounText.text   = "";
     DescriptionText.text = "";
     TaskProcess.value    = 0;
     GoToBtn.gameObject.SetActive(false);
     GetAwardBtn.gameObject.SetActive(false);
     HasGet.SetActive(false);
     ProgressTxt.text = "";
 }
Beispiel #10
0
        public override void BindData(int currentIndex, RaceConfig data)
        {
            _data = data;
            if (data == null)
            {
                return;
            }

            // 载入比赛图片。
            if (string.IsNullOrEmpty(data.pic))
            {
                RaceIcon.Reset();
            }
            else
            {
                RaceIcon.SetTargetPic(data.pic, null, data.pic_url);
            }

            DisPlayNameTxt.text     = data.display_name;
            RaceDateTxt.text        = data.race_description;
            RaceDescriptionTxt.text = data.award_description;
            RaceStartTimeTxt.text   = data.open_time;
            if (data.fee != null)
            {
                Tickets.SetCurrency(data.fee.count, data.fee.type);
            }

            if (!data.race_over)
            {
                SignUpOverBtn.gameObject.SetActive(false);
                SignUpBtn.gameObject.SetActive(!data.signed_up);
                MatchBtn.gameObject.SetActive(data.signed_up);
            }
            else
            {
                SignUpOverBtn.gameObject.SetActive(true);
            }
        }
 private void Start()
 {
     if (AdImg)
     {
         _hintItem = GetHintItemByPos(HintItemPos.HALL_BOTTOM);
         if (_hintItem == null || string.IsNullOrEmpty(_hintItem.outer_pic))
         {
             AdImg.Reset();
         }
         else
         {
             AdImg.SetTargetPic(ResourcePicName.ActivityOuterPic, ResourcePath.PortalWindow, null, true);
         }
     }
 }
        private void SetDetailContent(Commodity data)
        {
            if (data != null)
            {
                var vip = data.vip_level > 0;
                if (VIPTag.activeSelf != vip)
                {
                    VIPTag.SetActive(vip);
                }

                if (DetailImage && !DetailImage.gameObject.activeSelf)
                {
                    DetailImage.gameObject.SetActive(true);
                }

                if (DetailBgImage && DetailBgImage.gameObject.activeSelf)
                {
                    DetailBgImage.gameObject.SetActive(true);
                }

                var pic = data.pic;
                if (DetailImage)
                {
                    if (!string.IsNullOrEmpty(pic))
                    {
                        DetailImage.SetTargetPic(pic, ResourcePath.CommodityPath, null, true);
                    }
                    else
                    {
                        DetailImage.Reset();
                    }
                }

                if (DetailBgImage)
                {
                    var picBg = data.pic_bg;
                    if (!string.IsNullOrEmpty(picBg))
                    {
                        DetailBgImage.SetTargetPic(picBg, ResourcePath.CommodityPath, null, true);
                    }
                    else
                    {
                        DetailBgImage.Reset();
                    }
                }

                if (DetailName)
                {
                    if (!DetailName.gameObject.activeSelf)
                    {
                        DetailName.gameObject.SetActive(true);
                    }

                    DetailName.text = data.display_name;
                }

                if (DetailPrice)
                {
                    if (!DetailPrice.gameObject.activeSelf)
                    {
                        DetailPrice.gameObject.SetActive(true);
                    }

                    DetailPrice.SetCurrency(CommodityHelper.GetPrice(data), CommodityHelper.GetCurrencyType(data));
                }

                var bag          = _bag.Read();
                var user         = _user.Read();
                var hasCommodity = GameUtil.HasCommodity(bag, data);
                var equiped      = hasCommodity && GameUtil.IsCommodityEquiped(bag, user, data);

                if (hasCommodity)
                {
                    // 隐藏购买按钮。
                    if (BuyBtn && BuyBtn.gameObject.activeSelf)
                    {
                        BuyBtn.gameObject.SetActive(false);
                    }

                    // 使用按钮与是否装备相反。
                    if (UseBtn)
                    {
                        if (!UseBtn.gameObject.activeSelf)
                        {
                            UseBtn.gameObject.SetActive(true);
                        }

                        UseBtn.interactable = !equiped;
                    }

                    if (UnUseBtn)
                    {
                        if (!UnUseBtn.gameObject.activeSelf)
                        {
                            UnUseBtn.gameObject.SetActive(true);
                        }

                        UnUseBtn.interactable = equiped;
                    }

                    // 6.2版本不再显示典当按钮。
                    if (SaleBtn && SaleBtn.gameObject.activeSelf)
                    {
                        SaleBtn.gameObject.SetActive(false);
                    }

                    // 6.2版本不再显示典当提示。
                    if (SaleTip && SaleTip.gameObject.activeSelf)
                    {
                        SaleTip.gameObject.SetActive(false);
                    }
                }
                else
                {
                    if (BuyBtn && !BuyBtn.gameObject.activeSelf)
                    {
                        BuyBtn.gameObject.SetActive(true);
                    }

                    if (UseBtn && UseBtn.gameObject.activeSelf)
                    {
                        UseBtn.gameObject.SetActive(false);
                    }

                    if (UnUseBtn && UnUseBtn.gameObject.activeSelf)
                    {
                        UnUseBtn.gameObject.SetActive(false);
                    }

                    if (SaleBtn && SaleBtn.gameObject.activeSelf)
                    {
                        SaleBtn.gameObject.SetActive(false);
                    }

                    if (SaleTip && SaleTip.gameObject.activeSelf)
                    {
                        SaleTip.gameObject.SetActive(false);
                    }
                }
            }
            else
            {
                if (DetailBgImage)
                {
                    DetailBgImage.Reset();
                }

                if (DetailImage)
                {
                    DetailImage.Reset();
                }

                if (DetailName && DetailName.gameObject.activeSelf)
                {
                    DetailName.gameObject.SetActive(false);
                }

                if (DetailPrice && DetailPrice.gameObject.activeSelf)
                {
                    DetailPrice.gameObject.SetActive(false);
                }

                if (BuyBtn && BuyBtn.gameObject.activeSelf)
                {
                    BuyBtn.gameObject.SetActive(false);
                }

                if (UseBtn && UseBtn.gameObject.activeSelf)
                {
                    UseBtn.gameObject.SetActive(false);
                }

                if (UnUseBtn && UnUseBtn.gameObject.activeSelf)
                {
                    UnUseBtn.gameObject.SetActive(false);
                }

                if (SaleBtn && SaleBtn.gameObject.activeSelf)
                {
                    SaleBtn.gameObject.SetActive(false);
                }

                if (SaleTip && SaleTip.gameObject.activeSelf)
                {
                    SaleTip.gameObject.SetActive(false);
                }
            }
        }
        public override void BindData(int currentIndex, Commodity data)
        {
            if (data == null)
            {
                return;
            }

            _data = data;

            if (SelectCover && !SelectCover.gameObject.activeSelf)
            {
                SelectCover.gameObject.SetActive(false);
            }

            var pic = data.pic;

            if (Image)
            {
                if (!string.IsNullOrEmpty(pic))
                {
                    Image.SetTargetPic(pic, ResourcePath.CommodityPath, data.pic_url, true);
                }
                else
                {
                    Image.Reset();
                }
            }

            if (BgImage)
            {
                var picBg = data.pic_bg;
                if (!string.IsNullOrEmpty(picBg))
                {
                    BgImage.SetTargetPic(picBg, ResourcePath.CommodityPath, data.pic_bg_url, true);
                }
                else
                {
                    BgImage.Reset();
                }
            }

            if (data.vip_level > 0)
            {
                if (!VIPTag.activeSelf)
                {
                    VIPTag.SetActive(true);
                }
            }
            else
            {
                if (VIPTag.activeSelf)
                {
                    VIPTag.SetActive(false);
                }
            }

            var bag  = _bag.Read();
            var user = _user.Read();

            if (!GameUtil.HasCommodity(bag, data))
            {
                if (UnlockTag && !UnlockTag.activeSelf)
                {
                    UnlockTag.SetActive(true);
                }

                if (StateGroup && !StateGroup.activeSelf)
                {
                    StateGroup.SetActive(true);
                }

                if (StateText)
                {
                    StateText.text = "" + CommodityHelper.GetPrice(data) +
                                     CurrencyType.LabelOf(CommodityHelper.GetCurrencyType(data));
                }
            }
            else
            {
                if (UnlockTag && UnlockTag.activeSelf)
                {
                    UnlockTag.SetActive(false);
                }

                if (StateGroup && !StateGroup.activeSelf)
                {
                    StateGroup.SetActive(true);
                }

                if (StateText)
                {
                    StateText.text = GameUtil.IsCommodityEquiped(bag, user, data)
                        ? "<color=#4ae91a>当前装饰</color>"
                        : "<color=#f0aa4b>已购买</color>";
                }
            }
        }
Beispiel #14
0
        public override void BindData(int currentIndex, Room data)
        {
            _data = data;
            if (data == null)
            {
                // 如果没有数据的话,应该怎么显示房间按钮呢?
                // 房间可以不显示,但是是不是要显示在线人数。
                return;
            }

            // 载入人数和底注。
            BaseMoney.SetCurrency(_data.base_money, CurrencyType.GOLDEN_EGG);
            PlayerCount.text = "" + data.current_player_num;

            // 载入房间图片。
            if (string.IsNullOrEmpty(data.room_pic))
            {
                RoomPic.Reset();
            }
            else
            {
                var resourcePath = GetAssetBundleByPicNameMap.GetAssetBundleName(data.room_pic);
                RoomPic.SetTargetPic(data.room_pic, resourcePath, data.room_pic_url);
            }

            if (data.type == RoomType.Ad)
            {
                RoomContainer.SetActive(false);
                TagContainer.SetActive(false);
                var hintItem = data.hint_item;
                if (hintItem != null && !string.IsNullOrEmpty(hintItem.content_pic))
                {
                    var contentPic = _resourceCache.LoadSpriteFromLocalFile(hintItem.content_pic);
                    if (!contentPic)
                    {
                        if (!string.IsNullOrEmpty(hintItem.content_pic_url) &&
                            !_resourceCache.ContainsDownloadTask(hintItem.content_pic))
                        {
                            _resourceCache.StartDownload(
                                hintItem.content_pic,
                                hintItem.content_pic_url,
                                ContentType.Image);
                        }
                    }
                }
            }
            else
            {
                RoomContainer.SetActive(true);
                TagContainer.SetActive(true);
            }

            // 设置标签。
            if (!string.IsNullOrEmpty(data.tag))
            {
                if (!Tag1Group.activeSelf)
                {
                    Tag1Group.SetActive(true);
                }

                Tag1.text = data.tag;
            }
            else
            {
                if (Tag1Group.activeSelf)
                {
                    Tag1Group.SetActive(false);
                }
            }

            if (!string.IsNullOrEmpty(data.tag1))
            {
                if (!Tag2Group.activeSelf)
                {
                    Tag2Group.SetActive(true);
                }

                Tag2.text = data.tag1;
            }
            else
            {
                if (Tag2Group.activeSelf)
                {
                    Tag2Group.SetActive(false);
                }
            }

            if (!Button.gameObject.activeSelf)
            {
                Button.gameObject.SetActive(true);
            }
        }
 public override void Reset(int currentIndex)
 {
     Pic.Reset();
 }
Beispiel #16
0
        public override void BindData(int currentIndex, Prepayment data)
        {
            _data = data;

            if (data == null)
            {
                if (NormalGroup.activeSelf)
                {
                    NormalGroup.SetActive(false);
                }

                PackageImg.Reset();
                return;
            }

            if (data.currency_type == CurrencyType.COMPOUND)
            {
                // 礼包类型的支付包。
                if (NormalGroup && NormalGroup.activeSelf)
                {
                    NormalGroup.SetActive(false);
                }

                if (string.IsNullOrEmpty(data.pic))
                {
                    gameObject.SetActive(false);
                }
                else
                {
                    PackageImg.SetTargetPic(data.pic, null, data.pic_url);
                }

                return;
            }

            // 普通类型的支付包。

            PackageImg.Reset();

            if (!NormalGroup.activeSelf)
            {
                NormalGroup.SetActive(true);
            }

            if (!Icon.gameObject.activeSelf)
            {
                Icon.gameObject.SetActive(true);
            }

            Icon.sprite = _spriteHolder.GetPrepaymentIcon(data.currency_type);
            Icon.SetNativeSize();

            if (!Price.gameObject.activeSelf)
            {
                Price.gameObject.SetActive(true);
            }

            Price.text = "¥ " + data.price;

            HotTag.gameObject.SetActive(false);
            RecommendTag.gameObject.SetActive(false);

            if (!string.IsNullOrEmpty(data.tag))
            {
                if (!TagGroup.gameObject.activeSelf)
                {
                    TagGroup.gameObject.SetActive(true);
                }

                if (data.tag == _hotTag)
                {
                    HotTag.gameObject.SetActive(true);
                }
                else if (data.tag == _recommendTag)
                {
                    RecommendTag.gameObject.SetActive(true);
                }
            }
            else
            {
                if (TagGroup.gameObject.activeSelf)
                {
                    TagGroup.gameObject.SetActive(false);
                }
            }

            if (!string.IsNullOrEmpty(data.display_name))
            {
                if (!NameGroup.activeSelf)
                {
                    NameGroup.SetActive(true);
                }

                Name.text        = data.display_name;
                Description.text = data.description;
            }
            else
            {
                if (NameGroup.activeSelf)
                {
                    NameGroup.SetActive(false);
                }
            }
        }
        public void Apply(RaceAward msg)
        {
            var raceAward = msg;

            if (raceAward == null)
            {
                Reset();
                return;
            }
            RankTxt.text            = "" + raceAward.race_rank;
            ShareRankTxt.text       = "" + raceAward.race_rank;
            RaceNameTxt.text        = raceAward.race_name;
            ShareRaceNameTxt.text   = raceAward.race_name;
            HelpDescriptionTxt.text = raceAward.help;

            if (string.IsNullOrEmpty(raceAward.wx_share_url))
            {
                QrCodeImageBg.SetActive(false);
            }
            else
            {
                var sprite = GenerateQRCode.GenerateQRCodeSpriteFromUrl(raceAward.wx_share_url);
                if (sprite == null)
                {
                    QrCodeImageBg.SetActive(false);
                }
                else
                {
                    ShareQrCodeImage.sprite = sprite;
                    QrCodeImageBg.SetActive(true);
                }
            }

            if (string.IsNullOrEmpty(raceAward.description))
            {
                AwardHongbaoTxt.gameObject.SetActive(false);
                ShareAwardHongbaoTxt.gameObject.SetActive(false);
            }
            else
            {
                AwardHongbaoTxt.text      = raceAward.description;
                ShareAwardHongbaoTxt.text = raceAward.description;
                AwardHongbaoTxt.gameObject.SetActive(true);
                ShareAwardHongbaoTxt.gameObject.SetActive(true);
            }

            if (_currencyList.Count > 0)
            {
                for (var i = 0; i < _currencyList.Count; i++)
                {
                    Destroy(_currencyList[i].gameObject);
                }

                _currencyList.Clear();
            }

            var currencys = raceAward.currency;

            _currency.Clear();

            if (currencys == null || currencys.Count == 0)
            {
                AwardCurrency.SetActive(false);
                ShareAwardCurrency.SetActive(false);
            }
            else
            {
                _currency.AddRange(currencys);
                for (var i = 0; i < currencys.Count; i++)
                {
                    var cur      = _currencyValueFactory.Create();
                    var shareCur = _currencyValueFactory.Create();
                    if (cur)
                    {
                        cur.transform.SetParent(AwardCurrency.transform, false);
                        cur.SetCurrency(currencys[i].count, currencys[i].type);
                        cur.AmountTxt.color = Color.yellow;
                        _currencyList.Add(cur);
                    }
                    if (shareCur)
                    {
                        shareCur.transform.SetParent(ShareAwardCurrency.transform, false);
                        shareCur.SetCurrency(currencys[i].count, currencys[i].type);
                        shareCur.AmountTxt.color = Color.yellow;
                        _currencyList.Add(shareCur);
                    }
                }
                AwardCurrency.SetActive(true);
                ShareAwardCurrency.SetActive(true);
            }

            var user = raceAward.user;

            if (user == null)
            {
                HeadIcon.Reset();
                ShareNickname.text = "";
            }
            else
            {
                ShareNickname.text = user.nickname;
                if (string.IsNullOrEmpty(user.headicon_url))
                {
                    HeadIcon.gameObject.SetActive(false);
                }
                else
                {
                    HeadIcon.SetTargetPic(HeadIconPic(user), null, user.headicon_url);
                }
            }
        }