Skip to content

Commit e20d71d

Browse files
committed
feat: Remove support for Unity 2019/2020
1 parent 8b30293 commit e20d71d

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed

Editor/LineChart2D/DataList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Vector2 this[int index]
2121
set => _dataList[index] = value;
2222
}
2323

24-
private readonly List<Vector2> _dataList = new List<Vector2>();
24+
private readonly List<Vector2> _dataList = new();
2525

2626

2727
public DataList(string category, Color? color = null)

Editor/LineChart2D/LineChart2DWindow.cs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static LineChart2DWindow Open(string title)
2525
}
2626

2727

28-
private readonly List<DataList> _dataTable = new List<DataList>();
28+
private readonly List<DataList> _dataTable = new();
2929

3030
private ToolbarToggle _lockScaleToggle;
3131

@@ -48,9 +48,7 @@ public void SetColor(string category, Color color)
4848
if (dataListIndex < 0)
4949
{
5050
newDataList = true;
51-
#if UNITY_2021_1_OR_NEWER
5251
dataListIndex = _dataTable.Count;
53-
#endif
5452
dataList = new DataList(category);
5553
_dataTable.Add(dataList);
5654
}
@@ -63,27 +61,19 @@ public void SetColor(string category, Color color)
6361

6462
if (!newDataList)
6563
{
66-
#if UNITY_2021_1_OR_NEWER
6764
_categoryListView.RefreshItem(dataListIndex);
68-
#else
69-
_categoryListView.Refresh();
70-
#endif
7165
}
7266
}
7367

7468
public void AddData(string category, Vector2 data)
7569
{
7670
DataList dataList;
77-
#if UNITY_2021_1_OR_NEWER
7871
var newDataList = false;
79-
#endif
8072
var dataListIndex = _dataTable.FindIndex(list => list.Category == category);
8173
if (dataListIndex < 0)
8274
{
83-
#if UNITY_2021_1_OR_NEWER
8475
newDataList = true;
8576
dataListIndex = _dataTable.Count;
86-
#endif
8777
dataList = new DataList(category);
8878
_dataTable.Add(dataList);
8979
}
@@ -99,7 +89,6 @@ public void AddData(string category, Vector2 data)
9989
$"index={dataList.Count - 1}, value=({data.x:F5}, {data.y:F5}).");
10090
}
10191

102-
#if UNITY_2021_1_OR_NEWER
10392
if (newDataList)
10493
{
10594
_categoryListView.RefreshItems();
@@ -108,9 +97,6 @@ public void AddData(string category, Vector2 data)
10897
{
10998
_categoryListView.RefreshItem(dataListIndex);
11099
}
111-
#else
112-
_categoryListView.Refresh();
113-
#endif
114100

115101
OnDataListChanged(dataList.Count, false);
116102
}
@@ -133,19 +119,11 @@ public bool RemoveData(string category, int index)
133119
if (_dataTable[dataListIndex].Count == 0)
134120
{
135121
_dataTable.RemoveAt(dataListIndex);
136-
#if UNITY_2021_1_OR_NEWER
137122
_categoryListView.RefreshItems();
138-
#else
139-
_categoryListView.Refresh();
140-
#endif
141123
}
142124
else
143125
{
144-
#if UNITY_2021_1_OR_NEWER
145126
_categoryListView.RefreshItem(dataListIndex);
146-
#else
147-
_categoryListView.Refresh();
148-
#endif
149127
}
150128

151129
OnDataListChanged(dataList.Count, true);
@@ -251,13 +229,9 @@ private void OnEnable()
251229

252230
_categoryListView = new ListView
253231
{
254-
#if UNITY_2021_1_OR_NEWER
255232
showBorder = true,
256233
reorderable = false,
257234
fixedItemHeight = 20,
258-
#else
259-
itemHeight = 20,
260-
#endif
261235
itemsSource = _dataTable,
262236
makeItem = MakeDataListViewItem,
263237
bindItem = BindDataListViewItem,
@@ -358,17 +332,11 @@ private Toolbar CreateToolbar()
358332
_lockScaleToggle.RegisterValueChangedCallback(OnToolbarLockScaleToggleChanged);
359333
toolbar.Add(_lockScaleToggle);
360334

361-
_chartPointRadiusSlider = new SliderInt("Radius", 1, 10)
362-
{
363-
value = 2,
364-
};
335+
_chartPointRadiusSlider = new SliderInt("Radius", 1, 10) { value = 2, };
365336
_chartPointRadiusSlider.labelElement.style.minWidth = 45;
366-
#if UNITY_2021_1_OR_NEWER
367337
_chartPointRadiusSlider.Q<VisualElement>(className: "unity-base-slider__drag-container").style.width = 40;
368-
_chartPointRadiusSlider.Q<TextField>(className: "unity-base-slider__text-field").style.width = 22;
369-
#else
370-
_chartPointRadiusSlider.Q<VisualElement>(className: "unity-base-slider__input").style.width = 40;
371-
#endif
338+
// _chartPointRadiusSlider.Q<VisualElement>(className: "unity-base-slider__input").style.width = 40;
339+
// _chartPointRadiusSlider.Q<TextField>(className: "unity-base-slider__text-field").style.width = 22;
372340
_chartPointRadiusSlider.RegisterValueChangedCallback(OnToolbarChartPointRadiusSliderChanged);
373341
toolbar.Add(_chartPointRadiusSlider);
374342
UpdateToolbarChartPointRadiusSliderTitle();

0 commit comments

Comments
 (0)