-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from zhaozilong1988/release/v202409221240
New Features: Add NestedScrollRect for implementing Netflix-like list
- Loading branch information
Showing
11 changed files
with
889 additions
and
38 deletions.
There are no files selected for viewing
619 changes: 619 additions & 0 deletions
619
Assets/Scenes/Prefabs/SampleNestedScrollRectCell.prefab
Large diffs are not rendered by default.
Oops, something went wrong.
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
37 changes: 37 additions & 0 deletions
37
Assets/Scenes/Scripts/0_UITableViewCells/SampleNestedScrollRectCell.cs
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 UIKit; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class SampleNestedScrollRectCell : UITableViewCell, IUITableViewDataSource | ||
{ | ||
[SerializeField] Text _indexText; | ||
[SerializeField] UITableView _nestedTable; | ||
[SerializeField] SampleGridCell _cell; | ||
|
||
int _nestedCellCount; | ||
|
||
public void UpdateData(int cellIndex) | ||
{ | ||
_indexText.text = cellIndex.ToString(); | ||
_nestedCellCount = 10; | ||
_nestedTable.dataSource = this; | ||
_nestedTable.ReloadData(); | ||
} | ||
|
||
public UITableViewCell CellAtIndexInTableView(UITableView tableView, int cellIndex) | ||
{ | ||
var cell = tableView.ReuseOrCreateCell(_cell); | ||
cell.UpdateData(cellIndex, SampleGridView.Mode.Normal); | ||
return cell; | ||
} | ||
|
||
public int NumberOfCellsInTableView(UITableView tableView) | ||
{ | ||
return _nestedCellCount; | ||
} | ||
|
||
public float LengthForCellInTableView(UITableView tableView, int cellIndex) | ||
{ | ||
return cellIndex % 2 == 0 ? 200f : 250f; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scenes/Scripts/0_UITableViewCells/SampleNestedScrollRectCell.cs.meta
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
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ public enum SampleType | |
Image, | ||
Tab, | ||
Chat, | ||
NestedScrollRect, | ||
} | ||
|
||
public SampleType sampleType; | ||
|
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
Oops, something went wrong.