40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
|
|
using TMPro;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class MyTestLogCard : CardBase
|
||
|
|
{
|
||
|
|
public RectTransform rect;
|
||
|
|
public TextMeshProUGUI text;
|
||
|
|
|
||
|
|
public override void Set<T>(T _base)
|
||
|
|
{
|
||
|
|
base.Set(_base);
|
||
|
|
var data = _base as MyTestLogData;
|
||
|
|
text.text = data.log;
|
||
|
|
text.ForceMeshUpdate();
|
||
|
|
rect.sizeDelta = new Vector2(rect.sizeDelta.x, text.preferredHeight);
|
||
|
|
|
||
|
|
switch (data.logtype)
|
||
|
|
{
|
||
|
|
case LogType.Error:
|
||
|
|
case LogType.Exception:
|
||
|
|
text.color = Color.red;
|
||
|
|
break;
|
||
|
|
case LogType.Warning:
|
||
|
|
text.color = Color.yellow;
|
||
|
|
break;
|
||
|
|
case LogType.Assert:
|
||
|
|
case LogType.Log:
|
||
|
|
text.color = Color.white;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnClick_Copy()
|
||
|
|
{
|
||
|
|
TextEditor te = new TextEditor { text = text.text };
|
||
|
|
te.SelectAll();
|
||
|
|
te.Copy();
|
||
|
|
ToastUI.Ins.Set("내용을 클립보드에 복사했습니다.");
|
||
|
|
}
|
||
|
|
}
|