【四象心法】bug修改

dev_chengFeng
yuanshuai 2021-09-11 17:50:21 +08:00
parent 38947760c1
commit 0d32db8623
5 changed files with 98 additions and 60 deletions

View File

@ -2038,4 +2038,17 @@ function OpenWeb(url)
UnityEngine.Application.OpenURL(url) UnityEngine.Application.OpenURL(url)
end end
end end
end
function GetProfessionNameById(_professionId)
if _professionId==1 then
return "肉盾"
elseif _professionId==2 then
return "输出"
elseif _professionId==3 then
return "控制"
elseif _professionId==4 then
return "辅助"
end
return ""
end end

View File

@ -5606,7 +5606,7 @@ function NetManager.SendSixiangUpStarRequest(_professionId,func)
if curGongmingLv>gongmingLv then if curGongmingLv>gongmingLv then
PopupTipPanel.ShowTip(string.format("进阶成功,并激活了%s级共鸣效果",curGongmingLv)) PopupTipPanel.ShowTip(string.format("进阶成功,并激活了%s级共鸣效果",curGongmingLv))
else else
PopupTipPanel.ShowTip("进阶成功") PopupTipPanel.ShowTip(string.format("四象心法-%s进阶成功",GetProfessionNameById(_professionId)))
end end
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL) NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
if func then if func then

View File

@ -10,14 +10,6 @@ local ProfessionType = {
[4] = 4,--辅助 [4] = 4,--辅助
} }
--职业id对应职业名称
local ProfessionName={
[1] = "肉盾",
[2] = "输出",
[3] = "控制",
[4] = "辅助",
}
local propertyType = { local propertyType = {
[1] = 2,--攻击 [1] = 2,--攻击
[2] = 1,--生命 [2] = 1,--生命
@ -44,7 +36,7 @@ function this:InitComponent()
for i = 1, this.professionGrid.transform.childCount do for i = 1, this.professionGrid.transform.childCount do
local obj= this.professionGrid.transform:GetChild(i-1) local obj= this.professionGrid.transform:GetChild(i-1)
local professionId=ProfessionType[i] local professionId=ProfessionType[i]
Util.GetGameObject(obj,"professionName"):GetComponent("Text").text=ProfessionName[professionId] Util.GetGameObject(obj,"professionName"):GetComponent("Text").text=GetProfessionNameById(professionId)
Util.GetGameObject(obj,"professionIcon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetHeroProfessionById(professionId)) Util.GetGameObject(obj,"professionIcon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetHeroProfessionById(professionId))
local btn=Util.GetGameObject(obj,"btn") local btn=Util.GetGameObject(obj,"btn")
Util.AddClick(btn, function() Util.AddClick(btn, function()
@ -105,8 +97,8 @@ function this:OnOpen(data)
end end
function this.SetPropAdd(_propAddObj,_gongmingLv,isNext) function this.SetPropAdd(_propAddObj,_gongmingLv,isNext)
local curFourQuadConfig = ConfigManager.GetConfigDataByKey(ConfigName.FourQuadrantConfig,"Star",_gongmingLv) if _gongmingLv<=5 then
if curFourQuadConfig then local curFourQuadConfig = ConfigManager.GetConfigDataByKey(ConfigName.FourQuadrantConfig,"Star",_gongmingLv)
_propAddObj.transform.parent.gameObject:SetActive(true) _propAddObj.transform.parent.gameObject:SetActive(true)
for i = 1, #propertyType do for i = 1, #propertyType do
local propertyObj=_propAddObj.transform:GetChild(i-1) local propertyObj=_propAddObj.transform:GetChild(i-1)

View File

@ -15,13 +15,6 @@ local propertyType = {
[3] = 3,--护甲 [3] = 3,--护甲
[4] = 4,--魔抗 [4] = 4,--魔抗
} }
--职业id对应职业名称
local ProfessionName={
[1] = "肉盾",
[2] = "输出",
[3] = "控制",
[4] = "辅助",
}
--属性id对应属性名称 --属性id对应属性名称
local PropertyName={ local PropertyName={
@ -43,6 +36,8 @@ local _isReqLvUp=false
local oldPower = 0 local oldPower = 0
local newPower = 0 local newPower = 0
this.timePressStarted = 0--监听长按时间 this.timePressStarted = 0--监听长按时间
local oldPropMap={}
local barWidth=700
--初始化组件用于子类重写FourQuadrantPopup --初始化组件用于子类重写FourQuadrantPopup
function this:InitComponent() function this:InitComponent()
this.spLoader = SpriteLoader.New() this.spLoader = SpriteLoader.New()
@ -77,6 +72,18 @@ function this:InitComponent()
[2]=this.shuchuBtn, [2]=this.shuchuBtn,
[3]=this.kongzhiBtn, [3]=this.kongzhiBtn,
[4]=this.fuzhuBtn,} [4]=this.fuzhuBtn,}
this.propPreMap={}
for i = 1, #propertyType do
local obj=this.propertyGrid.transform:GetChild(i-1)
local propObjMap={}
propObjMap.bar=Util.GetGameObject(obj.gameObject,"progressBg/progressBar"):GetComponent("RectTransform")
propObjMap.addValue=Util.GetGameObject(obj.gameObject,"progressBg/addValue"):GetComponent("Text")
propObjMap.propertyValueText=Util.GetGameObject(obj.gameObject,"propertyValue"):GetComponent("Text")
propObjMap.propertyNameText=Util.GetGameObject(obj.gameObject,"propertyName"):GetComponent("Text")
propObjMap.propertyIcon=Util.GetGameObject(obj.gameObject,"propertyIcon"):GetComponent("Image")
propObjMap.fade=nil
this.propPreMap[propertyType[i]]=propObjMap
end
this.itemView= SubUIManager.Open(SubUIConfig.ItemView, this.limitCost.transform) this.itemView= SubUIManager.Open(SubUIConfig.ItemView, this.limitCost.transform)
end end
@ -133,7 +140,7 @@ function this:BindEvent()
end) end)
Util.AddClick(this.upStarBtn, function() Util.AddClick(this.upStarBtn, function()
if this.CheckXiuxingLv() then -- if this.CheckXiuxingLv() then
local costArr=fourQuadConfig.RankupCost local costArr=fourQuadConfig.RankupCost
for i = 1, #costArr do for i = 1, #costArr do
if BagManager.GetTotalItemNum(costArr[i][1])<costArr[i][2]then if BagManager.GetTotalItemNum(costArr[i][1])<costArr[i][2]then
@ -142,9 +149,9 @@ function this:BindEvent()
end end
end end
NetManager.SendSixiangUpStarRequest(this.professionId,this.UpStarUpdate) NetManager.SendSixiangUpStarRequest(this.professionId,this.UpStarUpdate)
else -- else
PopupTipPanel.ShowTip("修行等级不满足进阶条件") -- PopupTipPanel.ShowTip("修行等级不满足进阶条件")
end -- end
end) end)
Util.AddClick(this.helpBtn, function() Util.AddClick(this.helpBtn, function()
@ -181,6 +188,7 @@ function this:BindEvent()
LogRed("长按抬起状态") LogRed("长按抬起状态")
_isClicked = false _isClicked = false
_isLongPress = false _isLongPress = false
-- this.ShowAddPropNum(this.professionId)
end end
this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown
@ -235,8 +243,9 @@ function this.SetSelectBtn(_professionId)
end end
function this.UpdateData(_professionId) function this.UpdateData(_professionId)
oldPropMap={}
this.professionId=_professionId; this.professionId=_professionId;
this.curProfessionName=ProfessionName[_professionId] this.curProfessionName=GetProfessionNameById(_professionId)
this.titleText.text="四象心法-"..this.curProfessionName this.titleText.text="四象心法-"..this.curProfessionName
local professionInfo=PracticeManager.FourQuadrantData[_professionId] local professionInfo=PracticeManager.FourQuadrantData[_professionId]
this.professionLv=professionInfo and professionInfo.level or 0 this.professionLv=professionInfo and professionInfo.level or 0
@ -259,26 +268,32 @@ function this.UpdateData(_professionId)
lastPropertyLimit={} lastPropertyLimit={}
end end
this.upStarCostitem= ConfigManager.GetConfigData(ConfigName.ItemConfig,fourQuadConfig.RankupCost[1][1]) if fourQuadConfig.RankupCost then
if this.CheckIsUpStar() then this.upStarCostitem= ConfigManager.GetConfigData(ConfigName.ItemConfig,fourQuadConfig.RankupCost[1][1])
this.limitCost.gameObject:SetActive(false) this.limitHint.gameObject:SetActive(true)
this.limitHint.text=string.format("<color=#24F604>进阶后,四种属性全部提升%s%%</color>",10) if this.CheckIsUpStar() then
this.limitCost.gameObject:SetActive(false)
this.limitHint.text=string.format("<color=#24F604>进阶后,四种属性全部提升%s%%</color>",10)
else
local itemName=this.upStarCostitem.Name
local itemIcon=GetResourcePath(this.upStarCostitem.ResourceID)
this.limitHint.text=string.format("四种属性强化至上限后使用 <color=#24F604>%s</color>进阶",itemName)
this.limitCost.gameObject:SetActive(true)
this.limitCost.sprite=this.spLoader:LoadSprite(itemIcon)
this.itemView:OnOpen(false, {this.upStarCostitem.Id,1}, 0, false,false,false)
end
else else
local itemName=this.upStarCostitem.Name this.limitHint.gameObject:SetActive(false)
local itemIcon=GetResourcePath(this.upStarCostitem.ResourceID)
this.limitHint.text=string.format("四种属性强化至上限后使用 <color=#24F604>%s</color>进阶",itemName)
this.limitCost.gameObject:SetActive(true)
this.limitCost.sprite=this.spLoader:LoadSprite(itemIcon)
this.itemView:OnOpen(false, {this.upStarCostitem.Id,1}, 0, false,false,false)
end end
upStarProperty=PracticeManager.fourQuadrantUpStarPropMap[_professionId]
upStarProperty=PracticeManager.fourQuadrantUpStarPropMap[_professionId]
this.SaveOldProp(propertyList)
this.UpdateBtnStateAndCostShow() this.UpdateBtnStateAndCostShow()
this.UpdateProperty(propertyList) this.UpdateProperty(propertyList)
this.UpdateStarLv() this.UpdateStarLv()
this.professionIcon.sprite = this.spLoader:LoadSprite(GetHeroProfessionById(_professionId)) this.professionIcon.sprite = this.spLoader:LoadSprite(GetHeroProfessionById(_professionId))
end end
---更新职业等级显示
function this.UpdateStarLv() function this.UpdateStarLv()
local lvCount=this.starLv.transform.childCount local lvCount=this.starLv.transform.childCount
for i = 0, lvCount-1 do for i = 0, lvCount-1 do
@ -331,9 +346,9 @@ function this.UpdateBtnStateAndCostShow()
local num = costObj:GetComponent("Text") local num = costObj:GetComponent("Text")
icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(costStr[1])) icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(costStr[1]))
local cueHasNum=BagManager.GetTotalItemNum(costArr[i][1]) local cueHasNum=BagManager.GetTotalItemNum(costArr[i][1])
num.text = string.format("%s/%s",cueHasNum,costStr[2]) num.text = string.format("%s/%s",PrintWanNum2(cueHasNum),costStr[2])
if cueHasNum<costStr[2] then if cueHasNum<costStr[2] then
num.text = string.format("<color=red>%s/%s</color>",cueHasNum,costStr[2]) num.text = string.format("<color=red>%s/%s</color>",PrintWanNum2(cueHasNum),costStr[2])
end end
else else
costObj:SetActive(false); costObj:SetActive(false);
@ -350,28 +365,25 @@ function this.UpdateProperty(_propertyInfoList)
end end
end end
for i = 1, #propertyType do for i = 1, #propertyType do
local obj=this.propertyGrid.transform:GetChild(i-1)
local bar=Util.GetGameObject(obj.gameObject,"progressBg/progressBar"):GetComponent("Image")
local propertyValueText=Util.GetGameObject(obj.gameObject,"propertyValue"):GetComponent("Text")
local propertyNameText=Util.GetGameObject(obj.gameObject,"propertyName"):GetComponent("Text")
local propertyIcon=Util.GetGameObject(obj.gameObject,"propertyIcon"):GetComponent("Image")
local propertyId=propertyType[i] local propertyId=propertyType[i]
propertyIcon.sprite=this.spLoader:LoadSprite(PropertyTypeIconDef[propertyId]) this.propPreMap[propertyId].propertyIcon.sprite=this.spLoader:LoadSprite(PropertyTypeIconDef[propertyId])
propertyNameText.text=string.format("%s神将%s",this.curProfessionName,PropertyName[propertyId]) this.propPreMap[propertyId].propertyNameText.text=string.format("%s神将%s",this.curProfessionName,PropertyName[propertyId])
local propertyNum=_propertyInfoMap[propertyId] and _propertyInfoMap[propertyId] or 0; local propertyNum=_propertyInfoMap[propertyId] and _propertyInfoMap[propertyId] or 0;
local curPropLimit=propertyLimit[propertyId] local curPropLimit=propertyLimit[propertyId]
local propBar=this.propPreMap[propertyId].bar
if this.professionLv>0 then if this.professionLv>0 then
local progressNum=_propertyInfoMap[propertyId]-lastPropertyLimit[propertyId] local progressNum=_propertyInfoMap[propertyId]-lastPropertyLimit[propertyId]
local progressLimit=curPropLimit-lastPropertyLimit[propertyId] local progressLimit=curPropLimit-lastPropertyLimit[propertyId]
bar.fillAmount = progressNum/progressLimit propBar.sizeDelta= Vector2.New(progressNum/progressLimit*barWidth,propBar.sizeDelta.y)
else else
bar.fillAmount = propertyNum/curPropLimit propBar.sizeDelta = Vector2.New(propertyNum/curPropLimit*barWidth.sizeDelta.y)
end end
propertyValueText.text=string.format("%s/%s",propertyNum,curPropLimit) this.propPreMap[propertyId].propertyValueText.text=string.format("%s/%s",propertyNum,curPropLimit)
end end
this.UpdateBtnStateAndCostShow() this.UpdateBtnStateAndCostShow()
_isReqLvUp = false _isReqLvUp = false
this.CheckWinRedPoint() this.CheckWinRedPoint()
this.ShowAddPropNum(this.professionId)
end end
---显示战斗力提升 ---显示战斗力提升
@ -380,6 +392,36 @@ function this.ShowPower()
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPower,newValue = newPower}) UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPower,newValue = newPower})
oldPower = newPower oldPower = newPower
end end
--保存打开界面时初始属性
function this.SaveOldProp(_propertyInfoList)
if _propertyInfoList then
for i = 1, #_propertyInfoList do
oldPropMap[_propertyInfoList[i].propertyId]=_propertyInfoList[i].propertyNum
end
end
end
--显示属性值增加
function this.ShowAddPropNum(_professionId)
local propertyList=PracticeManager.FourQuadrantData[_professionId].propertyList
if propertyList then
for i = 1, #propertyList do
local propertyInfo=propertyList[i]
local addNum=propertyInfo.propertyNum-oldPropMap[propertyInfo.propertyId]
if addNum>0 then
this.propPreMap[propertyInfo.propertyId].addValue.text=string.format("+%s",addNum);
this.propPreMap[propertyInfo.propertyId].addValue.gameObject:SetActive(true)
if this.propPreMap[propertyInfo.propertyId].fade then
this.propPreMap[propertyInfo.propertyId].fade:Kill()
end
this.propPreMap[propertyInfo.propertyId].addValue:DOFade(1, 0)
this.propPreMap[propertyInfo.propertyId].fade= this.propPreMap[propertyInfo.propertyId].addValue:DOFade(0, 3):OnComplete(function()
this.propPreMap[propertyInfo.propertyId].fade=nil
end)
end
oldPropMap[propertyInfo.propertyId]=propertyInfo.propertyNum
end
end
end
--进阶刷新界面 --进阶刷新界面
function this.UpStarUpdate() function this.UpStarUpdate()

View File

@ -537,6 +537,9 @@ function this.CheckIsUpStarByProfessionId(_professionId)
if not professionInfo then if not professionInfo then
return false return false
end end
if professionInfo.level>=5 then
return false
end
local fourQuadConfig = ConfigManager.GetConfigDataByKey(ConfigName.FourQuadrantConfig,"Star",professionInfo.level) local fourQuadConfig = ConfigManager.GetConfigDataByKey(ConfigName.FourQuadrantConfig,"Star",professionInfo.level)
for i = 1, #fourQuadConfig.PropLimit do for i = 1, #fourQuadConfig.PropLimit do
local propLimitArr=fourQuadConfig.PropLimit[i] local propLimitArr=fourQuadConfig.PropLimit[i]
@ -603,16 +606,4 @@ function this.CheckIsUpStarCondition(_professionId)
return true return true
end end
function this.GetGongMingPropList()
local propMap={}
propMap[1]=1000
propMap[2]=1000
propMap[3]=1000
propMap[4]=1000
return propMap
end
return PracticeManager return PracticeManager