|
@@ -47,6 +47,7 @@ namespace GFGGame
|
|
|
_valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
|
|
|
|
_ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
|
+ _ui.m_list.SetVirtual();
|
|
|
_ui.m_list.itemRenderer = ListItemRender;
|
|
|
_ui.m_list.onClickItem.Add(OnListItemClick);
|
|
|
|
|
@@ -62,14 +63,19 @@ namespace GFGGame
|
|
|
{
|
|
|
base.OnShown();
|
|
|
_valueBarController.OnShown();
|
|
|
-
|
|
|
UpdateList();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
_valueBarController.OnHide();
|
|
|
+
|
|
|
+ if (_ui.m_list.numItems > 0)
|
|
|
+ {
|
|
|
+ _ui.m_list.ScrollToView(0);
|
|
|
+ }
|
|
|
_ui.m_list.numItems = 0;
|
|
|
+
|
|
|
base.OnHide();
|
|
|
}
|
|
|
protected override void RemoveEventListener()
|
|
@@ -80,14 +86,6 @@ namespace GFGGame
|
|
|
private void UpdateList()
|
|
|
{
|
|
|
_ui.m_list.numItems = BagDataManager.Instance.BagDatas.Count;
|
|
|
- int index = BagDataManager.Instance.GetItemIndex(_curItemId, _ui.m_list.selectedIndex);
|
|
|
-
|
|
|
- if (index >= 0)
|
|
|
- {
|
|
|
- _ui.m_list.selectedIndex = index;
|
|
|
- int childIndex = _ui.m_list.ItemIndexToChildIndex(index);
|
|
|
- GComponent comItem = _ui.m_list.GetChildAt(childIndex).asCom;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void ListItemRender(int index, GObject obj)
|
|
@@ -98,16 +96,6 @@ namespace GFGGame
|
|
|
item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
item.m_txtCount.SetVar("count", itemData.num.ToString()).FlushVars();
|
|
|
item.target.data = itemCfg;
|
|
|
- // if (obj.data == null)
|
|
|
- // {
|
|
|
- // ItemView itemView = new ItemView(obj as GComponent);
|
|
|
- // obj.data = itemView;
|
|
|
- // _listItemViews.Add(itemView);
|
|
|
- // }
|
|
|
- // (obj.data as ItemView).SetData(itemData);
|
|
|
- // (obj.data as ItemView).ShowName = false;
|
|
|
- // (obj.data as ItemView).ShowHasCount = false;
|
|
|
- // (obj.data as ItemView).ShowTips = false;
|
|
|
}
|
|
|
|
|
|
private void OnListItemClick(EventContext context)
|