【建木神树优化】界面中可预览当前神应属性和下级增加属性
parent
35aa32fe32
commit
334ba9bd19
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,8 @@ local this = SacredTreeManager
|
|||
local treeLevelConfig = ConfigManager.GetConfig(ConfigName.GodHoodTreeLevel)
|
||||
local treeSetting = ConfigManager.GetConfig(ConfigName.GodHoodTreeSetting)
|
||||
local jewerLevelUpConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig)
|
||||
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||||
local ClientAttriData = ConfigManager.GetConfigData(ConfigName.GodHoodTreeSetting,0).PropertyUnlcokLevelForClient
|
||||
|
||||
function this.Initialize()
|
||||
this.treeLevel = 0
|
||||
|
@ -145,4 +147,39 @@ function this.CheckRedPoint()
|
|||
end
|
||||
end
|
||||
|
||||
--获取当前等级和下一级的数据
|
||||
function this.GetAttriDetail(index)
|
||||
local data = {}
|
||||
local maxSacredLevel = ConfigManager.GetConfigDataByKey(ConfigName.JewelConfig,"GodHoodPool",index).GodHoodMaxlv
|
||||
local level = this.treeLevel < maxSacredLevel and this.treeLevel or maxSacredLevel
|
||||
local configData = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelRankupConfig,"Type",3,"Level",level,"PoolID",index)
|
||||
local configNextData = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelRankupConfig,"Type",3,"Level",level+1,"PoolID",index)
|
||||
if this.treeLevel >= maxSacredLevel then--如果当前神树等级超出魂灵宝所能达到的最大等级就取最大
|
||||
configNextData = nil
|
||||
end
|
||||
-- LogRed("#configData.Property:"..tostring(#configData.Property))
|
||||
for i = 1, #configData.Property do
|
||||
data[i] = {}
|
||||
local bool = MonsterCampManager.GetFourElementTotalWave() >= ClientAttriData[i][2]
|
||||
local color1 = bool and "#F3D98F" or "#A0A0A0"--是否解锁了当前属性
|
||||
local color2 = bool and "#00FF00" or "#A0A0A0"--是否解锁了当前属性
|
||||
if PropertyConfig[configData.Property[i][1]].Style == 1 then
|
||||
data[i].text1 = string.format("<color=%s>%s+%s</color>",color1,PropertyConfig[configData.Property[i][1]].Info,configData.Property[i][2])
|
||||
elseif PropertyConfig[configData.Property[i][1]].Style == 2 then
|
||||
data[i].text1 = string.format("<color=%s>%s+%s",color1,PropertyConfig[configData.Property[i][1]].Info,configData.Property[i][2]/100).."%</color>"
|
||||
end
|
||||
-- LogPink("configNextData:"..tostring(configNextData))
|
||||
if configNextData then
|
||||
if PropertyConfig[configNextData.Property[i][1]].Style == 1 then
|
||||
data[i].text2 = string.format("<color=%s>+%s</color>",color2,configNextData.Property[i][2])
|
||||
elseif PropertyConfig[configNextData.Property[i][1]].Style == 2 then
|
||||
data[i].text2 = string.format("<color=%s>+%s",color2,configNextData.Property[i][2]/100).."%</color>"
|
||||
end
|
||||
else
|
||||
data[i].text2 = "<color=#F3D98F>已达上限</color>"
|
||||
end
|
||||
-- LogGreen(data[i].text1.." "..data[i].text2)
|
||||
end
|
||||
return data
|
||||
end
|
||||
return this
|
|
@ -8,6 +8,24 @@ local orginLayer = 0
|
|||
local curTreeLevel = 0
|
||||
local length = 0
|
||||
local t = 3 --用来区分长按和点击的临界值
|
||||
local lastSelect = 5
|
||||
|
||||
|
||||
local COLOR = {
|
||||
[1] = "#00FF00",
|
||||
[2] = "#0000FF",
|
||||
[3] = "#FF00FF",
|
||||
[4] = "#FFCA00",
|
||||
[5] = "#FF0000",
|
||||
}
|
||||
local Trans = {
|
||||
[1] = 5,
|
||||
[2] = 4,
|
||||
[3] = 3,
|
||||
[4] = 2,
|
||||
[5] = 1,
|
||||
}
|
||||
|
||||
function SacredTreePanel:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
--button
|
||||
|
@ -16,18 +34,44 @@ function SacredTreePanel:InitComponent()
|
|||
self.helpBtn = Util.GetGameObject(self.transform, "helpBtn")
|
||||
self.helpPos = self.helpBtn:GetComponent("RectTransform").localPosition
|
||||
self.attriBtn = Util.GetGameObject(self.transform, "attriBtn")
|
||||
self.upgradeBtn = Util.GetGameObject(self.transform, "upgradeBtn")
|
||||
self.treeRed = Util.GetGameObject(self.transform, "upgradeBtn/redPoint")
|
||||
|
||||
--show
|
||||
self.attriNum = Util.GetGameObject(self.attriBtn, "num"):GetComponent("Text")
|
||||
self.treeLevel = Util.GetGameObject(self.transform, "bg/level"):GetComponent("Text")
|
||||
self.needIcon = Util.GetGameObject(self.transform, "tips/Image"):GetComponent("Image")
|
||||
self.needNum = Util.GetGameObject(self.transform, "tips/num"):GetComponent("Text")
|
||||
self.upGrade = Util.GetGameObject(self.transform, "upgradeBtn/Text"):GetComponent("Text")
|
||||
self.attriNum = Util.GetGameObject(self.transform, "attriBtn/num"):GetComponent("Text")
|
||||
|
||||
--btn
|
||||
self.bottom = Util.GetGameObject(self.transform, "bottom")
|
||||
self.upgradeBtn = Util.GetGameObject(self.bottom, "upgradeBtn")
|
||||
self.treeRed = Util.GetGameObject(self.upgradeBtn, "redPoint")
|
||||
self.upGrade = Util.GetGameObject(self.upgradeBtn, "Text"):GetComponent("Text")
|
||||
|
||||
--tips
|
||||
self.tips = Util.GetGameObject(self.bottom, "tips")
|
||||
self.needIcon = Util.GetGameObject(self.tips, "Image"):GetComponent("Image")
|
||||
self.needNum = Util.GetGameObject(self.tips, "num"):GetComponent("Text")
|
||||
|
||||
--详细信息部分
|
||||
self.attriDetail = Util.GetGameObject(self.transform, "attriDetail")
|
||||
self.title = Util.GetGameObject(self.attriDetail, "Grid/Top/Title"):GetComponent("Text")
|
||||
self.btnChange = Util.GetGameObject(self.attriDetail, "Grid/Top/btnChange")
|
||||
self.attriGrid = Util.GetGameObject(self.attriDetail, "Grid/Attributions")
|
||||
self.attriPre = Util.GetGameObject(self.attriGrid, "attriPre")
|
||||
self.jtBtn = Util.GetGameObject(self.transform, "jtBtn")
|
||||
self.jtImg = Util.GetGameObject(self.jtBtn, "Image")
|
||||
self.attriList = {}
|
||||
self.bool = true--箭头按钮
|
||||
self.selectIndex = 5
|
||||
self.selectMask = Util.GetGameObject(self.transform, "Mask")
|
||||
self.selectGrid = Util.GetGameObject(self.selectMask, "selectGrid")
|
||||
self.selectList = {}
|
||||
for i = 1, 5 do
|
||||
self.selectList[i] = {}
|
||||
self.selectList[i].btn1 = Util.GetGameObject(self.selectMask, "selectGrid/Pre ("..i..")/Image")
|
||||
self.selectList[i].btn2 = Util.GetGameObject(self.selectMask, "selectGrid/Pre ("..i..")/Text")
|
||||
self.selectList[i].select = Util.GetGameObject(self.selectMask, "selectGrid/Pre ("..i..")/Select")
|
||||
self.selectList[i].select:SetActive(false)
|
||||
end
|
||||
|
||||
--特效加长按
|
||||
self.UI_effect_RecruitPanel_particle = Util.GetGameObject(self.transform, "UI_effect_RecruitPanel_particle")
|
||||
|
||||
self.trigger = Util.GetEventTriggerListener(self.upgradeBtn)
|
||||
self.OnPointerDo = function(go, data)
|
||||
self:OnPointerDown1(go, data)
|
||||
|
@ -93,20 +137,19 @@ function SacredTreePanel:Refresh(isSend)
|
|||
end
|
||||
-- 重新计算宝物评分
|
||||
EquipTreasureManager.SetAllTreasureDirty()
|
||||
|
||||
SacredTreeManager.OnPowerChange(oldPower)
|
||||
end
|
||||
self.isShortPress = false
|
||||
self.numCount = 0
|
||||
self:RequestDonate(self.num)
|
||||
self:RequestDonate(self.num)
|
||||
else
|
||||
self.num = self.num + 1
|
||||
BagManager.HeroLvUpUpdateItemsNum(treeLevelConfig[curTreeLevel].LvupCost[1],treeLevelConfig[curTreeLevel].LvupCost[2])
|
||||
BagManager.HeroLvUpUpdateItemsNum(treeLevelConfig[curTreeLevel].LvupCost[1],treeLevelConfig[curTreeLevel].LvupCost[2])
|
||||
self.itemNum = BagManager.GetTotalItemNum(treeLevelConfig[curTreeLevel].LvupCost[1])
|
||||
if curTreeLevel == 0 then
|
||||
PopupTipPanel.ShowTip("成功解锁神树~")
|
||||
end
|
||||
SacredTreeManager.treeLevel = SacredTreeManager.treeLevel + 1
|
||||
SacredTreeManager.treeLevel = SacredTreeManager.treeLevel + 1
|
||||
curTreeLevel = curTreeLevel + 1
|
||||
local oldPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||||
EquipTreasureManager.ChangeTreeLv()
|
||||
|
@ -128,14 +171,13 @@ function SacredTreePanel:Refresh(isSend)
|
|||
self.isPressed = false
|
||||
self:Refresh(true)
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SacredTreePanel:RequestDonate(num)
|
||||
NetManager.UpgradeGodTreeRequest(num,function ()
|
||||
self.num = 0
|
||||
NetManager.UpgradeGodTreeRequest(num,function ()
|
||||
self.num = 0
|
||||
self:OnShow()
|
||||
end)
|
||||
end
|
||||
|
@ -150,25 +192,47 @@ function SacredTreePanel:BindEvent()
|
|||
Util.AddClick(self.attriBtn, function()
|
||||
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenYingShuXing)
|
||||
end)
|
||||
-- Util.AddClick(self.upgradeBtn, function()
|
||||
-- if curTreeLevel >= length then
|
||||
-- PopupTipPanel.ShowTip("神树已达最大等级~")
|
||||
-- else
|
||||
-- local num = BagManager.GetTotalItemNum(treeLevelConfig[curTreeLevel].LvupCost[1])
|
||||
-- if num < treeLevelConfig[curTreeLevel].LvupCost[2] then
|
||||
-- PopupTipPanel.ShowTip(string.format("%s不足!",itemConfig[treeLevelConfig[curTreeLevel].LvupCost[1]].Name))
|
||||
-- else
|
||||
-- local oldPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||||
-- NetManager.UpgradeGodTreeRequest(function ()
|
||||
-- if curTreeLevel == 0 then
|
||||
-- PopupTipPanel.ShowTip("成功解锁神树~")
|
||||
-- end
|
||||
-- SacredTreeManager.OnPowerChange(oldPower)
|
||||
-- SacredTreePanel:OnShow()
|
||||
-- end)
|
||||
-- end
|
||||
-- end
|
||||
-- end)
|
||||
Util.AddClick(self.jtBtn, function()
|
||||
self.bool = not self.bool
|
||||
self:ResetDetailPos()
|
||||
end)
|
||||
|
||||
Util.AddClick(self.btnChange, function()
|
||||
local length = self.bool and SacredTreeManager.CulAttri()*50 - 700 or #attriConfig.PropertyUnlcokLevels*50 - 700
|
||||
self.selectGrid:GetComponent("RectTransform").localPosition = Vector3.New(0,length,0)
|
||||
self.selectMask:SetActive(true)
|
||||
PlayUIAnim(self.selectGrid)
|
||||
end)
|
||||
for i = 1, 5 do
|
||||
Util.AddClick(self.selectList[i].btn1, function()
|
||||
for j = 1, 5 do
|
||||
self.selectList[j].select:SetActive(false)
|
||||
end
|
||||
self.selectList[i].select:SetActive(true)
|
||||
self.selectIndex = Trans[i]
|
||||
end)
|
||||
Util.AddClick(self.selectList[i].btn2, function()
|
||||
for j = 1, 5 do
|
||||
self.selectList[j].select:SetActive(false)
|
||||
end
|
||||
self.selectList[i].select:SetActive(true)
|
||||
self.selectIndex = Trans[i]
|
||||
end)
|
||||
end
|
||||
Util.AddClick(self.selectMask, function()
|
||||
self.selectMask:SetActive(false)
|
||||
if lastSelect == self.selectIndex then
|
||||
return
|
||||
end
|
||||
lastSelect = self.selectIndex
|
||||
for index, value in ipairs(self.attriList) do
|
||||
value.transform:DORotate(Vector3.New(90,0,0),0.3):OnComplete(function ()
|
||||
-- value.transform.rotation=Vector3.New(-90,0,0)
|
||||
self:SetAttriDetail()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
BindRedPointObject(RedPointType.Sacred,self.treeRed)
|
||||
FixedUpdateBeat:Add(self.OnUpdate, self)--长按方法注册
|
||||
end
|
||||
|
@ -227,6 +291,49 @@ function SacredTreePanel:OnShow()
|
|||
self.needNum.gameObject:SetActive(curTreeLevel < length)
|
||||
end
|
||||
self.attriNum.text = SacredTreeManager.CulAttri().."/"..#attriConfig.PropertyUnlcokLevels
|
||||
--设置中间属性
|
||||
self:SetAttriDetail()
|
||||
end
|
||||
|
||||
|
||||
function SacredTreePanel:SetAttriDetail()
|
||||
local curSelectIndex = self.selectIndex
|
||||
if curTreeLevel <= 0 then
|
||||
self.attriDetail:SetActive(false)
|
||||
else
|
||||
self.attriDetail:SetActive(true)
|
||||
self.title.text = string.format("<color=%s>%s宝物神应属性</color>",COLOR[curSelectIndex],QualityNameDef[curSelectIndex+1])
|
||||
local data = SacredTreeManager.GetAttriDetail(curSelectIndex)
|
||||
for index, value in ipairs(data) do
|
||||
local go = self.attriList[index]
|
||||
if not go then
|
||||
go = newObjToParent(self.attriPre,self.attriGrid.transform)
|
||||
self.attriList[index] = go
|
||||
go:SetActive(true)
|
||||
end
|
||||
PlayUIAnim(go)
|
||||
Util.GetGameObject(go,"curAttri"):GetComponent("Text").text = value.text1
|
||||
Util.GetGameObject(go,"nextAttri"):GetComponent("Text").text = value.text2
|
||||
end
|
||||
self:InitDetailPos()
|
||||
end
|
||||
end
|
||||
|
||||
function SacredTreePanel:InitDetailPos()
|
||||
self.selectMask:SetActive(false)
|
||||
self.selectList[Trans[self.selectIndex]].select:SetActive(true)
|
||||
local rotation = self.bool and Vector3.zero or Vector3.New(179,0,0)
|
||||
local length = self.bool and 170 + SacredTreeManager.CulAttri()*50 or 170 + #attriConfig.PropertyUnlcokLevels*50
|
||||
self.jtImg:GetComponent("RectTransform").rotation = Quaternion.Euler(rotation)
|
||||
self.attriDetail:GetComponent("RectTransform").sizeDelta = Vector3(0,length,0)
|
||||
end
|
||||
|
||||
function SacredTreePanel:ResetDetailPos()
|
||||
local length = self.bool and 170 + SacredTreeManager.CulAttri()*50 or 170 + #attriConfig.PropertyUnlcokLevels*50
|
||||
local size = Vector2.New(1080,length)
|
||||
local rotation = self.bool and 0 or 179
|
||||
self.attriDetail.transform:DOSizeDelta(size, 0.8)
|
||||
self.jtImg.transform:DORotateQuaternion(Quaternion.Euler(Vector3.New(rotation,0,0)),0.8)
|
||||
end
|
||||
|
||||
function SacredTreePanel:OnClose()
|
||||
|
@ -234,10 +341,12 @@ function SacredTreePanel:OnClose()
|
|||
-- body
|
||||
end
|
||||
function SacredTreePanel:OnDestroy()
|
||||
self.selectIndex = 5
|
||||
self.attriList = {}
|
||||
FixedUpdateBeat:Remove(self.OnUpdate, self)
|
||||
SubUIManager.Close(self.UpView)
|
||||
self.spLoader:Destroy()
|
||||
ClearRedPointObject(RedPointType.Sacred,self.treeRed)
|
||||
ClearRedPointObject(RedPointType.Sacred,self.treeRed)
|
||||
end
|
||||
|
||||
return SacredTreePanel
|
Loading…
Reference in New Issue