using UnityEngine;
using UnityEngine.UI;
using System;
public class PHyperLink : UIPlane {
public Text content;
public Button goBtn;
public Text lineText;
public Action callback;
// Use this for initialization
void Start () {
goBtn.onClick.AddListener(delegate
{
if (callback != null)
{
callback();
}
});
}
public void SetPos(string str)
{
content.text = str;
//dec.text = "_";
lineText.text = "".PadLeft((int)(content.preferredWidth / content.preferredWidth) + 1, '_');
goBtn.GetComponent<RectTransform>().sizeDelta = new Vector2(lineText.preferredWidth, lineText.preferredHeight);
}
}
using UnityEngine.UI;
using System;
public class PHyperLink : UIPlane {
public Text content;
public Button goBtn;
public Text lineText;
public Action callback;
// Use this for initialization
void Start () {
goBtn.onClick.AddListener(delegate
{
if (callback != null)
{
callback();
}
});
}
public void SetPos(string str)
{
content.text = str;
//dec.text = "_";
lineText.text = "".PadLeft((int)(content.preferredWidth / content.preferredWidth) + 1, '_');
goBtn.GetComponent<RectTransform>().sizeDelta = new Vector2(lineText.preferredWidth, lineText.preferredHeight);
}
}