protected override void OnFreshView() { _curData = Parse(Data); if (_curData == null) { return; } SetGoodsName(_curData.Name); SetPrice(_curData.ConsumeId, _curData.GetConsumeNumText()); SetIcon(_curData.IconUrl); SetDescription(_curData.Description); SetHotSign(_curData.IsHot); }
/// <summary> /// 设置消耗 /// </summary> /// <param name="goods">消耗类型</param> private void SetPrice(YxGoods goods) { var consumeId = goods.ConsumeId; var newPrice = goods.GetConsumeNumText(); var oldPrice = goods.GetOldConsumeNumText(); SetPrice(CurrentPriceView, consumeId, newPrice); SetPrice(CostPriceView, consumeId, newPrice); if (goods.OldConsumeNum <= goods.ConsumeNum) { if (OldPriceView != null) { var ts = OldPriceView.transform; var scale = ts.localScale; scale.y = 0; ts.localScale = scale; OldPriceView.Hide(); } } SetPrice(OldPriceView, consumeId, oldPrice); }