forked from qiankanglai/LoopScrollRect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfc2743
commit e113137
Showing
3 changed files
with
67 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
namespace UnityEngine.UI | ||
{ | ||
public abstract class LoopScrollDataSource | ||
{ | ||
public abstract void ProvideData(Transform transform, int idx); | ||
} | ||
|
||
public class LoopScrollSendIndexSource : LoopScrollDataSource | ||
{ | ||
public static readonly LoopScrollSendIndexSource Instance = new LoopScrollSendIndexSource(); | ||
|
||
LoopScrollSendIndexSource(){} | ||
|
||
public override void ProvideData(Transform transform, int idx) | ||
{ | ||
transform.SendMessage("ScrollCellIndex", idx); | ||
} | ||
} | ||
|
||
public class LoopScrollArraySource<T> : LoopScrollDataSource | ||
{ | ||
T[] objectsToFill; | ||
|
||
public LoopScrollArraySource(T[] objectsToFill) | ||
{ | ||
this.objectsToFill = objectsToFill; | ||
} | ||
|
||
public override void ProvideData(Transform transform, int idx) | ||
{ | ||
transform.SendMessage("ScrollCellContent", objectsToFill[idx]); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters