备份CatanBuilding瘦身独立工程
This commit is contained in:
54
Assets/Scripts/UI/Potion/PotionWallScrollViewController.cs
Normal file
54
Assets/Scripts/UI/Potion/PotionWallScrollViewController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using asap.core;
|
||||
using EnhancedUI.EnhancedScroller;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace game
|
||||
{
|
||||
public class PotionWallScrollViewController : EnhancedScroller, IEnhancedScrollerDelegate
|
||||
{
|
||||
private EventPotionDataManager m_DataManager;
|
||||
|
||||
public void Init(EnhancedScroller scroller, EventPotionDataManager dataManager)
|
||||
{
|
||||
m_Scroller = scroller;
|
||||
m_DataManager = dataManager;
|
||||
|
||||
InitScrollerListData();
|
||||
|
||||
m_Scroller.Delegate = this;
|
||||
|
||||
m_Scroller.ReloadData();
|
||||
}
|
||||
|
||||
#region EnhancedScroller Handlers
|
||||
private EnhancedScroller m_Scroller;
|
||||
public PotionWallItem potionWallItem;
|
||||
List<PotionItemData> scrollerDataList = new List<PotionItemData>();
|
||||
|
||||
void InitScrollerListData()
|
||||
{
|
||||
scrollerDataList = m_DataManager.ScrollerDataList;
|
||||
}
|
||||
|
||||
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
|
||||
{
|
||||
PotionWallItem cellView = scroller.GetCellView(potionWallItem) as PotionWallItem;
|
||||
var data = scrollerDataList[dataIndex];
|
||||
cellView.SetData(data);
|
||||
return cellView;
|
||||
}
|
||||
|
||||
public float GetCellViewSize(EnhancedScroller scroller, int dataIndex)
|
||||
{
|
||||
return 200f;
|
||||
}
|
||||
|
||||
public int GetNumberOfCells(EnhancedScroller scroller)
|
||||
{
|
||||
return scrollerDataList.Count;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user