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