You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
59 lines
1.5 KiB
4 years ago
|
using SuperScrollView;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class XLogItem : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public Toggle ExpandBtn;
|
||
|
public Text TextStackTrace;
|
||
|
public Text TextCondition;
|
||
|
public Text TextSendTime;
|
||
|
public Image XLogIcon;
|
||
|
public Image Background;
|
||
|
XLog data;
|
||
|
public void Init()
|
||
|
{
|
||
|
ExpandBtn.onValueChanged.AddListener(ExpandBtn_OnValueChanged);
|
||
|
}
|
||
|
|
||
|
private void ExpandBtn_OnValueChanged(bool arg0)
|
||
|
{
|
||
|
data.IsSelected = arg0;
|
||
|
RectTransform rt = gameObject.GetComponent<RectTransform>();
|
||
|
if (arg0)
|
||
|
{
|
||
|
TextStackTrace.text = string.Format("{0}\n{1}", data.Condition, data.StackTrace);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
TextStackTrace.text = "选中日志,查看详细信息。";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
internal void SetItemData(XLog itemData, int index)
|
||
|
{
|
||
|
data = itemData;
|
||
|
gameObject.SetActive(true);
|
||
|
ExpandBtn.isOn = data.IsSelected;
|
||
|
TextCondition.text = data.Condition;
|
||
|
TextSendTime.text = data.SendTime.ToString("HH:mm:ss:ffff");
|
||
|
switch (data.Type)
|
||
|
{
|
||
|
case LogType.Error:
|
||
|
case LogType.Exception:
|
||
|
XLogIcon.color = Color.red;
|
||
|
break;
|
||
|
case LogType.Warning:
|
||
|
XLogIcon.color = Color.yellow;
|
||
|
break;
|
||
|
case LogType.Log:
|
||
|
XLogIcon.color = Color.white;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|