|
@@ -16,7 +16,7 @@ namespace FL.FGUI
|
|
|
{
|
|
|
public bool bShowName;
|
|
|
public bool bShowCount;
|
|
|
- public bool bShowBtn; // 是否可点击
|
|
|
+ public bool bShowBtn; // 是否可点击
|
|
|
public bool bShowMask;
|
|
|
public bool bShowLevel;
|
|
|
public bool bShowBaseInfo; // 点击道具是否只显示物品简易信息
|
|
@@ -35,24 +35,21 @@ namespace FL.FGUI
|
|
|
{
|
|
|
AddUIListenres();
|
|
|
}
|
|
|
+
|
|
|
protected override void OnDisable()
|
|
|
{
|
|
|
RemoveUIListenres();
|
|
|
}
|
|
|
+
|
|
|
#region UI事件
|
|
|
private void AddUIListenres()
|
|
|
{
|
|
|
- if (VM.ItemBtn != null)
|
|
|
- {
|
|
|
- VM.ItemBtn.onClick.Add(OnClickBtn);
|
|
|
- }
|
|
|
+ VM.ItemBtn.onClick.Add(OnClickBtn);
|
|
|
}
|
|
|
+
|
|
|
private void RemoveUIListenres()
|
|
|
{
|
|
|
- if (VM.ItemBtn != null)
|
|
|
- {
|
|
|
- VM.ItemBtn.onClick.Remove(OnClickBtn);
|
|
|
- }
|
|
|
+ VM.ItemBtn.onClick.Remove(OnClickBtn);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -74,60 +71,57 @@ namespace FL.FGUI
|
|
|
Context.UI.OpenAsync(UIKeys.EquipEquipPanel, data);
|
|
|
}
|
|
|
else
|
|
|
- Context.UI.OpenAsync(UIKeys.EquipEquipPanel, EquipData.Instance.GetBagEquipItem(data.Id));
|
|
|
+ Context.UI.OpenAsync(
|
|
|
+ UIKeys.EquipEquipPanel,
|
|
|
+ EquipData.Instance.GetBagEquipItem(data.Id)
|
|
|
+ );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ShowItemInfoPanel();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private void ShowItemInfoPanel()
|
|
|
{
|
|
|
Log.Debug($"显示道具:{data.Name}详情界面");
|
|
|
- Context.UI.OpenAsync(UIKeys.ItemInformationPanel, new ItemInfoParam
|
|
|
- {
|
|
|
- itemInfo = ItemTableRepo.Get(data.TableId),
|
|
|
- numDesc = data?.ItemType == EItemType.Equip ? $"LV.{data.Level}" : (int.Parse(data.Count) > 1 ? data.Count : null),
|
|
|
- });
|
|
|
+ Context.UI.OpenAsync(
|
|
|
+ UIKeys.ItemInformationPanel,
|
|
|
+ new ItemInfoParam
|
|
|
+ {
|
|
|
+ itemInfo = ItemTableRepo.Get(data.TableId),
|
|
|
+ numDesc =
|
|
|
+ data?.ItemType == EItemType.Equip
|
|
|
+ ? $"LV.{data.Level}"
|
|
|
+ : (int.Parse(data.Count) > 1 ? data.Count : null),
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
public void ShowUI(IItem item, UiParam uiParam)
|
|
|
{
|
|
|
data = item;
|
|
|
bShowBaseInfo = uiParam.bShowBaseInfo;
|
|
|
- if (VM.QualityImg != null)
|
|
|
- {
|
|
|
- VM.QualityImg.icon = AddressableDefine.ItemFrame(item.Quality);
|
|
|
- }
|
|
|
- if (VM.ItemIcon != null)
|
|
|
- {
|
|
|
- VM.ItemIcon.icon = item.Icon;
|
|
|
- }
|
|
|
-
|
|
|
- if (VM.LvLabel != null)
|
|
|
- {
|
|
|
- VM.LvLabel.visible = uiParam.bShowLevel;
|
|
|
- if (uiParam.bShowLevel)
|
|
|
- {
|
|
|
- VM.LvLabel.text = $"LV.{item.Level}";
|
|
|
- }
|
|
|
- }
|
|
|
- if (VM.CountLabel != null)
|
|
|
- {
|
|
|
- VM.CountLabel.visible = uiParam.bShowCount;
|
|
|
- if (uiParam.bShowCount)
|
|
|
- {
|
|
|
- VM.CountLabel.text = item.Count;
|
|
|
- }
|
|
|
- }
|
|
|
- if (VM.MaskImg != null)
|
|
|
+
|
|
|
+ VM.QualityImg.icon = AddressableDefine.ItemFrame(item.Quality);
|
|
|
+
|
|
|
+ VM.ItemIcon.icon = item.Icon;
|
|
|
+
|
|
|
+ VM.LvLabel.visible = uiParam.bShowLevel;
|
|
|
+ if (uiParam.bShowLevel)
|
|
|
{
|
|
|
- VM.MaskImg.visible = uiParam.bShowMask;
|
|
|
+ VM.LvLabel.text = $"LV.{item.Level}";
|
|
|
}
|
|
|
- if (VM.ItemBtn != null)
|
|
|
+
|
|
|
+ VM.CountLabel.visible = uiParam.bShowCount;
|
|
|
+ if (uiParam.bShowCount)
|
|
|
{
|
|
|
- VM.ItemBtn.visible = uiParam.bShowBtn;
|
|
|
+ VM.CountLabel.text = item.Count;
|
|
|
}
|
|
|
+
|
|
|
+ VM.MaskImg.visible = uiParam.bShowMask;
|
|
|
+
|
|
|
+ VM.ItemBtn.visible = uiParam.bShowBtn;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -145,4 +139,4 @@ namespace FL.FGUI
|
|
|
ShowUI(itemData, _uiParam);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|