优化 UI 效果
This commit is contained in:
@@ -10,6 +10,7 @@ namespace SepCore.UI
|
||||
public string IconAssetName;
|
||||
public string Title;
|
||||
public ItemType ItemType;
|
||||
public string TypeName;
|
||||
public Rarity Rarity;
|
||||
public string Description;
|
||||
public int Price;
|
||||
@@ -21,6 +22,7 @@ namespace SepCore.UI
|
||||
Index = -1;
|
||||
IconAssetName = string.Empty;
|
||||
Title = string.Empty;
|
||||
TypeName = string.Empty;
|
||||
ItemType = ItemType.None;
|
||||
Rarity = Rarity.White;
|
||||
Description = string.Empty;
|
||||
@@ -43,6 +45,7 @@ namespace SepCore.UI
|
||||
var data = rawData.WeaponData;
|
||||
IconAssetName = data.Sprite;
|
||||
Title = data.Title;
|
||||
TypeName = ItemDescUtility.FormatWeaponTags(data);
|
||||
Description = ItemDescUtility.CreateWeaponDescription(data);
|
||||
}
|
||||
else if (ItemType == ItemType.Prop)
|
||||
@@ -50,6 +53,7 @@ namespace SepCore.UI
|
||||
var data = rawData.PropData;
|
||||
IconAssetName = data.IconAssetName;
|
||||
Title = data.Title;
|
||||
TypeName = "道具";
|
||||
Description = ItemDescUtility.CreatePropDescription(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SepCore.UI
|
||||
View.contentRectTransform.anchoredPosition3D = _targetPos;
|
||||
|
||||
View.titleText.text = _context.Title;
|
||||
View.typeText.text = BuildTypeText(_context.ItemType);
|
||||
View.typeText.text = _context.TypeName;
|
||||
View.infoText.text = _context.Description;
|
||||
View.textFormatText.Set(_context.Price);
|
||||
|
||||
@@ -173,16 +173,5 @@ namespace SepCore.UI
|
||||
float z = View.contentRectTransform.anchoredPosition3D.z;
|
||||
return new Vector3(localPoint.x, localPoint.y, z);
|
||||
}
|
||||
|
||||
private string BuildTypeText(ItemType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
ItemType.None => "error",
|
||||
ItemType.Weapon => "武器",
|
||||
ItemType.Prop => "道具",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user