透明小地图&列表点击切换&海拔图头像位移

This commit is contained in:
lishuo committed 2022-03-29 18:41:32 +08:00
1 parent bf48989a9c
commit 6ec4c0101b
114 files changed
+12787 -6517

No files matched your search

@@ -0,0 +1,75 @@
using System.Collections.Generic;
using UnityEngine;
using PolyAndCode.UI;
/// <summary>
/// Demo controller class for Recyclable Scroll Rect.
/// A controller class is responsible for providing the scroll rect with datasource. Any class can be a controller class.
/// The only requirement is to inherit from IRecyclableScrollRectDataSource and implement the interface methods
/// </summary>
//Dummy Data model for demostraion
public struct ContactInfo
{
public string Name;
public string Gender;
public string id;
}
public class RecyclableScrollerDemo : MonoBehaviour, IRecyclableScrollRectDataSource
{
[SerializeField]
RecyclableScrollRect _recyclableScrollRect;
[SerializeField]
private int _dataLength;
//Dummy data List
private List<ContactInfo> _contactList = new List<ContactInfo>();
//Recyclable scroll rect's data source must be assigned in Awake.
private void Awake()
{
InitData();
_recyclableScrollRect.DataSource = this;
}
//Initialising _contactList with dummy data
private void InitData()
{
if (_contactList != null) _contactList.Clear();
string[] genders = { "Male", "Female" };
for (int i = 0; i < _dataLength; i++)
{
ContactInfo obj = new ContactInfo();
obj.Name = i + "_Name";
obj.Gender = genders[Random.Range(0, 2)];
obj.id = "item : " + i;
_contactList.Add(obj);
}
}
#region DATA-SOURCE
/// <summary>
/// Data source method. return the list length.
/// </summary>
public int GetItemCount()
{
return _contactList.Count;
}
/// <summary>
/// Data source method. Called for a cell every time it is recycled.
/// Implement this method to do the necessary cell configuration.
/// </summary>
public void SetCell(ICell cell, int index)
{
//Casting to the implemented Cell
var item = cell as DemoCell;
item.ConfigureCell(_contactList[index], index);
}
#endregion
}