|
@@ -43,7 +43,7 @@ namespace GFGGame
|
|
|
|
|
|
_ui.m_listTab.selectedIndex = 0;
|
|
|
_ui.m_listType.selectedIndex = 0;
|
|
|
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zxian_bg3");
|
|
|
+ _ui.m_loaBg.url = "ui://Main/zhangjie_bg";//ResPathUtil.GetBgImgPath("zxian_bg3");
|
|
|
|
|
|
_ui.m_listChapter.scrollPane.onScroll.Add(DoSpecialEffect);//滚动时派发事件
|
|
|
|
|
@@ -76,6 +76,7 @@ namespace GFGGame
|
|
|
|
|
|
Timers.inst.Remove(CheckGuide);
|
|
|
Timers.inst.Remove(OnTimerUpdate);
|
|
|
+ Timers.inst.Remove(DoSpecialEffect);
|
|
|
}
|
|
|
|
|
|
private void OnClickBtnBack()
|
|
@@ -107,7 +108,7 @@ namespace GFGGame
|
|
|
StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterID);
|
|
|
//这里变成-1,是因为调整了item,最左右两边现在有item但是是透明没数据的
|
|
|
int index = chapterCfg.order - 1;
|
|
|
- index = Mathf.Clamp(index, 0, _ui.m_listChapter.numItems - 2);
|
|
|
+ //index = Mathf.Clamp(index, 0, _ui.m_listChapter.numItems - 2);
|
|
|
int firstChildIndex = _ui.m_listChapter.GetFirstChildInView();
|
|
|
if (firstChildIndex != index)
|
|
|
{
|
|
@@ -288,6 +289,7 @@ namespace GFGGame
|
|
|
}
|
|
|
_timeCount = 0;
|
|
|
Timers.inst.Add(0.1f, _ui.m_listChapter.numChildren , OnTimerUpdate, 1);
|
|
|
+ DoSpecialEffect();
|
|
|
}
|
|
|
private void CheckGuide(object param)
|
|
|
{
|
|
@@ -323,18 +325,18 @@ namespace GFGGame
|
|
|
GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.STUDIO_FILING, 1, "点击返回主界面。");
|
|
|
}
|
|
|
|
|
|
- private void DoSpecialEffect()
|
|
|
+ private void DoSpecialEffect(object parm = null)
|
|
|
{
|
|
|
- float listCenter = _ui.m_listChapter.scrollPane.posX + _ui.m_listChapter.viewWidth / 2;
|
|
|
+ //scrollPane.scrollingPosX这个实时变化,。scrollPane.posX这个使用ScrlootoVIew直接取终值
|
|
|
+ float listCenter = _ui.m_listChapter.scrollPane.scrollingPosX + _ui.m_listChapter.viewWidth / 2;
|
|
|
float listLeft = _ui.m_listChapter.scrollPane.posX + _ui.m_listChapter.viewWidth / 2; ;
|
|
|
- //list组件的x值,加上list组件自身宽度的一半,设置为对标的中心x值
|
|
|
for (int i = 0; i < _ui.m_listChapter.numChildren; i++)
|
|
|
{
|
|
|
GObject item = _ui.m_listChapter.GetChildAt(i);
|
|
|
float itemCenter = item.x + item.width / 2;//循环列表内元素的中心x值
|
|
|
float itemWidth = item.width;//列表元素的宽度
|
|
|
float distance = Mathf.Abs(listCenter - itemCenter);
|
|
|
- if (distance < item.width)
|
|
|
+ // if (distance < item.width)
|
|
|
{
|
|
|
float distanceRange = 1 + (1 - distance / itemWidth) * 0.3f;//使放大动画有渐进效果
|
|
|
item.SetScale(distanceRange, distanceRange);//设置放大比例
|
|
@@ -350,16 +352,10 @@ namespace GFGGame
|
|
|
listItem.m_content.m_compPic.m_pic.color = new Color(0.4f, 0.4f, 0.4f, 1.000f);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- //设置颜色变化
|
|
|
- UI_ListChapterItem listItem = UI_ListChapterItem.Proxy(_ui.m_listChapter.GetChildAt(i));
|
|
|
- listItem.m_content.m_compPic.m_pic.color = new Color(0.4f, 0.4f, 0.4f, 1.000f);
|
|
|
- item.SetScale(1.0f, 1.0f);
|
|
|
- }
|
|
|
float distanceX = ((1 - (listCenter - itemCenter)) / itemWidth) * 0.05f;//使y轴移动有渐进效果
|
|
|
item.y = -_ui.m_listChapter.height * distanceX;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
}
|