浏览代码

章节问题修复

zhangyuqian 1 年之前
父节点
当前提交
75cdf3b46d
共有 1 个文件被更改,包括 14 次插入12 次删除
  1. 14 12
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterView.cs

+ 14 - 12
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterView.cs

@@ -154,16 +154,6 @@ namespace GFGGame
 
             Timers.inst.AddUpdate(CheckGuide);
 
-            //根据困难程度选择显示图片
-            currentDifficulty = _chapterID / 10000 - 1;
-            if (currentDifficulty == 1)
-            {
-                _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zhangjie_bg");
-            }
-            else
-            {
-                _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_zhuxian");
-            }
         }
 
         protected override void OnHide()
@@ -191,7 +181,7 @@ namespace GFGGame
         private void OnClickSwitchBack()
         {
             Timers.inst.Remove(SetContainerY);
-            ViewManager.Show<StoryChapterListView>(new object[] { currentDifficulty , newIndex }, new object[] { typeof(StoryChapterView).FullName, this.viewData });
+            ViewManager.Show<StoryChapterListView>(new object[] {Mathf.Max(0, currentDifficulty) , newIndex }, new object[] { typeof(StoryChapterView).FullName, this.viewData });
         }
 
         private void OnClickBtnHome()
@@ -251,6 +241,18 @@ namespace GFGGame
                 _ui.m_chapter.m_compChapterScroll.m_imgBegin.visible = true;
                 _ui.m_chapter.m_compChapterScroll.m_nextEffect.visible = true;
             }
+
+            //根据困难程度选择显示图片
+            currentDifficulty = _chapterID / 10000 - 1;
+            if (currentDifficulty == 1)
+            {
+                _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zhangjie_bg");
+            }
+            else
+            {
+                currentDifficulty = 0;
+                _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_zhuxian");
+            }
             //_comEff.visible = false;
             //_effFirst.visible = false;
             for (int i = 0; i < 20; i++)
@@ -283,7 +285,7 @@ namespace GFGGame
                         {
                             levelItem.m_flower.target.visible = true;
                             int starCount = InstanceZonesDataManager.GetStarCountHistory(levelCfg.id);
-                            StoryUtil.UpdateStar(starCount, levelItem.m_flower.target,currentDifficulty);
+                            StoryUtil.UpdateStar(starCount, levelItem.m_flower.target,Mathf.Max(0, currentDifficulty));
                         }
                     }
                     else