using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using EnhancedUI.EnhancedScroller;
|
using UnityEngine.UI;
|
using System;
|
|
public class CellView : EnhancedScrollerCellView
|
{
|
Button m_btn;
|
|
public Action<CellView> OnClick;
|
|
public ScrollerDataType type;
|
|
public float height = 100;
|
|
public CellInfo? info;
|
|
public ScrollerController controller { get; private set; }
|
|
private ScrollerUI scrollerUI;
|
|
public ScrollerUI diplayCell
|
{
|
get
|
{
|
if (scrollerUI == null)
|
{
|
scrollerUI = GetComponent<ScrollerUI>();
|
}
|
return scrollerUI;
|
}
|
}
|
|
|
private void Start()
|
{
|
m_btn = GetComponent<Button>();
|
if (m_btn != null)
|
{
|
m_btn.onClick.AddListener(OnBtnClick);
|
}
|
}
|
|
public void SetData(ScrollerData data, ScrollerDataType type, ScrollerController controller)
|
{
|
index = data.index;
|
this.type = type;
|
this.controller = controller;
|
}
|
|
void OnBtnClick()
|
{
|
if (OnClick != null)
|
{
|
OnClick(this);
|
}
|
}
|
|
public override void RefreshCellView()
|
{
|
if (controller != null)
|
{
|
controller.OnRefreshCellActive(this);
|
}
|
RefreshUI();
|
}
|
|
public void RefreshUI()
|
{
|
if (diplayCell != null)
|
{
|
diplayCell.Refresh(this);
|
}
|
}
|
}
|
|
public struct CellInfo
|
{
|
public int infoInt1;
|
public int infoInt2;
|
public int infoInt3;
|
public string infoStr1;
|
|
public CellInfo(int infoInt1, int infoInt2, string infoStr1)
|
{
|
this.infoInt1 = infoInt1;
|
this.infoInt2 = infoInt2;
|
this.infoStr1 = infoStr1;
|
this.infoInt3 = 0;
|
}
|
|
public void SetInfo(int _val)
|
{
|
infoInt3 = _val;
|
}
|
|
public static CellInfo Default
|
{
|
get
|
{
|
return new CellInfo(0, 0, string.Empty);
|
}
|
}
|
}
|