-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGridDataSourceSamples.cs
44 lines (38 loc) · 1.34 KB
/
GridDataSourceSamples.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Copyright (C) 2021 LimeVista
// Author: LimeVista(https://github.com/LimeVista/RecyclableScrollRectX)
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the The MIT License (MIT).
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See The MIT License (MIT) for more details.
//
// You should have received a copy of The MIT License (MIT)
// along with this library.
//
using UnityEngine;
namespace RecyclableScrollRectX.Samples
{
[CreateAssetMenu(menuName = "Samples/GridDomeDataSource")]
public class GridDataSourceSamples : RecyclableScriptableDataSource
{
public override bool SingleZygoteMode => true;
public override int GetCellCount() => 100;
public override RectTransform GetCellZygote(int type)
{
const string path = "Prefabs/DemoCell03";
return Resources.Load<GameObject>(path).GetComponent<RectTransform>();
}
public override int GetCellType(int index) => 0;
public override void OnBindCell(RecyclingSystem.ICell cell, int index)
{
if (cell is DemoCell dc)
{
dc.OnBind(index);
}
}
}
}