local UIBattleRelivePanel = UIViewClass() function UIBattleRelivePanel:OnCreated() self.rightBottom=self.rightBottom.gameObject self.line =self.line.gameObject self.BackGround =self.BackGround.gameObject end function UIBattleRelivePanel:OnOpened(killername) --注册Update self:StartRepeatFunc(self.OnUpdateFun, 0) self.reviveTime = 0 self.timer = 0 self.currentTime = 0 local reliveType = self:GetLevelType() self:SetUILayout(reliveType) self.reviveTime = BattleDataGetter.GetMainPlayerReviveTime() self.labLocal_RelivetTme.text = string.format( "%.0f" , self.reviveTime / 1000) self:SetKiller(killername[1]) self.reviveTotalTime = self.reviveTime / 1000 self.barTime = 0 CTL.Sound.PlayGameSound("SFX_die") end function UIBattleRelivePanel:OnClosed() CTL.Sound.PlayGameSound("SFX_life") end function UIBattleRelivePanel:GetLevelType() local levelID = BattleDataGetter.GetLevelID() local data = DataSheetManager.LevelInfoData:GetDataByLevelID(levelID) if data then return 5--data.RebornType 这个界面都彻底不要了 ,所以删除了也没啥问题 end return 0 end function UIBattleRelivePanel:SetUILayout(reliveType) UIUtils.SetActive(self.line,true) UIUtils.ChangeHeight(self.rightBottom,650) UIUtils.SetLabelText(self.timeLable,Const_IDS.IDS_REBORN_TIME) if(reliveType==0) then UIUtils.SetActive(self.event_NearRelive.gameObject,true) UIUtils.SetActive(self.event_NowRelive.gameObject,true) UIUtils.SetRectPosition(self.event_NearRelive.gameObject,-100,-110) UIUtils.SetRectPosition(self.event_NowRelive.gameObject,100,-110) elseif(reliveType==1)then UIUtils.SetActive(self.event_NearRelive.gameObject,false) UIUtils.SetActive(self.event_NowRelive.gameObject,true) UIUtils.SetRectPosition(self.event_NowRelive.gameObject,0,-110) elseif(reliveType == 2) then self.labLocal_RelivetTme.text = "--" elseif(reliveType == 3) then UIUtils.SetActive(self.event_NearRelive.gameObject,true) UIUtils.SetActive(self.event_NowRelive.gameObject,false) UIUtils.SetActive(self.labLocal_RelivetTme.gameObject,false) UIUtils.SetRectPosition(self.event_NearRelive.gameObject,0,-110) elseif(reliveType == 4) then UIUtils.SetActive(self.event_NearRelive.gameObject,true) UIUtils.SetActive(self.event_NowRelive.gameObject,false) UIUtils.SetActive(self.labLocal_RelivetTme.gameObject,false) UIUtils.SetRectPosition(self.event_NearRelive.gameObject,0,-110) elseif(reliveType == 5) then UIUtils.SetActive(self.event_NearRelive.gameObject,false) UIUtils.SetActive(self.event_NowRelive.gameObject,false) UIUtils.SetActive(self.line,false) UIUtils.SetActive(self.labLocal_RelivetTme.gameObject,true) UIUtils.ChangeHeight(self.rightBottom,410) UIUtils.SetLabelText(self.timeLable,Const_IDS.IDS_REBORN_TIME1) end end function UIBattleRelivePanel:OnClickNowRelive() print("OnClickNowRelive" ) UIManager.CloseView(Const_UI_Lua.UIEnum.UIBattleRelivePanel) --LuaInputManager.SpecialCommand = LuaConst.SpecialCommandType.ReviveNeerby LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.ReviveNeerby) end function UIBattleRelivePanel:OnClickNearRelive() print("OnClickNearRelive" ) UIManager.CloseView(Const_UI_Lua.UIEnum.UIBattleRelivePanel) --LuaInputManager.SpecialCommand = LuaConst.SpecialCommandType.ReviveOnSite LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.ReviveOnSite) end function UIBattleRelivePanel:OnClickMask() UIManager.CloseView(Const_UI_Lua.UIEnum.UIBattleRelivePanel) end --设置凶手 function UIBattleRelivePanel:SetKiller(name) if name == nil then name = "--" end local killer = UIUtils.GetLocalizedTxt(Const_IDS.IDS_REBORN_KILLER) killer = killer .. "" .. name .. "" self.labLocal_LoseTips.text = killer end function UIBattleRelivePanel:OnUpdateFun(deltaTime, timeSinceUpdate) self.timer = timeSinceUpdate - self.currentTime if( self.timer >= 1) then self.currentTime = self.currentTime + self.timer self.reviveTime = BattleDataGetter.GetMainPlayerReviveTime() self.labLocal_RelivetTme.text = string.format( "%.0f" , self.reviveTime / 1000) end if(self.event_NowRelive.gameObject.activeInHierarchy) then self.barTime = self.barTime + deltaTime; UIUtils.SetAtlasImageFillAmount( self.nowReliveBar , 1 - self.barTime / self.reviveTotalTime ) end end function UIBattleRelivePanel:OnButtonClicked(obj) if(obj==self.event_NowRelive) then self:OnClickNowRelive() elseif(obj==self.event_NearRelive) then self:OnClickNearRelive() elseif (obj==self.event_Mask) then self:OnClickMask() end end return UIBattleRelivePanel