Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
michael811125 committed Oct 24, 2023
1 parent 5113eac commit 8641835
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 86 deletions.
9 changes: 9 additions & 0 deletions Assets/InfiniteScrollView/Scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## CHANGELOG

## [1.2.1] - 2023-10-24
- Modified InfiniteCell method name (OnUpdate change to OnRefresh more clear).
```C#
public virtual void OnRefresh() { }
```
- Modified callback names in InfiniteScrollView.
- onRectTransformUpdate change to onRectTransformDimensionsChanged.
- onRefresh change onRefreshed.

## [1.2.0] - 2023-10-20
- Added [initializePoolOnAwake] trigger for InfiniteScrollView.
- Added OnClick in InfiniteCell for button event (Can assign event on button click).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void DoRefresh()
width += padding.right;
scrollRect.content.sizeDelta = new Vector2(width, scrollRect.content.sizeDelta.y);
this.RefreshCellVisibility();
onRefresh?.Invoke();
onRefreshed?.Invoke();
}

private async UniTask DelayToRefresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void DoRefresh()
width += padding.right;
scrollRect.content.sizeDelta = new Vector2(width, scrollRect.content.sizeDelta.y);
this.RefreshCellVisibility();
onRefresh?.Invoke();
onRefreshed?.Invoke();
}

private async UniTask DelayToRefresh()
Expand Down
4 changes: 2 additions & 2 deletions Assets/InfiniteScrollView/Scripts/Runtime/InfiniteCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public InfiniteCellData CellData
set
{
cellData = value;
OnUpdate();
OnRefresh();
}
get
{
Expand All @@ -35,7 +35,7 @@ public InfiniteCellData CellData

public virtual async UniTask OnCreate(object args) { }

public virtual void OnUpdate() { }
public virtual void OnRefresh() { }

public virtual void OnRecycle() { }

Expand Down
16 changes: 10 additions & 6 deletions Assets/InfiniteScrollView/Scripts/Runtime/InfiniteScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ public class Padding
public List<InfiniteCellData> dataList = new List<InfiniteCellData>();
public List<InfiniteCell> cellList = new List<InfiniteCell>();
protected Queue<InfiniteCell> cellPool = new Queue<InfiniteCell>();
private CancellationTokenSource _cts;
public event Action onRectTransformUpdate;
public Action<Vector2> onValueChanged;
public event Action<InfiniteCell> onCellSelected;
public Action onRefresh;
public SnapAlign snapAlign = SnapAlign.Start;
public Padding padding;

// Callbacks
public Action<Vector2> onValueChanged;
public event Action onRectTransformDimensionsChanged;
public event Action<InfiniteCell> onCellSelected;
public Action onRefreshed;

// Task cancellation
private CancellationTokenSource _cts;

public bool IsInitialized
{
get;
Expand Down Expand Up @@ -355,7 +359,7 @@ protected override void OnRectTransformDimensionsChange()
base.OnRectTransformDimensionsChange();
if (scrollRect)
{
onRectTransformUpdate?.Invoke();
onRectTransformDimensionsChanged?.Invoke();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void DoRefresh()
height += padding.bottom;
scrollRect.content.sizeDelta = new Vector2(scrollRect.content.sizeDelta.x, height);
this.RefreshCellVisibility();
onRefresh?.Invoke();
onRefreshed?.Invoke();
}

private async UniTask DelayToRefresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void DoRefresh()
height += padding.bottom;
scrollRect.content.sizeDelta = new Vector2(scrollRect.content.sizeDelta.x, height);
this.RefreshCellVisibility();
onRefresh?.Invoke();
onRefreshed?.Invoke();
}

private async UniTask DelayToRefresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class DemoVerticalGridCell : InfiniteCell
{
public Text text;

public override void OnUpdate()
public override void OnRefresh()
{
RectTransform.sizeDelta = CellData.cellSize;
text.text = CellData.index.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class DemoTabPageCell : InfiniteCell
{
public Text text;

public override void OnUpdate()
public override void OnRefresh()
{
DemoTabPageData data = (DemoTabPageData)CellData.data;
RectTransform.sizeDelta = CellData.cellSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ChatCell : InfiniteCell
public Text speakerText;
public Text messageText;

public override void OnUpdate()
public override void OnRefresh()
{
// Get cell data
ChatCellData data = (ChatCellData)CellData.data;
Expand Down
2 changes: 1 addition & 1 deletion Assets/InfiniteScrollView/Scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.howtungtung.infinitescrollview",
"displayName": "InfiniteScrollView with UniTask",
"description": "InfiniteScrollView is made for Unity extension, that support use as less as possible gameObject count to achieve large infinite scrolling content. Developed by native UGUI system, no any magical code inside, so you can easily modify and extend by yourself.",
"version": "1.2.0",
"version": "1.2.1",
"unity": "2021.3",
"license": "MIT",
"samples": [
Expand Down
10 changes: 5 additions & 5 deletions UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedSceneGuid-0:
value: 52020303030c5d58585a097a48775e1344164d78282a27692e7b4831b3b7666f
value: 010157505051510a5e565f7240775c4114151d7e792b7e68782a4865b0e6356e
flags: 0
RecentlyUsedSceneGuid-1:
value: 5252515f5353085909580e2713760e4443151e7f7b2e23627d7a4a37b4e46561
value: 52020303030c5d58585a097a48775e1344164d78282a27692e7b4831b3b7666f
flags: 0
RecentlyUsedSceneGuid-2:
value: 020906515053580a080a5d7a47770916154f1a287e7075642b2f1b63e7b86d60
value: 570252035d015b095c0b0a7643775c1546151e2f7f7b74367f284464e0b2313d
flags: 0
RecentlyUsedSceneGuid-3:
value: 010157505051510a5e565f7240775c4114151d7e792b7e68782a4865b0e6356e
value: 020906515053580a080a5d7a47770916154f1a287e7075642b2f1b63e7b86d60
flags: 0
RecentlyUsedSceneGuid-4:
value: 570252035d015b095c0b0a7643775c1546151e2f7f7b74367f284464e0b2313d
value: 5252515f5353085909580e2713760e4443151e7f7b2e23627d7a4a37b4e46561
flags: 0
RecentlyUsedScenePath-0:
value: 224247031146467e150f01321c264c5f46452702233a2f2a22270932eeaf646addcf39fbee2030322d03e3721130082beb
Expand Down
Loading

0 comments on commit 8641835

Please sign in to comment.