【建木神树优化】界面中可预览当前神应属性和下级增加属性

dev_chengFeng
ZhangBiao 2022-01-07 19:34:07 +08:00
parent 35aa32fe32
commit 334ba9bd19
3 changed files with 3929 additions and 247 deletions

View File

@ -3,6 +3,8 @@ local this = SacredTreeManager
local treeLevelConfig = ConfigManager.GetConfig(ConfigName.GodHoodTreeLevel) local treeLevelConfig = ConfigManager.GetConfig(ConfigName.GodHoodTreeLevel)
local treeSetting = ConfigManager.GetConfig(ConfigName.GodHoodTreeSetting) local treeSetting = ConfigManager.GetConfig(ConfigName.GodHoodTreeSetting)
local jewerLevelUpConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig) local jewerLevelUpConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig)
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local ClientAttriData = ConfigManager.GetConfigData(ConfigName.GodHoodTreeSetting,0).PropertyUnlcokLevelForClient
function this.Initialize() function this.Initialize()
this.treeLevel = 0 this.treeLevel = 0
@ -145,4 +147,39 @@ function this.CheckRedPoint()
end end
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 return this

View File

@ -8,6 +8,24 @@ local orginLayer = 0
local curTreeLevel = 0 local curTreeLevel = 0
local length = 0 local length = 0
local t = 3 --用来区分长按和点击的临界值 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() function SacredTreePanel:InitComponent()
self.spLoader = SpriteLoader.New() self.spLoader = SpriteLoader.New()
--button --button
@ -16,18 +34,44 @@ function SacredTreePanel:InitComponent()
self.helpBtn = Util.GetGameObject(self.transform, "helpBtn") self.helpBtn = Util.GetGameObject(self.transform, "helpBtn")
self.helpPos = self.helpBtn:GetComponent("RectTransform").localPosition self.helpPos = self.helpBtn:GetComponent("RectTransform").localPosition
self.attriBtn = Util.GetGameObject(self.transform, "attriBtn") self.attriBtn = Util.GetGameObject(self.transform, "attriBtn")
self.upgradeBtn = Util.GetGameObject(self.transform, "upgradeBtn") self.attriNum = Util.GetGameObject(self.attriBtn, "num"):GetComponent("Text")
self.treeRed = Util.GetGameObject(self.transform, "upgradeBtn/redPoint")
--show
self.treeLevel = Util.GetGameObject(self.transform, "bg/level"):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.UI_effect_RecruitPanel_particle = Util.GetGameObject(self.transform, "UI_effect_RecruitPanel_particle")
self.trigger = Util.GetEventTriggerListener(self.upgradeBtn) self.trigger = Util.GetEventTriggerListener(self.upgradeBtn)
self.OnPointerDo = function(go, data) self.OnPointerDo = function(go, data)
self:OnPointerDown1(go, data) self:OnPointerDown1(go, data)
@ -93,7 +137,6 @@ function SacredTreePanel:Refresh(isSend)
end end
-- 重新计算宝物评分 -- 重新计算宝物评分
EquipTreasureManager.SetAllTreasureDirty() EquipTreasureManager.SetAllTreasureDirty()
SacredTreeManager.OnPowerChange(oldPower) SacredTreeManager.OnPowerChange(oldPower)
end end
self.isShortPress = false self.isShortPress = false
@ -129,7 +172,6 @@ function SacredTreePanel:Refresh(isSend)
self:Refresh(true) self:Refresh(true)
return return
end end
end end
end end
@ -150,25 +192,47 @@ function SacredTreePanel:BindEvent()
Util.AddClick(self.attriBtn, function() Util.AddClick(self.attriBtn, function()
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenYingShuXing) UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenYingShuXing)
end) end)
-- Util.AddClick(self.upgradeBtn, function() Util.AddClick(self.jtBtn, function()
-- if curTreeLevel >= length then self.bool = not self.bool
-- PopupTipPanel.ShowTip("神树已达最大等级~") self:ResetDetailPos()
-- else end)
-- local num = BagManager.GetTotalItemNum(treeLevelConfig[curTreeLevel].LvupCost[1])
-- if num < treeLevelConfig[curTreeLevel].LvupCost[2] then Util.AddClick(self.btnChange, function()
-- PopupTipPanel.ShowTip(string.format("%s不足!",itemConfig[treeLevelConfig[curTreeLevel].LvupCost[1]].Name)) local length = self.bool and SacredTreeManager.CulAttri()*50 - 700 or #attriConfig.PropertyUnlcokLevels*50 - 700
-- else self.selectGrid:GetComponent("RectTransform").localPosition = Vector3.New(0,length,0)
-- local oldPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) self.selectMask:SetActive(true)
-- NetManager.UpgradeGodTreeRequest(function () PlayUIAnim(self.selectGrid)
-- if curTreeLevel == 0 then end)
-- PopupTipPanel.ShowTip("成功解锁神树~") for i = 1, 5 do
-- end Util.AddClick(self.selectList[i].btn1, function()
-- SacredTreeManager.OnPowerChange(oldPower) for j = 1, 5 do
-- SacredTreePanel:OnShow() self.selectList[j].select:SetActive(false)
-- end) end
-- end self.selectList[i].select:SetActive(true)
-- end self.selectIndex = Trans[i]
-- end) 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) BindRedPointObject(RedPointType.Sacred,self.treeRed)
FixedUpdateBeat:Add(self.OnUpdate, self)--长按方法注册 FixedUpdateBeat:Add(self.OnUpdate, self)--长按方法注册
end end
@ -227,6 +291,49 @@ function SacredTreePanel:OnShow()
self.needNum.gameObject:SetActive(curTreeLevel < length) self.needNum.gameObject:SetActive(curTreeLevel < length)
end end
self.attriNum.text = SacredTreeManager.CulAttri().."/"..#attriConfig.PropertyUnlcokLevels 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 end
function SacredTreePanel:OnClose() function SacredTreePanel:OnClose()
@ -234,6 +341,8 @@ function SacredTreePanel:OnClose()
-- body -- body
end end
function SacredTreePanel:OnDestroy() function SacredTreePanel:OnDestroy()
self.selectIndex = 5
self.attriList = {}
FixedUpdateBeat:Remove(self.OnUpdate, self) FixedUpdateBeat:Remove(self.OnUpdate, self)
SubUIManager.Close(self.UpView) SubUIManager.Close(self.UpView)
self.spLoader:Destroy() self.spLoader:Destroy()