/// <summary> /// 根据类型初始化面板内容 /// </summary> private void SetContent() { m_Prime.gameObject.SetActive(false); m_BlueprintNameLabel.text = TableUtil.GetItemName(m_CurrentProduce.Id); m_BlueprintQuality.color = ColorUtil.GetColorByItemQuality(TableUtil.GetItemQuality(m_CurrentItem.Id)); m_BlueprintNumberLabel.text = m_CurrentProduce.ProductNum.ToString(); string iconName = ""; if (m_Style == UIViewListLayout.Row) { iconName = TableUtil.GetItemIconImage(m_CurrentItem.Id); } else { iconName = TableUtil.GetItemSquareIconImage(m_CurrentItem.Id); } UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(m_CurrentItem.Id), iconName); m_OverlyingIcon.sprite = m_IconImage.sprite; switch (m_ProduceType) { case ProduceType.HeavyWeapon: case ProduceType.LightWeapon: WeaponL2 weaponL2 = 0; ItemTypeUtil.SetSubType(ref weaponL2, ItemTypeUtil.GetItemType(m_CurrentItem.Type)); m_Prime.text = TableUtil.GetLanguageString(weaponL2); m_Prime.gameObject.SetActive(true); break; } }
public void SetData(ItemBase item, bool isSelect, bool isList = false) { Init(); m_Quality.color = ColorUtil.GetColorByItemQuality(item.ItemConfig.Quality); if (isList) { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemIconImage(item.TID)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemIconImage(item.TID)); } else { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemSquareIconImage(item.TID)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemSquareIconImage(item.TID)); } m_Count.text = item.Count.ToString(); m_Used.gameObject.SetActive(item.Replicas != null && item.Replicas.Count > 0); m_Price.text = item.ItemConfig.MoneyPrice.ToString(); if (isSelect) { m_Price.color = new Color(41f / 255f, 41f / 255f, 41f / 255f, 1); } else { m_Price.color = Color.white; } m_Name.text = TableUtil.GetItemName(item.TID); m_Level.text = TableUtil.ShowLevel(1); UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((uint)item.ItemConfig.SellCurrency), TableUtil.GetItemIconImage((uint)item.ItemConfig.SellCurrency)); }
/// <summary> /// 等级奖励 /// </summary> private void LevelRewards() { int index = 0; if (m_RewarList.Count == 0) { m_RewardContainer.gameObject.SetActive(false); return; } m_RewardContainer.gameObject.SetActive(true); for (; index < m_RewarList.Count; index++) { RewardDateVO mailReward = m_RewarList[index]; Transform node = index < m_RewardContainer.childCount ? m_RewardContainer.GetChild(index) : Object.Instantiate(m_RewardContainer.GetChild(0), m_RewardContainer); Image icon = FindComponent <Image>(node, "Icon"); Image quality = FindComponent <Image>(node, "Quality"); TMP_Text num = FindComponent <TMP_Text>(node, "label_Num"); num.text = mailReward.Num.ToString(); quality.color = ColorUtil.GetColorByItemQuality(mailReward.Quality); string iconName = TableUtil.GetItemSquareIconImage(mailReward.Id); UIUtil.SetIconImage(icon, TableUtil.GetItemIconBundle(mailReward.Id), iconName); node.gameObject.SetActive(true); } for (; index < m_RewardContainer.childCount; index++) { m_RewardContainer.GetChild(index).gameObject.SetActive(false); } }
/// <summary> /// /// </summary> /// <param name="view"></param> /// <param name="data"></param> private void LayoutMailTip(GameObject view, MailDataVO data) { int index = 0; Transform m_TipsTransform = FindComponent <Transform>(view.transform, "TipsScrollView/ALL"); TextMeshProUGUI m_Title = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Label_Name"); TextMeshProUGUI m_Sender = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Type/Label_Type"); TextMeshProUGUI m_Describe = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/Describe/Label_Describe"); Transform itemRootTf = FindComponent <Transform>(view.transform, "TipsScrollView/ALL/Content/Materials"); m_Title.text = data.Title; m_Sender.text = data.Sender; m_Describe.text = data.Content; m_Describe.text = m_Describe.text.Replace("\\n", "\n"); if (data.Items == null) { return; } for (; index < data.Items.Count; index++) { RewardDateVO mailReward = data.Items[index]; Transform node = index < itemRootTf.childCount ? itemRootTf.GetChild(index) : Object.Instantiate(itemRootTf.GetChild(0), itemRootTf); Image icon = FindComponent <Image>(node, "Content/Icon/Icon"); Image quality = FindComponent <Image>(node, "Content/Icon/Quality"); TMP_Text name = FindComponent <TMP_Text>(node, "Content/Label_Name"); TMP_Text num = FindComponent <TMP_Text>(node, "Content/Label_Num"); name.text = TableUtil.GetItemName((int)mailReward.Id); num.text = mailReward.Num.ToString(); quality.color = ColorUtil.GetColorByItemQuality(mailReward.Quality); string iconName = TableUtil.GetItemSquareIconImage(mailReward.Id); UIUtil.SetIconImage(icon, TableUtil.GetItemIconBundle(mailReward.Id), iconName); if (data.Got == 1) { icon.color = Color.gray; } else { icon.color = Color.white; } node.gameObject.SetActive(true); } for (; index < itemRootTf.childCount; index++) { itemRootTf.GetChild(index).gameObject.SetActive(false); } }
/// <summary> /// 添加条目 /// </summary> /// <param name="itemGetting">条目数据</param> private void OnGettingItem(ItemChangeInfo itemGetting) { if (itemGetting.CountChangeDelta > 0 && itemGetting.TID > 0) { if (itemGetting.Category != 0 && itemGetting.Category != Category.Package) { ItemData data = new ItemData(); data.Name = TableUtil.GetItemName(itemGetting.TID); data.Quality = TableUtil.GetItemQuality(itemGetting.TID); data.Count = itemGetting.CountChangeDelta; data.IconBundle = TableUtil.GetItemIconBundle(itemGetting.TID); data.IconName = TableUtil.GetItemSquareIconImage(itemGetting.TID); m_WaitingQueue.Add(data); } } }
/// <summary> /// 设置船内容显示 /// </summary> /// <param name="ship"></param> public void SetData(IShip ship, bool isList) { Initialize(); m_Ship = ship; if (isList) { UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemIconImage(ship.GetTID())); } else { UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemSquareIconImage(ship.GetTID())); } m_OverlyingIcon.sprite = m_IconImage.sprite; m_NameLabel.text = TableUtil.GetItemName((int)ship.GetTID()); m_LvLabel.text = TableUtil.ShowLevel(ship.GetLv()); m_Appoint.gameObject.SetActive(ship.GetUID() == m_ShipProxy.GetAppointWarShip().GetUID()); m_New.gameObject.SetActive(!m_ShipProxy.MarkNew(ship)); }
/// <summary> /// 设置商品数据 /// </summary> /// <param name="shopWindowVO"></param> /// <param name="isSelect"></param> /// <param name="isList"></param> public void SetData(ShopWindowVO shopWindowVO, bool isSelect, bool isList = false) { Init(); Item m_Item = shopWindowVO.ShopItemConfig.Value.ItemGood.Value; m_ShopItemData = shopWindowVO.ShopItemConfig.Value; m_Quality.color = ColorUtil.GetColorByItemQuality(m_Item.Quality); if (isList) { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id)); } else { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id)); } m_Name.text = TableUtil.GetItemName(m_Item.Id); m_Level.text = TableUtil.ShowLevel(1); m_Bounds.text = m_ShopItemData.Bounds.ToString(); if (shopWindowVO.LimitCount == -1) { m_Available.gameObject.SetActive(false); } else { m_Available.gameObject.SetActive(true); m_Available.text = string.Format(TableUtil.GetLanguageString("shop_text_1012"), shopWindowVO.LimitCount); } if (shopWindowVO.LimitCount < m_ShopItemData.Bounds) { m_Available.color = Color.red; } else { m_Available.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white; } UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopItemData.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopItemData.MoneyType)); if (m_ShopItemData.DisCount == 1) { m_Discount.gameObject.SetActive(false); m_GoodPrice = m_ShopItemData.BuyCost; } else { m_Discount.gameObject.SetActive(true); m_Discount.text = m_ShopItemData.BuyCost.ToString(); m_GoodPrice = Mathf.CeilToInt(m_ShopItemData.BuyCost * m_ShopItemData.DisCount); } m_Price.text = m_GoodPrice.ToString(); if (MoneyeEnough()) { m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1); } else { m_Price.color = Color.red; } if (shopWindowVO.ServerLeftNum == -1) { m_Stock.text = TableUtil.GetLanguageString("shop_text_1010"); } else if (shopWindowVO.ServerLeftNum == 0) { m_Stock.text = TableUtil.GetLanguageString("shop_text_1013"); } else { m_Stock.text = string.Format(TableUtil.GetLanguageString("shop_text_1011"), shopWindowVO.ServerLeftNum); } m_Stock.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white; m_Black.gameObject.SetActive(shopWindowVO.IsOpen == 0); }
/// <summary> /// 设置回购数据 /// </summary> /// <param name="sellBackVO"></param> /// <param name="isList">是否列表模式</param> public void SetData(ShopSellBackVO sellBackVO, bool isList) { Init(); m_SellBackVO = sellBackVO; m_Quality.color = ColorUtil.GetColorByItemQuality(sellBackVO.ItemConfig.Quality); if (isList) { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid)); } else { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid)); } m_Num.text = sellBackVO.Num.ToString(); UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((uint)sellBackVO.ItemConfig.SellCurrency), TableUtil.GetItemIconImage((uint)sellBackVO.ItemConfig.SellCurrency)); m_Price.text = sellBackVO.ItemConfig.BuybackPrice.ToString(); m_Name.text = TableUtil.GetItemName((uint)m_SellBackVO.Tid); m_Level.text = TableUtil.ShowLevel(1); if (MoneyeEnough()) { m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1); } else { m_Price.color = Color.red; } }