/// <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)); }
public void SetData(ItemWeaponVO Vo) { Initialize(); m_Empty.gameObject.SetActive(Vo.TID == 0); m_Content.gameObject.SetActive(Vo.TID != 0); if (Vo.TID == 0) { return; } UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(Vo.TID), TableUtil.GetItemIconImage(Vo.TID)); m_OverlyingIcon.sprite = m_IconImage.sprite; m_NameLabel.text = TableUtil.GetItemName((int)Vo.TID); m_Quality.color = ColorUtil.GetColorByItemQuality(Vo.ItemConfig.Quality); m_Used.gameObject.SetActive(Vo.Replicas != null && Vo.Replicas.Count > 0); int index = 0; char[] charArray = Vo.Lv.ToString().PadLeft(3, '0').ToCharArray(); for (int i = 0; i < charArray.Length; i++) { char cc = charArray[i]; if (cc != '0') { index = i; break; } } string sstr = Vo.Lv.ToString().PadLeft(3, '0'); if (index != 0) { sstr = sstr.Insert(index, "</color>"); sstr = sstr.Insert(0, "<color=#808080>"); } m_LvLabel.text = sstr; m_TypeLabel.text = TableUtil.GetLanguageString(Vo.WeaponType2); int m_ModCount = 0; if (Vo.Items != null) { foreach (ItemContainer item in Vo.Items.Values) { if (item.Items != null) { m_ModCount += item.Items.Count; } } } SetMod(m_ModCount); }
public void SetData(ItemBase Vo) { Initialize(); m_Empty.gameObject.SetActive(Vo.TID == 0); m_Content.gameObject.SetActive(Vo.TID != 0); if (Vo.TID == 0) { return; } UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(Vo.TID), TableUtil.GetItemIconImage(Vo.TID)); m_OverlyingIcon.sprite = m_IconImage.sprite; m_NameLabel.text = TableUtil.GetItemName((int)Vo.TID); m_Quality.color = ColorUtil.GetColorByItemQuality(Vo.ItemConfig.Quality); m_NumLabel.text = Vo.Count.ToString(); m_TypeLabel.text = TableUtil.GetLanguageString(Vo.MainType); }
/// <summary> /// 设置日志内容显示 /// </summary> private void SetContent(LogDataVO dataVO) { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(dataVO.Tid), TableUtil.GetItemIconImage(dataVO.Tid)); UIUtil.SetIconImage(m_OverlyingIcon, TableUtil.GetItemIconBundle(dataVO.Tid), TableUtil.GetItemIconImage(dataVO.Tid)); Color m_QualityColor = ColorUtil.GetColorByItemQuality(TableUtil.GetItemQuality(dataVO.Tid)); string m_Name = TableUtil.GetItemName(dataVO.Tid); string m_ColorText = ColorUtil.AddColor(m_Name, m_QualityColor); string m_ShowText = ""; if (dataVO.Num > 1) { m_ShowText = string.Format(TableUtil.GetLanguageString("log_text_1011"), m_ColorText, dataVO.Num); } else { m_ShowText = string.Format(TableUtil.GetLanguageString("log_text_1010"), m_ColorText); } m_Describe.text = string.Format(m_ShowText); }
private void ShowModMessageTips(WarshipModPanelElement cell) { m_ModTips.transform.localPosition = cell.transform.localPosition; m_ModTips.gameObject.SetActive(true); TransformUtil.FindUIObject <Transform>(m_ModTips.transform, "Content").gameObject.SetActive(cell.HasData()); TransformUtil.FindUIObject <Transform>(m_ModTips.transform, "Empty").gameObject.SetActive(!cell.HasData()); if (cell.HasData()) { UIUtil.SetIconImage( TransformUtil.FindUIObject <Image>(m_ModTips.transform, "Content/Image_Icon"), TableUtil.GetItemIconBundle(cell.GetModTid()), TableUtil.GetItemIconImage(cell.GetModTid()), autoSetNativeSize: true); TransformUtil.FindUIObject <Image>(m_ModTips.transform, "Content/Image_Quality").color = ColorUtil.GetColorByItemQuality(m_CfgEternityProxy.GetItemByKey(cell.GetModTid()).Quality); //数字不足3位,补0 ,并将补充的颜色置灰 int lv = cell.GetLv(); int index = 0; char[] charArray = lv.ToString().PadLeft(3, '0').ToCharArray(); for (int i = 0; i < charArray.Length; i++) { char cc = charArray[i]; if (cc != '0') { index = i; break; } } string sstr = lv.ToString().PadLeft(3, '0'); if (index != 0) { sstr = sstr.Insert(index, "</color>"); sstr = sstr.Insert(0, "<color=#808080>"); } TransformUtil.FindUIObject <TMP_Text>(m_ModTips.transform, "Content/Label_Lv").text = sstr; TransformUtil.FindUIObject <TMP_Text>(m_ModTips.transform, "Content/Label_Name").text = TableUtil.GetItemName(cell.GetModTid()); } }
/// <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="data"></param> /// <param name="cell"></param> private void SetEquipmentData(IEquipment data, Transform cell) { TransformUtil.FindUIObject <Transform>(cell, "Content").gameObject.SetActive(data != null); TransformUtil.FindUIObject <Transform>(cell, "Empty").gameObject.SetActive(data == null); if (data != null) { //icon UIUtil.SetIconImage(TransformUtil.FindUIObject <Image>(cell, "Content/Image_Icon"), TableUtil.GetItemIconBundle(data.GetTID()), TableUtil.GetItemIconImage(data.GetTID())); //name TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Name").text = TableUtil.GetItemName((int)data.GetTID()); //quality TransformUtil.FindUIObject <Image>(cell, "Content/Image_Quality").color = ColorUtil.GetColorByItemQuality(data.GetBaseConfig().Quality); //lv TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Lv").text = "Lv." + PadLeft(data.GetLv().ToString()); } }
/// <summary> /// 设置船具体属性数据 /// </summary> private void SetShipData() { InitShipPanel(); m_ShipPanelEmptyRoot.SetActive(false); m_ShipPanelContentRoot.SetActive(true); UIUtil.SetIconImage(m_ShipPanelIcon, TableUtil.GetItemIconBundle(m_CurrentShip.GetTID()), TableUtil.GetItemIconImage(m_CurrentShip.GetTID())); m_ShipPanelNameText.text = TableUtil.GetItemName((int)m_CurrentShip.GetTID()); m_ShipPanelQualityImage.color = ColorUtil.ShipColor.GetColorByPrime(m_CurrentShip.GetConfig().IsPrime > 0); m_ShipPanelLvText.text = "Lv." + PadLeft(m_CurrentShip.GetLv().ToString()); uint modCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax() + m_CurrentShip.GetExclusivelyModContainer().GetCurrentSizeMax(); for (int i = 0; i < m_ShipMods.Length; i++) { m_ShipMods[i].gameObject.SetActive(i < modCount); m_ShipMods[i].transform.GetChild(0).GetComponent <Image>().enabled = false; } IMod[] mods = m_CurrentShip.GetGeneralModContainer().GetMods(); if (mods != null && mods.Length > 0) { for (int i = 0; i < mods.Length; i++) { m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().enabled = true; m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().color = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality); } } mods = m_CurrentShip.GetExclusivelyModContainer().GetMods(); uint GeneralModCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax(); if (mods != null && mods.Length > 0) { for (int i = 0; i < mods.Length; i++) { m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().enabled = true; m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().color = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality); } } }
public override void OnShow(object msg) { base.OnShow(msg); if (msg != null) { m_ShopParameter = (OpenShopParameter)msg; } m_ItemConfig = m_CfgEternityProxy.GetItemByKey(m_ShopParameter.Tid); m_Bounds = m_ShopParameter.Bounds; if (m_ShopParameter.MoneyType == 1) { m_Money = (int)CurrencyUtil.GetGameCurrencyCount(); } else { m_Money = (int)CurrencyUtil.GetRechargeCurrencyCount(); } if (m_ShopParameter.OperateType == 1) { m_Max = m_ShopParameter.LimitCount; } else { GetGoodMax(); if (m_Max == 0) { m_Min = 0; } } m_GoodName.text = TableUtil.GetItemName(m_ShopParameter.Tid); m_GoodName.color = ColorUtil.GetColorByItemQuality(m_ItemConfig.Quality); UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopParameter.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopParameter.MoneyType)); m_InputBox.onValueChanged.RemoveAllListeners(); m_CurrentNum = m_Bounds; m_InputBox.text = m_Bounds.ToString(); m_TotalPrice.text = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds)).ToString(); m_InputBox.onValueChanged.AddListener((str) => { if (str.Length > 0) { m_CurrentNum = int.Parse(str); if (m_CurrentNum < m_Min) { m_CurrentNum = m_Min; } else if (m_CurrentNum > m_Max) { m_CurrentNum = m_Max; } m_InputBox.text = m_CurrentNum.ToString(); m_BtnLeft.GetComponent <Button>().interactable = m_CurrentNum > m_Bounds; m_BtnRight.GetComponent <Button>().interactable = m_CurrentNum < m_Max; SetHotKeyEnabled("left", m_CurrentNum > m_Bounds); SetHotKeyEnabled("Right", m_CurrentNum < m_Max); int m_Price = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds)); m_TotalPrice.text = m_Price.ToString(); if (m_ShopParameter.OperateType != 1) { SetHotKeyEnabled("confirm", m_Money >= m_Price && m_CurrentNum > 0); } else { SetHotKeyEnabled("confirm", true); } } else { m_CurrentNum = 0; int m_Price = 0; m_TotalPrice.text = m_Price.ToString(); SetHotKeyEnabled("confirm", false); } }); UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onDown = OnLeftDonw; UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onUp = OnUp; UIEventListener.UIEventListener.AttachListener(m_BtnRight).onDown = OnRightDown; UIEventListener.UIEventListener.AttachListener(m_BtnRight).onUp = OnUp; }
/// <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; } }