This commit is contained in:
2020-07-05 15:44:30 +08:00
parent a8f02e4da5
commit e344c54d82
32 changed files with 647 additions and 209 deletions

View File

@@ -150,6 +150,32 @@ namespace Coolape
object initCellCallback;
object onEndListCallback;
object onHeadListCallback;
public List<EventDelegate> OnShowHeadListCallbacks = new List<EventDelegate>();
public List<EventDelegate> OnHideHeadListCallbacks = new List<EventDelegate>();
public List<EventDelegate> OnEndListCallbacks = new List<EventDelegate>();
protected void ExecuteOnEndList()
{
if (EventDelegate.IsValid(OnEndListCallbacks))
{
EventDelegate.Execute(OnEndListCallbacks, gameObject); // modify by chenbin
}
}
protected void ExecuteOnShowHeadList()
{
if (EventDelegate.IsValid(OnShowHeadListCallbacks))
{
EventDelegate.Execute(OnShowHeadListCallbacks, gameObject); // modify by chenbin
}
}
protected void ExecuteOnHideHeadList()
{
if (EventDelegate.IsValid(OnHideHeadListCallbacks))
{
EventDelegate.Execute(OnHideHeadListCallbacks, gameObject); // modify by chenbin
}
}
public void refreshContentOnly ()
{
@@ -469,7 +495,12 @@ namespace Coolape
// Debug.Log (int.Parse (head.name) + "=11===" + (list.Count - 1) + "===" + firstVislable);
// Debug.Log (int.Parse (tail.name) + "=22===" + (list.Count - 1) + "===" + lastVisiable);
if (firstVislable && int.Parse (head.name) > 0) {
if (firstVislable && int.Parse (head.name) > 0)
{
if (!isCanCallOnHeadList)
{
ExecuteOnHideHeadList();
}
isCanCallOnEndList = true;
isCanCallOnHeadList = true;
times--;
@@ -477,7 +508,12 @@ namespace Coolape
sourceIndex = itemList.Count - 1;
targetIndex = 0;
sign = 1;
} else if (lastVisiable && int.Parse (tail.name) < list.Count - 1) {
} else if (lastVisiable && int.Parse (tail.name) < list.Count - 1)
{
if (!isCanCallOnHeadList)
{
ExecuteOnHideHeadList();
}
isCanCallOnEndList = true;
isCanCallOnHeadList = true;
times++;
@@ -491,8 +527,13 @@ namespace Coolape
isCanCallOnHeadList = false;
Utl.doCallback (this.onHeadListCallback, head);
ExecuteOnShowHeadList();
}
} else {
if(!isCanCallOnHeadList)
{
ExecuteOnHideHeadList();
}
isCanCallOnHeadList = true;
}
if (lastVisiable && int.Parse (tail.name) == list.Count - 1) {
@@ -501,8 +542,10 @@ namespace Coolape
isCanCallOnEndList = false;
Utl.doCallback (this.onEndListCallback, tail);
ExecuteOnEndList();
}
} else {
} else
{
isCanCallOnEndList = true;
}
}