From 17c6d0cdc7b08abe36c2831dd6679baf4111f607 Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Fri, 31 Dec 2021 14:07:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=B0=8F=E4=BA=BA=E6=8C=BA?= =?UTF-8?q?=E4=BD=8F=E4=B8=8D=E5=8A=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Fight/View/ExploreMapView.lua | 31 +---------- .../~Lua/View/SingleExplorePlayerView.lua | 52 ++++++++----------- 2 files changed, 24 insertions(+), 59 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Fight/View/ExploreMapView.lua b/Assets/ManagedResources/~Lua/Modules/Fight/View/ExploreMapView.lua index 75d0151f33..61f5e965f1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Fight/View/ExploreMapView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Fight/View/ExploreMapView.lua @@ -72,13 +72,6 @@ function this:InitComponent(root, parent) this.effectRoot = Util.GetGameObject(root, "effectRoot") this.buffTip = Util.GetGameObject(this.effectRoot, "money") this.playerViews = {} - - local str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value - local strList = string.split(str,"#") - if strList and #strList > 0 then - local num = math.random(1,#strList) - FightPointPassManager.randomNum = num - end end function this:AddListener() @@ -148,8 +141,8 @@ function this:Init() this.playerViews[v.formationId]:RefreshIsSelf(false) end this.playerViews[v.formationId]:SetData((index3 == 1 and index1 or index2),index4,v) - this.playerViews[v.formationId]:RefreshHp(v.formationId) this.playerViews[v.formationId]:Run() + this.playerViews[v.formationId]:RefreshHp(v.formationId) end -- 设置相机初始化位置 local v4 = this.playerViews[0].transform.localPosition @@ -200,25 +193,10 @@ function this.LoadMapIcon() end end -function this.SetPlayerViewWalk() - if this.startTimer then - this.startTimer:Stop() - this.startTimer = nil - end - this.startTimer = Timer.New(function () - for k,v in pairs(this.playerViews) do - v:SetRoleHitTarget() - end - end,1.5) - this.startTimer:Start() -end - this.isCanUseIconList = 0 function this.RequestIconList() - --Log(" this.isCanUseIconList:".. tostring(this.isCanUseIconList)) if this.isCanUseIconList == 0 then this.isCanUseIconList = 1 - --Log(" this.iconList:".. tostring(this.iconList)) return this.iconList end return nil @@ -355,6 +333,7 @@ function this.LoadPointIcon(useAnim) pointView:ShowFreshTime(false) pointView:ShowDialogue(false) this.iconList[pos] = pointView + this.RemoveSelectIconList(pos) end end end @@ -409,12 +388,6 @@ function this.BattleEnd(selectPointPos,isSelf) -- 删除图标 this.DeletePointIcon(selectPointPos) this.RemoveSelectIconList(selectPointPos) - local str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value - local strList = string.split(str,"#") - if strList and #strList > 0 then - local num = math.random(1,#strList) - FightPointPassManager.randomNum = num - end end --- ==================== 角色行走 ===================================== diff --git a/Assets/ManagedResources/~Lua/View/SingleExplorePlayerView.lua b/Assets/ManagedResources/~Lua/View/SingleExplorePlayerView.lua index f3cc7225ba..e90ba2c284 100644 --- a/Assets/ManagedResources/~Lua/View/SingleExplorePlayerView.lua +++ b/Assets/ManagedResources/~Lua/View/SingleExplorePlayerView.lua @@ -222,6 +222,7 @@ function SingleExplorePlayerView:SetData(u,v,data) --当前状态 self.state = 0 + self.HaveIconRequest = 0 self.activeState = 0 PlayUIAnim(self.gameObject) end @@ -251,36 +252,30 @@ function SingleExplorePlayerView:RefreshHp() self.timer:Stop() self.timer = nil end + if self.eventPointPos then + self.parent.RemoveSelectIconList(self.eventPointPos) + self.eventPointPos = nil + end if self.data.formationId > 3100 then self.blood:SetActive(true) local hp = ExploreManager.GetHpById(self.data.formationId) if hp <= 0 then self.tip.gameObject:SetActive(true) self.bloodSlider.gameObject:SetActive(false) - if self.activeState == 1 then - self.activeState = 0 - self.eventPointPos = nil - self:RoleWalkEnd(nil) - end self.activeState = 0 self:RefreshPoints() else self.bloodSlider.fillAmount = hp/FormationManager.GetFormationPower(self.data.formationId) self.bloodSlider.gameObject:SetActive(true) self.tip.gameObject:SetActive(false) - if self.activeState == 0 then - self.activeState = 1 - self.eventPointPos = nil - self:RoleWalkEnd(nil) - end + self.activeState = 1 self.activeState = 1 end else self.activeState = 1 self.blood:SetActive(false) - self.eventPointPos = nil - self:RoleWalkEnd(nil) end + self:RoleWalkEnd(nil) end function SingleExplorePlayerView:RefreshPoints() @@ -341,10 +336,15 @@ function SingleExplorePlayerView:SetRoleHitTarget() self:SetWalkDir(WALK_DIR.IDLE_FRONT) return end - if self.thread then + + if self.thread then coroutine.stop(self.thread) self.thread=nil end + if self.HaveIconRequest == 1 then + self.parent.ReleaseIconList() + end + self.HaveIconRequest = 0 self.thread = coroutine.start(function() --LogGreen("随机一个位置给大爷走走") --local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf) @@ -369,6 +369,7 @@ function SingleExplorePlayerView:SelectTargetPos() --LogGreen("iconList:"..tostring(iconList)) if iconList and LengthOfTable(iconList) > 0 then --LogGreen("iconList:"..tostring(LengthOfTable(iconList))) + self.HaveIconRequest = 1 local selectIconList = {} local minDis = 999 for i, v in pairs(iconList) do @@ -400,14 +401,17 @@ function SingleExplorePlayerView:SelectTargetPos() local targetPos = 0 --LogGreen("#selectIconList:"..#selectIconList.." self.uid:"..self.userId) if #selectIconList > 1 then + self.parent.RemoveSelectIconList(self.eventPointPos) + self.eventPointPos = selectIconList[1].pos self.parent.AddSelectIconList(selectIconList[1].pos,self.data.formationId) targetPos = self:GetTargetPos(selectIconList[1].pos) - self.parent.RemoveSelectIconList(self.eventPointPos) else self.parent.ReleaseIconList() + self.HaveIconRequest = 0 return end self.parent.ReleaseIconList() + self.HaveIconRequest = 0 return targetPos end end @@ -609,21 +613,7 @@ function SingleExplorePlayerView:SetIconShow(_eventpoint) local iconType = self.eventPointPos.iconId or -1 --LogGreen("iconType:"..iconType) local index = (self.eventpoint == 4 or self.eventpoint == 1) and 4 or 3 - if iconType == -1 then - --显示对话框 - self.dialogueRoot.gameObject:SetActive(true) - self.dialogueRoot.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0) - self.context.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0) - self.dialogueRoot.transform.localPosition = m_roleTextPos[index].pos - local str = "" - local strList = {} - if self.isSelf then - str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value - else - str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,112).Value - end - strList = string.split(str,"#") - self.context.text = strList[FightPointPassManager.randomNum] or Language[12322] + if iconType == -1 then self:NotBattleShow() elseif iconType == 8 or iconType == 11 then -- 宝箱 self:SetWalkDir(WALK_DIR.JINGYA) @@ -930,7 +920,9 @@ end function SingleExplorePlayerView:OnClose() self.isclose = true - self.dialogueRoot.gameObject:SetActive(false) + if self.dialogueRoot then + self.dialogueRoot.gameObject:SetActive(false) + end self:StopAction() self.hurtNum = {} self.buffTipList = {}