小兵替换战力变化添加显示

tcx_xiyou_solider
PC-202302260912\Administrator 2024-03-29 17:29:25 +08:00
parent b55e3bbe71
commit fd3ac0926a
4 changed files with 169056 additions and 25 deletions

View File

@ -569,5 +569,6 @@ GameEvent = {
Solider={
RefreshSoliderInfoWindow = "RefreshSoliderInfoWindow", --刷新小兵界面
RefreshLvInfo ="RefreshLvInfo", --刷新小兵等级
ShowSoliderChangeInfo="RefreshLvInfo",--显示小兵改变信息
},
}

View File

@ -248,6 +248,8 @@ function FightPointPassMainPanel:InitComponent()
this.soliderList[i].lv=Util.GetGameObject(go, "lv"):GetComponent("Text")
this.soliderList[i].type=Util.GetGameObject(go, "type"):GetComponent("Text")
this.soliderList[i].lock=Util.GetGameObject(go, "Image")
this.soliderList[i].effect=Util.GetGameObject(go, "effect")
this.soliderList[i].stateImg=Util.GetGameObject(go, "changeImg"):GetComponent("Image")
end
--战斗部分
this.battlePanel=Util.GetGameObject(self.gameObject, "Bg/battlePanel")
@ -482,6 +484,7 @@ function this.RefreshSoliderInfo()
this.soliderList[i].icon.gameObject:SetActive(true)
this.soliderList[i].lv.gameObject:SetActive(true)
this.soliderList[i].type.gameObject:SetActive(false)
--this.soliderList[i].lock:SetActive(false)
local data=dataList[i]
this.soliderList[i].bg.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(data.quality))
@ -501,18 +504,40 @@ function this.RefreshSoliderInfo()
--this.soliderList[i].lock:SetActive(true)
end
--
this.soliderList[i].effect:SetActive(false)
Util.SetParticleSortLayer(this.soliderList[i].effect,orginLayer+1)
this.soliderList[i].stateImg.gameObject:SetActive(false)
this.soliderList[i].lock:SetActive(CheckListIsContainValue1(openList,i)==false)
end
this.ShowBattleInfo()
end
function this.ShowSoliderChange(_pos,_isUp)
--LogError("_pos======================".._pos.." _isup==="..tostring(_isUp))
this.soliderList[_pos].effect:SetActive(true)
local str=""
if _isUp then
str="r_hero_zhanlishangsheng_png"
else
str="r_hero_zhanlixiajiang_png"
end
this.soliderList[_pos].stateImg.gameObject:SetActive(true)
this.soliderList[_pos].stateImg.sprite=this.spLoader:LoadSprite(str)
Timer.New(function()
this.soliderList[_pos].stateImg.gameObject:SetActive(false)
this.soliderList[_pos].effect:SetActive(false)
end, 5, 1, true):Start()
end
local soliderPreList={}
local bossSpine
function this.ShowBattleInfo()
--显示boss
curSoliderStageConfig=ConfigManager.GetConfigData(ConfigName.SoldierStageConfig,FightPointPassManager.soldierLayerId)
local heroData = ConfigManager.GetConfigData(ConfigName.HeroConfig,curSoliderStageConfig.Hero)
local bossName=GetResourcePath(heroData.Live)
@ -819,6 +844,7 @@ function FightPointPassMainPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Solider.RefreshSoliderInfoWindow, this.RefreshSoliderInfo)
Game.GlobalEvent:AddEvent(GameEvent.Solider.RefreshLvInfo, this.RefreshLvInfo)
Game.GlobalEvent:AddEvent(GameEvent.Mission.OnOpenFight, this.RefreshBossInfo)
Game.GlobalEvent:AddEvent(GameEvent.Solider.ShowSoliderChangeInfo, this.ShowSoliderChange)
end
--移除事件监听(用于子类重写)
@ -841,6 +867,7 @@ function FightPointPassMainPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.RefreshSoliderInfoWindow, this.RefreshSoliderInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.RefreshLvInfo, this.RefreshLvInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.Mission.OnOpenFight, this.RefreshBossInfo)
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.ShowSoliderChangeInfo, this.ShowSoliderChange)
end
--界面打开时调用(用于子类重写)

View File

@ -10,7 +10,10 @@ local oldWarPower=0
local team
local state
local quaName={"粗糙","普通","优良","优秀","稀有","史诗","传说","神话"}
local isUp=true
local type=0
local oldData=nil
local newData=nil
function SmallSoldierInfoPanel:InitComponent()
self.spLoader = SpriteLoader.New()
self.btn_close=Util.GetGameObject(self.gameObject, "mask")
@ -45,34 +48,38 @@ function SmallSoldierInfoPanel:BindEvent()
--上阵按钮
Util.AddClick(self.btn_up,function()
NetManager.ReplaceSoldierRequest(1,0,function ()
self:ClosePanel()
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Solider)
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldWarPower ~= tempPower then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower})
end
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Solider)
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldWarPower ~= tempPower then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower})
end
isUp=true
Game.GlobalEvent:DispatchEvent(GameEvent.Solider.ShowSoliderChangeInfo,newData.type,isUp)
self:ClosePanel()
end)
end)
--替换按钮
Util.AddClick(self.btn_change,function()
NetManager.ReplaceSoldierRequest(1,state,function ()
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Solider)
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldWarPower ~= tempPower then
LogError("tempPower-old=================="..tempPower-oldWarPower)
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower})
isUp= tempPower- oldWarPower>0
oldWarPower=tempPower
end
Game.GlobalEvent:DispatchEvent(GameEvent.Solider.ShowSoliderChangeInfo,newData.type,isUp)
if state==1 then
self:ClosePanel()
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Solider)
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldWarPower ~= tempPower then
LogError("tempPower-old=================="..tempPower-oldWarPower)
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower})
oldWarPower=tempPower
end
else
self:OnShow()
end
end)
end)
@ -93,9 +100,7 @@ function SmallSoldierInfoPanel:RemoveListener()
end
local type=0
local oldData=nil
local newData=nil
--待功能扩展(试图打开某个状态)
function SmallSoldierInfoPanel:OnOpen(...)
local args={...}
@ -259,8 +264,10 @@ end
function SmallSoldierInfoPanel:OnClose()
oldData=nil
newData=nil
end
function SmallSoldierInfoPanel:OnDestroy()