英雄基础数据
This commit is contained in:
parent
d719ceeb74
commit
10575642e1
@ -16,7 +16,6 @@ function DataManager:init()
|
|||||||
self:initManager("BagData", "app/userdata/bag/bag_data")
|
self:initManager("BagData", "app/userdata/bag/bag_data")
|
||||||
self:initManager("EquipData", "app/userdata/equip/equip_data")
|
self:initManager("EquipData", "app/userdata/equip/equip_data")
|
||||||
self:initManager("SkinData", "app/userdata/skin/skin_data")
|
self:initManager("SkinData", "app/userdata/skin/skin_data")
|
||||||
self:initManager("RunesData", "app/userdata/runes/runes_data")
|
|
||||||
self:initManager("BattleData", "app/userdata/battle/battle_data")
|
self:initManager("BattleData", "app/userdata/battle/battle_data")
|
||||||
self:initManager("BattlePVPData", "app/userdata/battle/battle_pvp_data")
|
self:initManager("BattlePVPData", "app/userdata/battle/battle_pvp_data")
|
||||||
self:initManager("FormationData", "app/userdata/formation/formation_data")
|
self:initManager("FormationData", "app/userdata/formation/formation_data")
|
||||||
@ -111,7 +110,6 @@ function DataManager:clear()
|
|||||||
self.BagData:clear()
|
self.BagData:clear()
|
||||||
self.EquipData:clear()
|
self.EquipData:clear()
|
||||||
self.SkinData:clear()
|
self.SkinData:clear()
|
||||||
self.RunesData:clear()
|
|
||||||
self.FormationData:clear()
|
self.FormationData:clear()
|
||||||
self.ActivityData:clear()
|
self.ActivityData:clear()
|
||||||
self.MailData:clear()
|
self.MailData:clear()
|
||||||
@ -158,13 +156,11 @@ function DataManager:initWithServerData(data)
|
|||||||
self.DailyChallengeData:init(data.chapter_daily_challenge)
|
self.DailyChallengeData:init(data.chapter_daily_challenge)
|
||||||
self.DungeonData:initDungeonGold(data.chapter_gold_challenge)
|
self.DungeonData:initDungeonGold(data.chapter_gold_challenge)
|
||||||
self.DungeonData:initDungeonShards(data.chapter_shards_challenge)
|
self.DungeonData:initDungeonShards(data.chapter_shards_challenge)
|
||||||
-- FormationData要在RunesData之前初始化,依赖阵容数据进行上报
|
|
||||||
self.FormationData:init(data.fight_info)
|
self.FormationData:init(data.fight_info)
|
||||||
self.EquipData:init(data.heroes_equips)
|
self.EquipData:init(data.heroes_equips)
|
||||||
self.EquipData:initGifts(data.act_weapon_armor_gift)
|
self.EquipData:initGifts(data.act_weapon_armor_gift)
|
||||||
self.SkinData:init(data.bag.skins)
|
self.SkinData:init(data.bag.skins)
|
||||||
self.RunesData:init(data.rune)
|
-- HeroData要在EquipData、SkinData之后初始化,依赖它们的属性数据
|
||||||
-- HeroData要在EquipData、SkinData、RunesData之后初始化,依赖它们的属性数据
|
|
||||||
self.HeroData:init(data.bag.heroes)
|
self.HeroData:init(data.bag.heroes)
|
||||||
self.BagData:init(data.bag)
|
self.BagData:init(data.bag)
|
||||||
self.DungeonData:initDungeonWeapon(data.chapter_weapon_challenge)
|
self.DungeonData:initDungeonWeapon(data.chapter_weapon_challenge)
|
||||||
@ -200,7 +196,6 @@ function DataManager:initWithServerData(data)
|
|||||||
end
|
end
|
||||||
self.HeroFundData:init(data.hero_fund)
|
self.HeroFundData:init(data.hero_fund)
|
||||||
self.FourteenDayData:init(data.fourteen_bounty)
|
self.FourteenDayData:init(data.fourteen_bounty)
|
||||||
self.DungeonData:initDungeonRune(data.chapter_rune_challenge)
|
|
||||||
|
|
||||||
-- 任务数据最后初始化,依赖其他模块的数据
|
-- 任务数据最后初始化,依赖其他模块的数据
|
||||||
self.TaskData:init()
|
self.TaskData:init()
|
||||||
|
|||||||
@ -54,8 +54,6 @@ EventManager.CUSTOM_EVENT = {
|
|||||||
EQUIP_UPGRADE_SUCCESS = "EQUIP_UPGRADE_SUCCESS",
|
EQUIP_UPGRADE_SUCCESS = "EQUIP_UPGRADE_SUCCESS",
|
||||||
EQUIP_UPSECTION_SUCCESS = "EQUIP_UPSECTION_SUCCESS",
|
EQUIP_UPSECTION_SUCCESS = "EQUIP_UPSECTION_SUCCESS",
|
||||||
HERO_UPGRADE_SUCCESS = "HERO_UPGRADE_SUCCESS",
|
HERO_UPGRADE_SUCCESS = "HERO_UPGRADE_SUCCESS",
|
||||||
-- 符文
|
|
||||||
RUNE_QUENCHING_SUCCESS = "RUNE_QUENCHING_SUCCESS",
|
|
||||||
GO_DUNGEON_UI = "GO_DUNGEON_UI",
|
GO_DUNGEON_UI = "GO_DUNGEON_UI",
|
||||||
-- 皮肤
|
-- 皮肤
|
||||||
SKIN_SELECT = "SKIN_SELECT",
|
SKIN_SELECT = "SKIN_SELECT",
|
||||||
|
|||||||
@ -28,9 +28,8 @@ HeroConst.CHECK_LV_UP_STATE = {
|
|||||||
-- 英雄界面显示类型
|
-- 英雄界面显示类型
|
||||||
HeroConst.PANEL_TYPE = {
|
HeroConst.PANEL_TYPE = {
|
||||||
HERO = 1,
|
HERO = 1,
|
||||||
WEAPON = 2,
|
STAR = 2,
|
||||||
ARMOR = 3,
|
SKIN = 3,
|
||||||
RUNES = 4,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 总计
|
-- 总计
|
||||||
|
|||||||
@ -1,358 +1,281 @@
|
|||||||
local HeroDetailUI = class("HeroDetailUI", BaseUI)
|
local HeroDetailUI = class("HeroDetailUI", BaseUI)
|
||||||
local COMP_HERO = "app/ui/hero/hero_info_comp"
|
local COMP_HERO = "app/ui/hero/hero_info_comp"
|
||||||
local COMP_WEAPON = "app/ui/hero/weapon_info_comp"
|
local COMP_STAR = "app/ui/hero/star_info_comp"
|
||||||
local COMP_ARMOR = "app/ui/hero/armor_info_comp"
|
local COMP_SKIN = "app/ui/hero/skin_info_comp"
|
||||||
local COMP_RUNES = "app/ui/hero/runes_info_comp"
|
|
||||||
local SIZE_DELTA_Y_HERO = 942
|
local SIZE_DELTA_Y_HERO = 942
|
||||||
local SIZE_DELTA_Y_LOOK_HERO = 802
|
local SIZE_DELTA_Y_LOOK_HERO = 802
|
||||||
|
|
||||||
function HeroDetailUI:isFullScreen()
|
function HeroDetailUI:isFullScreen()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:getPrefabPath()
|
function HeroDetailUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/hero/hero_detail_ui.prefab"
|
return "assets/prefabs/ui/hero/hero_detail_ui.prefab"
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:onPressBackspace()
|
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
|
||||||
self.onlyLook = parmas.onlyLook
|
self.onlyLook = parmas.onlyLook
|
||||||
if parmas.heroEntity then
|
if parmas.heroEntity then
|
||||||
self.heroEntity = parmas.heroEntity
|
self.heroEntity = parmas.heroEntity
|
||||||
else
|
else
|
||||||
local heroId = parmas.heroId
|
local heroId = parmas.heroId
|
||||||
self.heroEntity = DataManager.HeroData:getHeroById(heroId)
|
self.heroEntity = DataManager.HeroData:getHeroById(heroId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:onLoadRootComplete()
|
function HeroDetailUI:onLoadRootComplete()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
|
|
||||||
self.commonInfo = uiMap["hero_detail_ui.common"]
|
self.commonInfo = uiMap["hero_detail_ui.common"]
|
||||||
self.heroInfo = uiMap["hero_detail_ui.hero_info"]
|
self.heroInfo = uiMap["hero_detail_ui.hero_info"]
|
||||||
self.weaponInfo = uiMap["hero_detail_ui.weapon_info"]
|
self.starInfo = uiMap["hero_detail_ui.star_info"]
|
||||||
self.armorInfo = uiMap["hero_detail_ui.armor_info"]
|
self.skinInfo = uiMap["hero_detail_ui.skin_info"]
|
||||||
self.runesInfo = uiMap["hero_detail_ui.runes_info"]
|
self.txTitle = uiMap["hero_detail_ui.common.img_title.tx_title"]
|
||||||
self.txTitle = uiMap["hero_detail_ui.common.img_title.tx_title"]
|
self.btnClose = uiMap["hero_detail_ui.common.btn_close"]
|
||||||
self.btnClose = uiMap["hero_detail_ui.common.btn_close"]
|
self.bg = uiMap["hero_detail_ui.common.bg.bg"]
|
||||||
self.bg = uiMap["hero_detail_ui.common.bg.bg"]
|
self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"]
|
||||||
self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"]
|
self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"]
|
||||||
self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"]
|
self.selectHero = uiMap["hero_detail_ui.common.btns.btn_hero.select"]
|
||||||
self.selectHero = uiMap["hero_detail_ui.common.btns.btn_hero.select"]
|
self.txHero2 = uiMap["hero_detail_ui.common.btns.btn_hero.select.tx_select"]
|
||||||
self.txHero2 = uiMap["hero_detail_ui.common.btns.btn_hero.select.tx_select"]
|
self.btnStar = uiMap["hero_detail_ui.common.btns.btn_star"]
|
||||||
self.btnWeapon = uiMap["hero_detail_ui.common.btns.btn_weapon"]
|
self.lockStar = uiMap["hero_detail_ui.common.btns.btn_star.content.img_lock"]
|
||||||
self.lockWeapon = uiMap["hero_detail_ui.common.btns.btn_weapon.img_lock"]
|
self.txStar1 = uiMap["hero_detail_ui.common.btns.btn_star.content.tx_btn"]
|
||||||
self.txWeapon1 = uiMap["hero_detail_ui.common.btns.btn_weapon.tx_btn"]
|
self.selectStar = uiMap["hero_detail_ui.common.btns.btn_star.select"]
|
||||||
self.selectWeapon = uiMap["hero_detail_ui.common.btns.btn_weapon.select"]
|
self.txStar2 = uiMap["hero_detail_ui.common.btns.btn_star.select.tx_select"]
|
||||||
self.txWeapon2 = uiMap["hero_detail_ui.common.btns.btn_weapon.select.tx_select"]
|
self.btnSkin = uiMap["hero_detail_ui.common.btns.btn_skin"]
|
||||||
self.btnArmor = uiMap["hero_detail_ui.common.btns.btn_armor"]
|
self.lockSkin = uiMap["hero_detail_ui.common.btns.btn_skin.content.img_lock"]
|
||||||
self.lockArmor = uiMap["hero_detail_ui.common.btns.btn_armor.img_lock"]
|
self.txSkin1 = uiMap["hero_detail_ui.common.btns.btn_skin.content.tx_btn"]
|
||||||
self.txArmor1 = uiMap["hero_detail_ui.common.btns.btn_armor.tx_btn"]
|
self.selectSkin = uiMap["hero_detail_ui.common.btns.btn_skin.select"]
|
||||||
self.selectArmor = uiMap["hero_detail_ui.common.btns.btn_armor.select"]
|
self.txSkin2 = uiMap["hero_detail_ui.common.btns.btn_skin.select.tx_select"]
|
||||||
self.txArmor2 = uiMap["hero_detail_ui.common.btns.btn_armor.select.tx_select"]
|
self.btnLeft = uiMap["hero_detail_ui.common.btn_left"]
|
||||||
self.btnRunes = uiMap["hero_detail_ui.common.btns.btn_runes"]
|
self.btnRight = uiMap["hero_detail_ui.common.btn_right"]
|
||||||
self.lockRunes = uiMap["hero_detail_ui.common.btns.btn_runes.content.img_lock"]
|
|
||||||
self.txRunes1 = uiMap["hero_detail_ui.common.btns.btn_runes.content.tx_btn"]
|
|
||||||
self.selectRunes = uiMap["hero_detail_ui.common.btns.btn_runes.select"]
|
|
||||||
self.txRunes2 = uiMap["hero_detail_ui.common.btns.btn_runes.select.tx_select"]
|
|
||||||
self.btnLeft = uiMap["hero_detail_ui.common.btn_left"]
|
|
||||||
self.btnRight = uiMap["hero_detail_ui.common.btn_right"]
|
|
||||||
|
|
||||||
self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
|
self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
|
||||||
self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
|
self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
|
||||||
self.txWeapon1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
|
self.txStar1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
|
||||||
self.txWeapon2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
|
self.txStar2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
|
||||||
self.txArmor1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
|
self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
|
||||||
self.txArmor2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
|
self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
|
||||||
self.txRunes1:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_6))
|
if not DataManager.HeroData:isStarOpen() then
|
||||||
self.txRunes2:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_6))
|
self.lockStar:setVisible(true)
|
||||||
if not DataManager.EquipData:isWeaponOpen() then
|
GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5)
|
||||||
self.lockWeapon:setVisible(true)
|
else
|
||||||
GFunc.centerImgAndTx(self.lockWeapon, self.txWeapon1, 5)
|
self.lockStar:setVisible(false)
|
||||||
else
|
end
|
||||||
self.lockWeapon:setVisible(false)
|
if not DataManager.HeroData:isSkinOpen() then
|
||||||
end
|
self.lockSkin:setVisible(true)
|
||||||
if not DataManager.EquipData:isArmorOpen() then
|
GFunc.centerImgAndTx(self.lockSkin, self.txSkin1, 5)
|
||||||
self.lockArmor:setVisible(true)
|
else
|
||||||
GFunc.centerImgAndTx(self.lockArmor, self.txArmor1, 5)
|
self.lockSkin:setVisible(false)
|
||||||
else
|
end
|
||||||
self.lockArmor:setVisible(false)
|
self.heroList = DataManager.HeroData:getAllHeroesSort(self.formationType)
|
||||||
end
|
self:updateSide()
|
||||||
if not DataManager.RunesData:isOpen() then
|
self:refreshShow()
|
||||||
self.lockRunes:setVisible(true)
|
|
||||||
GFunc.centerImgAndTx(self.lockRunes, self.txRunes1, 5)
|
|
||||||
else
|
|
||||||
self.lockRunes:setVisible(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.heroList = DataManager.HeroData:getAllHeroesSort(self.formationType)
|
self.btnHero:addClickListener(function()
|
||||||
self:updateSide()
|
self.panelType = GConst.HeroConst.PANEL_TYPE.HERO
|
||||||
self:refreshShow()
|
self:refreshShow()
|
||||||
|
end)
|
||||||
self.btnHero:addClickListener(function()
|
self.btnStar:addClickListener(function()
|
||||||
self.panelType = GConst.HeroConst.PANEL_TYPE.HERO
|
if not DataManager.HeroData:isStarOpen(true) then
|
||||||
self:refreshShow()
|
return
|
||||||
end)
|
end
|
||||||
self.btnWeapon:addClickListener(function()
|
self.panelType = GConst.HeroConst.PANEL_TYPE.STAR
|
||||||
if not DataManager.EquipData:isWeaponOpen(true) then
|
self:refreshShow()
|
||||||
return
|
end)
|
||||||
end
|
self.btnSkin:addClickListener(function()
|
||||||
self.panelType = GConst.HeroConst.PANEL_TYPE.WEAPON
|
if not DataManager.HeroData:isSkinOpen(true) then
|
||||||
self:refreshShow()
|
return
|
||||||
end)
|
end
|
||||||
self.btnArmor:addClickListener(function()
|
self.panelType = GConst.HeroConst.PANEL_TYPE.SKIN
|
||||||
if not DataManager.EquipData:isArmorOpen(true) then
|
self:refreshShow()
|
||||||
return
|
end)
|
||||||
end
|
self.btnClose:addClickListener(function()
|
||||||
self.panelType = GConst.HeroConst.PANEL_TYPE.ARMOR
|
self:closeUI()
|
||||||
self:refreshShow()
|
end)
|
||||||
end)
|
self.btnLeft:addClickListener(function()
|
||||||
self.btnRunes:addClickListener(function()
|
if not self:isShowLeftArrow() then
|
||||||
if not DataManager.RunesData:isOpen(true) then
|
return
|
||||||
return
|
end
|
||||||
end
|
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxLast].cfgId)
|
||||||
if not self.heroEntity:isActived() then
|
self:updateSide()
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_24))
|
self:refreshShow()
|
||||||
return
|
end)
|
||||||
end
|
self.btnRight:addClickListener(function()
|
||||||
self.panelType = GConst.HeroConst.PANEL_TYPE.RUNES
|
if not self:isShowRightArrow() then
|
||||||
self:refreshShow()
|
return
|
||||||
end)
|
end
|
||||||
self.btnClose:addClickListener(function()
|
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxNext].cfgId)
|
||||||
self:closeUI()
|
self:updateSide()
|
||||||
end)
|
self:refreshShow()
|
||||||
self.btnLeft:addClickListener(function()
|
end)
|
||||||
if not self:isShowLeftArrow() then
|
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
||||||
return
|
self:refreshRedPoint()
|
||||||
end
|
end)
|
||||||
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxLast].cfgId)
|
self:addEventListener(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, function(id)
|
||||||
self:updateSide()
|
self:refreshRedPoint()
|
||||||
self:refreshShow()
|
end)
|
||||||
end)
|
self:addEventListener(EventManager.CUSTOM_EVENT.EQUIP_UPSECTION_SUCCESS, function(part)
|
||||||
self.btnRight:addClickListener(function()
|
Logger.logHighlight("升段:"..part)
|
||||||
if not self:isShowRightArrow() then
|
if part == GConst.EquipConst.PART_TYPE.STAR then
|
||||||
return
|
self.compStar:playEffect(true, true)
|
||||||
end
|
else
|
||||||
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxNext].cfgId)
|
self.compSkin:playUpgradeEffect(part)
|
||||||
self:updateSide()
|
end
|
||||||
self:refreshShow()
|
self:refreshRedPoint()
|
||||||
end)
|
end)
|
||||||
|
self:addEventListener(EventManager.CUSTOM_EVENT.EQUIP_UPGRADE_SUCCESS, function(part)
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.RUNE_QUENCHING_SUCCESS, function(tempCount)
|
Logger.logHighlight("升级:"..part)
|
||||||
if DataManager.RunesData:hasRedPoint(tempCount) then
|
if part == GConst.EquipConst.PART_TYPE.STAR then
|
||||||
self.btnRunes:addRedPoint(-55, 0, 0.6)
|
self.compStar:playEffect(true, false)
|
||||||
else
|
else
|
||||||
self.btnRunes:removeRedPoint()
|
self.compSkin:playUpgradeEffect(part)
|
||||||
end
|
end
|
||||||
end)
|
self:refreshRedPoint()
|
||||||
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
end)
|
||||||
self:refreshRedPoint()
|
self:addEventListener(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI, function()
|
||||||
end)
|
self:closeUI()
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, function(id)
|
end)
|
||||||
self:refreshRedPoint()
|
|
||||||
end)
|
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.EQUIP_UPSECTION_SUCCESS, function(part)
|
|
||||||
Logger.logHighlight("升段:"..part)
|
|
||||||
if part == GConst.EquipConst.PART_TYPE.WEAPON then
|
|
||||||
self.compWeapon:playEffect(true, true)
|
|
||||||
else
|
|
||||||
self.compArmor:playUpgradeEffect(part)
|
|
||||||
end
|
|
||||||
self:refreshRedPoint()
|
|
||||||
end)
|
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.EQUIP_UPGRADE_SUCCESS, function(part)
|
|
||||||
Logger.logHighlight("升级:"..part)
|
|
||||||
if part == GConst.EquipConst.PART_TYPE.WEAPON then
|
|
||||||
self.compWeapon:playEffect(true, false)
|
|
||||||
else
|
|
||||||
self.compArmor:playUpgradeEffect(part)
|
|
||||||
end
|
|
||||||
self:refreshRedPoint()
|
|
||||||
end)
|
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI, function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:updateSide()
|
function HeroDetailUI:updateSide()
|
||||||
for index, data in ipairs(self.heroList) do
|
for index, data in ipairs(self.heroList) do
|
||||||
if data.cfgId == self.heroEntity:getCfgId() then
|
if data.cfgId == self.heroEntity:getCfgId() then
|
||||||
self.idxLast = index - 1
|
self.idxLast = index - 1
|
||||||
self.idxNext = index + 1
|
self.idxNext = index + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:refreshShow()
|
function HeroDetailUI:refreshShow()
|
||||||
self.txTitle:setText(self.heroEntity:getName())
|
self.txTitle:setText(self.heroEntity:getName())
|
||||||
if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
|
if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
|
||||||
self:showHeroInfo()
|
self:showHeroInfo()
|
||||||
elseif self.panelType == GConst.HeroConst.PANEL_TYPE.WEAPON then
|
elseif self.panelType == GConst.HeroConst.PANEL_TYPE.STAR then
|
||||||
self:showWeaponInfo()
|
self:showStarInfo()
|
||||||
elseif self.panelType == GConst.HeroConst.PANEL_TYPE.ARMOR then
|
elseif self.panelType == GConst.HeroConst.PANEL_TYPE.SKIN then
|
||||||
self:showArmorInfo()
|
self:showskinInfo()
|
||||||
elseif self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
|
end
|
||||||
self:showRunesInfo()
|
if self.onlyLook then -- 仅查看的不显示升级和激活按钮
|
||||||
end
|
self.btnHero:setActive(false)
|
||||||
if self.onlyLook then -- 仅查看的不显示升级和激活按钮
|
self.btnStar:setActive(false)
|
||||||
self.btnHero:setActive(false)
|
self.btnSkin:setActive(false)
|
||||||
self.btnWeapon:setActive(false)
|
self.btnLeft:setActive(false)
|
||||||
self.btnArmor:setActive(false)
|
self.btnRight:setActive(false)
|
||||||
self.btnRunes:setActive(false)
|
if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
|
||||||
self.btnLeft:setActive(false)
|
self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_LOOK_HERO)
|
||||||
self.btnRight:setActive(false)
|
end
|
||||||
if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
|
else
|
||||||
self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_LOOK_HERO)
|
self.btnHero:setActive(true)
|
||||||
end
|
self.btnStar:setActive(true)
|
||||||
else
|
self.btnSkin:setActive(true)
|
||||||
self.btnHero:setActive(true)
|
self.btnLeft:setActive(self:isShowLeftArrow())
|
||||||
self.btnWeapon:setActive(true)
|
self.btnRight:setActive(self:isShowRightArrow())
|
||||||
self.btnArmor:setActive(true)
|
self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO)
|
||||||
self.btnRunes:setActive(true)
|
self:refreshRedPoint()
|
||||||
self.btnLeft:setActive(self:isShowLeftArrow())
|
end
|
||||||
self.btnRight:setActive(self:isShowRightArrow())
|
|
||||||
self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO)
|
|
||||||
self:refreshRedPoint()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 刷新标签红点
|
-- 刷新标签红点
|
||||||
function HeroDetailUI:refreshRedPoint()
|
function HeroDetailUI:refreshRedPoint()
|
||||||
if self.heroEntity:canLvUp() then
|
if self.heroEntity:canLvUp() then
|
||||||
self.btnHero:addRedPoint(-55, 0, 0.6)
|
self.btnHero:addRedPoint(-55, 0, 0.6)
|
||||||
else
|
else
|
||||||
self.btnHero:removeRedPoint()
|
self.btnHero:removeRedPoint()
|
||||||
end
|
end
|
||||||
if DataManager.EquipData:canUpgradeWeapon(self.heroEntity:getCfgId()) then
|
-- if DataManager.EquipData:canUpgradeStar(self.heroEntity:getCfgId()) then
|
||||||
self.btnWeapon:addRedPoint(-55, 0, 0.6)
|
-- self.btnStar:addRedPoint(-55, 0, 0.6)
|
||||||
else
|
-- else
|
||||||
self.btnWeapon:removeRedPoint()
|
-- self.btnStar:removeRedPoint()
|
||||||
end
|
-- end
|
||||||
if DataManager.EquipData:canUpgradeArmor(self.heroEntity:getCfgId()) then
|
-- if DataManager.EquipData:canUpgradeSkin(self.heroEntity:getCfgId()) then
|
||||||
self.btnArmor:addRedPoint(-55, 0, 0.6)
|
-- self.btnSkin:addRedPoint(-55, 0, 0.6)
|
||||||
else
|
-- else
|
||||||
self.btnArmor:removeRedPoint()
|
-- self.btnSkin: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()
|
||||||
self.heroInfo:setActive(true)
|
self.heroInfo:setActive(true)
|
||||||
self.selectHero:setActive(true)
|
self.selectHero:setActive(true)
|
||||||
self.weaponInfo:setActive(false)
|
self.starInfo:setActive(false)
|
||||||
self.selectWeapon:setActive(false)
|
self.selectStar:setActive(false)
|
||||||
self.armorInfo:setActive(false)
|
self.skinInfo:setActive(false)
|
||||||
self.selectArmor:setActive(false)
|
self.selectSkin:setActive(false)
|
||||||
self.runesInfo:setActive(false)
|
self.bg:setActive(true)
|
||||||
self.selectRunes:setActive(false)
|
|
||||||
self.bg:setActive(true)
|
|
||||||
|
|
||||||
if not self.compHero then
|
if not self.compHero then
|
||||||
self.heroInfo:initPrefabHelper()
|
self.heroInfo:initPrefabHelper()
|
||||||
self.heroInfo:genAllChildren()
|
self.heroInfo:genAllChildren()
|
||||||
self.compHero = self.heroInfo:addLuaComponent(COMP_HERO)
|
self.compHero = self.heroInfo:addLuaComponent(COMP_HERO)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.compHero:setHeroData(self.heroEntity, self.onlyLook)
|
self.compHero:setHeroData(self.heroEntity, self.onlyLook)
|
||||||
self.compHero:refresh()
|
self.compHero:refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:showWeaponInfo()
|
function HeroDetailUI:showStarInfo()
|
||||||
self.heroInfo:setActive(false)
|
self.heroInfo:setActive(false)
|
||||||
self.selectHero:setActive(false)
|
self.selectHero:setActive(false)
|
||||||
self.weaponInfo:setActive(true)
|
self.starInfo:setActive(true)
|
||||||
self.selectWeapon:setActive(true)
|
self.selectStar:setActive(true)
|
||||||
self.armorInfo:setActive(false)
|
self.skinInfo:setActive(false)
|
||||||
self.selectArmor:setActive(false)
|
self.selectSkin:setActive(false)
|
||||||
self.runesInfo:setActive(false)
|
self.bg:setActive(true)
|
||||||
self.selectRunes:setActive(false)
|
|
||||||
self.bg:setActive(true)
|
|
||||||
|
|
||||||
if not self.compWeapon then
|
if not self.compStar then
|
||||||
self.weaponInfo:initPrefabHelper()
|
self.starInfo:initPrefabHelper()
|
||||||
self.weaponInfo:genAllChildren()
|
self.starInfo:genAllChildren()
|
||||||
self.compWeapon = self.weaponInfo:addLuaComponent(COMP_WEAPON)
|
self.compStar = self.starInfo:addLuaComponent(COMP_STAR)
|
||||||
self.compWeapon:setUI(self)
|
self.compStar:setUI(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.compWeapon:setHeroData(self.heroEntity)
|
self.compStar:setHeroData(self.heroEntity)
|
||||||
self.compWeapon:refresh()
|
self.compStar:refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroDetailUI:showArmorInfo()
|
function HeroDetailUI:showskinInfo()
|
||||||
self.heroInfo:setActive(false)
|
self.heroInfo:setActive(false)
|
||||||
self.selectHero:setActive(false)
|
self.selectHero:setActive(false)
|
||||||
self.weaponInfo:setActive(false)
|
self.starInfo:setActive(false)
|
||||||
self.selectWeapon:setActive(false)
|
self.selectStar:setActive(false)
|
||||||
self.armorInfo:setActive(true)
|
self.skinInfo:setActive(true)
|
||||||
self.selectArmor:setActive(true)
|
self.selectSkin:setActive(true)
|
||||||
self.runesInfo:setActive(false)
|
self.bg:setActive(true)
|
||||||
self.selectRunes:setActive(false)
|
|
||||||
self.bg:setActive(true)
|
|
||||||
|
|
||||||
if not self.compArmor then
|
if not self.compSkin then
|
||||||
self.armorInfo:initPrefabHelper()
|
self.skinInfo:initPrefabHelper()
|
||||||
self.armorInfo:genAllChildren()
|
self.skinInfo:genAllChildren()
|
||||||
self.compArmor = self.armorInfo:addLuaComponent(COMP_ARMOR)
|
self.compSkin = self.skinInfo:addLuaComponent(COMP_Skin)
|
||||||
self.compArmor:setUI(self)
|
self.compSkin:setUI(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.compArmor:setHeroData(self.heroEntity)
|
self.compSkin:setHeroData(self.heroEntity)
|
||||||
self.compArmor:refresh()
|
self.compSkin:refresh()
|
||||||
end
|
|
||||||
|
|
||||||
function HeroDetailUI:showRunesInfo()
|
|
||||||
self.heroInfo:setActive(false)
|
|
||||||
self.selectHero:setActive(false)
|
|
||||||
self.weaponInfo:setActive(false)
|
|
||||||
self.selectWeapon:setActive(false)
|
|
||||||
self.armorInfo:setActive(false)
|
|
||||||
self.selectArmor:setActive(false)
|
|
||||||
self.runesInfo:setActive(true)
|
|
||||||
self.selectRunes:setActive(true)
|
|
||||||
self.bg:setActive(false)
|
|
||||||
|
|
||||||
if not self.compRunes then
|
|
||||||
self.runesInfo:initPrefabHelper()
|
|
||||||
self.runesInfo:genAllChildren()
|
|
||||||
self.compRunes = self.runesInfo:addLuaComponent(COMP_RUNES)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.compRunes:setHeroData(self.heroEntity)
|
|
||||||
self.compRunes:refresh()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 是否显示左箭头
|
-- 是否显示左箭头
|
||||||
function HeroDetailUI:isShowLeftArrow()
|
function HeroDetailUI:isShowLeftArrow()
|
||||||
if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
|
if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.idxLast and self.idxLast > 0
|
return self.idxLast and self.idxLast > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 是否显示右箭头
|
-- 是否显示右箭头
|
||||||
function HeroDetailUI:isShowRightArrow()
|
function HeroDetailUI:isShowRightArrow()
|
||||||
if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
|
if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.idxNext and self.idxNext <= #self.heroList
|
return self.idxNext and self.idxNext <= #self.heroList
|
||||||
end
|
end
|
||||||
|
|
||||||
return HeroDetailUI
|
return HeroDetailUI
|
||||||
@ -1,333 +0,0 @@
|
|||||||
local RunesInfoComp = class("RunesInfoComp", LuaComponent)
|
|
||||||
|
|
||||||
local LOCK_ICON = "common_lock"
|
|
||||||
local UNLOCK_ICON = "common_lock_1"
|
|
||||||
|
|
||||||
function RunesInfoComp:onClose()
|
|
||||||
if self.autoSid then
|
|
||||||
self.baseObject:unscheduleGlobal(self.autoSid)
|
|
||||||
self.autoSid = nil
|
|
||||||
end
|
|
||||||
if self.autoSyncSid then
|
|
||||||
self.baseObject:unscheduleGlobal(self.autoSyncSid)
|
|
||||||
self.autoSyncSid = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesInfoComp:init()
|
|
||||||
local uiMap = self:getUIMap()
|
|
||||||
self.btnHelp = uiMap["runes_info.btn_help"]
|
|
||||||
self.imgProg = uiMap["runes_info.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
|
||||||
self.txProg = uiMap["runes_info.prog.tx_prog"]
|
|
||||||
self.txLevel = uiMap["runes_info.level.tx_level"]
|
|
||||||
self.btnSuit = uiMap["runes_info.btn_suit"]
|
|
||||||
self.txSuit = uiMap["runes_info.btn_suit.tx_suit"]
|
|
||||||
self.itemMaterial = uiMap["runes_info.item_material"]
|
|
||||||
self.txNum = uiMap["runes_info.item_material.tx_num"]
|
|
||||||
self.btnUse = uiMap["runes_info.bottom.btn_use"]
|
|
||||||
self.txUse = uiMap["runes_info.bottom.btn_use.tx_use"]
|
|
||||||
self.imgCost = uiMap["runes_info.bottom.btn_use.cost.img_cost"]
|
|
||||||
self.txCost = uiMap["runes_info.bottom.btn_use.cost.tx_cost"]
|
|
||||||
self.btnAuto = uiMap["runes_info.bottom.btn_auto"]
|
|
||||||
self.spineAuto = uiMap["runes_info.bottom.btn_auto.spine_auto"]
|
|
||||||
self.txAuto = uiMap["runes_info.bottom.btn_auto.tx_auto"]
|
|
||||||
self.txEmpty = uiMap["runes_info.suits.tx_empty"]
|
|
||||||
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 = {}
|
|
||||||
for i = 1, 3 do
|
|
||||||
self.suits[i] = uiMap["runes_info.suits.item_suit_" .. i]
|
|
||||||
end
|
|
||||||
self.grids = {}
|
|
||||||
for i = 1, 6 do
|
|
||||||
self.grids[i] = uiMap["runes_info.list_attr.grid_" .. i]
|
|
||||||
end
|
|
||||||
|
|
||||||
self.mask:setActive(false)
|
|
||||||
self.txSuit:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_2))
|
|
||||||
self.txUse:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_5))
|
|
||||||
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()
|
|
||||||
UIManager:showUI("app/ui/runes/runes_source_ui")
|
|
||||||
end)
|
|
||||||
self.btnHelp:addClickListener(function()
|
|
||||||
UIManager:showUI("app/ui/runes/runes_level_ui")
|
|
||||||
end)
|
|
||||||
self.btnSuit:addClickListener(function()
|
|
||||||
UIManager:showUI("app/ui/runes/runes_suit_ui", self.heroEntity)
|
|
||||||
end)
|
|
||||||
self.btnAuto:addClickListener(function()
|
|
||||||
if not DataManager.RunesData:canAutoMake() then
|
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_27, DataManager.RunesData:getAutoMakeOpenLevel()))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local checkIds = DataManager.RunesData:getCheckQualityIds()
|
|
||||||
if #checkIds > 0 then
|
|
||||||
local params ={
|
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_21, I18N:getGlobalText(I18N.GlobalConst["RUNES_QLT_" .. DataManager.RunesData:getCheckQualityIds()[1]]), I18N:getGlobalText(I18N.GlobalConst["RUNES_QLT_" .. DataManager.RunesData:getCheckQualityIds()[2]])),
|
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
|
||||||
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.RUNES_AUTO,
|
|
||||||
okFunc = function()
|
|
||||||
self:checkQuenching(true)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
GFunc.showMessageBox(params)
|
|
||||||
else
|
|
||||||
self:checkQuenching(true)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.btnAutoEnd:addClickListener(function()
|
|
||||||
-- 玩家点击停止自动淬炼
|
|
||||||
ModuleManager.RunesManager:reqSyncQuenching(true)
|
|
||||||
end)
|
|
||||||
self.btnUse:addClickListener(function()
|
|
||||||
self:checkQuenching(false)
|
|
||||||
end)
|
|
||||||
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
|
||||||
self:refresh()
|
|
||||||
end)
|
|
||||||
self:bind(DataManager.RunesData, "isDirty", function()
|
|
||||||
self:refresh()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesInfoComp:setHeroData(heroEntity)
|
|
||||||
self.heroEntity = heroEntity
|
|
||||||
self.runesEntity = DataManager.RunesData:getRunes(self.heroEntity:getCfgId())
|
|
||||||
end
|
|
||||||
|
|
||||||
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 self.autoSyncSid then
|
|
||||||
self.baseObject:unscheduleGlobal(self.autoSyncSid)
|
|
||||||
self.autoSyncSid = nil
|
|
||||||
end
|
|
||||||
if ModuleManager.RunesManager:isInAutoQuenching() then
|
|
||||||
self:startAutoQuenching()
|
|
||||||
return
|
|
||||||
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()
|
|
||||||
|
|
||||||
if self.isAutoQuenching then
|
|
||||||
-- 结束自动淬炼
|
|
||||||
self:endAutoQuenching()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 自动淬炼刷新
|
|
||||||
function RunesInfoComp:autoQuenching()
|
|
||||||
self:refreshSuit()
|
|
||||||
self:refreshRunes()
|
|
||||||
|
|
||||||
if not ModuleManager.RunesManager:isInSyncQuenching() then
|
|
||||||
DataManager.RunesData:onAutoQuenchingOnce()
|
|
||||||
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(GFunc.num2Str(self.tempMaterialCount))
|
|
||||||
if self.tempMaterialCount < self.tempCostNum then
|
|
||||||
-- 剩余材料不够,结束自动淬炼
|
|
||||||
ModuleManager.RunesManager:reqSyncQuenching(true)
|
|
||||||
else
|
|
||||||
DataManager.RunesData:checkAutoTime()
|
|
||||||
end
|
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.RUNE_QUENCHING_SUCCESS, self.tempMaterialCount)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新等级经验、道具个数
|
|
||||||
function RunesInfoComp:refreshLevelExp()
|
|
||||||
local curExp = DataManager.RunesData:getLevelExp()
|
|
||||||
local maxExp = DataManager.RunesData:getNextLevelTotalExp()
|
|
||||||
if maxExp then
|
|
||||||
self.imgProg.value = curExp / maxExp
|
|
||||||
self.txProg:setText(curExp .. "/" .. 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, DataManager.RunesData:getLevel()))
|
|
||||||
self.txNum:setText(GFunc.num2Str(DataManager.RunesData:getMaterialCount()))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新符文
|
|
||||||
function RunesInfoComp:refreshRunes()
|
|
||||||
for index, obj in ipairs(self.grids) do
|
|
||||||
local map = obj:genAllChildren()
|
|
||||||
local imgQlt = map["img_qlt"]
|
|
||||||
local imgSuit = map["img_suit"]
|
|
||||||
local txAttr = map["tx_attr"]
|
|
||||||
local imgLock = map["img_lock"]
|
|
||||||
local lock = map["lock"]
|
|
||||||
local txLock = map["tx_lock"]
|
|
||||||
obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR).enabled = false
|
|
||||||
|
|
||||||
if ModuleManager.RunesManager:isInAutoQuenching() and index <= DataManager.RunesData:getLevelConfig()[self.tempLevel].grid or DataManager.RunesData:isUnlock(index) then
|
|
||||||
lock:setActive(false)
|
|
||||||
local qlt = self.runesEntity:getGridQuality(index)
|
|
||||||
if qlt then
|
|
||||||
imgQlt:setSprite(GConst.ATLAS_PATH.HERO, GConst.RunesConst.QUALITY_ICON[qlt])
|
|
||||||
end
|
|
||||||
local suit = self.runesEntity:getGridSuit(index)
|
|
||||||
if suit then
|
|
||||||
imgSuit:setSprite(GConst.ATLAS_PATH.HERO, "hero_rune_"..suit)
|
|
||||||
end
|
|
||||||
imgLock:setSprite(GConst.ATLAS_PATH.COMMON, self.runesEntity:isAttrLock(index) and LOCK_ICON or UNLOCK_ICON)
|
|
||||||
local attr = self.runesEntity:getGridAttr(index)
|
|
||||||
if attr then
|
|
||||||
txAttr:setText(GFunc.getAttrDesc(attr.type, attr.num))
|
|
||||||
end
|
|
||||||
imgLock:addClickListener(function()
|
|
||||||
ModuleManager.RunesManager:reqChangeLockGrid(self.heroEntity:getCfgId(), index, not self.runesEntity:isAttrLock(index))
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
lock:setActive(true)
|
|
||||||
txLock:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_3, DataManager.RunesData:getUnlockLevel(index)))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新套装
|
|
||||||
function RunesInfoComp:refreshSuit()
|
|
||||||
local ids = self.runesEntity:getSuitIds()
|
|
||||||
|
|
||||||
local isEmpty = true
|
|
||||||
for index, obj in ipairs(self.suits) do
|
|
||||||
local map = obj:genAllChildren()
|
|
||||||
local img = map["img"]
|
|
||||||
local tx = map["tx"]
|
|
||||||
|
|
||||||
if ids[index] then
|
|
||||||
local level = self.runesEntity:getSuitLevel(ids[index].id)
|
|
||||||
if level > 0 then
|
|
||||||
isEmpty = false
|
|
||||||
obj:setActive(true)
|
|
||||||
img:setSprite(GConst.ATLAS_PATH.HERO, "hero_rune_"..ids[index].id)
|
|
||||||
tx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, level))
|
|
||||||
else
|
|
||||||
obj:setActive(false)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
obj:setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.txEmpty:setActive(isEmpty)
|
|
||||||
|
|
||||||
self.suitsNode:RefreshLayout()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 检查淬炼
|
|
||||||
function RunesInfoComp:checkQuenching(isAuto)
|
|
||||||
-- 是否全部锁定
|
|
||||||
if DataManager.RunesData:getRunes(self.heroEntity:getCfgId()):getAttrLockCount() >= DataManager.RunesData:getUnlockCount() then
|
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_25))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 材料是否足够
|
|
||||||
local cost = self.runesEntity:getMaterialCost()
|
|
||||||
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
|
||||||
UIManager:showUI("app/ui/runes/runes_source_ui")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.runesEntity:isUnlockHighQlt() then
|
|
||||||
local params ={
|
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_28, I18N:getGlobalText(I18N.GlobalConst["RUNES_QLT_" .. DataManager.RunesData:getCheckQualityIds()[1]])),
|
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC),
|
|
||||||
okFunc = function()
|
|
||||||
self:reqQuenching(isAuto)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
GFunc.showMessageBox(params)
|
|
||||||
else
|
|
||||||
self:reqQuenching(isAuto)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 请求淬炼
|
|
||||||
function RunesInfoComp:reqQuenching(isAuto)
|
|
||||||
if isAuto then
|
|
||||||
-- 自动淬炼
|
|
||||||
self.isAutoQuenching = true
|
|
||||||
self.mask:setActive(true)
|
|
||||||
self.btnUse:setActive(false)
|
|
||||||
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_30))
|
|
||||||
self.spineAuto:playAnim("attack", true, true)
|
|
||||||
ModuleManager.RunesManager:reqAutoQuenching(self.heroEntity:getCfgId())
|
|
||||||
else
|
|
||||||
-- 单次淬炼
|
|
||||||
ModuleManager.RunesManager:reqQuenching(self.heroEntity:getCfgId())
|
|
||||||
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)
|
|
||||||
self.autoSyncSid = self.baseObject:scheduleGlobal(function() ModuleManager.RunesManager:reqSyncQuenching(false, true) end, GConst.RunesConst.SYNC_INTERVAL)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 结束自动淬炼
|
|
||||||
function RunesInfoComp:endAutoQuenching()
|
|
||||||
self.isAutoQuenching = false
|
|
||||||
self.mask:setActive(false)
|
|
||||||
self.btnUse:setActive(true)
|
|
||||||
self.txAuto:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_4))
|
|
||||||
self.spineAuto:playAnim("idle", true, true)
|
|
||||||
|
|
||||||
for index, obj in ipairs(self.grids) do
|
|
||||||
local qlt = self.runesEntity:getGridQuality(index)
|
|
||||||
if qlt and table.containValue(DataManager.RunesData:getCheckQualityIds(), qlt) and not self.runesEntity:isAttrLock(index) then
|
|
||||||
obj:getTransform():SetAsLastSibling()
|
|
||||||
local animator = obj:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
|
||||||
animator.enabled = true
|
|
||||||
-- CS.UnityEngine.Animator.StringToHash("runes_shake") 结果是1132417824
|
|
||||||
animator:Play(1132417824, -1, 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return RunesInfoComp
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4d6ae74e1ac107c4ca73bacaafebec15
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -85,29 +85,9 @@ function HeroData:addHero(heroStruct)
|
|||||||
local entity = self:getEntity(heroStruct)
|
local entity = self:getEntity(heroStruct)
|
||||||
|
|
||||||
self.heroes[heroStruct.id] = entity
|
self.heroes[heroStruct.id] = entity
|
||||||
self:updateSelfHeroEquipsAndRunes(entity)
|
|
||||||
|
|
||||||
self.data.activeCount = self.data.activeCount + 1
|
self.data.activeCount = self.data.activeCount + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 更新装备、符文数据
|
|
||||||
function HeroData:updateSelfHeroEquipsAndRunes(entity)
|
|
||||||
if EDITOR_MODE then
|
|
||||||
Logger.logHighlight("更新英雄属性:" .. entity:getCfgId())
|
|
||||||
end
|
|
||||||
|
|
||||||
entity:setEquips(GConst.EquipConst.PART_TYPE.WEAPON, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.WEAPON), true)
|
|
||||||
entity:setEquips(GConst.EquipConst.PART_TYPE.HAT, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.HAT), true)
|
|
||||||
entity:setEquips(GConst.EquipConst.PART_TYPE.CLOTHES, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.CLOTHES), true)
|
|
||||||
entity:setEquips(GConst.EquipConst.PART_TYPE.BELT, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.BELT), true)
|
|
||||||
entity:setEquips(GConst.EquipConst.PART_TYPE.HANDGUARD, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.HANDGUARD), true)
|
|
||||||
entity:setRunes(DataManager.RunesData:getRunes(entity:getCfgId()), true)
|
|
||||||
|
|
||||||
-- 手动调用更新数据
|
|
||||||
entity:onEquipAttrChange()
|
|
||||||
entity:onRunesAttrChange()
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroData:getEntity(heroStruct)
|
function HeroData:getEntity(heroStruct)
|
||||||
return HeroEntity:create(heroStruct.id, heroStruct.level, heroStruct.skin, heroStruct.star)
|
return HeroEntity:create(heroStruct.id, heroStruct.level, heroStruct.skin, heroStruct.star)
|
||||||
end
|
end
|
||||||
@ -162,7 +142,6 @@ function HeroData:setHeroLv(id, lv)
|
|||||||
local activeBefore = true
|
local activeBefore = true
|
||||||
if not entity:isActived() then
|
if not entity:isActived() then
|
||||||
self.data.activeCount = self.data.activeCount + 1
|
self.data.activeCount = self.data.activeCount + 1
|
||||||
self:updateSelfHeroEquipsAndRunes(entity)
|
|
||||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT)
|
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT)
|
||||||
ModuleManager.PlayerManager:checkUnlockAvatar(id)
|
ModuleManager.PlayerManager:checkUnlockAvatar(id)
|
||||||
activeBefore = false
|
activeBefore = false
|
||||||
@ -343,7 +322,7 @@ function HeroData:getAllHeroesSort(formationType)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- region
|
-- region 配置相关
|
||||||
function HeroData:getHeroConfig(id)
|
function HeroData:getHeroConfig(id)
|
||||||
if id then
|
if id then
|
||||||
return ConfigManager:getConfig("hero")[id]
|
return ConfigManager:getConfig("hero")[id]
|
||||||
@ -374,6 +353,25 @@ function HeroData:getHeroLevelCost(lv, qlt)
|
|||||||
return cfg.cost
|
return cfg.cost
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
|
-- region
|
||||||
|
function HeroData:isStarOpen()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroData:getStarById(id)
|
||||||
|
local hero = self.heroes[id]
|
||||||
|
if hero then
|
||||||
|
return hero:getStar()
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
|
-- region 皮肤相关
|
||||||
|
function HeroData:isSkinOpen()
|
||||||
|
return true
|
||||||
|
end
|
||||||
-- endregion
|
-- endregion
|
||||||
return HeroData
|
return HeroData
|
||||||
@ -8,15 +8,15 @@ function HeroEntity:ctor(cfgId, lv, skin, star)
|
|||||||
self.data.skin = skin
|
self.data.skin = skin
|
||||||
self.data.star = star
|
self.data.star = star
|
||||||
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
||||||
self.beginLv = self.config.begin_lv -- 初始等级
|
self.beginLv = 1 -- 激活等级
|
||||||
|
|
||||||
self.baseAttrOriginal = {}
|
self.baseAttrOriginal = {}
|
||||||
self.equipAttr = {}
|
self.starAttr = {}
|
||||||
self.skinAttr = {}
|
self.skinAttr = {}
|
||||||
self.runesAttr = {}
|
|
||||||
self.allAttr = {}
|
self.allAttr = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- region 属性
|
||||||
function HeroEntity:initAttr()
|
function HeroEntity:initAttr()
|
||||||
self:setTotalAttrValue(ATTR_NAME.HP, 0)
|
self:setTotalAttrValue(ATTR_NAME.HP, 0)
|
||||||
self:setTotalAttrValue(ATTR_NAME.ATK, 0)
|
self:setTotalAttrValue(ATTR_NAME.ATK, 0)
|
||||||
@ -25,15 +25,6 @@ function HeroEntity:initAttr()
|
|||||||
self:setTotalAttrValue(ATTR_NAME.ATK_GREEN, 0)
|
self:setTotalAttrValue(ATTR_NAME.ATK_GREEN, 0)
|
||||||
self:setTotalAttrValue(ATTR_NAME.ATK_BLUE, 0)
|
self:setTotalAttrValue(ATTR_NAME.ATK_BLUE, 0)
|
||||||
self:setTotalAttrValue(ATTR_NAME.ATK_PURPLE, 0)
|
self:setTotalAttrValue(ATTR_NAME.ATK_PURPLE, 0)
|
||||||
self:setEquipAttrValue(GConst.MATCH_HP_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], 0)
|
|
||||||
self:setEquipAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()], 0)
|
|
||||||
|
|
||||||
self:updateAllAttr()
|
self:updateAllAttr()
|
||||||
end
|
end
|
||||||
@ -44,8 +35,8 @@ function HeroEntity:onBaseAttrChange()
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:onEquipAttrChange()
|
function HeroEntity:onStarAttrChange()
|
||||||
self:updateEquipAttr()
|
self:updateStarAttr()
|
||||||
self:updateTotalAttr()
|
self:updateTotalAttr()
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
@ -56,12 +47,6 @@ function HeroEntity:onSkinAttrChange()
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:onRunesAttrChange()
|
|
||||||
self:updateRunesAttr()
|
|
||||||
self:updateTotalAttr()
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:setDirty()
|
function HeroEntity:setDirty()
|
||||||
self.data.isDirty = not self.data.isDirty
|
self.data.isDirty = not self.data.isDirty
|
||||||
end
|
end
|
||||||
@ -73,9 +58,8 @@ end
|
|||||||
-- 更新所有属性
|
-- 更新所有属性
|
||||||
function HeroEntity:updateAllAttr()
|
function HeroEntity:updateAllAttr()
|
||||||
self:updateBaseAttr()
|
self:updateBaseAttr()
|
||||||
self:updateEquipAttr()
|
self:updateStarAttr()
|
||||||
self:updateSkinAttr()
|
self:updateSkinAttr()
|
||||||
self:updateRunesAttr()
|
|
||||||
self:updateTotalAttr()
|
self:updateTotalAttr()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -90,76 +74,44 @@ function HeroEntity:updateBaseAttr()
|
|||||||
self.baseAttrOriginal[GConst.MATCH_ATTACK_NAME[self.config.position]] = self:getCfgAtk()
|
self.baseAttrOriginal[GConst.MATCH_ATTACK_NAME[self.config.position]] = self:getCfgAtk()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 更新装备属性
|
-- 更新皮肤属性
|
||||||
function HeroEntity:updateEquipAttr()
|
function HeroEntity:updateStarAttr()
|
||||||
self.equipAttr = {}
|
self.starAttr = {}
|
||||||
|
|
||||||
local hp,atk,normalHurt,skillHurt,critPer,critHurtPer,normalHurtPer,skillHurtPer,healPer = 0
|
-- local hp = DataManager.SkinData:getHp(self)
|
||||||
|
-- local atk = DataManager.SkinData:getAttack(self)
|
||||||
|
-- local normalHurt = DataManager.SkinData:getNormalHurt(self)
|
||||||
|
-- local skillHurt = DataManager.SkinData:getSkillHurt(self)
|
||||||
|
-- local critPer = DataManager.SkinData:getCritPercent(self)
|
||||||
|
-- local critHurtPer = DataManager.SkinData:getCritHurtPercent(self)
|
||||||
|
-- local normalHurtPer = DataManager.SkinData:getNormalHurtPercent(self)
|
||||||
|
-- local skillHurtPer = DataManager.SkinData:getSkillHurtPercent(self)
|
||||||
|
-- local healPer = DataManager.SkinData:getHealPercent(self)
|
||||||
|
|
||||||
local addArmorAttrPer = true
|
-- self.starAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp
|
||||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
-- self.starAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk
|
||||||
local equipEntity = self:getEquips(partType)
|
-- self.starAttr[GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()]] = normalHurt
|
||||||
if equipEntity then
|
-- self.starAttr[GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()]] = skillHurt
|
||||||
-- 基础值
|
-- self.starAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] = critPer
|
||||||
hp = equipEntity:getHp()
|
-- self.starAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] = critHurtPer
|
||||||
atk = equipEntity:getAttack()
|
-- self.starAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] = normalHurtPer
|
||||||
normalHurt = equipEntity:getNormalHurt()
|
-- self.starAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] = skillHurtPer
|
||||||
skillHurt = equipEntity:getSkillHurt()
|
-- self.starAttr[GConst.MATCH_CURED_NAME[self:getMatchType()]] = healPer
|
||||||
-- 属性值
|
|
||||||
critPer = 0
|
|
||||||
critHurtPer = 0
|
|
||||||
normalHurtPer = 0
|
|
||||||
skillHurtPer = 0
|
|
||||||
healPer = 0
|
|
||||||
if partType == GConst.EquipConst.PART_TYPE.WEAPON or addArmorAttrPer then
|
|
||||||
if partType ~= GConst.EquipConst.PART_TYPE.WEAPON then
|
|
||||||
addArmorAttrPer = false-- 防具的属性只只用计算一次
|
|
||||||
end
|
|
||||||
|
|
||||||
critPer = equipEntity:getCritPercent()
|
-- if EDITOR_MODE then
|
||||||
critHurtPer = equipEntity:getCritHurtPercent()
|
-- local printStr = ""
|
||||||
normalHurtPer = equipEntity:getNormalHurtPercent()
|
-- printStr = printStr .. "更新皮肤数值:"..self:getCfgId() .. "\n"
|
||||||
skillHurtPer = equipEntity:getSkillHurtPercent()
|
-- printStr = printStr .. "生命:".. hp .. "\n"
|
||||||
healPer = equipEntity:getHealPercent()
|
-- printStr = printStr .. "攻击力:".. atk .. "\n"
|
||||||
end
|
-- printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
||||||
|
-- printStr = printStr .. "技能增伤:".. skillHurt .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_HP_NAME[self:getMatchType()], hp)
|
-- printStr = printStr .. "暴击率:".. critPer .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], atk)
|
-- printStr = printStr .. "暴击伤害百分比:".. critHurtPer .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()], normalHurt)
|
-- printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()], skillHurt)
|
-- printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()], critPer)
|
-- printStr = printStr .. "治疗加成百分比:".. healPer .. "\n"
|
||||||
self:addEquipAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()], critHurtPer)
|
-- Logger.logHighlight(printStr)
|
||||||
self:addEquipAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], normalHurtPer)
|
-- end
|
||||||
self:addEquipAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], skillHurtPer)
|
|
||||||
self:addEquipAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()], healPer)
|
|
||||||
|
|
||||||
-- if EDITOR_MODE then
|
|
||||||
-- local printStr = ""
|
|
||||||
-- printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "-" .. equipEntity:getLevel() .. "\n"
|
|
||||||
-- printStr = printStr .. "生命:".. hp .. "\n"
|
|
||||||
-- printStr = printStr .. "攻击力:".. atk .. "\n"
|
|
||||||
-- printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
|
||||||
-- printStr = printStr .. "技能增伤:".. skillHurt .. "\n"
|
|
||||||
-- printStr = printStr .. "暴击率:".. critPer .. "\n"
|
|
||||||
-- printStr = printStr .. "暴击伤害百分比:".. critHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "治疗加成百分比:".. healPer .. "\n"
|
|
||||||
-- Logger.logHighlight(printStr)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:setEquipAttrValue(name, value)
|
|
||||||
self.equipAttr[name] = value
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:addEquipAttrValue(name, value)
|
|
||||||
if self.equipAttr[name] == nil then
|
|
||||||
self.equipAttr[name] = 0
|
|
||||||
end
|
|
||||||
self.equipAttr[name] = self.equipAttr[name] + value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 更新皮肤属性
|
-- 更新皮肤属性
|
||||||
@ -202,69 +154,15 @@ function HeroEntity:updateSkinAttr()
|
|||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 更新符文属性
|
|
||||||
function HeroEntity:updateRunesAttr()
|
|
||||||
self.runesAttr = {}
|
|
||||||
|
|
||||||
local runesEntity = self:getRunes()
|
|
||||||
if runesEntity == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local hp = runesEntity:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()])
|
|
||||||
local atk = runesEntity:getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()])
|
|
||||||
local normalHurt = runesEntity:getAttrValue(GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()])
|
|
||||||
local skillHurt = runesEntity:getAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()])
|
|
||||||
local critPer = runesEntity:getAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()])
|
|
||||||
local critHurtPer = runesEntity:getAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()])
|
|
||||||
local normalHurtPer = runesEntity:getAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], true)
|
|
||||||
local skillHurtPer = runesEntity:getAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], true)
|
|
||||||
local healPer = runesEntity:getAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()])
|
|
||||||
local allHurtp = runesEntity:getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()])
|
|
||||||
|
|
||||||
self.runesAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp
|
|
||||||
self.runesAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk
|
|
||||||
self.runesAttr[GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()]] = normalHurt
|
|
||||||
self.runesAttr[GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()]] = skillHurt
|
|
||||||
self.runesAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] = critPer
|
|
||||||
self.runesAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] = critHurtPer
|
|
||||||
self.runesAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] = normalHurtPer
|
|
||||||
self.runesAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] = skillHurtPer
|
|
||||||
self.runesAttr[GConst.MATCH_CURED_NAME[self:getMatchType()]] = healPer
|
|
||||||
self.runesAttr[GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()]] = allHurtp
|
|
||||||
|
|
||||||
-- if EDITOR_MODE then
|
|
||||||
-- local printStr = ""
|
|
||||||
-- printStr = printStr .. "更新符文数值:"..self:getCfgId() .. "\n"
|
|
||||||
-- printStr = printStr .. "生命:".. hp .. "\n"
|
|
||||||
-- printStr = printStr .. "攻击力:".. atk .. "\n"
|
|
||||||
-- printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
|
||||||
-- printStr = printStr .. "技能增伤:".. skillHurt .. "\n"
|
|
||||||
-- printStr = printStr .. "暴击率:".. critPer .. "\n"
|
|
||||||
-- printStr = printStr .. "暴击伤害百分比:".. critHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n"
|
|
||||||
-- printStr = printStr .. "治疗加成百分比:".. healPer .. "\n"
|
|
||||||
-- printStr = printStr .. "所有伤害百分比:".. allHurtp .. "\n"
|
|
||||||
-- Logger.logHighlight(printStr)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 更新总属性
|
-- 更新总属性
|
||||||
function HeroEntity:updateTotalAttr()
|
function HeroEntity:updateTotalAttr()
|
||||||
self.allAttr = {}
|
self.allAttr = {}
|
||||||
for k, v in pairs(self.baseAttrOriginal) do
|
for k, v in pairs(self.baseAttrOriginal) do
|
||||||
self:setTotalAttrValue(k, v)
|
self:setTotalAttrValue(k, v)
|
||||||
end
|
end
|
||||||
for k, v in pairs(self.equipAttr) do
|
|
||||||
self:addTotalAttrValue(k, v)
|
|
||||||
end
|
|
||||||
for k, v in pairs(self.skinAttr) do
|
for k, v in pairs(self.skinAttr) do
|
||||||
self:addTotalAttrValue(k, v)
|
self:addTotalAttrValue(k, v)
|
||||||
end
|
end
|
||||||
for k, v in pairs(self.runesAttr) do
|
|
||||||
self:addTotalAttrValue(k, v)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:setTotalAttrValue(name, value)
|
function HeroEntity:setTotalAttrValue(name, value)
|
||||||
@ -290,60 +188,41 @@ function HeroEntity:getTotalAttrValue(name)
|
|||||||
return GFunc.decryptNumber(self.allAttr[name])
|
return GFunc.decryptNumber(self.allAttr[name])
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:setLv(lv, onlyChangeLv)
|
-- 获取总基础生命值(英雄+装备+皮肤)
|
||||||
if not lv then
|
function HeroEntity:getTotalBaseHp()
|
||||||
return
|
local result = self:isActived() and self:getCfgHp() or self:getCfgHp(self:getBeginLv())
|
||||||
end
|
result = result + DataManager.SkinData:getBaseHp(self)
|
||||||
if self.data.lv == lv then
|
return result
|
||||||
return
|
|
||||||
end
|
|
||||||
self.data.lv = lv
|
|
||||||
self:updateAllAttr()
|
|
||||||
self:setDirty()
|
|
||||||
|
|
||||||
if not onlyChangeLv then
|
|
||||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_HERO_LV_UP, lv)
|
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, self:getCfgId())
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getCfgId()
|
-- 获取总基础攻击值(英雄+装备+皮肤)
|
||||||
return self.cfgId
|
function HeroEntity:getTotalBaseAtk()
|
||||||
|
local result = self:isActived() and self:getCfgAtk() or self:getCfgAtk(self:getBeginLv())
|
||||||
|
-- local logStr = self:getCfgId() .. "总基础攻击值:\n英雄:" .. result
|
||||||
|
-- 武器 + 防具
|
||||||
|
-- for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
||||||
|
-- local equipEntity = self:getEquips(partType)
|
||||||
|
-- if equipEntity then
|
||||||
|
-- -- logStr = logStr .. "\n" .. partName .. ":" .. equipEntity:getBaseAttack()
|
||||||
|
-- result = result + equipEntity:getBaseAttack()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- logStr = logStr .. "\nSKIN:" .. DataManager.SkinData:getBaseAttack(self)
|
||||||
|
result = result + DataManager.SkinData:getBaseAttack(self)
|
||||||
|
-- Logger.logHighlight(logStr)
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getLv()
|
function HeroEntity:getAtk()
|
||||||
return self.data.lv
|
local atkName = GConst.MATCH_ATTACK_NAME[self:getMatchType()]
|
||||||
|
local atkAddName = GConst.MATCH_ATTACK_ADD_NAME[self:getMatchType()]
|
||||||
|
return self:getTotalAttrValue(atkName) + self:getTotalAttrValue(atkAddName)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取当前穿戴皮肤
|
function HeroEntity:getHp()
|
||||||
function HeroEntity:getSkinId()
|
local hpName = ATTR_NAME.HP
|
||||||
if self.data.skin == nil or self.data.skin == 0 then
|
local hpAddName = GConst.MATCH_HP_ADD_NAME[self:getMatchType()]
|
||||||
return DataManager.SkinData:getOriginSkinId(self:getCfgId())
|
return self:getTotalAttrValue(hpName) + self:getTotalAttrValue(hpAddName)
|
||||||
end
|
|
||||||
return self.data.skin
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 穿戴皮肤
|
|
||||||
function HeroEntity:onChangeSkin(skinId)
|
|
||||||
self.data.skin = skinId
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getQlt()
|
|
||||||
return self.config.qlt
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getBeginLv()
|
|
||||||
return self.beginLv
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getMatchType()
|
|
||||||
return self.config.position
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 英雄每级可领取图鉴点数
|
|
||||||
function HeroEntity:getCollectionPoint()
|
|
||||||
return self.config.collection_point
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getCfgHp(lv)
|
function HeroEntity:getCfgHp(lv)
|
||||||
@ -369,34 +248,36 @@ function HeroEntity:getCfgAtk(lv)
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
function HeroEntity:getUnlcokChapter()
|
-- region 基础
|
||||||
return self.config.unlock_chapter
|
function HeroEntity:setLv(lv, onlyChangeLv)
|
||||||
|
if not lv then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.data.lv == lv then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.data.lv = lv
|
||||||
|
self:updateAllAttr()
|
||||||
|
self:setDirty()
|
||||||
|
|
||||||
|
if not onlyChangeLv then
|
||||||
|
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_HERO_LV_UP, lv)
|
||||||
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, self:getCfgId())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getUnlockDan()
|
function HeroEntity:getLv()
|
||||||
return self.config.unlock_arena
|
return self.data.lv
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getIsShowUnlcokChapter()
|
function HeroEntity:getBeginLv()
|
||||||
return self.config.is_show == 1
|
return self.beginLv
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getAtk()
|
|
||||||
local atkName = GConst.MATCH_ATTACK_NAME[self:getMatchType()]
|
|
||||||
local atkAddName = GConst.MATCH_ATTACK_ADD_NAME[self:getMatchType()]
|
|
||||||
return self:getTotalAttrValue(atkName) + self:getTotalAttrValue(atkAddName)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getHp()
|
|
||||||
local hpName = ATTR_NAME.HP
|
|
||||||
local hpAddName = GConst.MATCH_HP_ADD_NAME[self:getMatchType()]
|
|
||||||
return self:getTotalAttrValue(hpName) + self:getTotalAttrValue(hpAddName)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:isMaxLv()
|
function HeroEntity:isMaxLv()
|
||||||
return self.data.lv >= self:getMaxLv()
|
return self.data.lv >= self:getMaxLv()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getMaxLv()
|
function HeroEntity:getMaxLv()
|
||||||
@ -436,28 +317,18 @@ function HeroEntity:isUnlock()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local unlockChapter = self:getUnlcokChapter()
|
|
||||||
if unlockChapter and unlockChapter <= DataManager.ChapterData:getMaxChapterId() then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
local unlockDan = self:getUnlockDan()
|
|
||||||
if unlockDan and unlockDan <= DataManager.ArenaData:getFormartMaxGrading() then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:isActived()
|
function HeroEntity:isActived()
|
||||||
-- return self.data.lv >= self:getBeginLv()
|
return self.data.lv >= self:getBeginLv()
|
||||||
return self.data.lv >= 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getLvUpMaterials()
|
function HeroEntity:getLvUpMaterials()
|
||||||
local lv = self.data.lv + 1
|
local lv = self.data.lv + 1
|
||||||
-- if lv < self:getBeginLv() then
|
if lv < self:getBeginLv() then
|
||||||
-- lv = self:getBeginLv()
|
lv = self:getBeginLv()
|
||||||
-- end
|
end
|
||||||
local nextLvInfo = ConfigManager:getConfig("hero_level")[lv]
|
local nextLvInfo = ConfigManager:getConfig("hero_level")[lv]
|
||||||
if not nextLvInfo then
|
if not nextLvInfo then
|
||||||
return
|
return
|
||||||
@ -465,7 +336,9 @@ function HeroEntity:getLvUpMaterials()
|
|||||||
-- local fieldName = "cost_" .. self:getQlt()
|
-- local fieldName = "cost_" .. self:getQlt()
|
||||||
return nextLvInfo.cost
|
return nextLvInfo.cost
|
||||||
end
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
|
-- region 配置
|
||||||
function HeroEntity:getConfig()
|
function HeroEntity:getConfig()
|
||||||
return self.config
|
return self.config
|
||||||
end
|
end
|
||||||
@ -503,6 +376,10 @@ function HeroEntity:getLvUpCostId()
|
|||||||
return self.config.level_id
|
return self.config.level_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getCfgId()
|
||||||
|
return self.cfgId
|
||||||
|
end
|
||||||
|
|
||||||
function HeroEntity:getName()
|
function HeroEntity:getName()
|
||||||
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
||||||
end
|
end
|
||||||
@ -511,6 +388,14 @@ function HeroEntity:getDesc()
|
|||||||
return ModuleManager.HeroManager:getHeroDesc(self:getCfgId())
|
return ModuleManager.HeroManager:getHeroDesc(self:getCfgId())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getQlt()
|
||||||
|
return self.config.qlt
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getMatchType()
|
||||||
|
return self.config.position
|
||||||
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
-- function HeroEntity:getActiveRogueCount()
|
-- function HeroEntity:getActiveRogueCount()
|
||||||
-- local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
|
-- local lvInfo = ConfigManager:getConfig("hero_level")[self.data.lv]
|
||||||
@ -522,6 +407,7 @@ end
|
|||||||
-- return 0
|
-- return 0
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
-- region 技能
|
||||||
function HeroEntity:getUnlockRogueId()
|
function HeroEntity:getUnlockRogueId()
|
||||||
return self.config.rouge_skill
|
return self.config.rouge_skill
|
||||||
end
|
end
|
||||||
@ -573,69 +459,32 @@ function HeroEntity:getActiveRogueSkills()
|
|||||||
|
|
||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
|
-- endregion
|
||||||
|
|
||||||
-- 获取总基础生命值(英雄+装备+皮肤)
|
-- region 升星相关
|
||||||
function HeroEntity:getTotalBaseHp()
|
function HeroEntity:getStar()
|
||||||
local result = self:isActived() and self:getCfgHp() or self:getCfgHp(self:getBeginLv())
|
return self.data.star
|
||||||
-- 武器 + 防具
|
end
|
||||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
-- endregion
|
||||||
local equipEntity = self:getEquips(partType)
|
|
||||||
if equipEntity then
|
-- region 皮肤相关
|
||||||
result = result + equipEntity:getBaseHp()
|
|
||||||
end
|
-- 获取当前穿戴皮肤
|
||||||
|
function HeroEntity:getSkinId()
|
||||||
|
if self.data.skin == nil or self.data.skin == 0 then
|
||||||
|
return DataManager.SkinData:getOriginSkinId(self:getCfgId())
|
||||||
end
|
end
|
||||||
result = result + DataManager.SkinData:getBaseHp(self)
|
return self.data.skin
|
||||||
|
|
||||||
local runesEntity = self:getRunes()
|
|
||||||
if runesEntity then
|
|
||||||
result = result + runesEntity:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()], true)
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取总基础攻击值(英雄+装备+皮肤)
|
-- 穿戴皮肤
|
||||||
function HeroEntity:getTotalBaseAtk()
|
function HeroEntity:onChangeSkin(skinId)
|
||||||
local result = self:isActived() and self:getCfgAtk() or self:getCfgAtk(self:getBeginLv())
|
self.data.skin = skinId
|
||||||
-- local logStr = self:getCfgId() .. "总基础攻击值:\n英雄:" .. result
|
self:setDirty()
|
||||||
-- 武器 + 防具
|
|
||||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
|
||||||
local equipEntity = self:getEquips(partType)
|
|
||||||
if equipEntity then
|
|
||||||
-- logStr = logStr .. "\n" .. partName .. ":" .. equipEntity:getBaseAttack()
|
|
||||||
result = result + equipEntity:getBaseAttack()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- logStr = logStr .. "\nSKIN:" .. DataManager.SkinData:getBaseAttack(self)
|
|
||||||
result = result + DataManager.SkinData:getBaseAttack(self)
|
|
||||||
local runesEntity = self:getRunes()
|
|
||||||
if runesEntity then
|
|
||||||
-- logStr = logStr .. "\nRUNES:" .. self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], true)
|
|
||||||
result = result + runesEntity:getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], true)
|
|
||||||
end
|
|
||||||
-- Logger.logHighlight(logStr)
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- {partType = EquipEntity}
|
function HeroEntity:getSkins()
|
||||||
function HeroEntity:setEquips(partType, equipEntities, notNowUpdate)
|
return self.unlockSkins
|
||||||
if self.equipEntities == nil then
|
|
||||||
self.equipEntities = {}
|
|
||||||
end
|
|
||||||
self.equipEntities[partType] = equipEntities
|
|
||||||
|
|
||||||
if notNowUpdate then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self:getTotalAttrValue() -- 防止报错
|
|
||||||
self:onEquipAttrChange()
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getEquips(partType)
|
|
||||||
if self.equipEntities then
|
|
||||||
return self.equipEntities[partType]
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:setSkins(skinIds)
|
function HeroEntity:setSkins(skinIds)
|
||||||
@ -643,23 +492,6 @@ function HeroEntity:setSkins(skinIds)
|
|||||||
self:getTotalAttrValue() -- 防止报错
|
self:getTotalAttrValue() -- 防止报错
|
||||||
self:onSkinAttrChange()
|
self:onSkinAttrChange()
|
||||||
end
|
end
|
||||||
|
-- endregion
|
||||||
function HeroEntity:getSkins()
|
|
||||||
return self.unlockSkins
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:setRunes(runesEntity, notNowUpdate)
|
|
||||||
self.runesEntity = runesEntity
|
|
||||||
|
|
||||||
if notNowUpdate then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self:getTotalAttrValue() -- 防止报错
|
|
||||||
self:onRunesAttrChange()
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroEntity:getRunes()
|
|
||||||
return self.runesEntity
|
|
||||||
end
|
|
||||||
|
|
||||||
return HeroEntity
|
return HeroEntity
|
||||||
@ -1,390 +0,0 @@
|
|||||||
local RunesData = class("RunesData", BaseData)
|
|
||||||
local RunesEntity = require "app/userdata/runes/runes_entity"
|
|
||||||
|
|
||||||
function RunesData:ctor()
|
|
||||||
self.data.isDirty = false
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:clear()
|
|
||||||
DataManager:unregisterTryOpenFunc("RunesData")
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:init(data)
|
|
||||||
data = data or GConst.EMPTY_TABLE
|
|
||||||
if EDITOR_MODE then
|
|
||||||
Logger.logHighlight("符文初始化数据")
|
|
||||||
Logger.printTable(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
self:updateLevelAndExp(data.level or 1, data.exp or 0)
|
|
||||||
if data.heroes_grids then
|
|
||||||
for heroId, grids in pairs(data.heroes_grids) do
|
|
||||||
self:addRunes(heroId, grids.grids)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 处理上报
|
|
||||||
local formation = DataManager.FormationData:getStageFormation()
|
|
||||||
local runesChapter = {}
|
|
||||||
for elementType, heroId in pairs(formation) do
|
|
||||||
runesChapter[heroId] = data.heroes_grids[heroId]
|
|
||||||
end
|
|
||||||
BIReport:postRunes(BIReport.RUNES_FORMATION.CHAPTER, runesChapter)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 活动开启
|
|
||||||
DataManager:registerTryOpenFunc("RunesData", function()
|
|
||||||
if self:isOpen() then
|
|
||||||
DataManager:unregisterTryOpenFunc("RunesData")
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:setDirty()
|
|
||||||
self.data.isDirty = not self.data.isDirty
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:isOpen(showToast)
|
|
||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.RUNES_OPEN, not showToast) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:addRunes(heroId, grids)
|
|
||||||
if self.runes == nil then
|
|
||||||
self.runes = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.runes[heroId] == nil then
|
|
||||||
self.runes[heroId] = self:createEntity(heroId, grids)
|
|
||||||
else
|
|
||||||
self.runes[heroId]:updateGrids(grids)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:createEntity(heroId, grids)
|
|
||||||
return RunesEntity:create(heroId, grids)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesData:getRunes(heroId)
|
|
||||||
if self.runes == nil then
|
|
||||||
self.runes = {}
|
|
||||||
end
|
|
||||||
if self.runes[heroId] == nil then
|
|
||||||
self.runes[heroId] = self:createEntity(heroId)
|
|
||||||
end
|
|
||||||
|
|
||||||
return self.runes[heroId]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 是否有红点
|
|
||||||
function RunesData:hasRedPoint(tempCount)
|
|
||||||
return (tempCount or self:getMaterialCount()) > GFunc.getConstIntValue("runes_red_point")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取等级配置
|
|
||||||
function RunesData:getLevelConfig()
|
|
||||||
if self.RuneCfg == nil then
|
|
||||||
self.RuneCfg = ConfigManager:getConfig("runes_level")
|
|
||||||
end
|
|
||||||
|
|
||||||
return self.RuneCfg
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取铸台最大等级
|
|
||||||
function RunesData:getMaxLevel()
|
|
||||||
return #self:getLevelConfig()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取符文铸台等级
|
|
||||||
function RunesData:getLevel()
|
|
||||||
return self.level
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取等级当前经验
|
|
||||||
function RunesData:getLevelExp()
|
|
||||||
return self.exp - (self:getLevelConfig()[self:getLevel()].cost or 0)
|
|
||||||
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()
|
|
||||||
local nextExp
|
|
||||||
local cfg = self:getLevelConfig()[self:getLevel() + 1]
|
|
||||||
if cfg then
|
|
||||||
nextExp = cfg.cost or 0
|
|
||||||
end
|
|
||||||
local curExp = self:getLevelConfig()[self:getLevel()].cost or 0
|
|
||||||
|
|
||||||
return nextExp - curExp
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取需要检查锁定状态的品质的id
|
|
||||||
function RunesData:getCheckQualityIds()
|
|
||||||
local curLevel = self:getLevel()
|
|
||||||
local ids = {}
|
|
||||||
if curLevel <= GConst.RunesConst.NOT_CHECK_QLT_LEVEL then
|
|
||||||
return ids
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = GConst.RunesConst.MAX_QUALITY_COUNT, 1, -1 do
|
|
||||||
local weight = self:getQualityRate(self:getLevel(), i)
|
|
||||||
if weight then
|
|
||||||
table.insert(ids, i)
|
|
||||||
end
|
|
||||||
|
|
||||||
if #ids >= GConst.RunesConst.CHECK_QLT_LOCK_NUM then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.sort(ids)
|
|
||||||
|
|
||||||
return ids
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取相应铸台等级的品质概率
|
|
||||||
function RunesData:getQualityRate(level, quality)
|
|
||||||
local cfg = self:getLevelConfig()[level]
|
|
||||||
|
|
||||||
local total = 0
|
|
||||||
for i = 1, GConst.RunesConst.MAX_QUALITY_COUNT do
|
|
||||||
total = total + (cfg["weight_"..i] or 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
local value = cfg["weight_"..quality]
|
|
||||||
if value then
|
|
||||||
return string.format("%.2f",(value / total) * 100)
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取相应套装的相应属性
|
|
||||||
function RunesData:getSuitAttr(id, heroType, suitLevel)
|
|
||||||
local data = ConfigManager:getConfig("runes_suit")[id]
|
|
||||||
local attrs
|
|
||||||
if heroType == GConst.HeroConst.MATCH_TYPE.RED then
|
|
||||||
attrs = data.red_suit_attr
|
|
||||||
elseif heroType == GConst.HeroConst.MATCH_TYPE.YELLOW then
|
|
||||||
attrs = data.yellow_suit_attr
|
|
||||||
elseif heroType == GConst.HeroConst.MATCH_TYPE.GREEN then
|
|
||||||
attrs = data.green_suit_attr
|
|
||||||
elseif heroType == GConst.HeroConst.MATCH_TYPE.BLUE then
|
|
||||||
attrs = data.blue_suit_attr
|
|
||||||
elseif heroType == GConst.HeroConst.MATCH_TYPE.PURPLE then
|
|
||||||
attrs = data.purple_suit_attr
|
|
||||||
end
|
|
||||||
|
|
||||||
if attrs ~= nil and attrs[suitLevel] then
|
|
||||||
return attrs[suitLevel]
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
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()
|
|
||||||
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_RUNES)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 是否可以一键铸造
|
|
||||||
function RunesData:canAutoMake()
|
|
||||||
local cfg = self:getLevelConfig()[self:getLevel()]
|
|
||||||
return cfg.auto and cfg.auto == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取自动铸造的开启等级
|
|
||||||
function RunesData:getAutoMakeOpenLevel()
|
|
||||||
for level, data in ipairs(self:getLevelConfig()) do
|
|
||||||
if data.auto and data.auto == 1 then
|
|
||||||
return level
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 符文栏是否解锁
|
|
||||||
function RunesData:isUnlock(index)
|
|
||||||
local level = self:getLevel()
|
|
||||||
return index <= self:getLevelConfig()[level].grid
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取符文栏解锁个数
|
|
||||||
function RunesData:getUnlockCount()
|
|
||||||
local unlock = 0
|
|
||||||
for i = 1, GConst.RunesConst.MAX_ATTR_GRID_COUNT do
|
|
||||||
if self:isUnlock(i) then
|
|
||||||
unlock = unlock + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return unlock
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取符文栏解锁等级要求
|
|
||||||
function RunesData:getUnlockLevel(index)
|
|
||||||
for level, data in ipairs(self:getLevelConfig()) do
|
|
||||||
if data.grid >= index then
|
|
||||||
return level
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取套装名
|
|
||||||
function RunesData:getSuitName(index)
|
|
||||||
if index == 1 then
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_10)
|
|
||||||
elseif index == 2 then
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_11)
|
|
||||||
elseif index == 3 then
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_14)
|
|
||||||
elseif index == 4 then
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_12)
|
|
||||||
elseif index == 5 then
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_13)
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 改变属性栏锁定状态成功
|
|
||||||
function RunesData:onGridLockSuccess(heroId, grids)
|
|
||||||
self.runes[heroId]:updateGrids(grids)
|
|
||||||
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取随机一套grids数据
|
|
||||||
function RunesData:getRandomGrids()
|
|
||||||
if self.fakeGrids == nil then
|
|
||||||
self.fakeGrids = {}
|
|
||||||
|
|
||||||
local maxQlt = self:getCheckQualityIds()[1] - 1
|
|
||||||
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(maxQlt)
|
|
||||||
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()
|
|
||||||
self.executedTotalAutoCount = self.executedTotalAutoCount + 1
|
|
||||||
self.executedAutoCount = self.executedAutoCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 检查自动次数是否足够
|
|
||||||
function RunesData:checkAutoTime()
|
|
||||||
if self.executedTotalAutoCount >= self.autoTotalCount then
|
|
||||||
-- 剩余自动次数不足,同步并请求数据
|
|
||||||
ModuleManager.RunesManager:reqSyncQuenching(self.isCountEnd)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 淬炼成功
|
|
||||||
function RunesData:onQuenchingSuccess(level, exp, heroId, grids)
|
|
||||||
self:updateLevelAndExp(level, exp)
|
|
||||||
self.runes[heroId]:updateGrids(grids)
|
|
||||||
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 自动淬炼数据获取成功
|
|
||||||
function RunesData:onGetAutoQuenchingDataSuccess(heroId, count, isCountEnd)
|
|
||||||
self.autoHeroId = heroId
|
|
||||||
self.autoTotalCount = count
|
|
||||||
self.executedTotalAutoCount = 0
|
|
||||||
self.executedAutoCount = 0
|
|
||||||
self.isCountEnd = isCountEnd
|
|
||||||
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 自动淬炼成功
|
|
||||||
function RunesData:onAutoQuenchingSuccess(level, exp, grids)
|
|
||||||
self:updateLevelAndExp(level, exp)
|
|
||||||
self.runes[self:getAutoHeroId()]:updateGrids(grids)
|
|
||||||
self.executedAutoCount = 0
|
|
||||||
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 更新等级和经验
|
|
||||||
function RunesData:updateLevelAndExp(level, exp)
|
|
||||||
if self.level and self.level ~= level then
|
|
||||||
-- 等级变了,重置假数据
|
|
||||||
self.fakeGrids = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
self.level = level
|
|
||||||
self.exp = exp
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 自动淬炼失败
|
|
||||||
function RunesData:onAutoQuenchingFailed()
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
return RunesData
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a9a5f762edecf854ab9eecd7ace92c0e
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,245 +0,0 @@
|
|||||||
local RunesEntity = class("RunesEntity", BaseData)
|
|
||||||
local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR
|
|
||||||
|
|
||||||
function RunesEntity:ctor(heroId, grids)
|
|
||||||
self.heroId = heroId
|
|
||||||
self.grids = grids or {}
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesEntity:setDirty()
|
|
||||||
self.data.isDirty = not self.data.isDirty
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesEntity:updateGrids(grids)
|
|
||||||
self.grids = grids or {}
|
|
||||||
self:getHeroEntity():onRunesAttrChange()
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
function RunesEntity:getHeroEntity()
|
|
||||||
if self.heroEntity == nil then
|
|
||||||
self.heroEntity = DataManager.HeroData:getHeroById(self.heroId)
|
|
||||||
end
|
|
||||||
|
|
||||||
return self.heroEntity
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 符文栏是否锁定属性
|
|
||||||
function RunesEntity:isAttrLock(index)
|
|
||||||
if self.grids[index] then
|
|
||||||
return self.grids[index].lock
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取已锁定的符文栏个数
|
|
||||||
function RunesEntity:getAttrLockCount()
|
|
||||||
local lock = 0
|
|
||||||
for i = 1, GConst.RunesConst.MAX_ATTR_GRID_COUNT do
|
|
||||||
if self:isAttrLock(i) then
|
|
||||||
lock = lock + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return lock
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 是否存在品质大于s的未锁定
|
|
||||||
function RunesEntity:isUnlockHighQlt()
|
|
||||||
for idx, data in ipairs(self.grids) do
|
|
||||||
if table.containValue(DataManager.RunesData:getCheckQualityIds(), self:getGridQuality(idx)) and not self:isAttrLock(idx) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取锻造的材料消耗
|
|
||||||
function RunesEntity:getMaterialCost()
|
|
||||||
local base = GFunc.getConstReward("runes_cost_base")
|
|
||||||
local add = GFunc.getConstReward("runes_cost_add")
|
|
||||||
local total = {id = base.id, num = base.num, type = base.type}
|
|
||||||
|
|
||||||
total.num = total.num + (add.num * self:getAttrLockCount())
|
|
||||||
|
|
||||||
return total
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取锻造的材料消耗个数
|
|
||||||
function RunesEntity:getMaterialCostNum()
|
|
||||||
local num = DataManager.RunesData:getMaterialCostBaseNum()
|
|
||||||
|
|
||||||
num = num + (DataManager.RunesData:getMaterialCostAddNum() * self:getAttrLockCount())
|
|
||||||
|
|
||||||
return num
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取格子的符文属性
|
|
||||||
function RunesEntity:getGridAttr(index)
|
|
||||||
if self.grids[index] then
|
|
||||||
local cfg = ConfigManager:getConfig("runes_sub")[self:getGridQuality(index)]
|
|
||||||
local attr = cfg["attr_"..self:getGridAttrIndex(index)]
|
|
||||||
if attr then
|
|
||||||
return attr[self:getHeroEntity():getMatchType()]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
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)
|
|
||||||
if not self:isAttrLock(index) and ModuleManager.RunesManager:isInAutoQuenching() then
|
|
||||||
return DataManager.RunesData:getRandomGrids()[index].quality
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.grids[index] then
|
|
||||||
return self.grids[index].quality
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取格子的套装
|
|
||||||
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
|
|
||||||
return self.grids[index].suit
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Logger.logError("英雄".. self.heroId .. "未获取到格子的符文数据:"..tostring(index))
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取套装等级,2件套是lv1,4件套是lv2,没有就是lv0
|
|
||||||
function RunesEntity:getSuitLevel(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
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
if count and count >= 2 then
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取已有的套装id map
|
|
||||||
function RunesEntity:getSuitIds()
|
|
||||||
local typeCount = {}
|
|
||||||
for i = 1, GConst.RunesConst.MAX_ATTR_GRID_COUNT do
|
|
||||||
local t = self:getGridSuit(i)
|
|
||||||
if t then
|
|
||||||
local temp = table.find(typeCount, function(value) return value.id == t end)
|
|
||||||
if temp then
|
|
||||||
temp.count = temp.count + 1
|
|
||||||
else
|
|
||||||
table.insert(typeCount, {id = t, count = 1})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.sort(typeCount, function(a, b)
|
|
||||||
return a.count > b.count
|
|
||||||
end)
|
|
||||||
|
|
||||||
return typeCount
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 属性相关接口start------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- 获取所有属性加成,未经过计算加成
|
|
||||||
function RunesEntity:getAllAttr()
|
|
||||||
if not DataManager.RunesData:isOpen() then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local all = {}
|
|
||||||
local func = function(attr)
|
|
||||||
if attr == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local temp = table.find(all, function(value)
|
|
||||||
return value.type == attr.type
|
|
||||||
end)
|
|
||||||
|
|
||||||
if temp then
|
|
||||||
temp.num = temp.num + attr.num
|
|
||||||
else
|
|
||||||
table.insert(all, {type = attr.type, num = attr.num})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 格子属性
|
|
||||||
for i = 1, GConst.RunesConst.MAX_ATTR_GRID_COUNT do
|
|
||||||
func(self:getGridAttr(i))
|
|
||||||
end
|
|
||||||
-- 套装属性
|
|
||||||
local pos = self:getHeroEntity():getMatchType()
|
|
||||||
for idx, data in pairs(self:getSuitIds()) do
|
|
||||||
func(DataManager.RunesData:getSuitAttr(data.id, pos, self:getSuitLevel(data.id)))
|
|
||||||
end
|
|
||||||
|
|
||||||
return all
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 是否拥有某属性
|
|
||||||
function RunesEntity:hasAttr(attrType)
|
|
||||||
return self:getAttrValue(attrType) > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取属性 , isBase是否是基础配置的属性
|
|
||||||
function RunesEntity:getAttrValue(attrType, isBase)
|
|
||||||
if type(attrType) ~= "string" then
|
|
||||||
Logger.logError("获取符文属性传入格式错误")
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local result
|
|
||||||
if not isBase and attrType == GConst.MATCH_HP_FIX_NAME[self:getHeroEntity():getMatchType()] then
|
|
||||||
result = self:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getHeroEntity():getMatchType()], true)
|
|
||||||
result = result + self:getHeroEntity():getTotalBaseHp() * self:getAttrValue(GConst.MATCH_HP_ADD_NAME[self:getHeroEntity():getMatchType()]) // DEFAULT_FACTOR
|
|
||||||
return result
|
|
||||||
elseif not isBase and attrType == GConst.MATCH_ATTACK_NAME[self:getHeroEntity():getMatchType()] then
|
|
||||||
result = self:getAttrValue(GConst.MATCH_ATTACK_NAME[self:getHeroEntity():getMatchType()], true)
|
|
||||||
result = result + self:getHeroEntity():getTotalBaseAtk() * self:getAttrValue(GConst.MATCH_ATTACK_ADD_NAME[self:getHeroEntity():getMatchType()]) // DEFAULT_FACTOR
|
|
||||||
return result
|
|
||||||
elseif not isBase and (attrType == GConst.MATCH_NORMAL_HURTP_NAME[self:getHeroEntity():getMatchType()] or attrType == GConst.MATCH_SKILL_HURTP_NAME[self:getHeroEntity():getMatchType()]) then
|
|
||||||
result = self:getAttrValue(attrType, true)
|
|
||||||
result = result + self:getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getHeroEntity():getMatchType()], true)
|
|
||||||
return result
|
|
||||||
else
|
|
||||||
local all = self:getAllAttr()
|
|
||||||
if all == nil then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
result = table.find(all, function(value)
|
|
||||||
return attrType == value.type
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
return result and result.num or 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 属性相关接口end------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
return RunesEntity
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 22f546c66a8d67842b8befee0e17a707
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user