装备系统完结,修复并加入很多
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class esDesPrefab : MonoBehaviour
|
||||
{
|
||||
public Image skillProfile;
|
||||
public Text skillName;
|
||||
public Text skillDescription;
|
||||
public Text skill_story;
|
||||
|
||||
public void Bind(string displayName, Sprite icon, string description)
|
||||
{
|
||||
if (skillProfile != null)
|
||||
{
|
||||
skillProfile.sprite = icon;
|
||||
skillProfile.enabled = icon != null;
|
||||
}
|
||||
|
||||
if (skillName != null)
|
||||
{
|
||||
skillName.text = displayName ?? string.Empty;
|
||||
}
|
||||
|
||||
string mainText = description ?? string.Empty;
|
||||
string storyText = string.Empty;
|
||||
int splitIndex = mainText.IndexOf("\n\n", System.StringComparison.Ordinal);
|
||||
if (splitIndex >= 0)
|
||||
{
|
||||
storyText = mainText.Substring(splitIndex + 2).Trim();
|
||||
mainText = mainText.Substring(0, splitIndex).Trim();
|
||||
}
|
||||
|
||||
if (skillDescription != null)
|
||||
{
|
||||
skillDescription.text = mainText;
|
||||
}
|
||||
|
||||
if (skill_story != null)
|
||||
{
|
||||
skill_story.text = storyText;
|
||||
skill_story.gameObject.SetActive(!string.IsNullOrWhiteSpace(storyText));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user