【玉虚】挑战界面动画添加,优化界面显示,挑战完成后关闭界面时刷新挑战列表

dev_chengFeng
gaoxin 2021-09-09 18:04:56 +08:00
parent 48e25d05e7
commit ed1f153fa1
3 changed files with 122 additions and 61 deletions

View File

@ -892,7 +892,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -1428,9 +1428,9 @@ RectTransform:
m_Father: {fileID: 5186622360375891445} m_Father: {fileID: 5186622360375891445}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -179} m_AnchoredPosition: {x: 10, y: 308.55}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1493750792 --- !u!1 &1493750792
@ -2011,7 +2011,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -4034,9 +4034,9 @@ RectTransform:
m_Father: {fileID: 5186622360375891445} m_Father: {fileID: 5186622360375891445}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -481} m_AnchoredPosition: {x: 10, y: 6.549988}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &946039569063552125 --- !u!1 &946039569063552125
@ -4072,9 +4072,9 @@ RectTransform:
m_Father: {fileID: 4703390379678214157} m_Father: {fileID: 4703390379678214157}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -783} m_AnchoredPosition: {x: 10, y: -295.44998}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &962637960711437815 --- !u!1 &962637960711437815
@ -6903,7 +6903,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -11028,7 +11028,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -11599,7 +11599,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -11757,7 +11757,7 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 3 m_MinSize: 3
m_MaxSize: 45 m_MaxSize: 45
m_Alignment: 0 m_Alignment: 1
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
@ -13294,9 +13294,9 @@ RectTransform:
m_Father: {fileID: 4703390379678214157} m_Father: {fileID: 4703390379678214157}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -179} m_AnchoredPosition: {x: 10, y: 308.55}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4233438366005003641 --- !u!1 &4233438366005003641
@ -17352,9 +17352,9 @@ RectTransform:
m_Father: {fileID: 4703390379678214157} m_Father: {fileID: 4703390379678214157}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -481} m_AnchoredPosition: {x: 10, y: 6.549988}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &5772368194543481208 --- !u!1 &5772368194543481208
@ -22530,9 +22530,9 @@ RectTransform:
m_Father: {fileID: 5186622360375891445} m_Father: {fileID: 5186622360375891445}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 192.5, y: -783} m_AnchoredPosition: {x: 10, y: -295.44998}
m_SizeDelta: {x: 385, y: 358} m_SizeDelta: {x: 385, y: 358}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7716782139807800611 --- !u!1 &7716782139807800611

View File

@ -2,7 +2,7 @@ require("Base/BasePanel")
local WorldArenaBattleInfoPanel = Inherit(BasePanel) local WorldArenaBattleInfoPanel = Inherit(BasePanel)
local this = WorldArenaBattleInfoPanel local this = WorldArenaBattleInfoPanel
local state=1 -- 1:开战前 2.:开战中 3开战后 local state=1 -- 1:开战前 2.:开战中 3开战后
local myHeadObj=nil local myHeadObj=nil
local enHeadObj=nil local enHeadObj=nil
local resultList={} local resultList={}
@ -14,6 +14,10 @@ local enInfoData=nil
local targetIndex=0 local targetIndex=0
local currIndex=0 local currIndex=0
local isAnim = false
local _CloseFunc = nil
local function OnBeginDrag(self, Pointgo, data) local function OnBeginDrag(self, Pointgo, data)
if state~=1 then if state~=1 then
return return
@ -172,15 +176,38 @@ function this.RefreshBattleCastInfo()
end end
end end
function WorldArenaBattleInfoPanel:PlayFightAnim(leftList, rightList, num, func)
coroutine.start(function()
for i = 1, num do
leftList[i].transform:DOLocalMoveX(90, 0.2, false):OnComplete(function()
leftList[i].transform:DOLocalMoveX(10, 0.3, false):OnComplete(function()
if func then
func(i)
end
end)
end)
rightList[i].transform:DOLocalMoveX(-80, 0.2, false):OnComplete(function()
rightList[i].transform:DOLocalMoveX(10, 0.3, false)
end)
coroutine.wait(0.2)
end
end)
end
--绑定事件(用于子类重写) --绑定事件(用于子类重写)
function WorldArenaBattleInfoPanel:BindEvent() function WorldArenaBattleInfoPanel:BindEvent()
Util.AddClick(this.btn_close, function() Util.AddClick(this.btn_close, function()
self:ClosePanel() if not isAnim then
self:ClosePanel()
end
end) end)
Util.AddClick(this.btn_fight, function() Util.AddClick(this.btn_fight, function()
-- 动画中不能再执行
if isAnim then
return
end
if type~=1 then if type~=1 then
self:ClosePanel() self:ClosePanel()
return return
end end
local list={2001,2002,2003} local list={2001,2002,2003}
NetManager.CrossYuXuLunDaoChallengeRequest(list,enemyId,1,function(msg) NetManager.CrossYuXuLunDaoChallengeRequest(list,enemyId,1,function(msg)
@ -188,35 +215,49 @@ function WorldArenaBattleInfoPanel:BindEvent()
resultList=msg.fightResult resultList=msg.fightResult
fightDataList=msg.fightData fightDataList=msg.fightData
LogError("myscore=="..msg.myScore.."defScore=="..msg.defScore) LogError("myscore=="..msg.myScore.."defScore=="..msg.defScore)
isAnim = true
self:PlayFightAnim(this.leftTeam, this.rightTeam, 3, function(index)
this.ShowBattleState(index,3)
this.playBacks[index]:SetActive(true)
if index >= 3 then
isAnim = false
state = 3
type = 2
this.btnText.text="确定"
end
end)
-- for i = 1, #this.playBacks do -- for i = 1, #this.playBacks do
-- this.playBacks[i]:SetActive(true) -- this.playBacks[i]:SetActive(true)
-- end -- end
--播放打的动画 --播放打的动画
if this.TimeCounter then -- if this.TimeCounter then
this.TimeCounter=nil -- this.TimeCounter=nil
end -- end
local currIndex=1 -- local currIndex=1
local _TimeUpdate=function() -- local _TimeUpdate=function()
this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(101,this.rightTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) -- 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) -- 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("left pos.x=="..this.leftTeam[currIndex].transform.localPosition.x)
LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x) -- LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x)
this.playBacks[currIndex]:SetActive(true) -- this.playBacks[currIndex]:SetActive(true)
this.ShowBattleState(currIndex,3) -- this.ShowBattleState(currIndex,3)
this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition=Vector3.New(192,this.leftTeam[currIndex]:GetComponent("RectTransform").anchoredPosition.y,0) -- 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) -- 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("left pos.x=="..this.leftTeam[currIndex].transform.localPosition.x)
LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x) -- LogError("right pos.x=="..this.rightTeam[currIndex].transform.localPosition.x)
LogError("--------------") -- LogError("--------------")
currIndex=currIndex+1 -- currIndex=currIndex+1
if this.TimeCounter and currIndex>3 then -- if this.TimeCounter and currIndex>3 then
this.TimeCounter:Stop() -- this.TimeCounter:Stop()
this.TimeCounter = nil -- this.TimeCounter = nil
end -- end
end -- end
this.TimeCounter = Timer.New(_TimeUpdate,1.5, -1, true) -- this.TimeCounter = Timer.New(_TimeUpdate,1.5, -1, true)
this.TimeCounter:Start() -- this.TimeCounter:Start()
end) end)
end) end)
@ -271,15 +312,17 @@ function WorldArenaBattleInfoPanel:RemoveListener()
end end
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
function WorldArenaBattleInfoPanel:OnOpen(msg,_type) function WorldArenaBattleInfoPanel:OnOpen(msg,_type, closeFunc)
-- 请求数据 -- 请求数据
-- ArenaManager.RequestArenaRecord() -- ArenaManager.RequestArenaRecord()
type=_type type=_type
_CloseFunc = closeFunc
-- 刷新显示 -- 刷新显示
-- this.RefreshRecordList() -- this.RefreshRecordList()
if state==1 then if state==1 then
for i = 1, 3 do for i = 1, 3 do
this.playBacks[i]:SetActive(false) this.playBacks[i]:SetActive(false)
this.ShowBattleState(i, state)
end end
end end
if type==1 then if type==1 then
@ -424,6 +467,17 @@ function this:OnClose()
this.TimeCounter:Stop() this.TimeCounter:Stop()
this.TimeCounter = nil this.TimeCounter = nil
end end
-- 执行关闭方法
if _CloseFunc then
-- 如果是挑战完成了,返回就刷新挑战列表
if state == 3 then
_CloseFunc()
end
_CloseFunc = nil
end
-- 重置状态
state = 1
isAnim = false
end end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)

View File

@ -96,7 +96,9 @@ function WorldArenaMainPanel:BindEvent()
LogError("/////////////////") LogError("/////////////////")
NetManager.CrossYuXuLunDaoChallengeBeforeRequest(PlayerManager.uid,enemyList[i],function(msg) NetManager.CrossYuXuLunDaoChallengeBeforeRequest(PlayerManager.uid,enemyList[i],function(msg)
LogError("open battleinfo ???") LogError("open battleinfo ???")
UIManager.OpenPanel(UIName.WorldArenaBattleInfoPanel,msg,1) UIManager.OpenPanel(UIName.WorldArenaBattleInfoPanel,msg,1, function()
self:RefreshChallengeList()
end)
end) end)
else else
PopupTipPanel.ShowTip(Language[10092]) PopupTipPanel.ShowTip(Language[10092])
@ -109,14 +111,7 @@ function WorldArenaMainPanel:BindEvent()
end) end)
-- 刷新按钮 -- 刷新按钮
Util.AddClick(this.RefreshBtn, function() Util.AddClick(this.RefreshBtn, function()
PlaySoundWithoutClick("UI_refresh") self:RefreshChallengeList()
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ARENA) then
PopupTipPanel.ShowTip(Language[10075])
return
end
NetManager.CrossYuXuLunDaoChangeEnemyInfoRequest(function(msg)
this:RefreshEnemyData(msg.arenaEnemys)
end)
end) end)
-- 记录按钮 -- 记录按钮
Util.AddClick(this.RecordBtn, function() Util.AddClick(this.RecordBtn, function()
@ -153,6 +148,18 @@ function WorldArenaMainPanel:BindEvent()
end end
-- 刷新挑战列表
function WorldArenaMainPanel:RefreshChallengeList()
if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ARENA) then
PopupTipPanel.ShowTip(Language[10075])
return
end
NetManager.CrossYuXuLunDaoChangeEnemyInfoRequest(function(msg)
PlaySoundWithoutClick("UI_refresh")
this:RefreshEnemyData(msg.arenaEnemys)
end)
end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function WorldArenaMainPanel:AddListener() function WorldArenaMainPanel:AddListener()
end end