2019-10-22 04:09:04 +08:00
|
|
|
|
/******************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
2019-08-04 15:24:31 +08:00
|
|
|
|
using System.Collections.Generic;
|
2019-07-28 00:44:53 +08:00
|
|
|
|
using UnityEngine;
|
2019-07-29 00:25:10 +08:00
|
|
|
|
using UnityEngine.UI;
|
2019-11-12 07:38:02 +08:00
|
|
|
|
using System;
|
2019-07-28 00:44:53 +08:00
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// A data item of serie.
|
|
|
|
|
|
/// 系列中的一个数据项。可存储数据名和1-n维的数据。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
[System.Serializable]
|
2019-10-14 18:13:08 +08:00
|
|
|
|
public class SerieData : SubComponent
|
2019-07-28 00:44:53 +08:00
|
|
|
|
{
|
|
|
|
|
|
[SerializeField] private string m_Name;
|
|
|
|
|
|
[SerializeField] private bool m_Selected;
|
2019-10-14 09:46:27 +08:00
|
|
|
|
[SerializeField] private float m_Radius;
|
2019-11-12 07:38:02 +08:00
|
|
|
|
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
|
2019-11-30 21:24:04 +08:00
|
|
|
|
[SerializeField] private bool m_EnableLabel = false;
|
|
|
|
|
|
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
2020-03-17 08:37:48 +08:00
|
|
|
|
[SerializeField] private bool m_EnableItemStyle = false;
|
|
|
|
|
|
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
|
|
|
|
|
[SerializeField] private bool m_EnableEmphasis = false;
|
|
|
|
|
|
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
|
2019-07-28 00:44:53 +08:00
|
|
|
|
[SerializeField] private List<float> m_Data = new List<float>();
|
|
|
|
|
|
|
|
|
|
|
|
private bool m_Show = true;
|
2019-08-20 09:40:19 +08:00
|
|
|
|
private bool m_LabelAutoSize;
|
|
|
|
|
|
private float m_LabelPaddingLeftRight;
|
|
|
|
|
|
private float m_LabelPaddingTopBottom;
|
2019-10-14 09:46:27 +08:00
|
|
|
|
private float m_RtPieOutsideRadius;
|
2019-07-28 00:44:53 +08:00
|
|
|
|
|
2019-10-05 18:23:06 +08:00
|
|
|
|
public int index { get; set; }
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// the name of data item.
|
|
|
|
|
|
/// 数据项名称。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string name { get { return m_Name; } set { m_Name = value; } }
|
|
|
|
|
|
/// <summary>
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// 数据项图例名称。当数据项名称不为空时,图例名称即为系列名称;反之则为索引index。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <value></value>
|
|
|
|
|
|
public string legendName { get { return string.IsNullOrEmpty(name) ? ChartCached.IntToStr(index) : name; } }
|
|
|
|
|
|
/// <summary>
|
2019-10-14 09:46:27 +08:00
|
|
|
|
/// 自定义半径。可用在饼图中自定义某个数据项的半径。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
|
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// Whether the data item is selected.
|
|
|
|
|
|
/// 该数据项是否被选中。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
2019-09-24 18:47:43 +08:00
|
|
|
|
/// <summary>
|
2019-11-12 07:38:02 +08:00
|
|
|
|
/// the icon of data.
|
|
|
|
|
|
/// 数据项图标样式。
|
2019-09-24 18:47:43 +08:00
|
|
|
|
/// </summary>
|
2019-11-12 07:38:02 +08:00
|
|
|
|
public IconStyle iconStyle { get { return m_IconStyle; } set { m_IconStyle = value; } }
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// <summary>
|
2019-11-30 21:24:04 +08:00
|
|
|
|
/// 是否启用单个数据项的标签设置。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool enableLabel { get { return m_EnableLabel; } set { m_EnableLabel = value; } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 单个数据项的标签设置。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public SerieLabel label { get { return m_Label; } set { m_Label = value; } }
|
|
|
|
|
|
/// <summary>
|
2020-03-17 08:37:48 +08:00
|
|
|
|
/// 是否启用单个数据项的样式。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool enableItemStyle { get { return m_EnableItemStyle; } set { m_EnableItemStyle = value; } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 单个数据项的样式设置。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ItemStyle itemStyle { get { return m_ItemStyle; } set { m_ItemStyle = value; } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否启用单个数据项的高亮样式。
|
|
|
|
|
|
/// </summary>
|
2020-03-20 08:31:22 +08:00
|
|
|
|
public bool enableEmphasis { get { return m_EnableEmphasis; } set { m_EnableEmphasis = value; } }
|
2020-03-17 08:37:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 单个数据项的高亮样式设置。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Emphasis emphasis { get { return m_Emphasis; } set { m_Emphasis = value; } }
|
|
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// An arbitrary dimension data list of data item.
|
|
|
|
|
|
/// 可指定任意维数的数值列表。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public List<float> data { get { return m_Data; } set { m_Data = value; } }
|
|
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// [default:true] Whether the data item is showed.
|
|
|
|
|
|
/// 该数据项是否要显示。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool show { get { return m_Show; } set { m_Show = value; } }
|
|
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// Whether the data item is highlighted.
|
|
|
|
|
|
/// 该数据项是否被高亮,一般由鼠标悬停或图例悬停触发高亮。
|
2019-07-28 00:44:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool highlighted { get; set; }
|
2019-07-29 00:25:10 +08:00
|
|
|
|
/// <summary>
|
2019-08-01 23:49:30 +08:00
|
|
|
|
/// the label of data item.
|
|
|
|
|
|
/// 该数据项的文本标签。
|
2019-07-29 00:25:10 +08:00
|
|
|
|
/// </summary>
|
2019-08-20 09:40:19 +08:00
|
|
|
|
public Text labelText { get; private set; }
|
|
|
|
|
|
public RectTransform labelRect { get; private set; }
|
2019-09-24 18:47:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 标志位置。
|
|
|
|
|
|
/// </summary>
|
2019-09-23 09:23:51 +08:00
|
|
|
|
public Vector3 labelPosition { get; set; }
|
2019-11-22 09:46:30 +08:00
|
|
|
|
private bool m_CanShowLabel = true;
|
2019-08-04 15:24:31 +08:00
|
|
|
|
/// <summary>
|
2019-09-05 09:21:37 +08:00
|
|
|
|
/// 是否可以显示Label
|
|
|
|
|
|
/// </summary>
|
2019-10-14 18:23:28 +08:00
|
|
|
|
public bool canShowLabel { get { return m_CanShowLabel; } set { m_CanShowLabel = value; } }
|
2019-09-05 09:21:37 +08:00
|
|
|
|
/// <summary>
|
2019-08-04 15:24:31 +08:00
|
|
|
|
/// the maxinum value.
|
|
|
|
|
|
/// 最大值。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public float max { get { return m_Data.Max(); } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// the mininum value.
|
|
|
|
|
|
/// 最小值。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public float min { get { return m_Data.Min(); } }
|
2019-11-12 07:38:02 +08:00
|
|
|
|
|
2019-09-25 09:44:53 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关联的gameObject
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public GameObject gameObject { get; private set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的开始角度(运行时自动计算)
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieStartAngle { get; internal set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的结束角度(运行时自动计算)
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieToAngle { get; internal set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的一半时的角度(运行时自动计算)
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieHalfAngle { get; internal set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的当前角度(运行时自动计算)
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieCurrAngle { get; internal set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的内半径
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieInsideRadius { get; internal set; }
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的外半径
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieOutsideRadius
|
2019-10-14 09:46:27 +08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (radius > 0) return radius;
|
|
|
|
|
|
else return m_RtPieOutsideRadius;
|
|
|
|
|
|
}
|
2019-11-02 08:24:37 +08:00
|
|
|
|
internal set
|
2019-10-14 09:46:27 +08:00
|
|
|
|
{
|
|
|
|
|
|
m_RtPieOutsideRadius = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-10-05 18:23:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 饼图数据项的偏移半径
|
|
|
|
|
|
/// </summary>
|
2019-11-02 08:24:37 +08:00
|
|
|
|
public float runtimePieOffsetRadius { get; internal set; }
|
|
|
|
|
|
public Vector3 runtiemPieOffsetCenter { get; internal set; }
|
2020-03-08 10:47:48 +08:00
|
|
|
|
private List<float> m_PreviousData = new List<float>();
|
2019-12-03 07:49:37 +08:00
|
|
|
|
private List<float> m_DataUpdateTime = new List<float>();
|
|
|
|
|
|
private List<bool> m_DataUpdateFlag = new List<bool>();
|
2019-11-30 21:24:04 +08:00
|
|
|
|
|
2020-04-18 08:19:17 +08:00
|
|
|
|
public float GetData(int index, bool inverse = false)
|
2019-08-04 15:24:31 +08:00
|
|
|
|
{
|
2019-11-30 21:24:04 +08:00
|
|
|
|
if (index >= 0 && index < m_Data.Count)
|
|
|
|
|
|
{
|
2020-04-18 08:19:17 +08:00
|
|
|
|
return inverse ? -m_Data[index] : m_Data[index];
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
2019-08-04 15:24:31 +08:00
|
|
|
|
else return 0;
|
|
|
|
|
|
}
|
2019-08-16 00:13:01 +08:00
|
|
|
|
|
2020-04-18 08:19:17 +08:00
|
|
|
|
public float GetPreviousData(int index, bool inverse = false)
|
2019-12-03 07:49:37 +08:00
|
|
|
|
{
|
2020-03-08 10:47:48 +08:00
|
|
|
|
if (index >= 0 && index < m_PreviousData.Count)
|
2019-12-03 07:49:37 +08:00
|
|
|
|
{
|
2020-04-18 08:19:17 +08:00
|
|
|
|
return inverse ? -m_PreviousData[index] : m_PreviousData[index];
|
2019-12-03 07:49:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
else return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-08 10:47:48 +08:00
|
|
|
|
public float GetFirstData(float animationDuration = 500f)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_Data.Count > 0) return GetCurrData(0, animationDuration);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float GetLastData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_Data.Count > 0) return m_Data[m_Data.Count - 1];
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-18 08:19:17 +08:00
|
|
|
|
public float GetCurrData(int index, float animationDuration = 500f, bool inverse = false)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
if (index < m_DataUpdateFlag.Count && m_DataUpdateFlag[index] && animationDuration > 0)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
var time = Time.time - m_DataUpdateTime[index];
|
2019-11-30 21:24:04 +08:00
|
|
|
|
var total = animationDuration / 1000;
|
2019-12-03 07:49:37 +08:00
|
|
|
|
if (time <= total)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
CheckLastData();
|
2020-04-18 08:19:17 +08:00
|
|
|
|
var curr = Mathf.Lerp(GetPreviousData(index, inverse), GetData(index, inverse), time / total);
|
2019-11-30 21:24:04 +08:00
|
|
|
|
return curr;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
m_DataUpdateFlag[index] = false;
|
2020-04-18 08:19:17 +08:00
|
|
|
|
return GetData(index, inverse);
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-04-18 08:19:17 +08:00
|
|
|
|
return GetData(index, inverse);
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-12-04 09:44:59 +08:00
|
|
|
|
public bool UpdateData(int dimension, float value)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
if (dimension >= 0 && dimension < data.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
CheckLastData();
|
2020-03-08 10:47:48 +08:00
|
|
|
|
m_PreviousData[dimension] = data[dimension];
|
2019-12-03 07:49:37 +08:00
|
|
|
|
m_DataUpdateTime[dimension] = Time.time;
|
|
|
|
|
|
m_DataUpdateFlag[dimension] = true;
|
|
|
|
|
|
data[dimension] = value;
|
2019-12-04 09:44:59 +08:00
|
|
|
|
return true;
|
2019-12-03 07:49:37 +08:00
|
|
|
|
}
|
2019-12-04 09:44:59 +08:00
|
|
|
|
return false;
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-12-03 07:49:37 +08:00
|
|
|
|
private void CheckLastData()
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2020-03-08 10:47:48 +08:00
|
|
|
|
if (m_PreviousData.Count != m_Data.Count)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2020-03-08 10:47:48 +08:00
|
|
|
|
m_PreviousData.Clear();
|
2019-12-20 09:17:15 +08:00
|
|
|
|
m_DataUpdateTime.Clear();
|
|
|
|
|
|
m_DataUpdateFlag.Clear();
|
2019-12-03 07:49:37 +08:00
|
|
|
|
for (int i = 0; i < m_Data.Count; i++)
|
2019-11-30 21:24:04 +08:00
|
|
|
|
{
|
2020-03-08 10:47:48 +08:00
|
|
|
|
m_PreviousData.Add(m_Data[i]);
|
2019-12-03 07:49:37 +08:00
|
|
|
|
m_DataUpdateTime.Add(Time.time);
|
|
|
|
|
|
m_DataUpdateFlag.Add(false);
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsDataChanged()
|
|
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
foreach (var b in m_DataUpdateFlag)
|
|
|
|
|
|
if (b) return true;
|
|
|
|
|
|
return false;
|
2019-11-30 21:24:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-20 09:40:19 +08:00
|
|
|
|
public void InitLabel(GameObject labelObj, bool autoSize, float paddingLeftRight, float paddingTopBottom)
|
|
|
|
|
|
{
|
2019-09-25 09:44:53 +08:00
|
|
|
|
gameObject = labelObj;
|
2019-08-20 09:40:19 +08:00
|
|
|
|
m_LabelAutoSize = autoSize;
|
|
|
|
|
|
m_LabelPaddingLeftRight = paddingLeftRight;
|
|
|
|
|
|
m_LabelPaddingTopBottom = paddingTopBottom;
|
|
|
|
|
|
labelText = labelObj.GetComponentInChildren<Text>();
|
2019-09-25 09:44:53 +08:00
|
|
|
|
labelRect = labelText.GetComponent<RectTransform>();
|
2019-08-20 09:40:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-16 00:13:01 +08:00
|
|
|
|
public void SetLabelActive(bool active)
|
|
|
|
|
|
{
|
2019-09-25 09:44:53 +08:00
|
|
|
|
if (labelRect)
|
2019-08-16 00:13:01 +08:00
|
|
|
|
{
|
2019-09-25 09:44:53 +08:00
|
|
|
|
ChartHelper.SetActive(labelRect, active);
|
2019-08-16 00:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-23 18:47:45 +08:00
|
|
|
|
public bool SetLabelText(string text)
|
2019-08-16 00:13:01 +08:00
|
|
|
|
{
|
2019-11-30 21:24:04 +08:00
|
|
|
|
if (labelText && !labelText.text.Equals(text))
|
2019-08-16 00:13:01 +08:00
|
|
|
|
{
|
2019-08-20 09:40:19 +08:00
|
|
|
|
labelText.text = text;
|
|
|
|
|
|
if (m_LabelAutoSize)
|
|
|
|
|
|
{
|
2019-11-04 13:09:06 +08:00
|
|
|
|
var newSize = string.IsNullOrEmpty(text) ? Vector2.zero :
|
|
|
|
|
|
new Vector2(labelText.preferredWidth + m_LabelPaddingLeftRight * 2,
|
2019-08-20 09:40:19 +08:00
|
|
|
|
labelText.preferredHeight + m_LabelPaddingTopBottom * 2);
|
2019-09-23 18:47:45 +08:00
|
|
|
|
var sizeChange = newSize.x != labelRect.sizeDelta.x || newSize.y != labelRect.sizeDelta.y;
|
|
|
|
|
|
if (sizeChange) labelRect.sizeDelta = newSize;
|
|
|
|
|
|
return sizeChange;
|
2019-08-20 09:40:19 +08:00
|
|
|
|
}
|
2019-08-16 00:13:01 +08:00
|
|
|
|
}
|
2019-09-23 18:47:45 +08:00
|
|
|
|
return false;
|
2019-08-16 00:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-11-30 21:24:04 +08:00
|
|
|
|
public void SetLabelColor(Color color)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (labelText)
|
|
|
|
|
|
{
|
|
|
|
|
|
labelText.color = color;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-06 09:11:46 +08:00
|
|
|
|
public float GetLabelWidth()
|
|
|
|
|
|
{
|
2019-09-23 18:47:45 +08:00
|
|
|
|
if (labelRect) return labelRect.sizeDelta.x;
|
2019-09-06 09:11:46 +08:00
|
|
|
|
else return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float GetLabelHeight()
|
|
|
|
|
|
{
|
2019-09-23 18:47:45 +08:00
|
|
|
|
if (labelRect) return labelRect.sizeDelta.y;
|
2019-09-06 09:11:46 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-25 09:44:53 +08:00
|
|
|
|
public void SetGameObjectPosition(Vector3 position)
|
2019-08-16 00:13:01 +08:00
|
|
|
|
{
|
2019-09-25 09:44:53 +08:00
|
|
|
|
if (gameObject)
|
2019-08-16 00:13:01 +08:00
|
|
|
|
{
|
2019-09-25 09:44:53 +08:00
|
|
|
|
gameObject.transform.localPosition = position;
|
2019-08-16 00:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-09-24 18:47:43 +08:00
|
|
|
|
|
2019-09-25 09:44:53 +08:00
|
|
|
|
public void SetLabelPosition(Vector3 position)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (labelRect) labelRect.localPosition = position;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-11-12 07:38:02 +08:00
|
|
|
|
[Obsolete("Use SerieData.SetIconImage() instead.", true)]
|
|
|
|
|
|
public void SetIconObj(GameObject iconObj) { }
|
|
|
|
|
|
|
|
|
|
|
|
public void SetIconImage(Image image)
|
2019-09-24 18:47:43 +08:00
|
|
|
|
{
|
2019-11-12 07:38:02 +08:00
|
|
|
|
if (iconStyle == null) return;
|
|
|
|
|
|
iconStyle.SetImage(image);
|
2019-09-24 18:47:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateIcon()
|
|
|
|
|
|
{
|
2019-11-12 07:38:02 +08:00
|
|
|
|
if (iconStyle == null) return;
|
|
|
|
|
|
iconStyle.UpdateIcon();
|
2019-09-24 18:47:43 +08:00
|
|
|
|
}
|
2019-11-30 21:24:04 +08:00
|
|
|
|
|
|
|
|
|
|
public bool IsInitLabel()
|
|
|
|
|
|
{
|
|
|
|
|
|
return labelText != null;
|
|
|
|
|
|
}
|
2019-07-28 00:44:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|