diff --git a/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaBattleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaBattleInfoPanel.lua index c5f742f9ef..95a433a13c 100644 --- a/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaBattleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaBattleInfoPanel.lua @@ -11,10 +11,21 @@ local type=0 local enemyId=0 local myInfoData=nil local enInfoData=nil + +local targetIndex=0 +local currIndex=0 local function OnBeginDrag(self, Pointgo, data) if state~=1 then return end + local num=999 + for i = 1, 3 do + local dis = math.abs(Pointgo.transform.parent.parent.localPosition.y - this.leftTeam[i].transform.localPosition.y ) + if dis <= num then + num = dis + currIndex=i + end + end self.oldGrid = Pointgo.transform.parent.parent self.tempInfo.transform.localPosition = Pointgo.transform.parent.parent.localPosition Pointgo.transform.parent:SetParent(self.tempInfo.transform) @@ -25,7 +36,7 @@ local function OnDrag(self, Pointgo, data) return end local pos = self.tempInfo.transform.localPosition - local y = pos.y + data.delta.y >= -300 and pos.y + data.delta.y or -300 + local y = pos.y + data.delta.y >= -400 and pos.y + data.delta.y or -400 y = y <= 450 and y or 450 self.tempInfo.transform.localPosition = Vector2.New(pos.x , y) end @@ -36,17 +47,19 @@ local function OnEndDrag(self, Pointgo, data) --Pointgo.transform.parent.localPosition = Vector3.zero local num = 999 local obj = nil + for i = 1, 3 do local dis = math.abs( self.tempInfo.transform.localPosition.y - this.leftTeam[i].transform.localPosition.y ) - LogError(" temp y=="..self.tempInfo.transform.localPosition.y.." leftteam y=="..this.leftTeam[i].transform.localPosition.y) + --LogError(" temp y=="..self.tempInfo.transform.localPosition.y.." leftteam y=="..this.leftTeam[i].transform.localPosition.y) if dis <= num then num = dis obj = this.leftTeam[i] + targetIndex=i end end --如果滑动距离太短,阵容放回原来的地方 LogError(" num=="..num) - if num<60 then + if num>100 then LogError("**********") local target=Util.GetGameObject(self.tempInfo.transform, "Demons") target.transform:SetParent(self.oldGrid.transform) @@ -55,13 +68,16 @@ local function OnEndDrag(self, Pointgo, data) return end if obj.transform.childCount > 0 then - --local targetInfo = obj.transform:GetChild(0) local targetInfo=Util.GetGameObject(obj.transform, "Demons") - -- LogError("targetInfo name=="..targetInfo.name) - targetInfo.transform:SetParent(self.oldGrid.transform) - targetInfo.transform:SetSiblingIndex(1) - --targetInfo.localPosition = Vector3.zero - targetInfo.transform.localPosition=Vector3.New(0,-67,0) + if targetInfo then + targetInfo.transform:SetParent(self.oldGrid.transform) + targetInfo.transform:SetSiblingIndex(1) + targetInfo.transform.localPosition=Vector3.New(0,-67,0) + else + LogError("targetInfo==nil") + return + end + else obj = self.oldGrid end @@ -70,11 +86,9 @@ local function OnEndDrag(self, Pointgo, data) curInfo:SetParent(obj.transform) curInfo.transform:SetSiblingIndex(1) curInfo.localPosition = Vector3.New(0,-67,0) + - for i = 1, 3 do - self.InfoList[i] = Util.GetGameObject(self.Content, "Grid ("..i..")/Info") - -- WorldArenaMyTeamPanel:Refresh() - end + LogError("起始id=="..currIndex.." 终点id=="..targetIndex) end --初始化组件(用于子类重写) function WorldArenaBattleInfoPanel:InitComponent() @@ -183,14 +197,19 @@ function WorldArenaBattleInfoPanel:BindEvent() end local currIndex=1 local _TimeUpdate=function() - LogError("currrindex=="..currIndex) - this.leftTeam[currIndex]:GetComponent("RectTransform").localPosition=Vector3.New(278,this.leftTeam[currIndex].transform.localPosition.y,0) - this.rightTeam[currIndex]:GetComponent("RectTransform").localPosition=Vector3.New(101,this.rightTeam[currIndex].transform.localPosition.y,0) - this.leftTeam[currIndex]:GetComponent("RectTransform").localPosition=Vector3.New(192.5,this.leftTeam[currIndex].transform.localPosition.y,0) - this.rightTeam[currIndex]:GetComponent("RectTransform").localPosition=Vector3.New(192.5,this.rightTeam[currIndex].transform.localPosition.y,0) - this.playBacks[currIndex]:SetActive(true) - - currIndex=currIndex+1 + + this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(101,this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) + this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(278,this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) + LogError("left pos.x=="..this.leftTeam[currIndex].transform.localPosition.x) + LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x) + this.playBacks[currIndex]:SetActive(true) + this.ShowBattleState(currIndex,3) + this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(192,this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) + this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(192,this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) + LogError("left pos.x=="..this.leftTeam[currIndex].transform.localPosition.x) + LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x) + LogError("--------------") + currIndex=currIndex+1 if this.TimeCounter and currIndex>3 then this.TimeCounter:Stop() this.TimeCounter = nil @@ -199,21 +218,13 @@ function WorldArenaBattleInfoPanel:BindEvent() this.TimeCounter = Timer.New(_TimeUpdate,1.5, -1, true) this.TimeCounter:Start() end) - -- state=3 - -- this.ShowBattleState() - - - - - --PlayUIAnim(this.leftTeam[1].gameObject) - --PlayUIAnim(this.rightTeam[1].gameObject) end) --回放按钮点击事件 for i = 1, #this.playBacks do Util.AddClick(this.playBacks[i],function() local nameStr = myInfoData.name.."|"..enInfoData.name - local realResult = (resultList[i] + 1) % 2 -- 服务器返回的是我的结果,转换为真实结果 + local realResult = resultList[i] --(resultList[i] + 1) % 2 -- 服务器返回的是我的结果,转换为真实结果 this.RequestReplayRecord(realResult,fightDataList[i], nameStr,function() this:ClosePanel() --构建显示结果数据(我永远在蓝方) @@ -323,20 +334,20 @@ function this.ShowInfo(msg) end end LogError("myteam len=="..#msg.myTeamInfo.crossTeam[1].team) - this.SetTeamInfo(this.myTeamInfo,msg.myTeamInfo.crossTeam) + this.SetTeamInfo(this.myTeamInfo,msg.myTeamInfo.crossTeam,1) this.SetTeamInfo(this.enTeamInfo,msg.defTeamInfo.crossTeam) end -function this.ShowBattleState() - for i = 1, 3 do - Util.GetGameObject(this.leftTeam[i], "Text").gameObject:SetActive(state~=3) - Util.GetGameObject(this.rightTeam[i], "Text").gameObject:SetActive(state~=3) - local leftImg=Util.GetGameObject(this.leftTeam[i], "Image"):GetComponent("Image") - local rightImg=Util.GetGameObject(this.rightTeam[i], "Image"):GetComponent("Image") +function this.ShowBattleState(index,state) + --for i = 1, 3 do + Util.GetGameObject(this.leftTeam[index], "Text").gameObject:SetActive(state~=3) + Util.GetGameObject(this.rightTeam[index], "Text").gameObject:SetActive(state~=3) + local leftImg=Util.GetGameObject(this.leftTeam[index], "Image"):GetComponent("Image") + local rightImg=Util.GetGameObject(this.rightTeam[index], "Image"):GetComponent("Image") leftImg.gameObject:SetActive(state==3) rightImg.gameObject:SetActive(state==3) if state==3 then - if resultList[i]==1 then + if resultList[index]==1 then leftImg.sprite=this.spLoader:LoadSprite("UI_effect_JJC_JieSuan_ShengLi_png_zh") rightImg.sprite=this.spLoader:LoadSprite("UI_effect_JJC_JieSuan_ShiBai_png_zh") else @@ -345,14 +356,15 @@ function this.ShowBattleState() end end - end + --end end --编队信息 -function this.SetTeamInfo(_go,teamData) +local allTeams={} +function this.SetTeamInfo(_go,teamData,type) for index = 1, 3 do local go = Util.GetGameObject(_go,"defendbox"..index) local data = teamData[index] @@ -370,6 +382,7 @@ function this.SetTeamInfo(_go,teamData) Util.GetGameObject(demon, "hero"):SetActive(false) end --队伍阵容 + local heroList={} for i, hero in ipairs(data.team) do local heroTid = data.team[i].heroTid if heroTid then @@ -383,20 +396,26 @@ function this.SetTeamInfo(_go,teamData) Util.GetGameObject(teamList[hero.position], "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality, hero.star)) SetHeroIcon(this.spLoader, hero,Util.GetGameObject(heroGo, "icon"):GetComponent("Image"),heroConfig) local frameBtn = Util.GetGameObject(teamList[hero.position], "frame") - local heroData = {} - Util.AddOnceClick(frameBtn, function() - NetManager.ViewHeroInfoRequest(self.playerId,hero.heroid,1,PLAYER_INFO_VIEW_TYPE.NORMAL,function(msg) - if not hero.heroid then - return - end - heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects,msg.guildSkill) - GoodFriendManager.InitEquipData(msg.equip,heroData) - UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true) - end) - end) + --local heroData = {} + -- Util.AddOnceClick(frameBtn, function() + -- NetManager.ViewHeroInfoRequest(self.playerId,hero.heroid,1,PLAYER_INFO_VIEW_TYPE.NORMAL,function(msg) + -- if not hero.heroid then + -- return + -- end + -- heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects,msg.guildSkill) + -- GoodFriendManager.InitEquipData(msg.equip,heroData) + -- UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true) + -- end) + -- end) + if type and type==1 then + table.insert(heroList,{heroId=heroTid,position=hero.position}) + end end end - + if type and type==1 then + allTeams[index]=heroList + end + end end diff --git a/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaMainPanel.lua index 34febdb5a4..8114d1ff57 100644 --- a/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaMainPanel.lua @@ -172,7 +172,7 @@ function WorldArenaMainPanel:OnOpen(...) leftTimes=msg.freeTimes WorldArenaManager.SetFreeTime(leftTimes) this.Integral.text="积分:"..msg.newMyscore - this.SetStarShow(rankData.RankLevel,grid,self.sortingOrder) + this.SetStarShow(grid,self.sortingOrder) this.endTime.text="周日23:30赛季结束" LogError("len==="..#msg.arenaEnemys) this:RefreshEnemyData(msg.arenaEnemys)