2023-11-16 08:40:28 +08:00
using System ;
2019-05-11 04:33:54 +08:00
using System.Collections.Generic ;
using UnityEngine ;
2022-02-19 22:37:57 +08:00
namespace XCharts.Runtime
2019-05-11 04:33:54 +08:00
{
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Legend component.The legend component shows different sets of tags, colors, and names.
/// You can control which series are not displayed by clicking on the legend.
2023-11-11 23:32:24 +08:00
/// ||图例组件。
2019-08-01 23:49:30 +08:00
/// 图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
/// </summary>
2019-05-11 04:33:54 +08:00
[System.Serializable]
2021-11-23 13:20:07 +08:00
[ComponentHandler(typeof(LegendHandler), true)]
2020-03-05 20:25:19 +08:00
public class Legend : MainComponent , IPropertyChanged
2019-05-11 04:33:54 +08:00
{
2021-03-05 08:56:55 +08:00
public enum Type
{
/// <summary>
/// 自动匹配。
/// </summary>
Auto ,
/// <summary>
/// 自定义图标。
/// </summary>
Custom ,
/// <summary>
/// 空心圆。
/// </summary>
EmptyCircle ,
/// <summary>
/// 圆形。
/// </summary>
Circle ,
/// <summary>
/// 正方形。可通过Setting的legendIconCornerRadius参数调整圆角。
/// </summary>
Rect ,
/// <summary>
/// 三角形。
/// </summary>
Triangle ,
/// <summary>
/// 菱形。
/// </summary>
Diamond ,
2022-08-26 23:18:35 +08:00
/// <summary>
/// 烛台( 可用于K线图) 。
/// </summary>
Candlestick ,
2021-03-05 08:56:55 +08:00
}
2019-08-04 15:24:31 +08:00
/// <summary>
2022-03-24 08:37:06 +08:00
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
2023-11-11 23:32:24 +08:00
/// ||图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
2019-08-04 15:24:31 +08:00
/// </summary>
public enum SelectedMode
{
/// <summary>
/// 多选。
/// </summary>
Multiple ,
/// <summary>
/// 单选。
/// </summary>
Single ,
/// <summary>
/// 无法选择。
/// </summary>
None
2022-05-22 22:17:38 +08:00
}
2021-12-31 13:00:17 +08:00
[SerializeField] private bool m_Show = true ;
2021-11-23 13:20:07 +08:00
[SerializeField] private Type m_IconType = Type . Auto ;
[SerializeField] private SelectedMode m_SelectedMode = SelectedMode . Multiple ;
2019-05-11 04:33:54 +08:00
[SerializeField] private Orient m_Orient = Orient . Horizonal ;
2021-11-23 13:20:07 +08:00
[SerializeField] private Location m_Location = new Location ( ) { align = Location . Align . TopCenter , top = 0.125f } ;
2021-03-05 08:56:55 +08:00
[SerializeField] private float m_ItemWidth = 25.0f ;
2020-02-26 22:52:57 +08:00
[SerializeField] private float m_ItemHeight = 12.0f ;
[SerializeField] private float m_ItemGap = 10f ;
[SerializeField] private bool m_ItemAutoColor = true ;
2022-05-22 22:17:38 +08:00
[SerializeField] private float m_ItemOpacity = 1 ;
2025-03-27 22:35:02 +08:00
[SerializeField] [ Since ( "v3.15.0" ) ] private float m_ItemInactiveOpacity = 1 ;
2026-05-17 18:47:47 +08:00
[SerializeField] [ Since ( "v3.16.0" ) ] private float m_Width = 0 ;
[SerializeField] [ Since ( "v3.16.0" ) ] private float m_Height = 0 ;
2019-09-20 12:38:45 +08:00
[SerializeField] private string m_Formatter ;
2022-04-26 08:24:45 +08:00
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle ( ) ;
2023-12-12 10:22:32 +08:00
[SerializeField] [ Since ( "v3.10.0" ) ] private TextLimit m_TextLimit = new TextLimit ( ) ;
2019-05-11 04:33:54 +08:00
[SerializeField] private List < string > m_Data = new List < string > ( ) ;
2020-02-26 22:52:57 +08:00
[SerializeField] private List < Sprite > m_Icons = new List < Sprite > ( ) ;
2022-05-22 22:17:38 +08:00
[SerializeField] private List < Color > m_Colors = new List < Color > ( ) ;
2022-06-25 11:45:22 +08:00
[SerializeField] [ Since ( "v3.1.0" ) ] protected ImageStyle m_Background = new ImageStyle ( ) { show = false } ;
[SerializeField] [ Since ( "v3.1.0" ) ] protected Padding m_Padding = new Padding ( ) ;
2023-03-04 21:09:50 +08:00
[SerializeField] [ Since ( "v3.6.0" ) ] private List < Vector3 > m_Positions = new List < Vector3 > ( ) ;
2019-05-11 04:33:54 +08:00
2021-11-23 13:20:07 +08:00
public LegendContext context = new LegendContext ( ) ;
2019-05-11 04:33:54 +08:00
2019-08-01 23:49:30 +08:00
/// <summary>
2022-03-24 08:37:06 +08:00
/// Whether to show legend component.
2023-11-11 23:32:24 +08:00
/// ||是否显示图例组件。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public bool show
{
get { return m_Show ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_Show , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2022-03-24 08:37:06 +08:00
/// Type of legend.
2023-11-11 23:32:24 +08:00
/// ||图例类型。
2021-03-05 08:56:55 +08:00
/// </summary>
public Type iconType
{
get { return m_IconType ; }
set { if ( PropertyUtil . SetStruct ( ref m_IconType , value ) ) SetAllDirty ( ) ; }
}
/// <summary>
2022-03-24 08:37:06 +08:00
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
2023-11-11 23:32:24 +08:00
/// ||选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
2019-08-04 15:24:31 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public SelectedMode selectedMode
{
get { return m_SelectedMode ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_SelectedMode , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-04 15:24:31 +08:00
/// <summary>
2022-03-24 08:37:06 +08:00
/// Specify whether the layout of legend component is horizontal or vertical.
2023-11-11 23:32:24 +08:00
/// ||布局方式是横还是竖。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public Orient orient
{
get { return m_Orient ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_Orient , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
/// The location of legend.
2023-11-11 23:32:24 +08:00
/// ||图例显示的位置。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public Location location
{
get { return m_Location ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetClass ( ref m_Location , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-02-26 22:52:57 +08:00
/// Image width of legend symbol.
2023-11-11 23:32:24 +08:00
/// ||图例标记的图形宽度。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public float itemWidth
{
get { return m_ItemWidth ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_ItemWidth , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-02-26 22:52:57 +08:00
/// Image height of legend symbol.
2023-11-11 23:32:24 +08:00
/// ||图例标记的图形高度。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public float itemHeight
{
get { return m_ItemHeight ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_ItemHeight , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
/// The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
2023-11-11 23:32:24 +08:00
/// ||图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public float itemGap
{
get { return m_ItemGap ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_ItemGap , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-02-26 22:52:57 +08:00
/// Whether the legend symbol matches the color automatically.
2023-11-11 23:32:24 +08:00
/// ||图例标记的图形是否自动匹配颜色。
2019-08-01 23:49:30 +08:00
/// </summary>
2020-03-05 20:25:19 +08:00
public bool itemAutoColor
{
get { return m_ItemAutoColor ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetStruct ( ref m_ItemAutoColor , value ) ) SetComponentDirty ( ) ; }
2021-08-14 15:05:37 +08:00
}
/// <summary>
2022-05-22 22:17:38 +08:00
/// the opacity of item color.
2023-11-11 23:32:24 +08:00
/// ||图例标记的图形的颜色透明度。
2022-05-22 22:17:38 +08:00
/// </summary>
public float itemOpacity
{
get { return m_ItemOpacity ; }
set { if ( PropertyUtil . SetStruct ( ref m_ItemOpacity , value ) ) SetComponentDirty ( ) ; }
}
/// <summary>
2025-03-27 22:35:02 +08:00
/// the opacity of item color when item is inactive.
/// ||图例标记的图形在非激活状态下的颜色透明度。
/// </summary>
public float itemInactiveOpacity
{
get { return m_ItemInactiveOpacity ; }
set { if ( PropertyUtil . SetStruct ( ref m_ItemInactiveOpacity , value ) ) SetComponentDirty ( ) ; }
}
/// <summary>
2023-11-16 08:40:28 +08:00
/// No longer used, the use of LabelStyle.formatter instead.
/// ||不再使用, 使用LabelStyle.formatter代替。
2019-09-23 19:09:56 +08:00
/// </summary>
2023-12-12 10:22:32 +08:00
[Obsolete("Use LabelStyle.formatter instead.", false)]
2020-03-05 20:25:19 +08:00
public string formatter
{
get { return m_Formatter ; }
2021-01-11 08:54:28 +08:00
set { if ( PropertyUtil . SetClass ( ref m_Formatter , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2019-09-20 12:38:45 +08:00
/// <summary>
2026-05-17 18:47:47 +08:00
/// the width of legend component. Default is 0 for auto adapt. When set a value between 0 and 1, it means the percentage relative to chart width and height.
/// ||图例组件的宽。默认为0自适应。当设置0-1的值时, 表示相对于图表宽高的比例。
/// </summary>
public float width
{
get { return m_Width ; }
set { if ( PropertyUtil . SetStruct ( ref m_Width , value ) ) SetComponentDirty ( ) ; }
}
/// <summary>
/// the height of legend component. Default is 0 for auto adapt. When set a value between 0 and 1, it means the percentage relative to chart width and height.
/// ||图例组件的高。默认为0自适应。当设置0-1的值时, 表示相对于图表宽高的比例。
/// </summary>
/// <value></value>
public float height
{
get { return m_Height ; }
set { if ( PropertyUtil . SetStruct ( ref m_Height , value ) ) SetComponentDirty ( ) ; }
}
/// <summary>
2020-02-26 22:52:57 +08:00
/// the style of text.
2023-11-11 23:32:24 +08:00
/// ||文本样式。
2020-02-26 22:52:57 +08:00
/// </summary>
2022-04-26 08:24:45 +08:00
public LabelStyle labelStyle
2020-03-05 20:25:19 +08:00
{
2022-04-26 08:24:45 +08:00
get { return m_LabelStyle ; }
set { if ( PropertyUtil . SetClass ( ref m_LabelStyle , value ) ) SetComponentDirty ( ) ; }
2020-03-05 20:25:19 +08:00
}
2020-02-26 22:52:57 +08:00
/// <summary>
2023-12-12 10:22:32 +08:00
/// the limit of text.
/// ||文本限制。
/// </summary>
public TextLimit textLimit
{
get { return m_TextLimit ; }
set { if ( value ! = null ) { m_TextLimit = value ; SetComponentDirty ( ) ; } }
}
/// <summary>
2022-06-24 22:15:49 +08:00
/// the sytle of background.
2023-11-11 23:32:24 +08:00
/// ||背景图样式。
2022-06-24 22:15:49 +08:00
/// </summary>
public ImageStyle background
{
get { return m_Background ; }
set { if ( PropertyUtil . SetClass ( ref m_Background , value ) ) SetAllDirty ( ) ; }
}
/// <summary>
/// the paddinng of item and background.
2023-11-11 23:32:24 +08:00
/// ||图例标记和背景的间距。
2022-06-24 22:15:49 +08:00
/// </summary>
public Padding padding
{
get { return m_Padding ; }
set { if ( PropertyUtil . SetClass ( ref m_Padding , value ) ) SetAllDirty ( ) ; }
}
/// <summary>
2019-08-01 23:49:30 +08:00
/// Data array of legend. An array item is usually a name representing string. (If it is a pie chart,
2022-03-24 08:37:06 +08:00
/// it could also be the name of a single data in the pie chart) of a series.
2022-07-04 08:30:43 +08:00
/// If data is not specified, it will be auto collected from series.
2023-11-11 23:32:24 +08:00
/// ||图例的数据数组。数组项通常为一个字符串,每一项代表一个系列的 name( 如果是饼图, 也可以是饼图单个数据的 name) 。
2019-08-01 23:49:30 +08:00
/// 如果 data 没有被指定, 会自动从当前系列中获取。指定data时里面的数据项和serie匹配时才会生效。
/// </summary>
2020-03-05 20:25:19 +08:00
public List < string > data
{
get { return m_Data ; }
set { if ( value ! = null ) { m_Data = value ; SetComponentDirty ( ) ; } }
}
2019-08-04 15:24:31 +08:00
/// <summary>
2020-02-26 22:52:57 +08:00
/// 自定义的图例标记图形。
/// </summary>
2020-03-05 20:25:19 +08:00
public List < Sprite > icons
{
get { return m_Icons ; }
set { if ( value ! = null ) { m_Icons = value ; SetComponentDirty ( ) ; } }
}
2022-06-15 07:36:05 +08:00
/// <summary>
/// the colors of legend item.
2023-11-11 23:32:24 +08:00
/// ||图例标记的颜色列表。
2022-06-15 07:36:05 +08:00
/// </summary>
2022-05-22 22:17:38 +08:00
public List < Color > colors
{
get { return m_Colors ; }
set { if ( value ! = null ) { m_Colors = value ; SetAllDirty ( ) ; } }
}
2020-03-05 20:25:19 +08:00
/// <summary>
2023-03-04 21:09:50 +08:00
/// the custom positions of legend item.
2023-11-11 23:32:24 +08:00
/// ||图例标记的自定义位置列表。
2023-03-04 21:09:50 +08:00
/// </summary>
public List < Vector3 > positions
{
get { return m_Positions ; }
set { if ( value ! = null ) { m_Positions = value ; SetAllDirty ( ) ; } }
}
/// <summary>
2020-03-05 20:25:19 +08:00
/// 图表是否需要刷新(图例组件不需要刷新图表)
/// </summary>
public override bool vertsDirty { get { return false ; } }
/// <summary>
/// 组件是否需要刷新
/// </summary>
public override bool componentDirty
{
2023-12-12 10:22:32 +08:00
get { return m_ComponentDirty | | location . componentDirty | | labelStyle . componentDirty | | textLimit . componentDirty ; }
2020-03-05 20:25:19 +08:00
}
2021-05-16 23:38:06 +08:00
public override void ClearComponentDirty ( )
2020-03-05 20:25:19 +08:00
{
base . ClearComponentDirty ( ) ;
location . ClearComponentDirty ( ) ;
2022-04-26 08:24:45 +08:00
labelStyle . ClearComponentDirty ( ) ;
2023-12-12 10:22:32 +08:00
textLimit . ClearComponentDirty ( ) ;
2020-03-05 20:25:19 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Clear legend data.
2023-11-11 23:32:24 +08:00
/// ||清空。
2019-08-01 23:49:30 +08:00
/// </summary>
2021-11-23 13:20:07 +08:00
public override void ClearData ( )
2019-05-15 09:44:18 +08:00
{
m_Data . Clear ( ) ;
2020-03-05 20:25:19 +08:00
SetComponentDirty ( ) ;
2019-05-15 09:44:18 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Whether include in legend data by the specified name.
2023-11-11 23:32:24 +08:00
/// ||是否包括由指定名字的图例
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
2019-05-15 09:44:18 +08:00
public bool ContainsData ( string name )
{
return m_Data . Contains ( name ) ;
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Removes the legend with the specified name.
2023-11-11 23:32:24 +08:00
/// ||移除指定名字的图例。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="name"></param>
2019-05-15 09:44:18 +08:00
public void RemoveData ( string name )
{
if ( m_Data . Contains ( name ) )
2019-05-11 04:33:54 +08:00
{
2019-05-15 09:44:18 +08:00
m_Data . Remove ( name ) ;
2020-03-05 20:25:19 +08:00
SetComponentDirty ( ) ;
2019-05-11 04:33:54 +08:00
}
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Add legend data.
2023-11-11 23:32:24 +08:00
/// ||添加图例。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="name"></param>
2019-05-15 09:44:18 +08:00
public void AddData ( string name )
2019-05-11 04:33:54 +08:00
{
2019-07-25 09:42:00 +08:00
if ( ! m_Data . Contains ( name ) & & ! string . IsNullOrEmpty ( name ) )
2019-05-15 09:44:18 +08:00
{
m_Data . Add ( name ) ;
2020-03-05 20:25:19 +08:00
SetComponentDirty ( ) ;
2019-05-15 09:44:18 +08:00
}
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Gets the legend for the specified index.
2023-11-11 23:32:24 +08:00
/// ||获得指定索引的图例。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
2019-07-13 16:38:38 +08:00
public string GetData ( int index )
{
if ( index > = 0 & & index < m_Data . Count )
{
return m_Data [ index ] ;
}
return null ;
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Gets the index of the specified legend.
2023-11-11 23:32:24 +08:00
/// ||获得指定图例的索引。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="legendName"></param>
/// <returns></returns>
2019-07-28 00:44:53 +08:00
public int GetIndex ( string legendName )
{
return m_Data . IndexOf ( legendName ) ;
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Remove all legend buttons.
2023-11-11 23:32:24 +08:00
/// ||移除所有图例按钮。
2019-08-01 23:49:30 +08:00
/// </summary>
2019-07-19 21:55:22 +08:00
public void RemoveButton ( )
2019-05-15 09:44:18 +08:00
{
2021-11-23 13:20:07 +08:00
context . buttonList . Clear ( ) ;
2019-05-11 04:33:54 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Bind buttons to legends.
2023-11-11 23:32:24 +08:00
/// ||给图例绑定按钮。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="name"></param>
/// <param name="btn"></param>
/// <param name="total"></param>
2020-02-26 22:52:57 +08:00
public void SetButton ( string name , LegendItem item , int total )
2019-05-11 04:33:54 +08:00
{
2021-11-23 13:20:07 +08:00
context . buttonList [ name ] = item ;
int index = context . buttonList . Values . Count ;
2021-03-05 08:56:55 +08:00
item . SetIconActive ( iconType = = Type . Custom ) ;
2020-02-26 22:52:57 +08:00
item . SetActive ( show ) ;
2019-05-11 04:33:54 +08:00
}
2019-08-01 23:49:30 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Update the legend button color.
2023-11-11 23:32:24 +08:00
/// ||更新图例按钮颜色。
2019-08-01 23:49:30 +08:00
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
2019-07-19 21:55:22 +08:00
public void UpdateButtonColor ( string name , Color color )
2019-05-11 04:33:54 +08:00
{
2021-11-23 13:20:07 +08:00
if ( context . buttonList . ContainsKey ( name ) )
2019-05-11 04:33:54 +08:00
{
2021-11-23 13:20:07 +08:00
context . buttonList [ name ] . SetIconColor ( color ) ;
2019-05-11 04:33:54 +08:00
}
}
2020-07-10 09:13:26 +08:00
/// <summary>
/// Update the text color of legend.
2023-11-11 23:32:24 +08:00
/// ||更新图例文字颜色。
2020-07-10 09:13:26 +08:00
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
2020-02-26 22:52:57 +08:00
public void UpdateContentColor ( string name , Color color )
2019-05-11 04:33:54 +08:00
{
2021-11-23 13:20:07 +08:00
if ( context . buttonList . ContainsKey ( name ) )
2020-02-26 22:52:57 +08:00
{
2021-11-23 13:20:07 +08:00
context . buttonList [ name ] . SetContentColor ( color ) ;
2020-02-26 22:52:57 +08:00
}
2019-05-11 04:33:54 +08:00
}
2020-07-10 09:13:26 +08:00
/// <summary>
/// Gets the legend button for the specified index.
2023-11-11 23:32:24 +08:00
/// ||获得指定索引的图例按钮。
2020-07-10 09:13:26 +08:00
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
2020-02-26 22:52:57 +08:00
public Sprite GetIcon ( int index )
2019-05-11 04:33:54 +08:00
{
2020-02-26 22:52:57 +08:00
if ( index > = 0 & & index < m_Icons . Count )
2019-05-11 04:33:54 +08:00
{
2020-02-26 22:52:57 +08:00
return m_Icons [ index ] ;
}
else
{
return null ;
2019-05-11 04:33:54 +08:00
}
}
2022-05-22 22:17:38 +08:00
public Color GetColor ( int index )
{
if ( index > = 0 & & index < m_Colors . Count )
return m_Colors [ index ] ;
else
return Color . white ;
}
2023-03-04 21:09:50 +08:00
public Vector3 GetPosition ( int index , Vector3 defaultPos )
{
if ( index > = 0 & & index < m_Positions . Count )
return m_Positions [ index ] ;
else
return defaultPos ;
}
2020-02-26 22:52:57 +08:00
/// <summary>
2020-07-10 09:13:26 +08:00
/// Callback handling when parameters change.
2023-11-11 23:32:24 +08:00
/// ||参数变更时的回调处理。
2020-02-26 22:52:57 +08:00
/// </summary>
public void OnChanged ( )
{
m_Location . OnChanged ( ) ;
}
2019-05-11 04:33:54 +08:00
}
2022-05-22 22:17:38 +08:00
}