符文自动淬炼修改、特效完善
This commit is contained in:
parent
a69389e473
commit
129528ee50
@ -167,6 +167,7 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
ACT_PVP_RANK_REWARD = "ActPvpRankReward",
|
ACT_PVP_RANK_REWARD = "ActPvpRankReward",
|
||||||
ACT_PVP_BUY_BOUNTY_LEVEL = "ActPvpBuyBountyLevel",
|
ACT_PVP_BUY_BOUNTY_LEVEL = "ActPvpBuyBountyLevel",
|
||||||
RUNES_QUENCHING = "RuneQuenching",
|
RUNES_QUENCHING = "RuneQuenching",
|
||||||
|
RUNES_AUTO_QUENCHING = "RuneAutoQuenching",
|
||||||
RUNES_GIFT = "RuneGift",
|
RUNES_GIFT = "RuneGift",
|
||||||
FULL_MOON_TASK = "FullMoonTask",
|
FULL_MOON_TASK = "FullMoonTask",
|
||||||
FULL_MOON_TASK_PROG_REWARD = "FullMoonTaskProgReward",
|
FULL_MOON_TASK_PROG_REWARD = "FullMoonTaskProgReward",
|
||||||
|
|||||||
@ -29,4 +29,12 @@ RunesConst.MAX_SUITS_COUNT = 5
|
|||||||
-- 最大符文种类个数
|
-- 最大符文种类个数
|
||||||
RunesConst.MAX_ATTR_COUNT = 11
|
RunesConst.MAX_ATTR_COUNT = 11
|
||||||
|
|
||||||
|
|
||||||
|
-- 假数据个数
|
||||||
|
RunesConst.FAKE_DATA_COUNT = 10
|
||||||
|
-- 自动淬炼频率n次/s
|
||||||
|
RunesConst.AUTO_INTERVAL = 10
|
||||||
|
-- 同步服务器数据间隔,单位s
|
||||||
|
RunesConst.SYNC_INTERVAL = 10
|
||||||
|
|
||||||
return RunesConst
|
return RunesConst
|
||||||
@ -1,5 +1,10 @@
|
|||||||
local RunesManager = class("RunesManager", BaseModule)
|
local RunesManager = class("RunesManager", BaseModule)
|
||||||
|
|
||||||
|
-- 当前是否处于自动淬炼中
|
||||||
|
function RunesManager:isInAutoQuenching()
|
||||||
|
return self.isAutoQuenching == true
|
||||||
|
end
|
||||||
|
|
||||||
-- 锁定和解锁属性栏
|
-- 锁定和解锁属性栏
|
||||||
function RunesManager:reqChangeLockGrid(heroId, index, isLock)
|
function RunesManager:reqChangeLockGrid(heroId, index, isLock)
|
||||||
if self.isReqLockChange then
|
if self.isReqLockChange then
|
||||||
@ -18,17 +23,11 @@ function RunesManager:rspChangeLockGrid(result)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 淬炼
|
-- 淬炼
|
||||||
function RunesManager:reqQuenching(heroId, autoCount)
|
function RunesManager:reqQuenching(heroId)
|
||||||
if self.isReqQuenching then
|
self:sendMessage(ProtoMsgType.FromMsgEnum.RuneQuenchingReq, {hero_id = heroId}, {}, self.rspQuenching, BIReport.ITEM_GET_TYPE.RUNES_QUENCHING)
|
||||||
return
|
|
||||||
end
|
|
||||||
self.isReqQuenching = true
|
|
||||||
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.RuneQuenchingReq, {hero_id = heroId, auto_count = autoCount}, {}, self.rspQuenching, BIReport.ITEM_GET_TYPE.RUNES_QUENCHING)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function RunesManager:rspQuenching(result)
|
function RunesManager:rspQuenching(result)
|
||||||
self.isReqQuenching = false
|
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
DataManager.RunesData:onQuenchingSuccess(result.level, result.exp, result.reqData.hero_id, result.hero_girds.grids)
|
DataManager.RunesData:onQuenchingSuccess(result.level, result.exp, result.reqData.hero_id, result.hero_girds.grids)
|
||||||
|
|
||||||
@ -40,6 +39,47 @@ function RunesManager:rspQuenching(result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取自动淬炼数据
|
||||||
|
function RunesManager:reqAutoQuenching(heroId)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.RuneQuenchingAutoReq, {hero_id = heroId}, {}, self.rspAutoQuenching)
|
||||||
|
end
|
||||||
|
|
||||||
|
function RunesManager:rspAutoQuenching(result)
|
||||||
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
self.isAutoQuenching = true
|
||||||
|
DataManager.RunesData:onGetAutoQuenchingDataSuccess(result.reqData.hero_id, result.count, result.stop_with_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 同步淬炼结果,共有四种情况
|
||||||
|
--1、玩家手动停止(停止)
|
||||||
|
--2、材料不够(停止)
|
||||||
|
--3、自动次数用完(同步已执行次数,继续请求自动数据)
|
||||||
|
function RunesManager:reqSyncQuenching(isEnd)
|
||||||
|
if self.isSyncQuenching then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.isSyncQuenching = true
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.RuneQuenchingAutoSyncReq, {count = DataManager.RunesData:getExecutedAutoCount(), isEnd = isEnd}, {}, self.rspSyncQuenching, BIReport.ITEM_GET_TYPE.RUNES_AUTO_QUENCHING)
|
||||||
|
end
|
||||||
|
|
||||||
|
function RunesManager:rspSyncQuenching(result)
|
||||||
|
self.isSyncQuenching = false
|
||||||
|
if result.reqData.isEnd then
|
||||||
|
-- 停止
|
||||||
|
self.isAutoQuenching = false
|
||||||
|
end
|
||||||
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
if not result.reqData.isEnd then
|
||||||
|
-- 同步已执行次数,继续请求自动数据
|
||||||
|
ModuleManager.RunesManager:reqAutoQuenching(DataManager.RunesData:getAutoHeroId())
|
||||||
|
end
|
||||||
|
DataManager.RunesData:onAutoQuenchingSuccess(result.level, result.exp, result.hero_girds.grids)
|
||||||
|
else
|
||||||
|
DataManager.RunesData:onAutoQuenchingFailed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function RunesManager:rspUpdate(result)
|
function RunesManager:rspUpdate(result)
|
||||||
DataManager.RunesData:init(result.rune)
|
DataManager.RunesData:init(result.rune)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,6 +18,12 @@ function HeroDetailUI:onPressBackspace()
|
|||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroDetailUI:onClose()
|
||||||
|
if self.compRunes then
|
||||||
|
self.compRunes:onClose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function HeroDetailUI:ctor(parmas)
|
function HeroDetailUI:ctor(parmas)
|
||||||
self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
|
self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
|
||||||
self.formationType = parmas.formationType
|
self.formationType = parmas.formationType
|
||||||
@ -228,6 +234,11 @@ function HeroDetailUI:refreshRedPoint()
|
|||||||
else
|
else
|
||||||
self.btnArmor:removeRedPoint()
|
self.btnArmor:removeRedPoint()
|
||||||
end
|
end
|
||||||
|
if DataManager.RunesData:hasRedPoint() then
|
||||||
|
self.btnRunes:addRedPoint(-55, 0, 0.6)
|
||||||
|
else
|
||||||
|
self.btnRunes:removeRedPoint()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:showHeroInfo()
|
function HeroDetailUI:showHeroInfo()
|
||||||
|
|||||||
@ -3,6 +3,13 @@ local RunesInfoComp = class("RunesInfoComp", LuaComponent)
|
|||||||
local LOCK_ICON = "common_lock"
|
local LOCK_ICON = "common_lock"
|
||||||
local UNLOCK_ICON = "common_lock_1"
|
local UNLOCK_ICON = "common_lock_1"
|
||||||
|
|
||||||
|
function RunesInfoComp:onClose()
|
||||||
|
if self.autoSid then
|
||||||
|
self.baseObject:unscheduleGlobal(self.autoSid)
|
||||||
|
self.autoSid = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function RunesInfoComp:init()
|
function RunesInfoComp:init()
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
self.btnHelp = uiMap["runes_info.btn_help"]
|
self.btnHelp = uiMap["runes_info.btn_help"]
|
||||||
@ -22,6 +29,9 @@ function RunesInfoComp:init()
|
|||||||
self.txAuto = uiMap["runes_info.bottom.btn_auto.tx_auto"]
|
self.txAuto = uiMap["runes_info.bottom.btn_auto.tx_auto"]
|
||||||
self.txEmpty = uiMap["runes_info.suits.tx_empty"]
|
self.txEmpty = uiMap["runes_info.suits.tx_empty"]
|
||||||
self.mask = uiMap["runes_info.bottom.mask"]
|
self.mask = uiMap["runes_info.bottom.mask"]
|
||||||
|
self.btnAutoEnd = uiMap["runes_info.bottom.btn_auto_end"]
|
||||||
|
self.txAutoEnd = uiMap["runes_info.bottom.btn_auto_end.tx_end"]
|
||||||
|
self.suitsNode = uiMap["runes_info.suits"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
self.suits = {}
|
self.suits = {}
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
self.suits[i] = uiMap["runes_info.suits.item_suit_" .. i]
|
self.suits[i] = uiMap["runes_info.suits.item_suit_" .. i]
|
||||||
@ -34,8 +44,9 @@ function RunesInfoComp:init()
|
|||||||
self.mask:setActive(false)
|
self.mask:setActive(false)
|
||||||
self.txSuit:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_2))
|
self.txSuit:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_2))
|
||||||
self.txUse:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_5))
|
self.txUse:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_5))
|
||||||
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_4))
|
|
||||||
self.txEmpty:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_23))
|
self.txEmpty:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_23))
|
||||||
|
self.txAutoEnd:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_29))
|
||||||
|
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_4))
|
||||||
|
|
||||||
self.itemMaterial:addClickListener(function()
|
self.itemMaterial:addClickListener(function()
|
||||||
UIManager:showUI("app/ui/runes/runes_source_ui")
|
UIManager:showUI("app/ui/runes/runes_source_ui")
|
||||||
@ -51,19 +62,19 @@ function RunesInfoComp:init()
|
|||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_27, DataManager.RunesData:getAutoMakeOpenLevel()))
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_27, DataManager.RunesData:getAutoMakeOpenLevel()))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if self.autoSid == nil then
|
local params ={
|
||||||
local params ={
|
content = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_21),
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_21),
|
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.RUNES_AUTO,
|
||||||
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.RUNES_AUTO,
|
okFunc = function()
|
||||||
okFunc = function()
|
self:checkQuenching(true)
|
||||||
self:checkQuenching(true)
|
end,
|
||||||
end,
|
}
|
||||||
}
|
GFunc.showMessageBox(params)
|
||||||
GFunc.showMessageBox(params)
|
end)
|
||||||
else
|
self.btnAutoEnd:addClickListener(function()
|
||||||
self:endAutoQuenching()
|
-- 玩家点击停止自动淬炼
|
||||||
end
|
ModuleManager.RunesManager:reqSyncQuenching(true)
|
||||||
end)
|
end)
|
||||||
self.btnUse:addClickListener(function()
|
self.btnUse:addClickListener(function()
|
||||||
self:checkQuenching(false)
|
self:checkQuenching(false)
|
||||||
@ -81,8 +92,70 @@ function RunesInfoComp:setHeroData(heroEntity)
|
|||||||
self.runesEntity = DataManager.RunesData:getRunes(self.heroEntity:getCfgId())
|
self.runesEntity = DataManager.RunesData:getRunes(self.heroEntity:getCfgId())
|
||||||
end
|
end
|
||||||
|
|
||||||
function RunesInfoComp:refresh()
|
function RunesInfoComp:updateData()
|
||||||
|
self.exp = self.runesEntity:getExp()
|
||||||
|
end
|
||||||
|
|
||||||
|
function RunesInfoComp:refresh()
|
||||||
|
if self.autoSid then
|
||||||
|
self.baseObject:unscheduleGlobal(self.autoSid)
|
||||||
|
self.autoSid = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if ModuleManager.RunesManager:isInAutoQuenching() then
|
||||||
|
self:startAutoQuenching()
|
||||||
|
return
|
||||||
|
elseif self.isAutoQuenching then
|
||||||
|
-- 结束自动淬炼
|
||||||
|
self:endAutoQuenching()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.txCost:setText(GFunc.getRewardNum(self.runesEntity:getMaterialCost()))
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost)
|
||||||
|
if DataManager.RunesData:canAutoMake() then
|
||||||
|
self.spineAuto:playAnim("idle", true, true)
|
||||||
|
else
|
||||||
|
self.spineAuto:playAnim("idle2", true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:refreshLevelExp()
|
||||||
|
self:refreshSuit()
|
||||||
|
self:refreshRunes()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 自动淬炼刷新
|
||||||
|
function RunesInfoComp:autoQuenching()
|
||||||
|
self.tempExp = self.tempExp + self.tempCostNum
|
||||||
|
self.tempMaterialCount = self.tempMaterialCount - self.tempCostNum
|
||||||
|
self.tempLevel = DataManager.RunesData:getLevelByExp(self.tempExp)
|
||||||
|
|
||||||
|
local curCfg = DataManager.RunesData:getLevelConfig()[self.tempLevel]
|
||||||
|
local nextCfg = DataManager.RunesData:getLevelConfig()[self.tempLevel + 1]
|
||||||
|
local maxExp = (nextCfg and nextCfg.cost or 0) - (curCfg and curCfg.cost or 0)
|
||||||
|
if maxExp then
|
||||||
|
local levelExp = self.tempExp - (curCfg and curCfg.cost or 0)
|
||||||
|
self.imgProg.value = levelExp / maxExp
|
||||||
|
self.txProg:setText(levelExp .. "/" .. maxExp)
|
||||||
|
else
|
||||||
|
self.imgProg.value = 1
|
||||||
|
self.txProg:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
|
||||||
|
end
|
||||||
|
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_1, self.tempLevel))
|
||||||
|
self.txNum:setText(self.tempMaterialCount)
|
||||||
|
|
||||||
|
self:refreshSuit()
|
||||||
|
self:refreshRunes()
|
||||||
|
|
||||||
|
if self.tempMaterialCount < self.tempCostNum then
|
||||||
|
-- 材料不够,结束自动淬炼
|
||||||
|
ModuleManager.RunesManager:reqSyncQuenching(true)
|
||||||
|
else
|
||||||
|
DataManager.RunesData:onAutoQuenchingOnce()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 刷新等级经验、道具个数
|
||||||
|
function RunesInfoComp:refreshLevelExp()
|
||||||
local curExp = DataManager.RunesData:getLevelExp()
|
local curExp = DataManager.RunesData:getLevelExp()
|
||||||
local maxExp = DataManager.RunesData:getNextLevelTotalExp()
|
local maxExp = DataManager.RunesData:getNextLevelTotalExp()
|
||||||
if maxExp then
|
if maxExp then
|
||||||
@ -92,21 +165,8 @@ function RunesInfoComp:refresh()
|
|||||||
self.imgProg.value = 1
|
self.imgProg.value = 1
|
||||||
self.txProg:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
|
self.txProg:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.autoSid == nil then
|
|
||||||
if DataManager.RunesData:canAutoMake() then
|
|
||||||
self.spineAuto:playAnim("idle", true, true)
|
|
||||||
else
|
|
||||||
self.spineAuto:playAnim("idle2", true, true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.txNum:setText(DataManager.RunesData:getMaterialCount())
|
|
||||||
self.txCost:setText(GFunc.getRewardNum(self.runesEntity:getMaterialCost()))
|
|
||||||
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_1, DataManager.RunesData:getLevel()))
|
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_1, DataManager.RunesData:getLevel()))
|
||||||
GFunc.centerImgAndTx(self.imgCost, self.txCost)
|
self.txNum:setText(DataManager.RunesData:getMaterialCount())
|
||||||
|
|
||||||
self:refreshSuit()
|
|
||||||
self:refreshRunes()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 刷新符文
|
-- 刷新符文
|
||||||
@ -121,7 +181,7 @@ function RunesInfoComp:refreshRunes()
|
|||||||
local txLock = map["tx_lock"]
|
local txLock = map["tx_lock"]
|
||||||
obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR).enabled = false
|
obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR).enabled = false
|
||||||
|
|
||||||
if DataManager.RunesData:isUnlock(index) then
|
if ModuleManager.RunesManager:isInAutoQuenching() and index <= DataManager.RunesData:getLevelConfig()[self.tempLevel].grid or DataManager.RunesData:isUnlock(index) then
|
||||||
lock:setActive(false)
|
lock:setActive(false)
|
||||||
local qlt = self.runesEntity:getGridQuality(index)
|
local qlt = self.runesEntity:getGridQuality(index)
|
||||||
if qlt then
|
if qlt then
|
||||||
@ -172,6 +232,8 @@ function RunesInfoComp:refreshSuit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.txEmpty:setActive(isEmpty)
|
self.txEmpty:setActive(isEmpty)
|
||||||
|
|
||||||
|
self.suitsNode:RefreshLayout()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 检查淬炼
|
-- 检查淬炼
|
||||||
@ -207,39 +269,45 @@ end
|
|||||||
function RunesInfoComp:reqQuenching(isAuto)
|
function RunesInfoComp:reqQuenching(isAuto)
|
||||||
if isAuto then
|
if isAuto then
|
||||||
-- 自动淬炼
|
-- 自动淬炼
|
||||||
|
self.isAutoQuenching = true
|
||||||
self.mask:setActive(true)
|
self.mask:setActive(true)
|
||||||
self.autoSid = self.baseObject:scheduleGlobal(function()
|
self.btnUse:setActive(false)
|
||||||
local cost = self.runesEntity:getMaterialCost()
|
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_30))
|
||||||
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
|
||||||
self:endAutoQuenching()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
ModuleManager.RunesManager:reqQuenching(self.heroEntity:getCfgId(), 0)
|
|
||||||
end, 1 / 3)
|
|
||||||
self.spineAuto:playAnim("attack", true, true)
|
self.spineAuto:playAnim("attack", true, true)
|
||||||
|
ModuleManager.RunesManager:reqAutoQuenching(self.heroEntity:getCfgId())
|
||||||
else
|
else
|
||||||
-- 单次淬炼
|
-- 单次淬炼
|
||||||
ModuleManager.RunesManager:reqQuenching(self.heroEntity:getCfgId(), 0)
|
ModuleManager.RunesManager:reqQuenching(self.heroEntity:getCfgId())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 开始自动淬炼
|
||||||
|
function RunesInfoComp:startAutoQuenching()
|
||||||
|
self.tempLevel = DataManager.RunesData:getLevel()
|
||||||
|
self.tempExp = DataManager.RunesData:getExp()
|
||||||
|
self.tempCostNum = self.runesEntity:getMaterialCostNum()
|
||||||
|
self.tempMaterialCount = DataManager.RunesData:getMaterialCount()
|
||||||
|
|
||||||
|
self.autoSid = self.baseObject:scheduleGlobal(function() self:autoQuenching() end, 1 / GConst.RunesConst.AUTO_INTERVAL)
|
||||||
|
end
|
||||||
|
|
||||||
-- 结束自动淬炼
|
-- 结束自动淬炼
|
||||||
function RunesInfoComp:endAutoQuenching()
|
function RunesInfoComp:endAutoQuenching()
|
||||||
|
self.isAutoQuenching = false
|
||||||
self.mask:setActive(false)
|
self.mask:setActive(false)
|
||||||
if self.autoSid then
|
self.btnUse:setActive(true)
|
||||||
self.baseObject:unscheduleGlobal(self.autoSid)
|
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_4))
|
||||||
self.autoSid = nil
|
self.spineAuto:playAnim("idle", true, true)
|
||||||
end
|
|
||||||
|
|
||||||
for index, obj in ipairs(self.grids) do
|
for index, obj in ipairs(self.grids) do
|
||||||
if DataManager.RunesData:isUnlock(index) then
|
local qlt = self.runesEntity:getGridQuality(index)
|
||||||
|
if qlt and qlt >= GConst.RunesConst.CHECK_QLT_LOCK and not self.runesEntity:isAttrLock(index) then
|
||||||
local animator = obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
local animator = obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
||||||
animator.enabled = true
|
animator.enabled = true
|
||||||
-- CS.UnityEngine.Animator.StringToHash("runes_shake") 结果是1132417824
|
-- CS.UnityEngine.Animator.StringToHash("runes_shake") 结果是1132417824
|
||||||
animator:Play(1132417824, -1, 0)
|
animator:Play(1132417824, -1, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.spineAuto:playAnim("idle", true, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return RunesInfoComp
|
return RunesInfoComp
|
||||||
@ -72,9 +72,18 @@ function RunesData:getRunes(heroId)
|
|||||||
return self.runes[heroId]
|
return self.runes[heroId]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取当前等级配置
|
-- 是否有红点
|
||||||
|
function RunesData:hasRedPoint()
|
||||||
|
return self:getMaterialCount() > GFunc.getConstIntValue("runes_red_point")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取等级配置
|
||||||
function RunesData:getLevelConfig()
|
function RunesData:getLevelConfig()
|
||||||
return ConfigManager:getConfig("runes_level")
|
if self.RuneCfg == nil then
|
||||||
|
self.RuneCfg = ConfigManager:getConfig("runes_level")
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.RuneCfg
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取铸台最大等级
|
-- 获取铸台最大等级
|
||||||
@ -92,6 +101,25 @@ function RunesData:getLevelExp()
|
|||||||
return self.exp - (self:getLevelConfig()[self:getLevel()].cost or 0)
|
return self.exp - (self:getLevelConfig()[self:getLevel()].cost or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取总经验值
|
||||||
|
function RunesData:getExp()
|
||||||
|
return self.exp
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 根据经验获取等级
|
||||||
|
function RunesData:getLevelByExp(exp)
|
||||||
|
local level
|
||||||
|
for index, value in ipairs(self:getLevelConfig()) do
|
||||||
|
if exp >= (value.cost or 0) then
|
||||||
|
level = index
|
||||||
|
else
|
||||||
|
return level
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return level
|
||||||
|
end
|
||||||
|
|
||||||
-- 获取到下一档的总经验
|
-- 获取到下一档的总经验
|
||||||
function RunesData:getNextLevelTotalExp()
|
function RunesData:getNextLevelTotalExp()
|
||||||
local nextExp
|
local nextExp
|
||||||
@ -144,9 +172,33 @@ function RunesData:getSuitAttr(id, heroType, suitLevel)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取锻造材料基础消耗个数
|
||||||
|
function RunesData:getMaterialCostBaseNum()
|
||||||
|
if self.baseCostNum == nil then
|
||||||
|
self.baseCostNum = GFunc.getConstReward("runes_cost_base").num
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.baseCostNum
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取锻造材料额外单个锁定消耗个数
|
||||||
|
function RunesData:getMaterialCostAddNum()
|
||||||
|
if self.addCostNum == nil then
|
||||||
|
self.addCostNum = GFunc.getConstReward("runes_cost_add").num
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.addCostNum
|
||||||
|
end
|
||||||
|
|
||||||
-- 获取锻造材料个数
|
-- 获取锻造材料个数
|
||||||
function RunesData:getMaterialCount()
|
function RunesData:getMaterialCount()
|
||||||
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_RUNES)
|
local count = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_RUNES)
|
||||||
|
|
||||||
|
if ModuleManager.RunesManager:isInAutoQuenching() then
|
||||||
|
return count - (self:getExecutedAutoCount() * self:getRunes(self.autoHeroId):getMaterialCostNum())
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 是否可以一键铸造
|
-- 是否可以一键铸造
|
||||||
@ -219,6 +271,49 @@ function RunesData:onGridLockSuccess(heroId, grids)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取随机一套grids数据
|
||||||
|
function RunesData:getRandomGrids()
|
||||||
|
if self.fakeGrids == nil then
|
||||||
|
self.fakeGrids = {}
|
||||||
|
|
||||||
|
for i = 1, GConst.RunesConst.FAKE_DATA_COUNT do
|
||||||
|
self.fakeGrids[i] = {}
|
||||||
|
for j = 1, GConst.RunesConst.MAX_ATTR_GRID_COUNT do
|
||||||
|
local grid = {}
|
||||||
|
grid.quality = math.random(GConst.RunesConst.MAX_QUALITY_COUNT - 2)
|
||||||
|
grid.attr = math.random(GConst.RunesConst.MAX_ATTR_COUNT)
|
||||||
|
grid.suit = math.random(GConst.RunesConst.MAX_SUITS_COUNT)
|
||||||
|
table.insert(self.fakeGrids[i], grid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Logger.logHighlight("轮播假数据:")
|
||||||
|
Logger.printTable(self.fakeGrids)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.fakeGrids[math.random(GConst.RunesConst.FAKE_DATA_COUNT)]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取当前已执行的自动淬炼次数
|
||||||
|
function RunesData:getExecutedAutoCount()
|
||||||
|
return self.executedAutoCount
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取当前自动淬炼的英雄
|
||||||
|
function RunesData:getAutoHeroId()
|
||||||
|
return self.autoHeroId
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 自动淬炼次数增加
|
||||||
|
function RunesData:onAutoQuenchingOnce()
|
||||||
|
if self.executedAutoCount >= self.autoTotalCount then
|
||||||
|
-- 剩余自动次数不足,同步并请求数据
|
||||||
|
ModuleManager.RunesManager:reqSyncQuenching(self.isCountEnd)
|
||||||
|
else
|
||||||
|
self.executedAutoCount = self.executedAutoCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- 淬炼成功
|
-- 淬炼成功
|
||||||
function RunesData:onQuenchingSuccess(level, exp, heroId, grids)
|
function RunesData:onQuenchingSuccess(level, exp, heroId, grids)
|
||||||
self.level = level
|
self.level = level
|
||||||
@ -228,4 +323,28 @@ function RunesData:onQuenchingSuccess(level, exp, heroId, grids)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 自动淬炼数据获取成功
|
||||||
|
function RunesData:onGetAutoQuenchingDataSuccess(heroId, count, isCountEnd)
|
||||||
|
self.autoHeroId = heroId
|
||||||
|
self.autoTotalCount = count
|
||||||
|
self.executedAutoCount = 0
|
||||||
|
self.isCountEnd = isCountEnd
|
||||||
|
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 自动淬炼成功
|
||||||
|
function RunesData:onAutoQuenchingSuccess(level, exp, grids)
|
||||||
|
self.level = level
|
||||||
|
self.exp = exp
|
||||||
|
self.runes[self:getAutoHeroId()]:updateGrids(grids)
|
||||||
|
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 自动淬炼失败
|
||||||
|
function RunesData:onAutoQuenchingFailed()
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
|
|
||||||
return RunesData
|
return RunesData
|
||||||
@ -67,25 +67,20 @@ function RunesEntity:getMaterialCost()
|
|||||||
return total
|
return total
|
||||||
end
|
end
|
||||||
|
|
||||||
-- -- 获取随机符文属性
|
-- 获取锻造的材料消耗个数
|
||||||
-- function RunesEntity:getRandomAttr()
|
function RunesEntity:getMaterialCostNum()
|
||||||
-- local randomQlt = math.random(GConst.RunesConst.MAX_QUALITY_COUNT - 2)
|
local num = DataManager.RunesData:getMaterialCostBaseNum()
|
||||||
-- local randomAttr = math.random(GConst.RunesConst.MAX_ATTR_COUNT)
|
|
||||||
|
|
||||||
-- local cfg = ConfigManager:getConfig("runes_sub")[randomQlt]
|
num = num + (DataManager.RunesData:getMaterialCostAddNum() * self:getAttrLockCount())
|
||||||
-- return cfg["attr_"..randomAttr][self:getHeroEntity():getMatchType()]
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- -- 获取随机套装
|
return num
|
||||||
-- function RunesEntity:getRandomSuit()
|
end
|
||||||
-- return math.random(GConst.RunesConst.MAX_SUITS_COUNT)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- 获取格子的符文属性
|
-- 获取格子的符文属性
|
||||||
function RunesEntity:getGridAttr(index)
|
function RunesEntity:getGridAttr(index)
|
||||||
if self.grids[index] then
|
if self.grids[index] then
|
||||||
local cfg = ConfigManager:getConfig("runes_sub")[self.grids[index].quality]
|
local cfg = ConfigManager:getConfig("runes_sub")[self:getGridQuality(index)]
|
||||||
local attr = cfg["attr_"..self.grids[index].attr]
|
local attr = cfg["attr_"..self:getGridAttrIndex(index)]
|
||||||
if attr then
|
if attr then
|
||||||
return attr[self:getHeroEntity():getMatchType()]
|
return attr[self:getHeroEntity():getMatchType()]
|
||||||
end
|
end
|
||||||
@ -94,8 +89,24 @@ function RunesEntity:getGridAttr(index)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取格子属性下标
|
||||||
|
function RunesEntity:getGridAttrIndex(index)
|
||||||
|
if not self:isAttrLock(index) and ModuleManager.RunesManager:isInAutoQuenching() then
|
||||||
|
return DataManager.RunesData:getRandomGrids()[index].attr
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.grids[index] then
|
||||||
|
return self.grids[index].attr
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
-- 获取格子的品质
|
-- 获取格子的品质
|
||||||
function RunesEntity:getGridQuality(index)
|
function RunesEntity:getGridQuality(index)
|
||||||
|
if not self:isAttrLock(index) and ModuleManager.RunesManager:isInAutoQuenching() then
|
||||||
|
return DataManager.RunesData:getRandomGrids()[index].quality
|
||||||
|
end
|
||||||
|
|
||||||
if self.grids[index] then
|
if self.grids[index] then
|
||||||
return self.grids[index].quality
|
return self.grids[index].quality
|
||||||
end
|
end
|
||||||
@ -105,6 +116,10 @@ end
|
|||||||
|
|
||||||
-- 获取格子的套装
|
-- 获取格子的套装
|
||||||
function RunesEntity:getGridSuit(index)
|
function RunesEntity:getGridSuit(index)
|
||||||
|
if not self:isAttrLock(index) and ModuleManager.RunesManager:isInAutoQuenching() then
|
||||||
|
return DataManager.RunesData:getRandomGrids()[index].suit
|
||||||
|
end
|
||||||
|
|
||||||
if self.grids[index] then
|
if self.grids[index] then
|
||||||
return self.grids[index].suit
|
return self.grids[index].suit
|
||||||
end
|
end
|
||||||
@ -115,7 +130,8 @@ end
|
|||||||
|
|
||||||
-- 获取套装等级,2件套是lv1,4件套是lv2,没有就是lv0
|
-- 获取套装等级,2件套是lv1,4件套是lv2,没有就是lv0
|
||||||
function RunesEntity:getSuitLevel(index)
|
function RunesEntity:getSuitLevel(index)
|
||||||
local count = self:getSuitCount(index)
|
local data = table.find(self:getSuitIds(), function(value) return value.id == index end)
|
||||||
|
local count = data and data.count or 0
|
||||||
|
|
||||||
if count and count >= 4 then
|
if count and count >= 4 then
|
||||||
return 2
|
return 2
|
||||||
@ -127,12 +143,6 @@ function RunesEntity:getSuitLevel(index)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取套装个数
|
|
||||||
function RunesEntity:getSuitCount(id)
|
|
||||||
local data = table.find(self:getSuitIds(), function(value) return value.id == id end)
|
|
||||||
return data and data.count or 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取已有的套装id map
|
-- 获取已有的套装id map
|
||||||
function RunesEntity:getSuitIds()
|
function RunesEntity:getSuitIds()
|
||||||
local typeCount = {}
|
local typeCount = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user