|
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|
using ET;
|
|
using ET;
|
|
using System;
|
|
using System;
|
|
using Hutool;
|
|
using Hutool;
|
|
|
|
+using UnityEngine;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
@@ -16,6 +17,8 @@ namespace GFGGame
|
|
private DressUpObjUI _dressUpObjUI;
|
|
private DressUpObjUI _dressUpObjUI;
|
|
private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
|
|
private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
|
|
private int _curSelectIndex = 0;
|
|
private int _curSelectIndex = 0;
|
|
|
|
+ //按钮锁定一段时间,防止点太快
|
|
|
|
+ private float _leftRightBtnLockEndTime = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
@@ -103,10 +106,14 @@ namespace GFGGame
|
|
|
|
|
|
private void RefreshList()
|
|
private void RefreshList()
|
|
{
|
|
{
|
|
- _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length - 1;
|
|
|
|
|
|
+ //这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
|
|
|
|
+ _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length;
|
|
}
|
|
}
|
|
private void ListItemRenderer(int index, GObject obj)
|
|
private void ListItemRenderer(int index, GObject obj)
|
|
{
|
|
{
|
|
|
|
+ //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
|
|
|
|
+ index--;
|
|
|
|
+ if (index < 0) index = 0;
|
|
VipCfg lastVipCfg = VipCfgArray.Instance.dataArray[index];
|
|
VipCfg lastVipCfg = VipCfgArray.Instance.dataArray[index];
|
|
VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
|
|
VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
|
|
UI_ListVipItem item = UI_ListVipItem.Proxy(obj);
|
|
UI_ListVipItem item = UI_ListVipItem.Proxy(obj);
|
|
@@ -219,26 +226,35 @@ namespace GFGGame
|
|
|
|
|
|
private void OnBtnLeftClick()
|
|
private void OnBtnLeftClick()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ //LogUtil.LogDev($"OnBtnLeftClick _curSelectIndex {_curSelectIndex}");
|
|
|
|
+ if (_leftRightBtnLockEndTime > Time.time) return;
|
|
if (_curSelectIndex == 0) return;
|
|
if (_curSelectIndex == 0) return;
|
|
_curSelectIndex = _curSelectIndex - 1;
|
|
_curSelectIndex = _curSelectIndex - 1;
|
|
- _ui.m_list.ScrollToView(_curSelectIndex, true);
|
|
|
|
- UpdateRedDot();
|
|
|
|
|
|
+ //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
|
|
|
|
+ _curSelectIndex = Mathf.Min(_curSelectIndex, _ui.m_list.numItems - 3);
|
|
|
|
+ _ui.m_list.ScrollToView(_curSelectIndex, true, true);
|
|
|
|
+ _leftRightBtnLockEndTime = Time.time + 0.2f;
|
|
}
|
|
}
|
|
private void OnBtnRightClick()
|
|
private void OnBtnRightClick()
|
|
{
|
|
{
|
|
|
|
+ //LogUtil.LogDev($"OnBtnRightClick _curSelectIndex {_curSelectIndex}");
|
|
|
|
+ if (_leftRightBtnLockEndTime > Time.time) return;
|
|
if (_curSelectIndex == _ui.m_list.numItems - 1) return;
|
|
if (_curSelectIndex == _ui.m_list.numItems - 1) return;
|
|
_curSelectIndex = _curSelectIndex + 1;
|
|
_curSelectIndex = _curSelectIndex + 1;
|
|
- _ui.m_list.ScrollToView(_curSelectIndex, true);
|
|
|
|
- UpdateRedDot();
|
|
|
|
|
|
+ _ui.m_list.ScrollToView(_curSelectIndex, true, true);
|
|
|
|
+ _leftRightBtnLockEndTime = Time.time + 0.2f;
|
|
|
|
|
|
}
|
|
}
|
|
private void UpdateSuitView()
|
|
private void UpdateSuitView()
|
|
{
|
|
{
|
|
_curSelectIndex = _ui.m_list.GetFirstChildInView();
|
|
_curSelectIndex = _ui.m_list.GetFirstChildInView();
|
|
|
|
+ //LogUtil.LogDev($"UpdateSuitView _curSelectIndex {_curSelectIndex}");
|
|
_ui.m_list.selectedIndex = _curSelectIndex;
|
|
_ui.m_list.selectedIndex = _curSelectIndex;
|
|
_ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
|
|
_ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
|
|
- _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 1 ? true : false;
|
|
|
|
|
|
+
|
|
|
|
+ //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
|
|
|
|
+ _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 2 ? true : false;
|
|
|
|
+ UpdateRedDot();
|
|
}
|
|
}
|
|
|
|
|
|
private void UpdateRedDot()
|
|
private void UpdateRedDot()
|
|
@@ -255,12 +271,10 @@ namespace GFGGame
|
|
if (red && _curSelectIndex > i - 1)
|
|
if (red && _curSelectIndex > i - 1)
|
|
{
|
|
{
|
|
leftRed = true;
|
|
leftRed = true;
|
|
- break;
|
|
|
|
}
|
|
}
|
|
if (red && _curSelectIndex + 1 < i)
|
|
if (red && _curSelectIndex + 1 < i)
|
|
{
|
|
{
|
|
rightRed = true;
|
|
rightRed = true;
|
|
- break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|