From 66c024eeae7ffaa423a72bafc141cc14e1073741 Mon Sep 17 00:00:00 2001 From: zhangqiang <657634622@qq.com> Date: Wed, 26 May 2021 20:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=B1=B1=E6=B2=B3=E7=A4=BE=E7=A8=B7?= =?UTF-8?q?=E5=9B=BE=E3=80=91bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FightLevel/FightLevelChapterPanel.lua | 5 +++ .../FightLevelSingleChapterPanel.lua | 38 ++++++++++--------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelChapterPanel.lua b/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelChapterPanel.lua index f50664299d..bae57d1816 100644 --- a/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelChapterPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelChapterPanel.lua @@ -83,6 +83,11 @@ function this.SingleChapterDataShow(go, data) npc = PlayerLiveView:New(playerParent.transform,2, PlayerLiveViewData,this.sortingOrder) npc:OnOpen(GetPlayerRoleSingleConFig().Scale6,Vector3.New(0,0,0),WALK_DIR.IDLE_LEFT) end + if curChapterId == data.chapterId then + playerParent.gameObject:SetActive(true) + else + playerParent.gameObject:SetActive(false) + end cur:SetActive(curChapterId == data.chapterId) open:SetActive(curChapterId > data.chapterId) lock:SetActive(curChapterId < data.chapterId) diff --git a/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelSingleChapterPanel.lua b/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelSingleChapterPanel.lua index 4a3375dca2..07ddff4241 100644 --- a/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelSingleChapterPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelSingleChapterPanel.lua @@ -115,15 +115,21 @@ function this.ShowChapterPoint() table.insert(allNodeDatas,value) end table.sort(allNodeDatas, function(a,b) return a.nodeId < b.nodeId end) - local num = 0 + local points = {} for i = 1, #allNodeDatas do if allNodeDatas[i].config.UselessPoint then + local isOpen = this.GetCurLevelIsOpen(allNodeDatas[i])-- -1 未开启 0 开启 1 需解锁上一关 2 等级不足 for j = 1, #allNodeDatas[i].config.UselessPoint do - num = num + 1 + table.insert(points,{allNodeDatas[i].config.UselessPoint[j][1],allNodeDatas[i].config.UselessPoint[j][2],isOpen}) + -- if allNodeDatas[i].config.UselessPoint[j + 1] then + -- local posX = allNodeDatas[i].config.UselessPoint[j][1] + (allNodeDatas[i].config.UselessPoint[j + 1][1] - allNodeDatas[i].config.UselessPoint[j][1])/2 + -- local posY = allNodeDatas[i].config.UselessPoint[j][2] + (allNodeDatas[i].config.UselessPoint[j + 1][2] - allNodeDatas[i].config.UselessPoint[j][2])/2 + -- table.insert(points,{posX,posY,isOpen}) + -- end end end end - for i = 1, math.max(#allSmallPoint , num) do + for i = 1, math.max(#allSmallPoint , #points) do local go = allSmallPoint[i] if not go then go = newObject(this.pointPre) @@ -135,18 +141,11 @@ function this.ShowChapterPoint() end go.gameObject:SetActive(false) end - local index = 0 - for i = 1, #allNodeDatas do - local isOpen = this.GetCurLevelIsOpen(allNodeDatas[i])-- -1 未开启 0 开启 1 需解锁上一关 2 等级不足 - if allNodeDatas[i].config.UselessPoint then - for j = 1, #allNodeDatas[i].config.UselessPoint do - index = index + 1 - allSmallPoint[index].gameObject:SetActive(true) - allSmallPoint[index].transform.localPosition = Vector3.New(allNodeDatas[i].config.UselessPoint[j][1],allNodeDatas[i].config.UselessPoint[j][2],0) - local image = allSmallPoint[index]:GetComponent("Image") - image.sprite = this.spLoader:LoadSprite(isOpen == 0 and point[1] or point[2]) - end - end + for i = 1, #points do + allSmallPoint[i].gameObject:SetActive(true) + allSmallPoint[i].transform.localPosition = Vector3.New(points[i][1],points[i][2],0) + local image = allSmallPoint[i]:GetComponent("Image") + image.sprite = this.spLoader:LoadSprite(points[i][3] == 0 and point[1] or point[2]) end end @@ -327,25 +326,30 @@ function this.LeftOrRightBtnClickEvent(index) -- chapterData = FightLevelManager.GetChapterData(chapterId) local upChapterId = chapterData.chapterId - 1 local upChapterData = FightLevelManager.GetChapterData(upChapterId) + local canLeft = true if upChapterData and upChapterId <= FightLevelManager.GetCurChapterId() then this.leftBtn:SetActive(true) else + canLeft = false this.leftBtn:SetActive(false) end local downChapterId = chapterData.chapterId + 1 local downChapterData = FightLevelManager.GetChapterData(downChapterId) + + local canRight = true if downChapterData and downChapterId <= FightLevelManager.GetCurChapterId() then this.rightBtn:SetActive(true) else + canRight = false this.rightBtn:SetActive(false) end - if index and index == 1 then--左 + if index and index == 1 and canLeft then--左 chapterId = upChapterId chapterData = upChapterData this.OnShowPanel() this.LeftOrRightBtnClickEvent() - elseif index and index == 2 then--右 + elseif index and index == 2 and canRight then--右 chapterId = downChapterId chapterData = downChapterData this.OnShowPanel()