mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 13:30:10 +00:00
优化性能,降低GC
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
@@ -62,6 +63,22 @@ namespace XCharts
|
||||
return m_ColorPalette[index];
|
||||
}
|
||||
|
||||
Dictionary<int, string> _colorDic = new Dictionary<int, string>();
|
||||
public string GetColorStr(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
index = index % m_ColorPalette.Length;
|
||||
if (_colorDic.ContainsKey(index)) return _colorDic[index];
|
||||
else
|
||||
{
|
||||
_colorDic[index] = ColorUtility.ToHtmlStringRGBA(GetColor(index));
|
||||
return _colorDic[index];
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(ThemeInfo theme)
|
||||
{
|
||||
m_Font = theme.m_Font;
|
||||
|
||||
Reference in New Issue
Block a user