3.0 commit

This commit is contained in:
monitor1394
2021-11-23 13:20:07 +08:00
parent d87e0f8267
commit 1b3fa7fb43
796 changed files with 410878 additions and 1656601 deletions

View File

@@ -8,6 +8,7 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts;
namespace XChartsDemo
{
@@ -35,6 +36,7 @@ namespace XChartsDemo
SerializedProperty m_Title = prop.FindPropertyRelative("m_Title");
SerializedProperty m_Selected = prop.FindPropertyRelative("m_Selected");
SerializedProperty m_Panel = prop.FindPropertyRelative("m_Panel");
prop.isExpanded = EditorGUI.Toggle(new Rect(pos.x - 10, pos.y, 10, 10), prop.isExpanded, EditorStyles.foldout);
var fieldWid = EditorGUIUtility.currentViewWidth - 30 - 5 - 40 - 80 - 50 - 100 - 6 * 2 - 70;
drawRect.width = 15;
EditorGUI.BeginChangeCheck();
@@ -120,11 +122,94 @@ namespace XChartsDemo
demo.InitModuleButton();
}
}
if (prop.isExpanded)
{
drawRect = pos;
EditorGUI.indentLevel++;
var m_ChartPrefabs = prop.FindPropertyRelative("m_ChartPrefabs");
drawRect.x = pos.x;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.height = EditorGUIUtility.singleLineHeight;
var chartSize = EditorGUI.IntField(drawRect, "Chart Size", m_ChartPrefabs.arraySize);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (chartSize != m_ChartPrefabs.arraySize)
{
while (chartSize > m_ChartPrefabs.arraySize) m_ChartPrefabs.arraySize++;
while (chartSize < m_ChartPrefabs.arraySize) m_ChartPrefabs.arraySize--;
}
for (int i = 0; i < chartSize; i++)
{
var element = m_ChartPrefabs.GetArrayElementAtIndex(i);
drawRect.width -= btnWidth * 5;
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
drawRect.x += drawRect.width;
drawRect.width = btnWidth;
if (GUI.Button(drawRect, Styles.iconUp, Styles.invisibleButton))
{
var demo = prop.serializedObject.targetObject as Demo;
var index = GetIndex(prop);
if (index >= 0)
{
var chartIndex = GetIndex(element);
Swap(demo.chartModules[index].chartPrefabs, chartIndex, chartIndex - 1);
demo.InitChartList(demo.chartModules[index]);
}
}
drawRect.x += btnWidth + 1;
if (GUI.Button(drawRect, Styles.iconDown, Styles.invisibleButton))
{
var demo = prop.serializedObject.targetObject as Demo;
var index = GetIndex(prop);
if (index >= 0)
{
var chartIndex = GetIndex(element);
Swap(demo.chartModules[index].chartPrefabs, chartIndex, chartIndex + 1);
demo.InitChartList(demo.chartModules[index]);
}
}
drawRect.x += btnWidth + 1;
if (GUI.Button(drawRect, Styles.iconAdd, Styles.invisibleButton))
{
var demo = prop.serializedObject.targetObject as Demo;
var index = GetIndex(prop);
if (index >= 0)
{
var chartIndex = GetIndex(element);
demo.chartModules[index].chartPrefabs.Insert(chartIndex + 1, null);
demo.InitChartList(demo.chartModules[index]);
}
}
drawRect.x += 16;
if (GUI.Button(drawRect, Styles.iconRemove, Styles.invisibleButton))
{
var demo = prop.serializedObject.targetObject as Demo;
var index = GetIndex(prop);
if (index >= 0)
{
var chartIndex = GetIndex(element);
demo.chartModules[index].chartPrefabs.RemoveAt(chartIndex);
demo.InitChartList(demo.chartModules[index]);
}
}
drawRect.x = pos.x;
drawRect.width = pos.width;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
EditorGUI.indentLevel--;
}
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
var height = 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
if (prop.isExpanded)
{
height += (prop.FindPropertyRelative("m_ChartPrefabs").arraySize + 1)
* (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
}
return height;
}
private int GetIndex(SerializedProperty prop)

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6ef196d200c01426e94b8d7976ca90f5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ecb59424fa99f494193ac717bbd85eaf
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4d3c24827bcd046c1849eb987628e0ce
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca14acb0a2be346c7bc142e8a8c8abbe
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d8efd2749bb8144ecbec478eb767c2c1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5ce429161e3844dd6b1d13f762e1b75a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b09f646eee7a46a0baf95702ab1dd94
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ded8677cb2dd245d692edb28b31a9c3d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e852d17191a2a48c9a20337aefdcc91f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4c459acff730e4f158802d2e7fe9a073
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd78b68519967493a8377d290aee8a0a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d7e7b1e6bfec64a04b67099998e63380
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a81b0a69d1b5848ec89917294a54f49c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 52b67cd734f9f47409ae55929c7a3ac2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9f1b7e6ea1bf4311a282f3781fbb29d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 666e7b5282740407d956c58ca1ddcfdb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,430 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1067674712461128}
m_IsPrefabParent: 1
--- !u!1 &1067674712461128
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224147804559871088}
- component: {fileID: 222072236248669632}
- component: {fileID: 114021868465902394}
m_Layer: 5
m_Name: "Line9_Data Transform Filter_\u6570\u636E\u8FC7\u6EE4"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114021868465902394
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1067674712461128}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b4f38bd00b4648c448cabfc167538f7c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_DebugMode: 0
m_EnableTextMeshPro: 0
m_ChartName:
m_Theme:
m_Theme: 0
m_ThemeName: Default
m_FontName: Arial
m_TMPFontName: LiberationSans SDF
m_FontInstacneId: 640
m_TMPFontInstanceId: 0
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_ContrastColor:
serializedVersion: 2
rgba: 4283256145
m_BackgroundColor:
serializedVersion: 2
rgba: 4294967295
m_ColorPalette:
- serializedVersion: 2
rgba: 4281415106
- serializedVersion: 2
rgba: 4283712815
- serializedVersion: 2
rgba: 4289241185
- serializedVersion: 2
rgba: 4284842708
- serializedVersion: 2
rgba: 4289644433
- serializedVersion: 2
rgba: 4286816116
- serializedVersion: 2
rgba: 4280452810
- serializedVersion: 2
rgba: 4288324285
- serializedVersion: 2
rgba: 4285821038
- serializedVersion: 2
rgba: 4285556052
- serializedVersion: 2
rgba: 4292070596
m_Common:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_Title:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 24
m_SubTitle:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.5882353, g: 0.5882353, b: 0.5882353, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 22
m_Legend:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_UnableColor: {r: 0.8, g: 0.8, b: 0.8, a: 1}
m_Axis:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 0.8
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 0
m_SplitLineColor:
serializedVersion: 2
rgba: 542200145
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4283256145
m_SplitAreaColors:
- serializedVersion: 2
rgba: 1308293882
- serializedVersion: 2
rgba: 1305004232
m_RadiusAxis:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 0.8
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 0
m_SplitLineColor:
serializedVersion: 2
rgba: 542200145
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4283256145
m_SplitAreaColors:
- serializedVersion: 2
rgba: 1308293882
- serializedVersion: 2
rgba: 1305004232
m_AngleAxis:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 0.8
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 0
m_SplitLineColor:
serializedVersion: 2
rgba: 542200145
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4283256145
m_SplitAreaColors:
- serializedVersion: 2
rgba: 1308293882
- serializedVersion: 2
rgba: 1305004232
m_Polar:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 0.8
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 0
m_SplitLineColor:
serializedVersion: 2
rgba: 542200145
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4283256145
m_SplitAreaColors:
- serializedVersion: 2
rgba: 1308293882
- serializedVersion: 2
rgba: 1305004232
m_Gauge:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 15
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 15
m_SplitLineColor:
serializedVersion: 2
rgba: 4294967295
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4294967295
m_SplitAreaColors:
- serializedVersion: 2
rgba: 1308293882
- serializedVersion: 2
rgba: 1305004232
m_BarBackgroundColor:
serializedVersion: 2
rgba: 4291348680
m_StageColor:
- m_Percent: 0.2
m_Color:
serializedVersion: 2
rgba: 4289644433
- m_Percent: 0.8
m_Color:
serializedVersion: 2
rgba: 4288579171
- m_Percent: 1
m_Color:
serializedVersion: 2
rgba: 4281415106
m_Radar:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_LineType: 0
m_LineWidth: 0.8
m_LineLength: 0
m_LineColor:
serializedVersion: 2
rgba: 4283256145
m_SplitLineType: 0
m_SplitLineWidth: 0.8
m_SplitLineLength: 0
m_SplitLineColor:
serializedVersion: 2
rgba: 542200145
m_TickWidth: 0.8
m_TickLength: 5
m_TickColor:
serializedVersion: 2
rgba: 4283256145
m_SplitAreaColors:
- serializedVersion: 2
rgba: 4294375158
- serializedVersion: 2
rgba: 4293388263
m_Tooltip:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0.31764707, g: 0.31764707, b: 0.31764707, a: 0.78431374}
m_FontSize: 20
m_LineType: 0
m_LineWidth: 0.8
m_LineColor:
serializedVersion: 2
rgba: 1680419113
m_AreaColor:
serializedVersion: 2
rgba: 542200145
m_LabelTextColor:
serializedVersion: 2
rgba: 4294967295
m_LabelBackgroundColor:
serializedVersion: 2
rgba: 4280887593
m_DataZoom:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_BorderWidth: 0.5
m_DataLineWidth: 0.5
m_FillerColor:
serializedVersion: 2
rgba: 1858910119
m_BorderColor:
serializedVersion: 2
rgba: 4292730333
m_DataLineColor:
serializedVersion: 2
rgba: 4283712815
m_DataAreaColor:
serializedVersion: 2
rgba: 1431586095
m_BackgroundColor:
serializedVersion: 2
rgba: 0
m_VisualMap:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
m_BorderWidth: 0
m_BorderColor:
serializedVersion: 2
rgba: 4291611852
m_BackgroundColor:
serializedVersion: 2
rgba: 0
m_TriangeLen: 20
m_Serie:
m_LineWidth: 1.8
m_LineSymbolSize: 4
m_LineSymbolSelectedSize: 8
m_ScatterSymbolSize: 20
m_ScatterSymbolSelectedSize: 30
m_PieTooltipExtraRadius: 8
m_PieSelectedOffset: 8
m_CandlestickColor:
serializedVersion: 2
rgba: 4281415106
m_CandlestickColor0:
serializedVersion: 2
rgba: 4283844145
m_CandlestickBorderWidth: 1
m_CandlestickBorderColor:
serializedVersion: 2
rgba: 4281415106
m_CandlestickBorderColor0:
serializedVersion: 2
rgba: 4283844145
m_Settings:
m_MaxPainter: 10
m_ReversePainter: 0
m_BasePainterMaterial: {fileID: 0}
m_SeriePainterMaterial: {fileID: 0}
m_TopPainterMaterial: {fileID: 0}
m_LineSmoothStyle: 3
m_LineSmoothness: 2
m_LineSegmentDistance: 3
m_CicleSmoothness: 2
m_LegendIconLineWidth: 2
m_LegendIconCornerRadius:
- 0.25
- 0.25
- 0.25
- 0.25
m_AngleAxes: []
m_Backgrounds: []
m_DataZooms: []
m_Grids: []
m_Legends: []
m_MarkLines: []
m_MarkAreas: []
m_Polars: []
m_Radars: []
m_RadiusAxes: []
m_Titles: []
m_Tooltips: []
m_Vessels: []
m_VisualMaps: []
m_XAxes: []
m_YAxes: []
m_SerieBars: []
m_SerieCandlesticks: []
m_SerieEffectScatters: []
m_SerieGauges: []
m_SerieHeatmaps: []
m_SerieLines: []
m_SerieLiquids: []
m_SeriePies: []
m_SerieRadars: []
m_SerieRings: []
m_SerieScatters: []
--- !u!222 &222072236248669632
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1067674712461128}
--- !u!224 &224147804559871088
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1067674712461128}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -974.7652}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -10.830725}
m_SizeDelta: {x: 1200, y: 800}
m_Pivot: {x: 0.5, y: 0.5}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e381dd638b7e64867876847ee25f4603
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4ab3460720d0f47f4ab339cf8cba5a25
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,445 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1193884583766258}
m_IsPrefabParent: 1
--- !u!1 &1023889020065772
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224498995510391718}
m_Layer: 5
m_Name: desc
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1193884583766258
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224457778121662608}
- component: {fileID: 222539473495237668}
- component: {fileID: 114656818258355322}
m_Layer: 5
m_Name: Thumb
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &1399349534157804
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224195826273946622}
- component: {fileID: 222447077409147954}
- component: {fileID: 114038891576819350}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1469835152884344
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224459326322377154}
- component: {fileID: 222315113265366012}
- component: {fileID: 114919977981523934}
m_Layer: 5
m_Name: chart
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1876512226706300
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224825352985075562}
- component: {fileID: 222838392271989024}
- component: {fileID: 114936933209995772}
- component: {fileID: 114501721475720118}
m_Layer: 5
m_Name: btn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1956389367569800
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224960384289850946}
- component: {fileID: 222693556488268584}
- component: {fileID: 114577082724077218}
m_Layer: 5
m_Name: Text2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114038891576819350
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1399349534157804}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.13333334, g: 0.13333334, b: 0.13333334, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
--- !u!114 &114501721475720118
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1876512226706300}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 0}
m_HighlightedColor: {r: 0.16078432, g: 0.5137255, b: 1, a: 0.32941177}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114936933209995772}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &114577082724077218
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1956389367569800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.3602941, g: 0.3602941, b: 0.3602941, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 20
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
--- !u!114 &114656818258355322
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1193884583766258}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114919977981523934
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1469835152884344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114936933209995772
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1876512226706300}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &222315113265366012
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1469835152884344}
--- !u!222 &222447077409147954
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1399349534157804}
--- !u!222 &222539473495237668
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1193884583766258}
--- !u!222 &222693556488268584
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1956389367569800}
--- !u!222 &222838392271989024
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1876512226706300}
--- !u!224 &224195826273946622
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1399349534157804}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224498995510391718}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 6.4799995}
m_SizeDelta: {x: 0, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224457778121662608
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1193884583766258}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224459326322377154}
- {fileID: 224498995510391718}
- {fileID: 224825352985075562}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 283.5, y: 242.54}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224459326322377154
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1469835152884344}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.23, y: 0.23, z: 1}
m_Children: []
m_Father: {fileID: 224457778121662608}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -95.37}
m_SizeDelta: {x: 0, y: 197.4}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &224498995510391718
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1023889020065772}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224195826273946622}
- {fileID: 224960384289850946}
m_Father: {fileID: 224457778121662608}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 7.760002}
m_SizeDelta: {x: 0, y: 66.4}
m_Pivot: {x: 0.5, y: 0}
--- !u!224 &224825352985075562
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1876512226706300}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224457778121662608}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224960384289850946
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1956389367569800}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224498995510391718}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: -21.79}
m_SizeDelta: {x: 0, y: 30}
m_Pivot: {x: 0.5, y: 0.5}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63a05c4a877ba4d129b65ab08d796190
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -23,6 +23,7 @@ namespace XChartsDemo
[SerializeField] private string m_Title = "Title";
[SerializeField] private bool m_Selected;
[SerializeField] private GameObject m_Panel;
[SerializeField] private List<GameObject> m_ChartPrefabs;
public int column { get { return m_Column; } set { m_Column = value; } }
public string name { get { return m_Name; } set { m_Name = value; } }
@@ -31,6 +32,7 @@ namespace XChartsDemo
public bool select { get { return m_Selected; } set { m_Selected = value; } }
public GameObject panel { get { return m_Panel; } set { m_Panel = value; } }
public Button button { get; set; }
public List<GameObject> chartPrefabs { get { return m_ChartPrefabs; } }
public int index { get; internal set; }
}
@@ -40,8 +42,8 @@ namespace XChartsDemo
{
[SerializeField] private float m_LeftWidth = 150;
[SerializeField] private float m_LeftButtonHeight = 60;
[SerializeField] private Vector2 m_ChartSpacing = new Vector2(5, 5);
[SerializeField] private Vector2 m_ChartSizeRatio = new Vector2(5, 3);
//[SerializeField] private Vector2 m_ChartSpacing = new Vector2(5, 5);
//[SerializeField] private Vector2 m_ChartSizeRatio = new Vector2(5, 3);
[SerializeField] private Color m_ButtonNormalColor;
[SerializeField] private Color m_ButtonSelectedColor;
[SerializeField] private Color m_ButtonHighlightColor;
@@ -49,24 +51,26 @@ namespace XChartsDemo
[SerializeField] private List<ChartModule> m_ChartModule = new List<ChartModule>();
private GameObject m_BtnClone;
private Theme m_SelectedTheme;
private GameObject m_ThumbClone;
private ThemeType m_SelectedTheme;
private GameObject m_SelectedPanel;
private int m_LastSelectedModuleIndex;
private float m_LastCheckLeftWidth;
private Button m_DefaultThemeButton;
private Button m_LightThemeButton;
private Button m_DarkThemeButton;
private Toggle m_DarkThemeToggle;
private Text m_Title;
private ScrollRect m_ScrollRect;
private Mask m_Mark;
private GameObject m_DetailRoot;
private GameObject m_DetailChartRoot;
public List<ChartModule> chartModules { get { return m_ChartModule; } }
void Awake()
{
m_SelectedTheme = Theme.Default;
m_SelectedTheme = ThemeType.Default;
m_ButtonNormalColor = ChartHelper.GetColor("#293C55FF");
m_ButtonSelectedColor = ChartHelper.GetColor("#e43c59ff");
@@ -77,22 +81,27 @@ namespace XChartsDemo
void Init()
{
m_ScrollRect = transform.Find("chart_detail").GetComponent<ScrollRect>();
m_Mark = transform.Find("chart_detail/Viewport").GetComponent<Mask>();
m_ScrollRect = transform.Find("chart_list").GetComponent<ScrollRect>();
m_Mark = transform.Find("chart_list/Viewport").GetComponent<Mask>();
m_Mark.enabled = true;
m_Title = transform.Find("chart_title/Text").GetComponent<Text>();
m_ThumbClone = transform.Find("clone_thumb").gameObject;
m_ThumbClone.SetActive(false);
m_DetailRoot = transform.Find("chart_detail").gameObject;
m_DetailChartRoot = transform.Find("chart_detail/chart").gameObject;
m_DetailRoot.SetActive(false);
InitThemeButton();
InitModuleButton();
InitChartList();
InitSize();
}
void InitSize()
{
UIUtil.SetRectTransformWidth(transform, m_LeftWidth, "chart_list");
UIUtil.SetRectTransformLeft(transform, m_LeftWidth, "chart_detail");
UIUtil.SetRectTransformWidth(transform, m_LeftWidth, "chart_btn");
UIUtil.SetRectTransformLeft(transform, m_LeftWidth, "chart_list");
UIUtil.SetRectTransformLeft(transform, m_LeftWidth, "chart_title");
UIUtil.SetGridLayoutGroup(transform, new Vector2(m_LeftWidth, m_LeftButtonHeight), new Vector2(0, 2), "chart_list");
UIUtil.SetGridLayoutGroup(transform, new Vector2(m_LeftWidth, m_LeftButtonHeight), new Vector2(0, 2), "chart_btn");
foreach (var module in m_ChartModule)
{
SetChartRootInfo(module);
@@ -101,32 +110,32 @@ namespace XChartsDemo
private void SetChartGridLayoutGroup(GridLayoutGroup grid, int column)
{
if (grid == null) return;
var screenWidth = Screen.width;
var screenHeight = Screen.height;
#if UNITY_EDITOR
screenWidth = Camera.main.pixelWidth;
#endif
var chartWidth = (screenWidth - m_LeftWidth - m_ChartSpacing.x * (column + 1)) / column;
// if (grid == null) return;
// var screenWidth = Screen.width;
// var screenHeight = Screen.height;
// #if UNITY_EDITOR
// screenWidth = Camera.main.pixelWidth;
// #endif
// var chartWidth = (screenWidth - m_LeftWidth - m_ChartSpacing.x * (column + 1)) / column;
var rect = grid.gameObject.GetComponent<RectTransform>();
rect.anchorMin = new Vector2(0, 1);
rect.anchorMax = new Vector2(1, 1);
rect.pivot = new Vector2(0, 1);
rect.anchoredPosition = Vector2.zero;
rect.sizeDelta = new Vector2(0, rect.sizeDelta.y);
grid.spacing = m_ChartSpacing;
grid.cellSize = new Vector2(chartWidth, chartWidth * m_ChartSizeRatio.y / m_ChartSizeRatio.x);
// var rect = grid.gameObject.GetComponent<RectTransform>();
// rect.anchorMin = new Vector2(0, 1);
// rect.anchorMax = new Vector2(1, 1);
// rect.pivot = new Vector2(0, 1);
// rect.anchoredPosition = Vector2.zero;
// rect.sizeDelta = new Vector2(0, rect.sizeDelta.y);
// grid.spacing = m_ChartSpacing;
// grid.cellSize = new Vector2(chartWidth, chartWidth * m_ChartSizeRatio.y / m_ChartSizeRatio.x);
}
private void SetChartRootInfo(ChartModule module)
{
var chartRoot = module.panel;
if (chartRoot == null) return;
var grid = chartRoot.GetComponent<GridLayoutGroup>();
var hig = Mathf.CeilToInt(chartRoot.transform.childCount * 1f / module.column) * (grid.cellSize.y + grid.spacing.y);
m_SelectedPanel = module.panel;
if (m_SelectedPanel == null) return;
var grid = m_SelectedPanel.GetComponent<GridLayoutGroup>();
var hig = Mathf.CeilToInt(m_SelectedPanel.transform.childCount * 1f / module.column) * (grid.cellSize.y + grid.spacing.y);
SetChartGridLayoutGroup(grid, module.column);
UIUtil.SetRectTransformHeight(chartRoot.transform, hig);
UIUtil.SetRectTransformHeight(m_SelectedPanel.transform, hig);
}
void ResetParam()
@@ -163,8 +172,8 @@ namespace XChartsDemo
public void InitModuleButton()
{
var btnPanel = transform.Find("chart_list");
m_BtnClone = transform.Find("btn_clone").gameObject;
var btnPanel = transform.Find("chart_btn");
m_BtnClone = transform.Find("clone_btn").gameObject;
m_BtnClone.SetActive(false);
ChartHelper.DestroyAllChildren(btnPanel.transform);
for (int i = 0; i < m_ChartModule.Count; i++)
@@ -210,6 +219,44 @@ namespace XChartsDemo
}
}
public void InitChartList()
{
foreach (var module in m_ChartModule)
InitChartList(module);
}
public void InitChartList(ChartModule module)
{
ChartHelper.DestroyAllChildren(module.panel.transform);
for (int i = 0; i < module.chartPrefabs.Count; i++)
{
var obj = UIUtil.Instantiate(m_ThumbClone, module.panel.transform);
var chartParent = obj.transform.Find("chart");
var prefab = module.chartPrefabs[i];
if (prefab != null)
{
var names = prefab.name.Split('_');
var chart = UIUtil.Instantiate(prefab, chartParent.transform);
obj.name = prefab.name;
chart.name = prefab.name;
if (names.Length == 3)
{
UIUtil.SetText(obj, names[1], "desc/Text");
UIUtil.SetText(obj, names[2], "desc/Text2");
}
obj.transform.Find("btn").GetComponent<Button>().onClick.AddListener(delegate ()
{
m_SelectedPanel = m_DetailChartRoot;
ChartHelper.DestroyAllChildren(m_DetailChartRoot.transform);
UIUtil.Instantiate(prefab, m_DetailChartRoot.transform);
m_DetailRoot.SetActive(true);
module.panel.SetActive(false);
SelecteTheme(m_SelectedTheme);
});
}
}
}
void ClickModule(ChartModule selectedModule)
{
if (lastSelectedModuleIndex >= 0)
@@ -217,6 +264,7 @@ namespace XChartsDemo
m_ChartModule[lastSelectedModuleIndex].select = false;
}
lastSelectedModuleIndex = selectedModule.index;
m_DetailRoot.SetActive(false);
foreach (var module in m_ChartModule)
{
if (module.index != lastSelectedModuleIndex)
@@ -251,32 +299,25 @@ namespace XChartsDemo
SetChartRootInfo(selectedModule);
m_Title.text = string.IsNullOrEmpty(selectedModule.title) ?
selectedModule.name : selectedModule.title;
SelecteTheme(m_SelectedTheme);
}
void InitThemeButton()
{
m_DefaultThemeButton = transform.Find("chart_theme/btn_default").GetComponent<Button>();
m_LightThemeButton = transform.Find("chart_theme/btn_light").GetComponent<Button>();
m_DarkThemeButton = transform.Find("chart_theme/btn_dark").GetComponent<Button>();
m_DarkThemeToggle = transform.Find("chart_theme/dark").GetComponent<Toggle>();
m_DarkThemeToggle.isOn = m_SelectedTheme == ThemeType.Dark;
m_DefaultThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Default);
m_LightThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Light);
m_DarkThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Dark);
m_DefaultThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Default); });
m_LightThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Light); });
m_DarkThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Dark); });
//SelecteTheme(Theme.Default);
m_DarkThemeToggle.onValueChanged.AddListener(delegate (bool flag)
{
m_SelectedTheme = flag ? ThemeType.Dark : ThemeType.Default;
SelecteTheme(m_SelectedTheme);
});
}
void SelecteTheme(Theme theme)
void SelecteTheme(ThemeType theme)
{
m_SelectedTheme = theme;
m_DefaultThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Default);
m_LightThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Light);
m_DarkThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Dark);
var charts = transform.GetComponentsInChildren<BaseChart>();
var charts = (m_SelectedPanel == null ? transform : m_SelectedPanel.transform).GetComponentsInChildren<BaseChart>();
foreach (var chart in charts)
{
chart.UpdateTheme(theme);

View File

@@ -36,7 +36,7 @@ namespace XChartsDemo
var charts = transform.GetComponentsInChildren<BaseChart>();
foreach (var chart in charts)
{
foreach (var serie in chart.series.list)
foreach (var serie in chart.series)
{
serie.animation.fadeInDuration = m_FadeInDuration;
serie.animation.fadeOutDuration = m_FadeOutDuration;
@@ -104,12 +104,12 @@ namespace XChartsDemo
{
if (chart is RingChart)
{
var serieData = chart.series.GetSerie(0).GetSerieData(0);
var serieData = chart.GetSerie(0).GetSerieData(0);
chart.UpdateData(0, 0, 0, Random.Range(0, (float)serieData.GetData(1)));
}
else
{
var dataCount = chart.series.list[0].dataCount;
var dataCount = chart.series[0].dataCount;
var index = UnityEngine.Random.Range(0, dataCount);
chart.UpdateData(0, index, UnityEngine.Random.Range(1, 100));
}
@@ -149,7 +149,7 @@ namespace XChartsDemo
m_FadeInDuration = int.Parse(content);
foreach (var chart in charts)
{
foreach (var serie in chart.series.list)
foreach (var serie in chart.series)
{
serie.animation.fadeInDuration = m_FadeInDuration;
}
@@ -162,7 +162,7 @@ namespace XChartsDemo
m_FadeOutDuration = int.Parse(content);
foreach (var chart in charts)
{
foreach (var serie in chart.series.list)
foreach (var serie in chart.series)
{
serie.animation.fadeOutDuration = m_FadeOutDuration;
}
@@ -175,7 +175,7 @@ namespace XChartsDemo
m_DataChangeDuration = int.Parse(content);
foreach (var chart in charts)
{
foreach (var serie in chart.series.list)
foreach (var serie in chart.series)
{
serie.animation.dataChangeDuration = m_DataChangeDuration;
}

View File

@@ -0,0 +1,56 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using XCharts;
using System;
using System.Collections.Generic;
namespace XChartsDemo
{
[DisallowMultipleComponent]
//[ExecuteInEditMode]
public class Demo_Line12 : MonoBehaviour
{
public int dataCount = 20000;
void Awake()
{
// var chart = GetComponent<BaseChart>();
// if (chart == null) return;
// chart.RemoveData();
// var serie = chart.AddSerie<Line>("Fake Data");
// serie.sampleDist = 2f;
// serie.symbol.show = false;
// serie.itemStyle.color = new Color32(255, 70, 131, 255);
// serie.areaStyle.show = true;
// serie.areaStyle.color = new Color32(255, 158, 68, 255);
// serie.areaStyle.toColor = new Color32(255, 70, 131, 255);
// var baseDate = new DateTime(1968, 9, 3);
// var data = new List<double>();
// data.Add(UnityEngine.Random.Range(0f, 1f) * 300);
// for (int i = 1; i < dataCount; i++)
// {
// baseDate = baseDate.AddHours(24);
// chart.AddXAxisData(baseDate.ToString("yyyy/MM/dd"));
// double value = (int)((UnityEngine.Random.Range(0f, 1f) - 0.5f) * 20 + data[i - 1]);
// data.Add(value);
// chart.AddData(0, value);
// }
// chart.RefreshChart();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddee4a93f14444d39bd02d3809194de6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -77,8 +77,8 @@ namespace XChartsDemo
void AddOneData()
{
lineChart.title.text = initCount + "数据";
barChart.title.text = initCount + "数据";
lineChart.GetChartComponent<Title>().text = initCount + "数据";
barChart.GetChartComponent<Title>().text = initCount + "数据";
timeNow = timeNow.AddSeconds(1);
string category = timeNow.ToString("hh:mm:ss");
float xvalue = Mathf.PI / 180 * initCount;

View File

@@ -13,6 +13,17 @@ namespace XChartsDemo
internal static class UIUtil
{
public static GameObject Instantiate(GameObject clone, Transform parent)
{
var obj = GameObject.Instantiate(clone);
obj.layer = LayerMask.NameToLayer("UI");
obj.transform.SetParent(parent, true);
obj.transform.localScale = Vector3.one;
obj.transform.localPosition = Vector3.zero;
obj.SetActive(true);
return obj;
}
public static RectTransform GetRectTransform(Transform transform, string path)
{
if (!string.IsNullOrEmpty(path))
@@ -70,5 +81,17 @@ namespace XChartsDemo
}
}
}
public static void SetText(GameObject parent, string text, string subPath = null)
{
if (!string.IsNullOrEmpty(subPath))
{
parent.transform.Find(subPath).GetComponent<Text>().text = text;
}
else
{
parent.GetComponent<Text>().text = text;
}
}
}
}

File diff suppressed because it is too large Load Diff