This commit is contained in:
puxuan 2025-09-09 19:39:38 +08:00
parent 96fe08e143
commit a2eaf90572
22 changed files with 747 additions and 288 deletions

View File

@ -159,7 +159,7 @@ function DataManager:initWithServerData(data)
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)
self.FormationData:init(data.fight_info) self.FormationData:init(data.fight_info)
self.EquipData:init(data.heroes_equips) self.EquipData:init(data.equip)
self.SkinData:init(data.bag.skins) self.SkinData:init(data.bag.skins)
-- HeroData要在EquipData、SkinData之后初始化依赖它们的属性数据 -- HeroData要在EquipData、SkinData之后初始化依赖它们的属性数据
self.HeroData:init(data.bag.heroes) self.HeroData:init(data.bag.heroes)

View File

@ -128,6 +128,8 @@ ModuleManager.MODULE_KEY = {
TALENT_OPEN = "talent_open", -- 天赋功能开启条件 TALENT_OPEN = "talent_open", -- 天赋功能开启条件
DUNGEON_OPEN = "dungeon_open", -- 玩法入口页签开启条件 DUNGEON_OPEN = "dungeon_open", -- 玩法入口页签开启条件
SUMMON_OPEN = "summon_open", -- 英雄抽卡功能开启条件(包括普通和高级抽) SUMMON_OPEN = "summon_open", -- 英雄抽卡功能开启条件(包括普通和高级抽)
-- 战力/攻击力toast
PowerToastManager = "app/ui/common/power_toast_manager",
} }
local _moduleMgrs = {} local _moduleMgrs = {}

View File

@ -681,6 +681,8 @@ local LocalizationGlobalConst =
HERO_DESC_22 = "HERO_DESC_22", HERO_DESC_22 = "HERO_DESC_22",
HERO_DESC_23 = "HERO_DESC_23", HERO_DESC_23 = "HERO_DESC_23",
BAG_DESC_1 = "BAG_DESC_1", BAG_DESC_1 = "BAG_DESC_1",
EQUIP_DESC_29 = "EQUIP_DESC_29",
EQUIP_DESC_30 = "EQUIP_DESC_30",
} }
return LocalizationGlobalConst return LocalizationGlobalConst

View File

@ -681,6 +681,8 @@ local localization_global =
["HERO_DESC_22"] = "去升星", ["HERO_DESC_22"] = "去升星",
["HERO_DESC_23"] = "技能等级:{0}", ["HERO_DESC_23"] = "技能等级:{0}",
["BAG_DESC_1"] = "背包", ["BAG_DESC_1"] = "背包",
["EQUIP_DESC_29"] = "只有上阵的英雄才能穿戴装备",
["EQUIP_DESC_30"] = "穿戴",
} }
return localization_global return localization_global

View File

@ -197,6 +197,7 @@ GConst.TYPEOF_LUA_CLASS = {
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell", GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
ARENA_GRADING_CELL = "app/ui/arena/cell/arena_grading_cell", ARENA_GRADING_CELL = "app/ui/arena/cell/arena_grading_cell",
PLAYER_RECORD_CELL = "app/ui/common/cell/player_record_cell", PLAYER_RECORD_CELL = "app/ui/common/cell/player_record_cell",
EQUIP_CELL = "app/ui/common/cell/equip_cell",
-- comp -- comp
HERO_FORMATION_COMP = "app/ui/common/component/hero_formation_comp", HERO_FORMATION_COMP = "app/ui/common/component/hero_formation_comp",

View File

@ -2,11 +2,12 @@ local EquipConst = {}
-- 部位类型 -- 部位类型
EquipConst.PART_TYPE = { EquipConst.PART_TYPE = {
WEAPON = 1, EQUIP_1 = 1,
HAT = 2, EQUIP_2 = 2,
CLOTHES = 3, EQUIP_3 = 3,
BELT = 4, EQUIP_4 = 4,
HANDGUARD = 5 EQUIP_5 = 5,
EQUIP_6 = 5,
} }
return EquipConst return EquipConst

View File

@ -1,93 +1,100 @@
local EquipManager = class("EquipManager", BaseModule) local EquipManager = class("EquipManager", BaseModule)
function EquipManager:showEquipListUI(heroEntity, part)
UIManager:showUI("app/ui/equip/equip_list_ui", {heroEntity = heroEntity, part = part})
end
-- 展示材料获取弹窗(英雄id部位材料id材料数量) -- 展示材料获取弹窗(英雄id部位材料id材料数量)
function EquipManager:showItemGetPop(heroId, part, id, num) function EquipManager:showItemGetPop(heroId, part, id, num)
self:reqEquipUpgradeGift(heroId, part) self:reqEquipUpgradeGift(heroId, part)
UIManager:showUI("app/ui/dungeon/item_get_ui", {heroId = heroId, part = part, id = id, value = num}) UIManager:showUI("app/ui/dungeon/item_get_ui", {heroId = heroId, part = part, id = id, value = num})
end
-- 检查装备礼包状态定时器
function EquipManager:updateEquipGiftTimer(isClear)
self:unscheduleAll()
if not isClear then
local time = DataManager.EquipData:getGiftNearestRemainTime()
if time and time > 0 then
Logger.logHighlight("设置装备礼包倒计时:"..time)
self.giftSid = self:performWithDelayGlobal(function()
DataManager.EquipData:onGiftStateChange()
end, time)
end
end
end end
-- 请求触发装备升级礼包 -- 请求触发装备升级礼包
function EquipManager:reqEquipUpgradeGift(heroId, part) function EquipManager:reqEquipUpgradeGift(heroId, part)
if DataManager.EquipData:getCanShowGiftId(heroId, part) ~= nil then if DataManager.EquipData:getCanShowGiftId(heroId, part) ~= nil then
return return
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.TriggerWeaponArmorGiftReq, {hero_id = heroId, equip_position = part}, {}, self.rspEquipUpgradeGift, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.TriggerWeaponArmorGiftReq, {hero_id = heroId, equip_position = part}, {}, self.rspEquipUpgradeGift, nil)
end end
function EquipManager:rspEquipUpgradeGift(result) function EquipManager:rspEquipUpgradeGift(result)
DataManager.EquipData:initGifts(result.info) DataManager.EquipData:initGifts(result.info)
end end
-- 升级装备 -- 升级装备
function EquipManager:reqUpgrade(id, part) function EquipManager:reqUpgrade(id, part)
local entity = DataManager.EquipData:getEquip(id, part) local entity = DataManager.EquipData:getEquip(id, part)
if not entity then if not entity then
return return
end end
local heroEntity = DataManager.HeroData:getHeroById(id) local heroEntity = DataManager.HeroData:getHeroById(id)
if heroEntity == nil or not heroEntity:isUnlock() then if heroEntity == nil or not heroEntity:isUnlock() then
return return
end end
for index, cost in ipairs(entity:getUpgradeMaterials()) do for index, cost in ipairs(entity:getUpgradeMaterials()) do
if cost.num > DataManager.BagData.ItemData:getItemNumById(cost.id) then if cost.num > DataManager.BagData.ItemData:getItemNumById(cost.id) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8))
self:showItemGetPop(id, part, cost.id, cost.num) self:showItemGetPop(id, part, cost.id, cost.num)
return return
end end
end end
if not entity:isEnoughGold() then if not entity:isEnoughGold() then
if not ModuleManager.ShopManager:tryTriggerCoinGift() then if not ModuleManager.ShopManager:tryTriggerCoinGift() then
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD) GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD)
end end
return return
end end
if entity:isMaxLevel() then if entity:isMaxLevel() then
if entity:getPart() == GConst.EquipConst.PART_TYPE.WEAPON then if entity:getPart() == GConst.EquipConst.PART_TYPE.WEAPON then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_7, DataManager.PlayerData:getLv() + 1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_7, DataManager.PlayerData:getLv() + 1))
else else
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_9, entity:getLevel() + 1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_9, entity:getLevel() + 1))
end end
return return
end end
local itemGetType = BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE local itemGetType = BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE
if part ~= GConst.EquipConst.PART_TYPE.WEAPON then if part ~= GConst.EquipConst.PART_TYPE.WEAPON then
itemGetType = BIReport.ITEM_GET_TYPE.ARMOR_UPGRADE itemGetType = BIReport.ITEM_GET_TYPE.ARMOR_UPGRADE
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, itemGetType) self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, itemGetType)
end end
function EquipManager:rspUpgrade(result) function EquipManager:rspUpgrade(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position) DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position)
if result.reqData.position == GConst.EquipConst.PART_TYPE.WEAPON then if result.reqData.position == GConst.EquipConst.PART_TYPE.WEAPON then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_WEAPON) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_WEAPON)
else else
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_ARMOR) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_ARMOR)
end end
end end
end end
--@region
function EquipManager:onEquipWearReq(slotId, ids)
local params = {}
params.slot = slotId
params.ids = ids
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipWearReq, params, {}, self.onEquipWearRsp, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
end
function EquipManager:onEquipWearRsp(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.HeroData:setHeroLv(result.hero.id, result.hero.level)
DataManager.HeroData:setDirty()
AudioManager:playEffect(AudioManager.EFFECT_ID.HERO_UP)
end
end
--@endregion
return EquipManager return EquipManager

View File

@ -31,7 +31,7 @@ HeroConst.CHECK_LV_UP_STATE = {
HeroConst.PANEL_TYPE = { HeroConst.PANEL_TYPE = {
HERO = 1, HERO = 1,
STAR = 2, STAR = 2,
SKIN = 3, EQUIP = 3,
} }
-- 总计 -- 总计

View File

@ -9,8 +9,6 @@ local ProtoMsgType = {
[132244689] = "ChapterSettlementRsp", [132244689] = "ChapterSettlementRsp",
[147147672] = "EnergyByADReq", [147147672] = "EnergyByADReq",
[147149505] = "EnergyByADRsp", [147149505] = "EnergyByADRsp",
[236190053] = "ChapterShardsChallengeStartReq",
[236191886] = "ChapterShardsChallengeStartRsp",
[252740891] = "PVPOverCDReq", [252740891] = "PVPOverCDReq",
[252742724] = "PVPOverCDRsp", [252742724] = "PVPOverCDRsp",
[295348381] = "ChangeAvatarReq", [295348381] = "ChangeAvatarReq",
@ -24,6 +22,8 @@ local ProtoMsgType = {
[433809660] = "LevelUpRsp", [433809660] = "LevelUpRsp",
[516281556] = "GuideFundMarkReq", [516281556] = "GuideFundMarkReq",
[516283389] = "GuideFundMarkRsp", [516283389] = "GuideFundMarkRsp",
[522621311] = "DungeonSettlementReq",
[522623144] = "DungeonSettlementRsp",
[524551468] = "FourteenBountyAwardReq", [524551468] = "FourteenBountyAwardReq",
[524553301] = "FourteenBountyAwardRsp", [524553301] = "FourteenBountyAwardRsp",
[531558517] = "PigPlayUpdateNtf", [531558517] = "PigPlayUpdateNtf",
@ -45,8 +45,6 @@ local ProtoMsgType = {
[817579102] = "SwitchFrontRsp", [817579102] = "SwitchFrontRsp",
[822916593] = "MatchReq", [822916593] = "MatchReq",
[822918426] = "MatchRsp", [822918426] = "MatchRsp",
[834139466] = "ChapterGoldChallengeStartReq",
[834141299] = "ChapterGoldChallengeStartRsp",
[850670891] = "SummerBountyClaimByDiamondReq", [850670891] = "SummerBountyClaimByDiamondReq",
[850672724] = "SummerBountyClaimByDiamondRsp", [850672724] = "SummerBountyClaimByDiamondRsp",
[904222760] = "ArenaBountyLevelUnlockReq", [904222760] = "ArenaBountyLevelUnlockReq",
@ -65,14 +63,16 @@ local ProtoMsgType = {
[1114437583] = "ItemUseRsp", [1114437583] = "ItemUseRsp",
[1150265172] = "ActivityPVPDailyRewardsReq", [1150265172] = "ActivityPVPDailyRewardsReq",
[1150267005] = "ActivityPVPDailyRewardsRsp", [1150267005] = "ActivityPVPDailyRewardsRsp",
[1224176921] = "EquipRefineReq",
[1224178754] = "EquipRefineRsp",
[1283733956] = "ActivityPVPMatchReq", [1283733956] = "ActivityPVPMatchReq",
[1283735789] = "ActivityPVPMatchRsp", [1283735789] = "ActivityPVPMatchRsp",
[1312685858] = "BossRushTopReq", [1312685858] = "BossRushTopReq",
[1312687691] = "BossRushTopRsp", [1312687691] = "BossRushTopRsp",
[1326064687] = "FourteenBountyExchangeAwardReq", [1326064687] = "FourteenBountyExchangeAwardReq",
[1326066520] = "FourteenBountyExchangeAwardRsp", [1326066520] = "FourteenBountyExchangeAwardRsp",
[1371198132] = "ChapterShardsChallengeSettlementReq", [1405582465] = "EquipDecomposeReq",
[1371199965] = "ChapterShardsChallengeSettlementRsp", [1405584298] = "EquipDecomposeRsp",
[1433352538] = "ChapterDailyChallengeResetReq", [1433352538] = "ChapterDailyChallengeResetReq",
[1433354371] = "ChapterDailyChallengeResetRsp", [1433354371] = "ChapterDailyChallengeResetRsp",
[1471116409] = "BindReq", [1471116409] = "BindReq",
@ -83,8 +83,6 @@ local ProtoMsgType = {
[1515382047] = "CardDailyRewardRsp", [1515382047] = "CardDailyRewardRsp",
[1552772605] = "MallDailyBuyReq", [1552772605] = "MallDailyBuyReq",
[1552774438] = "MallDailyBuyRsp", [1552774438] = "MallDailyBuyRsp",
[1571184475] = "ChapterShardsChallengeFarmReq",
[1571186308] = "ChapterShardsChallengeFarmRsp",
[1584689751] = "ActPaidResultReq", [1584689751] = "ActPaidResultReq",
[1584691584] = "ActPaidResultRsp", [1584691584] = "ActPaidResultRsp",
[1635643251] = "RecoveryNtf", [1635643251] = "RecoveryNtf",
@ -208,8 +206,6 @@ local ProtoMsgType = {
[3309820798] = "HeroPutOnReq", [3309820798] = "HeroPutOnReq",
[3309822631] = "HeroPutOnRsp", [3309822631] = "HeroPutOnRsp",
[3341173994] = "BountyBoughtNtf", [3341173994] = "BountyBoughtNtf",
[3359969683] = "ChapterGoldChallengeSettlementReq",
[3359971516] = "ChapterGoldChallengeSettlementRsp",
[3363939655] = "TaskDailyAdReq", [3363939655] = "TaskDailyAdReq",
[3363941488] = "TaskDailyAdRsp", [3363941488] = "TaskDailyAdRsp",
[3421550443] = "GlobalGiftReq", [3421550443] = "GlobalGiftReq",
@ -226,6 +222,8 @@ local ProtoMsgType = {
[3512216171] = "BossRushPlayerInfoRsp", [3512216171] = "BossRushPlayerInfoRsp",
[3525363388] = "TaskAchievementReq", [3525363388] = "TaskAchievementReq",
[3525365221] = "TaskAchievementRsp", [3525365221] = "TaskAchievementRsp",
[3530560174] = "DungeonStartReq",
[3530562007] = "DungeonStartRsp",
[3531336428] = "TournArenaRankClaimRewardReq", [3531336428] = "TournArenaRankClaimRewardReq",
[3531338261] = "TournArenaRankClaimRewardRsp", [3531338261] = "TournArenaRankClaimRewardRsp",
[3533710638] = "TournArenaBountyClaimReq", [3533710638] = "TournArenaBountyClaimReq",
@ -247,10 +245,10 @@ local ProtoMsgType = {
[3629728287] = "ActivityPVPSettlementRsp", [3629728287] = "ActivityPVPSettlementRsp",
[3629950931] = "PVPStageRewardReq", [3629950931] = "PVPStageRewardReq",
[3629952764] = "PVPStageRewardRsp", [3629952764] = "PVPStageRewardRsp",
[3694862366] = "BossRushFormationReq",
[3694864199] = "BossRushFormationRsp",
[3739566473] = "SummerDataReq", [3739566473] = "SummerDataReq",
[3739568306] = "SummerDataRsp", [3739568306] = "SummerDataRsp",
[3750411183] = "EquipWearReq",
[3750413016] = "EquipWearRsp",
[3757169544] = "BountyRewardReq", [3757169544] = "BountyRewardReq",
[3757171377] = "BountyRewardRsp", [3757171377] = "BountyRewardRsp",
[3762291611] = "ActivityPVPStartReq", [3762291611] = "ActivityPVPStartReq",
@ -281,14 +279,14 @@ local ProtoMsgType = {
[4099984587] = "BossRushExchangeRsp", [4099984587] = "BossRushExchangeRsp",
[4106156009] = "BountyLevelUnlockReq", [4106156009] = "BountyLevelUnlockReq",
[4106157842] = "BountyLevelUnlockRsp", [4106157842] = "BountyLevelUnlockRsp",
[4133057746] = "ChapterGoldChallengeFarmReq",
[4133059579] = "ChapterGoldChallengeFarmRsp",
[4152754481] = "PVPChallengeStartReq", [4152754481] = "PVPChallengeStartReq",
[4152756314] = "PVPChallengeStartRsp", [4152756314] = "PVPChallengeStartRsp",
[4155165814] = "SummerTaskClaimReq", [4155165814] = "SummerTaskClaimReq",
[4155167647] = "SummerTaskClaimRsp", [4155167647] = "SummerTaskClaimRsp",
[4188104820] = "HeroFundAwardReq", [4188104820] = "HeroFundAwardReq",
[4188106653] = "HeroFundAwardRsp", [4188106653] = "HeroFundAwardRsp",
[4192050044] = "DungeonSweepReq",
[4192051877] = "DungeonSweepRsp",
[4195650791] = "TriggerWeaponArmorGiftReq", [4195650791] = "TriggerWeaponArmorGiftReq",
[4195652624] = "TriggerWeaponArmorGiftRsp", [4195652624] = "TriggerWeaponArmorGiftRsp",
[4250417467] = "PlayerInfoReq", [4250417467] = "PlayerInfoReq",
@ -308,8 +306,6 @@ local ProtoMsgType = {
ChapterSettlementRsp = 132244689, ChapterSettlementRsp = 132244689,
EnergyByADReq = 147147672, EnergyByADReq = 147147672,
EnergyByADRsp = 147149505, EnergyByADRsp = 147149505,
ChapterShardsChallengeStartReq = 236190053,
ChapterShardsChallengeStartRsp = 236191886,
PVPOverCDReq = 252740891, PVPOverCDReq = 252740891,
PVPOverCDRsp = 252742724, PVPOverCDRsp = 252742724,
ChangeAvatarReq = 295348381, ChangeAvatarReq = 295348381,
@ -323,6 +319,8 @@ local ProtoMsgType = {
LevelUpRsp = 433809660, LevelUpRsp = 433809660,
GuideFundMarkReq = 516281556, GuideFundMarkReq = 516281556,
GuideFundMarkRsp = 516283389, GuideFundMarkRsp = 516283389,
DungeonSettlementReq = 522621311,
DungeonSettlementRsp = 522623144,
FourteenBountyAwardReq = 524551468, FourteenBountyAwardReq = 524551468,
FourteenBountyAwardRsp = 524553301, FourteenBountyAwardRsp = 524553301,
PigPlayUpdateNtf = 531558517, PigPlayUpdateNtf = 531558517,
@ -344,8 +342,6 @@ local ProtoMsgType = {
SwitchFrontRsp = 817579102, SwitchFrontRsp = 817579102,
MatchReq = 822916593, MatchReq = 822916593,
MatchRsp = 822918426, MatchRsp = 822918426,
ChapterGoldChallengeStartReq = 834139466,
ChapterGoldChallengeStartRsp = 834141299,
SummerBountyClaimByDiamondReq = 850670891, SummerBountyClaimByDiamondReq = 850670891,
SummerBountyClaimByDiamondRsp = 850672724, SummerBountyClaimByDiamondRsp = 850672724,
ArenaBountyLevelUnlockReq = 904222760, ArenaBountyLevelUnlockReq = 904222760,
@ -364,14 +360,16 @@ local ProtoMsgType = {
ItemUseRsp = 1114437583, ItemUseRsp = 1114437583,
ActivityPVPDailyRewardsReq = 1150265172, ActivityPVPDailyRewardsReq = 1150265172,
ActivityPVPDailyRewardsRsp = 1150267005, ActivityPVPDailyRewardsRsp = 1150267005,
EquipRefineReq = 1224176921,
EquipRefineRsp = 1224178754,
ActivityPVPMatchReq = 1283733956, ActivityPVPMatchReq = 1283733956,
ActivityPVPMatchRsp = 1283735789, ActivityPVPMatchRsp = 1283735789,
BossRushTopReq = 1312685858, BossRushTopReq = 1312685858,
BossRushTopRsp = 1312687691, BossRushTopRsp = 1312687691,
FourteenBountyExchangeAwardReq = 1326064687, FourteenBountyExchangeAwardReq = 1326064687,
FourteenBountyExchangeAwardRsp = 1326066520, FourteenBountyExchangeAwardRsp = 1326066520,
ChapterShardsChallengeSettlementReq = 1371198132, EquipDecomposeReq = 1405582465,
ChapterShardsChallengeSettlementRsp = 1371199965, EquipDecomposeRsp = 1405584298,
ChapterDailyChallengeResetReq = 1433352538, ChapterDailyChallengeResetReq = 1433352538,
ChapterDailyChallengeResetRsp = 1433354371, ChapterDailyChallengeResetRsp = 1433354371,
BindReq = 1471116409, BindReq = 1471116409,
@ -382,8 +380,6 @@ local ProtoMsgType = {
CardDailyRewardRsp = 1515382047, CardDailyRewardRsp = 1515382047,
MallDailyBuyReq = 1552772605, MallDailyBuyReq = 1552772605,
MallDailyBuyRsp = 1552774438, MallDailyBuyRsp = 1552774438,
ChapterShardsChallengeFarmReq = 1571184475,
ChapterShardsChallengeFarmRsp = 1571186308,
ActPaidResultReq = 1584689751, ActPaidResultReq = 1584689751,
ActPaidResultRsp = 1584691584, ActPaidResultRsp = 1584691584,
RecoveryNtf = 1635643251, RecoveryNtf = 1635643251,
@ -507,8 +503,6 @@ local ProtoMsgType = {
HeroPutOnReq = 3309820798, HeroPutOnReq = 3309820798,
HeroPutOnRsp = 3309822631, HeroPutOnRsp = 3309822631,
BountyBoughtNtf = 3341173994, BountyBoughtNtf = 3341173994,
ChapterGoldChallengeSettlementReq = 3359969683,
ChapterGoldChallengeSettlementRsp = 3359971516,
TaskDailyAdReq = 3363939655, TaskDailyAdReq = 3363939655,
TaskDailyAdRsp = 3363941488, TaskDailyAdRsp = 3363941488,
GlobalGiftReq = 3421550443, GlobalGiftReq = 3421550443,
@ -525,6 +519,8 @@ local ProtoMsgType = {
BossRushPlayerInfoRsp = 3512216171, BossRushPlayerInfoRsp = 3512216171,
TaskAchievementReq = 3525363388, TaskAchievementReq = 3525363388,
TaskAchievementRsp = 3525365221, TaskAchievementRsp = 3525365221,
DungeonStartReq = 3530560174,
DungeonStartRsp = 3530562007,
TournArenaRankClaimRewardReq = 3531336428, TournArenaRankClaimRewardReq = 3531336428,
TournArenaRankClaimRewardRsp = 3531338261, TournArenaRankClaimRewardRsp = 3531338261,
TournArenaBountyClaimReq = 3533710638, TournArenaBountyClaimReq = 3533710638,
@ -546,10 +542,10 @@ local ProtoMsgType = {
ActivityPVPSettlementRsp = 3629728287, ActivityPVPSettlementRsp = 3629728287,
PVPStageRewardReq = 3629950931, PVPStageRewardReq = 3629950931,
PVPStageRewardRsp = 3629952764, PVPStageRewardRsp = 3629952764,
BossRushFormationReq = 3694862366,
BossRushFormationRsp = 3694864199,
SummerDataReq = 3739566473, SummerDataReq = 3739566473,
SummerDataRsp = 3739568306, SummerDataRsp = 3739568306,
EquipWearReq = 3750411183,
EquipWearRsp = 3750413016,
BountyRewardReq = 3757169544, BountyRewardReq = 3757169544,
BountyRewardRsp = 3757171377, BountyRewardRsp = 3757171377,
ActivityPVPStartReq = 3762291611, ActivityPVPStartReq = 3762291611,
@ -580,14 +576,14 @@ local ProtoMsgType = {
BossRushExchangeRsp = 4099984587, BossRushExchangeRsp = 4099984587,
BountyLevelUnlockReq = 4106156009, BountyLevelUnlockReq = 4106156009,
BountyLevelUnlockRsp = 4106157842, BountyLevelUnlockRsp = 4106157842,
ChapterGoldChallengeFarmReq = 4133057746,
ChapterGoldChallengeFarmRsp = 4133059579,
PVPChallengeStartReq = 4152754481, PVPChallengeStartReq = 4152754481,
PVPChallengeStartRsp = 4152756314, PVPChallengeStartRsp = 4152756314,
SummerTaskClaimReq = 4155165814, SummerTaskClaimReq = 4155165814,
SummerTaskClaimRsp = 4155167647, SummerTaskClaimRsp = 4155167647,
HeroFundAwardReq = 4188104820, HeroFundAwardReq = 4188104820,
HeroFundAwardRsp = 4188106653, HeroFundAwardRsp = 4188106653,
DungeonSweepReq = 4192050044,
DungeonSweepRsp = 4192051877,
TriggerWeaponArmorGiftReq = 4195650791, TriggerWeaponArmorGiftReq = 4195650791,
TriggerWeaponArmorGiftRsp = 4195652624, TriggerWeaponArmorGiftRsp = 4195652624,
PlayerInfoReq = 4250417467, PlayerInfoReq = 4250417467,
@ -607,8 +603,6 @@ local ProtoMsgType = {
ChapterSettlementRsp = "ChapterSettlementRsp", ChapterSettlementRsp = "ChapterSettlementRsp",
EnergyByADReq = "EnergyByADReq", EnergyByADReq = "EnergyByADReq",
EnergyByADRsp = "EnergyByADRsp", EnergyByADRsp = "EnergyByADRsp",
ChapterShardsChallengeStartReq = "ChapterShardsChallengeStartReq",
ChapterShardsChallengeStartRsp = "ChapterShardsChallengeStartRsp",
PVPOverCDReq = "PVPOverCDReq", PVPOverCDReq = "PVPOverCDReq",
PVPOverCDRsp = "PVPOverCDRsp", PVPOverCDRsp = "PVPOverCDRsp",
ChangeAvatarReq = "ChangeAvatarReq", ChangeAvatarReq = "ChangeAvatarReq",
@ -622,6 +616,8 @@ local ProtoMsgType = {
LevelUpRsp = "LevelUpRsp", LevelUpRsp = "LevelUpRsp",
GuideFundMarkReq = "GuideFundMarkReq", GuideFundMarkReq = "GuideFundMarkReq",
GuideFundMarkRsp = "GuideFundMarkRsp", GuideFundMarkRsp = "GuideFundMarkRsp",
DungeonSettlementReq = "DungeonSettlementReq",
DungeonSettlementRsp = "DungeonSettlementRsp",
FourteenBountyAwardReq = "FourteenBountyAwardReq", FourteenBountyAwardReq = "FourteenBountyAwardReq",
FourteenBountyAwardRsp = "FourteenBountyAwardRsp", FourteenBountyAwardRsp = "FourteenBountyAwardRsp",
PigPlayUpdateNtf = "PigPlayUpdateNtf", PigPlayUpdateNtf = "PigPlayUpdateNtf",
@ -643,8 +639,6 @@ local ProtoMsgType = {
SwitchFrontRsp = "SwitchFrontRsp", SwitchFrontRsp = "SwitchFrontRsp",
MatchReq = "MatchReq", MatchReq = "MatchReq",
MatchRsp = "MatchRsp", MatchRsp = "MatchRsp",
ChapterGoldChallengeStartReq = "ChapterGoldChallengeStartReq",
ChapterGoldChallengeStartRsp = "ChapterGoldChallengeStartRsp",
SummerBountyClaimByDiamondReq = "SummerBountyClaimByDiamondReq", SummerBountyClaimByDiamondReq = "SummerBountyClaimByDiamondReq",
SummerBountyClaimByDiamondRsp = "SummerBountyClaimByDiamondRsp", SummerBountyClaimByDiamondRsp = "SummerBountyClaimByDiamondRsp",
ArenaBountyLevelUnlockReq = "ArenaBountyLevelUnlockReq", ArenaBountyLevelUnlockReq = "ArenaBountyLevelUnlockReq",
@ -663,14 +657,16 @@ local ProtoMsgType = {
ItemUseRsp = "ItemUseRsp", ItemUseRsp = "ItemUseRsp",
ActivityPVPDailyRewardsReq = "ActivityPVPDailyRewardsReq", ActivityPVPDailyRewardsReq = "ActivityPVPDailyRewardsReq",
ActivityPVPDailyRewardsRsp = "ActivityPVPDailyRewardsRsp", ActivityPVPDailyRewardsRsp = "ActivityPVPDailyRewardsRsp",
EquipRefineReq = "EquipRefineReq",
EquipRefineRsp = "EquipRefineRsp",
ActivityPVPMatchReq = "ActivityPVPMatchReq", ActivityPVPMatchReq = "ActivityPVPMatchReq",
ActivityPVPMatchRsp = "ActivityPVPMatchRsp", ActivityPVPMatchRsp = "ActivityPVPMatchRsp",
BossRushTopReq = "BossRushTopReq", BossRushTopReq = "BossRushTopReq",
BossRushTopRsp = "BossRushTopRsp", BossRushTopRsp = "BossRushTopRsp",
FourteenBountyExchangeAwardReq = "FourteenBountyExchangeAwardReq", FourteenBountyExchangeAwardReq = "FourteenBountyExchangeAwardReq",
FourteenBountyExchangeAwardRsp = "FourteenBountyExchangeAwardRsp", FourteenBountyExchangeAwardRsp = "FourteenBountyExchangeAwardRsp",
ChapterShardsChallengeSettlementReq = "ChapterShardsChallengeSettlementReq", EquipDecomposeReq = "EquipDecomposeReq",
ChapterShardsChallengeSettlementRsp = "ChapterShardsChallengeSettlementRsp", EquipDecomposeRsp = "EquipDecomposeRsp",
ChapterDailyChallengeResetReq = "ChapterDailyChallengeResetReq", ChapterDailyChallengeResetReq = "ChapterDailyChallengeResetReq",
ChapterDailyChallengeResetRsp = "ChapterDailyChallengeResetRsp", ChapterDailyChallengeResetRsp = "ChapterDailyChallengeResetRsp",
BindReq = "BindReq", BindReq = "BindReq",
@ -681,8 +677,6 @@ local ProtoMsgType = {
CardDailyRewardRsp = "CardDailyRewardRsp", CardDailyRewardRsp = "CardDailyRewardRsp",
MallDailyBuyReq = "MallDailyBuyReq", MallDailyBuyReq = "MallDailyBuyReq",
MallDailyBuyRsp = "MallDailyBuyRsp", MallDailyBuyRsp = "MallDailyBuyRsp",
ChapterShardsChallengeFarmReq = "ChapterShardsChallengeFarmReq",
ChapterShardsChallengeFarmRsp = "ChapterShardsChallengeFarmRsp",
ActPaidResultReq = "ActPaidResultReq", ActPaidResultReq = "ActPaidResultReq",
ActPaidResultRsp = "ActPaidResultRsp", ActPaidResultRsp = "ActPaidResultRsp",
RecoveryNtf = "RecoveryNtf", RecoveryNtf = "RecoveryNtf",
@ -806,8 +800,6 @@ local ProtoMsgType = {
HeroPutOnReq = "HeroPutOnReq", HeroPutOnReq = "HeroPutOnReq",
HeroPutOnRsp = "HeroPutOnRsp", HeroPutOnRsp = "HeroPutOnRsp",
BountyBoughtNtf = "BountyBoughtNtf", BountyBoughtNtf = "BountyBoughtNtf",
ChapterGoldChallengeSettlementReq = "ChapterGoldChallengeSettlementReq",
ChapterGoldChallengeSettlementRsp = "ChapterGoldChallengeSettlementRsp",
TaskDailyAdReq = "TaskDailyAdReq", TaskDailyAdReq = "TaskDailyAdReq",
TaskDailyAdRsp = "TaskDailyAdRsp", TaskDailyAdRsp = "TaskDailyAdRsp",
GlobalGiftReq = "GlobalGiftReq", GlobalGiftReq = "GlobalGiftReq",
@ -824,6 +816,8 @@ local ProtoMsgType = {
BossRushPlayerInfoRsp = "BossRushPlayerInfoRsp", BossRushPlayerInfoRsp = "BossRushPlayerInfoRsp",
TaskAchievementReq = "TaskAchievementReq", TaskAchievementReq = "TaskAchievementReq",
TaskAchievementRsp = "TaskAchievementRsp", TaskAchievementRsp = "TaskAchievementRsp",
DungeonStartReq = "DungeonStartReq",
DungeonStartRsp = "DungeonStartRsp",
TournArenaRankClaimRewardReq = "TournArenaRankClaimRewardReq", TournArenaRankClaimRewardReq = "TournArenaRankClaimRewardReq",
TournArenaRankClaimRewardRsp = "TournArenaRankClaimRewardRsp", TournArenaRankClaimRewardRsp = "TournArenaRankClaimRewardRsp",
TournArenaBountyClaimReq = "TournArenaBountyClaimReq", TournArenaBountyClaimReq = "TournArenaBountyClaimReq",
@ -845,10 +839,10 @@ local ProtoMsgType = {
ActivityPVPSettlementRsp = "ActivityPVPSettlementRsp", ActivityPVPSettlementRsp = "ActivityPVPSettlementRsp",
PVPStageRewardReq = "PVPStageRewardReq", PVPStageRewardReq = "PVPStageRewardReq",
PVPStageRewardRsp = "PVPStageRewardRsp", PVPStageRewardRsp = "PVPStageRewardRsp",
BossRushFormationReq = "BossRushFormationReq",
BossRushFormationRsp = "BossRushFormationRsp",
SummerDataReq = "SummerDataReq", SummerDataReq = "SummerDataReq",
SummerDataRsp = "SummerDataRsp", SummerDataRsp = "SummerDataRsp",
EquipWearReq = "EquipWearReq",
EquipWearRsp = "EquipWearRsp",
BountyRewardReq = "BountyRewardReq", BountyRewardReq = "BountyRewardReq",
BountyRewardRsp = "BountyRewardRsp", BountyRewardRsp = "BountyRewardRsp",
ActivityPVPStartReq = "ActivityPVPStartReq", ActivityPVPStartReq = "ActivityPVPStartReq",
@ -879,14 +873,14 @@ local ProtoMsgType = {
BossRushExchangeRsp = "BossRushExchangeRsp", BossRushExchangeRsp = "BossRushExchangeRsp",
BountyLevelUnlockReq = "BountyLevelUnlockReq", BountyLevelUnlockReq = "BountyLevelUnlockReq",
BountyLevelUnlockRsp = "BountyLevelUnlockRsp", BountyLevelUnlockRsp = "BountyLevelUnlockRsp",
ChapterGoldChallengeFarmReq = "ChapterGoldChallengeFarmReq",
ChapterGoldChallengeFarmRsp = "ChapterGoldChallengeFarmRsp",
PVPChallengeStartReq = "PVPChallengeStartReq", PVPChallengeStartReq = "PVPChallengeStartReq",
PVPChallengeStartRsp = "PVPChallengeStartRsp", PVPChallengeStartRsp = "PVPChallengeStartRsp",
SummerTaskClaimReq = "SummerTaskClaimReq", SummerTaskClaimReq = "SummerTaskClaimReq",
SummerTaskClaimRsp = "SummerTaskClaimRsp", SummerTaskClaimRsp = "SummerTaskClaimRsp",
HeroFundAwardReq = "HeroFundAwardReq", HeroFundAwardReq = "HeroFundAwardReq",
HeroFundAwardRsp = "HeroFundAwardRsp", HeroFundAwardRsp = "HeroFundAwardRsp",
DungeonSweepReq = "DungeonSweepReq",
DungeonSweepRsp = "DungeonSweepRsp",
TriggerWeaponArmorGiftReq = "TriggerWeaponArmorGiftReq", TriggerWeaponArmorGiftReq = "TriggerWeaponArmorGiftReq",
TriggerWeaponArmorGiftRsp = "TriggerWeaponArmorGiftRsp", TriggerWeaponArmorGiftRsp = "TriggerWeaponArmorGiftRsp",
PlayerInfoReq = "PlayerInfoReq", PlayerInfoReq = "PlayerInfoReq",

View File

@ -1,65 +1,141 @@
local EquipCell = class("EquipCell", BaseCell) local EquipCell = class("EquipCell", BaseCell)
function EquipCell:refresh(entity, showMask, showLv) function EquipCell:init()
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
local bg = uiMap["equip_cell.frame_bg"] self.imgQlt = uiMap["equip_cell.content.img_qlt"]
local icon = uiMap["equip_cell.icon"] self.imgIcon = uiMap["equip_cell.content.img_icon"]
local partBg = uiMap["equip_cell.part_bg"] self.rankNode = uiMap["equip_cell.content.rank"]
local mask = uiMap["equip_cell.mask"] self.txRank = uiMap["equip_cell.content.rank.tx_rank"]
local partIcon = uiMap["equip_cell.part_bg.icon"] self.levelNode = uiMap["equip_cell.content.level"]
local lvTx = uiMap["equip_cell.lv_tx"] self.txLv = uiMap["equip_cell.content.level.tx_lv"]
self.imgUp = uiMap["equip_cell.content.img_up"]
self.mask = uiMap["equip_cell.mask"]
self.check = uiMap["equip_cell.check"]
self.lock = uiMap["equip_cell.lock"]
self.select = uiMap["equip_cell.select"]
self.light = uiMap["equip_cell.light"]
self.levelNode:setActive(false)
bg:setSprite(entity:getFrameRes()) -- self:hideEffectUp()
icon:setSprite(entity:getIconRes())
partBg:setSprite(entity:getPartBgRes())
partIcon:setSprite(entity:getPartRes())
lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.LV_POINT, entity:getLv()))
icon:setVisible(true)
partBg:setVisible(true)
mask:setVisible(showMask == true)
lvTx:setVisible(showLv)
end end
function EquipCell:refreshByCfg(id, showMask) -- function EquipCell:setParentUI(parent)
local cfg = ConfigManager:getConfig("equip")[id] -- self.parentUI = parent
if not cfg then -- end
function EquipCell:refresh(entity, slotId, showMask, showCheck, showLock)
if entity == nil then
return return
end end
local uiMap = self:getUIMap() self:_refreshShow(entity:getQlt(), entity:getIconRes(), entity:getPartLevel(slotId), showMask, showCheck, showLock)
local bg = uiMap["equip_cell.frame_bg"]
local icon = uiMap["equip_cell.icon"]
local partBg = uiMap["equip_cell.part_bg"]
local partIcon = uiMap["equip_cell.part_bg.icon"]
local mask = uiMap["equip_cell.mask"]
local lvTx = uiMap["equip_cell.lv_tx"]
bg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. cfg.qlt)
icon:setSprite(GFunc.getEquipIconRes(id))
partBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "type_" .. cfg.qlt)
partIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "e" .. cfg.part)
icon:setVisible(true)
partBg:setVisible(true)
mask:setVisible(showMask == true)
lvTx:setVisible(false)
end end
function EquipCell:refreshByPart(part) function EquipCell:refreshByUid(uid)
local uiMap = self:getUIMap() self:refresh(DataManager.EquipData:getEntityByUid(uid))
local bg = uiMap["equip_cell.frame_bg"] end
local icon = uiMap["equip_cell.icon"]
local partBg = uiMap["equip_cell.part_bg"]
local mask = uiMap["equip_cell.mask"]
local lvTx = uiMap["equip_cell.lv_tx"]
bg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_empty") -- message Equip {
icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "empty_" .. part) -- int64 uid = 1; // 唯一 id
-- int32 cfg_id = 2; // 配置 id
-- int32 init_id = 3; // 初始配置 id (升品前)
-- repeated Attr purity_attrs = 4; // 洗炼属性
-- repeated Attr new_purity_attrs = 5; // 未应用的洗炼属性
-- }
function EquipCell:refreshByServer(equip)
local id = equip.cfg_id
self:_refreshShow(DataManager.EquipData:getQlt(id), DataManager.EquipData:getIconRes(id))
end
icon:setVisible(true) -- message EquipInfo {
partBg:setVisible(false) -- int32 cfg_id = 1; // 配置 ID
mask:setVisible(false) -- int32 level = 2; // 槽位等级
lvTx:setVisible(false) -- repeated Attr purity_attrs = 3; // 洗炼属性
-- }
function EquipCell:refreshByServer2(equip)
local id = equip.cfg_id
local lv = equip.level
self:_refreshShow(DataManager.EquipData:getQlt(id), DataManager.EquipData:getIconRes(id), lv)
end
function EquipCell:refreshByCfg(id, showMask, showCheck, showLock)
self:_refreshShow(DataManager.EquipData:getQlt(id), DataManager.EquipData:getIconRes(id), nil, showMask, showCheck, showLock)
end
function EquipCell:refreshByCustom(qlt, icon, lv, showMask, showCheck, showLock)
self:_refreshShow(qlt, icon, lv, showMask, showCheck, showLock)
end
function EquipCell:_refreshShow(qlt, icon, lv, showMask, showCheck, showLock)
if qlt then
self.imgQlt:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. qlt)
else
self.imgQlt:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_0")
end
if icon then
self.imgIcon:setActive(true)
Logger.logHighlight("icon: %s", icon)
self.imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, icon)
else
self.imgIcon:setActive(false)
end
if lv then
self.levelNode:setActive(true)
self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2, lv))
else
self.levelNode:setActive(false)
end
self:showMask(showMask)
self:showCheck(showCheck)
self:showLock(showLock)
self:showSelect(false)
self:showLight(false)
self:setShowUp(false)
end
function EquipCell:refreshEmpty(part, showSelect)
self.imgQlt:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_0")
-- self.imgIcon:setActive(true)
self.imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "101")
self.rankNode:setActive(false)
self.levelNode:setActive(false)
self:showMask(false)
self:showCheck(false)
self:showLock(false)
self:showSelect(showSelect or false)
self:showLight(false)
self:setShowUp(false)
end
function EquipCell:setShowUp(show)
self.imgUp:setActive(show)
end
function EquipCell:setShowLv(show)
self.levelNode:setActive(show)
end
function EquipCell:showMask(show)
self.mask:setActive(show)
end
function EquipCell:showCheck(show)
self.check:setActive(show)
end
function EquipCell:showLock(show)
self.lock:setActive(show)
end
function EquipCell:showSelect(show)
self.select:setActive(show)
end
function EquipCell:showLight(show)
self.light:setActive(show)
end end
function EquipCell:setTouchEnable(enable) function EquipCell:setTouchEnable(enable)
@ -70,6 +146,10 @@ function EquipCell:addClickListener(func)
self:getBaseObject():addClickListener(func) self:getBaseObject():addClickListener(func)
end end
function EquipCell:removeClickListener()
self:getBaseObject():removeClickListener()
end
function EquipCell:getAnchoredPositionX() function EquipCell:getAnchoredPositionX()
return self:getBaseObject():getAnchoredPositionX() return self:getBaseObject():getAnchoredPositionX()
end end
@ -82,12 +162,25 @@ function EquipCell:setActive(active)
self:getBaseObject():setActive(active) self:getBaseObject():setActive(active)
end end
function EquipCell:addRedPoint(posX, posY, scale) -- function EquipCell:showEffectUp()
self:getBaseObject():addRedPoint(posX, posY, scale) -- if self.effectUp == nil and self.parentUI then
end -- EffectManager:loadUIEffectAsync("assets/prefabs/effects/ui/vfx_ui_b9_yjqh_b01.prefab", self.parentUI, self.baseObject, GConst.UI_EFFECT_ORDER.LEVEL5, function(obj)
-- obj:setLocalScale(1, 1, 1)
-- obj:setAnchoredPosition(0, 0, 0)
-- obj:play()
-- self.effectUp = obj
function EquipCell:removeRedPoint() -- self.baseObject:performWithDelayGlobal(function()
self:getBaseObject():removeRedPoint() -- self:hideEffectUp()
end -- end, 0.5)
-- end)
-- end
-- end
-- function EquipCell:hideEffectUp()
-- if self.effectUp then
-- self.effectUp:setActive(false)
-- end
-- end
return EquipCell return EquipCell

8
lua/app/ui/equip.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 05db45ab1b69b4caeadabc7d32beeccc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60cd6534fa51148599e09729f9d5c657
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
local EquipListCell = class("EquipListCell", BaseCell)
function EquipListCell:init()
local uiMap = self.baseObject:genAllChildren()
self.equipCell = uiMap["cell.equip_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.nameTx = uiMap["cell.name_tx"]
self.powerTx = uiMap["cell.power_tx"]
self.wearBtn = uiMap["cell.wear_btn"]
self.wearBtnTx = uiMap["cell.wear_btn.text"]
self.wearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_30))
self.wearBtn:addClickListener(function()
-- if DataManager.DailyTaskData:canClaimTask(self.taskId) then
-- ModuleManager.TaskManager:claimDailyTask(self.taskId)
-- else
-- ModuleManager.TaskManager:taskGoto(self.taskType)
-- end
end)
end
function EquipListCell:refresh(entity, slotId)
self.entity = entity
self.slotId = slotId
self.nameTx:setText(entity:getName())
self.powerTx:setText(entity:getPower())
self.equipCell:refresh(entity, slotId)
end
return EquipListCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1f75da1774bd8474386e20575f24ae8c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,70 @@
local EquipListUI = class("EquipListUI", BaseUI)
local EQUIP_LIST_CELL = "app/ui/equip/cell/equip_list_cell"
function EquipListUI:isFullScreen()
return false
end
function EquipListUI:getPrefabPath()
return "assets/prefabs/ui/equip/equip_list_ui.prefab"
end
function EquipListUI:onPressBackspace()
self:closeUI()
end
function EquipListUI:ctor(parmas)
self.heroEntity = parmas.heroEntity
self.equipPart = parmas.part
self.slotId = self.heroEntity:getMatchType()
end
function EquipListUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["equip_list_ui.bg.close_btn"]:addClickListener(function()
self:closeUI()
end)
self.equipCell = uiMap["equip_list_ui.bg.equip_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.titleTx = uiMap["equip_list_ui.bg.title_tx"]
self.scrollrect = uiMap["equip_list_ui.bg.scrollrect"]
self.scrollRectComp = uiMap["equip_list_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return EQUIP_LIST_CELL
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.equipList[index], self.slotId)
end)
self.scrollRectComp:clearCells()
end
function EquipListUI:onRefresh()
self:initList()
self:refreshEquipCell()
self:refreshScrollrect()
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1))
end
function EquipListUI:refreshEquipCell()
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), self.equipPart)
if eid and eid > 0 then
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
self.equipCell:refresh(equipEntity, false, true)
else
self.equipCell:refreshEmpty(self.equipPart)
end
end
function EquipListUI:initList()
self.equipList = DataManager.EquipData:getEquipListByPart(self.equipPart)
end
function EquipListUI:refreshScrollrect()
self.scrollRectComp:refillCells(#self.equipList)
end
return EquipListUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 09e8dcc22f3b44ea28c1f9d56695ec34
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,108 @@
local EquipInfoComp = class("EquipInfoComp", LuaComponent)
function EquipInfoComp:init()
local uiMap = self:getUIMap()
self.atkNameTx = uiMap["equip_info.bg_5.atk_name_tx"]
self.atkTx = uiMap["equip_info.bg_5.atk_tx"]
self.hpNameTx = uiMap["equip_info.bg_6.hp_name_tx"]
self.hpTx = uiMap["equip_info.bg_6.hp_tx"]
self.attrBtn = uiMap["equip_info.bg_6.attr_btn"]
self.descTx = uiMap["equip_info.equip_node.up.desc_tx"]
self.descTx1 = uiMap["equip_info.equip_node.up.desc_tx_1"]
self.infoBtn = uiMap["equip_info.equip_node.up.info_btn"]
self.autoWaerBtn = uiMap["equip_info.equip_node.auto_waer_btn"]
self.autoWaerBtnTx = uiMap["equip_info.equip_node.auto_waer_btn.text"]
self.upBtn = uiMap["equip_info.equip_node.up_btn"]
self.upBtnTx = uiMap["equip_info.equip_node.up_btn.text"]
self.equipNode = uiMap["equip_info.equip_node"]
self.emptyTx = uiMap["equip_info.empty_tx"]
self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_29))
self.equipCells = {}
self.suitTxs = {}
for i = 1, 6 do
self.suitTxs[i] = uiMap["equip_info.equip_node.up.suit_tx_" .. i]
self.equipCells[i] = uiMap["equip_info.equip_node.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.equipCells[i]:addClickListener(function()
ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i)
end)
end
-- self.txAttr:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_6))
-- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_16))
-- self.txUp:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3))
self.attrBtn:addClickListener(function()
UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
end)
end
function EquipInfoComp:setParentUI(ui)
self.uiRoot = ui
end
function EquipInfoComp:setHeroData(heroEntity)
self.heroEntity = heroEntity
self.selectPart = self.selectPart or GConst.EquipConst.PART_TYPE.EQUIP_1
end
function EquipInfoComp:refresh()
self:refreshAttr()
self:refreshEquip()
end
function EquipInfoComp:refreshAttr()
self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
local lv = self.heroEntity:getLv()
local hpStr
local atkStr
if not self.heroEntity:isActived() then
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // GConst.DEFAULT_FACTOR
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // GConst.DEFAULT_FACTOR
else
local curHp = self.heroEntity:getHp() // GConst.DEFAULT_FACTOR
local curAtk = self.heroEntity:getAtk() // GConst.DEFAULT_FACTOR
local addHp = (self.heroEntity:getCfgHp(lv + 1) - self.heroEntity:getCfgHp()) // GConst.DEFAULT_FACTOR
local addAtk = (self.heroEntity:getCfgAtk(lv + 1) - self.heroEntity:getCfgAtk()) // GConst.DEFAULT_FACTOR
if addHp <= 0 then
hpStr = curHp
else
hpStr = curHp .. "<color=#A2FF29>+" .. addHp .. "</color>"
end
if addAtk <= 0 then
atkStr = curAtk
else
atkStr = curAtk .. "<color=#A2FF29>+" .. addAtk .. "</color>"
end
end
self.hpTx:setText(hpStr)
self.atkTx:setText(atkStr)
end
function EquipInfoComp:refreshEquip()
self.curFormation = DataManager.FormationData:getStageFormation()
if self.curFormation[self.heroEntity:getMatchType()] ~= self.heroEntity:getCfgId() then
self.emptyTx:setActive(true)
self.equipNode:setActive(false)
return
end
self.emptyTx:setActive(false)
self.equipNode:setActive(true)
for part = 1, 6 do
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), part)
if eid and eid > 0 then
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
self.equipCells[part]:refresh(equipEntity, false, true)
else
-- self.equipCells[part]:refreshByCustom(nil, part)
self.equipCells[part]:refreshEmpty(part)
end
end
end
return EquipInfoComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1997c9b02ba3f4a47ba864ff1199b6cb
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -1,7 +1,7 @@
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_STAR = "app/ui/hero/star_info_comp" local COMP_STAR = "app/ui/hero/star_info_comp"
local COMP_SKIN = "app/ui/hero/skin_info_comp" local COMP_EQUIP = "app/ui/hero/equip_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
@ -37,26 +37,11 @@ function HeroDetailUI:onLoadRootComplete()
self:closeUI() self:closeUI()
end) end)
-- self.commonInfo = uiMap["hero_detail_ui.common"]
self.heroInfo = uiMap["hero_detail_ui.hero_info"] self.heroInfo = uiMap["hero_detail_ui.hero_info"]
self.starInfo = uiMap["hero_detail_ui.star_info"] self.starInfo = uiMap["hero_detail_ui.star_info"]
self.skinInfo = uiMap["hero_detail_ui.skin_info"] self.equipInfo = uiMap["hero_detail_ui.equip_info"]
self.titleTx = uiMap["hero_detail_ui.common.name_tx"] self.titleTx = uiMap["hero_detail_ui.common.name_tx"]
self.bg = uiMap["hero_detail_ui.common.bg"] self.bg = uiMap["hero_detail_ui.common.bg"]
-- self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"]
-- self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"]
-- 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.btnStar = uiMap["hero_detail_ui.common.btns.btn_star"]
-- self.lockStar = uiMap["hero_detail_ui.common.btns.btn_star.content.img_lock"]
-- self.txStar1 = uiMap["hero_detail_ui.common.btns.btn_star.content.tx_btn"]
-- self.selectStar = uiMap["hero_detail_ui.common.btns.btn_star.select"]
-- self.txStar2 = uiMap["hero_detail_ui.common.btns.btn_star.select.tx_select"]
-- self.btnSkin = uiMap["hero_detail_ui.common.btns.btn_skin"]
-- self.lockSkin = uiMap["hero_detail_ui.common.btns.btn_skin.content.img_lock"]
-- self.txSkin1 = uiMap["hero_detail_ui.common.btns.btn_skin.content.tx_btn"]
-- self.selectSkin = uiMap["hero_detail_ui.common.btns.btn_skin.select"]
-- self.txSkin2 = uiMap["hero_detail_ui.common.btns.btn_skin.select.tx_select"]
self.leftBtn = uiMap["hero_detail_ui.common.left_btn"] self.leftBtn = uiMap["hero_detail_ui.common.left_btn"]
self.rightBtn = uiMap["hero_detail_ui.common.right_btn"] self.rightBtn = uiMap["hero_detail_ui.common.right_btn"]
@ -69,13 +54,15 @@ function HeroDetailUI:onLoadRootComplete()
self.qltBg = uiMap["hero_detail_ui.common.qlt_bg"] self.qltBg = uiMap["hero_detail_ui.common.qlt_bg"]
self.qltBgTx = uiMap["hero_detail_ui.common.qlt_bg.qlt_tx"] self.qltBgTx = uiMap["hero_detail_ui.common.qlt_bg.qlt_tx"]
self.starComp = uiMap["hero_detail_ui.common.hero_node.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL) self.starComp = uiMap["hero_detail_ui.common.hero_node.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
self.btnsLayout = uiMap["hero_detail_ui.common.btns"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
self.redNodeLayout = uiMap["hero_detail_ui.red_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)} self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16), I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1)}
self.pageBtns = {} self.pageBtns = {}
self.pageBtnTxs = {} self.pageBtnTxs = {}
self.pageBtnLocks = {} self.pageBtnLocks = {}
self.pageRedImgs = {} self.pageRedImgs = {}
for i = 1, 2 do for i = 1, 3 do
self.pageBtns[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i] self.pageBtns[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i]
self.pageBtnTxs[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".text"] self.pageBtnTxs[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".text"]
self.pageBtnLocks[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".lock_img"] self.pageBtnLocks[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".lock_img"]
@ -92,29 +79,6 @@ function HeroDetailUI:onLoadRootComplete()
end) end)
end end
-- self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
-- self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
-- self.txStar1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
-- self.txStar2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
-- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
-- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
-- self.txStar1:setText("升星")
-- self.txStar2:setText("升星")
-- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
-- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
-- self.powerTx:setText(self.heroEntity:getPower())
-- if not DataManager.HeroData:isStarOpen() then
-- self.lockStar:setVisible(true)
-- GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5)
-- else
-- self.lockStar:setVisible(false)
-- end
-- if not DataManager.HeroData:isSkinOpen() then
-- self.lockSkin:setVisible(true)
-- GFunc.centerImgAndTx(self.lockSkin, self.txSkin1, 5)
-- else
-- self.lockSkin:setVisible(false)
-- end
self.leftBtn:addClickListener(function() self.leftBtn:addClickListener(function()
if not self:isShowLeftArrow() then if not self:isShowLeftArrow() then
return return
@ -139,7 +103,7 @@ function HeroDetailUI:onLoadRootComplete()
if part == GConst.EquipConst.PART_TYPE.STAR then if part == GConst.EquipConst.PART_TYPE.STAR then
self.compStar:playEffect(true, true) self.compStar:playEffect(true, true)
else else
self.compSkin:playUpgradeEffect(part) self.compEquip:playUpgradeEffect(part)
end end
self:refreshPageBtn() self:refreshPageBtn()
end) end)
@ -147,7 +111,7 @@ function HeroDetailUI:onLoadRootComplete()
if part == GConst.EquipConst.PART_TYPE.STAR then if part == GConst.EquipConst.PART_TYPE.STAR then
self.compStar:playEffect(true, false) self.compStar:playEffect(true, false)
else else
self.compSkin:playUpgradeEffect(part) self.compEquip:playUpgradeEffect(part)
end end
self:refreshPageBtn() self:refreshPageBtn()
end) end)
@ -165,6 +129,8 @@ function HeroDetailUI:getIsOpen(page)
return true return true
elseif page == GConst.HeroConst.PANEL_TYPE.STAR then elseif page == GConst.HeroConst.PANEL_TYPE.STAR then
return DataManager.HeroData:isStarOpen() return DataManager.HeroData:isStarOpen()
elseif page == GConst.HeroConst.PANEL_TYPE.EQUIP then
return true
end end
return false return false
end end
@ -220,8 +186,8 @@ function HeroDetailUI:refreshPageInfo()
self:showHeroInfo() self:showHeroInfo()
elseif self.page == GConst.HeroConst.PANEL_TYPE.STAR then elseif self.page == GConst.HeroConst.PANEL_TYPE.STAR then
self:showStarInfo() self:showStarInfo()
elseif self.page == GConst.HeroConst.PANEL_TYPE.SKIN then elseif self.page == GConst.HeroConst.PANEL_TYPE.EQUIP then
self:showskinInfo() self:showEquipInfo()
end end
self:refreshPageBtn() self:refreshPageBtn()
end end
@ -231,14 +197,14 @@ function HeroDetailUI:refreshPageBtn()
if self.onlyLook then -- 仅查看的不显示升级和激活按钮 if self.onlyLook then -- 仅查看的不显示升级和激活按钮
self.leftBtn:setActive(false) self.leftBtn:setActive(false)
self.rightBtn:setActive(false) self.rightBtn:setActive(false)
for i = 1, 2 do for i = 1, 3 do
self.pageBtns[i]:setActive(false) self.pageBtns[i]:setActive(false)
self.pageRedImgs[i]:setActive(false) self.pageRedImgs[i]:setActive(false)
end end
else else
self.leftBtn:setActive(self:isShowLeftArrow()) self.leftBtn:setActive(self:isShowLeftArrow())
self.rightBtn:setActive(self:isShowRightArrow()) self.rightBtn:setActive(self:isShowRightArrow())
for i = 1, 2 do for i = 1, 3 do
self.pageBtns[i]:setActive(true) self.pageBtns[i]:setActive(true)
if self.page == i then if self.page == i then
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1") self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
@ -254,11 +220,8 @@ end
function HeroDetailUI:showHeroInfo() function HeroDetailUI:showHeroInfo()
self.heroInfo:setActive(true) self.heroInfo:setActive(true)
-- self.selectHero:setActive(true)
self.starInfo:setActive(false) self.starInfo:setActive(false)
-- self.selectStar:setActive(false) self.equipInfo:setActive(false)
self.skinInfo:setActive(false)
-- self.selectSkin:setActive(false)
self.bg:setActive(true) self.bg:setActive(true)
local power = self.heroEntity:getPower() local power = self.heroEntity:getPower()
@ -276,11 +239,8 @@ end
function HeroDetailUI:showStarInfo() function HeroDetailUI:showStarInfo()
self.heroInfo:setActive(false) self.heroInfo:setActive(false)
-- self.selectHero:setActive(false)
self.starInfo:setActive(true) self.starInfo:setActive(true)
-- self.selectStar:setActive(true) self.equipInfo:setActive(false)
self.skinInfo:setActive(false)
-- self.selectSkin:setActive(false)
self.bg:setActive(true) self.bg:setActive(true)
if not self.compStar then if not self.compStar then
@ -294,24 +254,21 @@ function HeroDetailUI:showStarInfo()
self.compStar:refresh() self.compStar:refresh()
end end
function HeroDetailUI:showskinInfo() function HeroDetailUI:showEquipInfo()
self.heroInfo:setActive(false) self.heroInfo:setActive(false)
-- self.selectHero:setActive(false)
self.starInfo:setActive(false) self.starInfo:setActive(false)
-- self.selectStar:setActive(false) self.equipInfo:setActive(true)
self.skinInfo:setActive(true)
-- self.selectSkin:setActive(true)
self.bg:setActive(true) self.bg:setActive(true)
if not self.compSkin then if not self.compEquip then
self.skinInfo:initPrefabHelper() self.equipInfo:initPrefabHelper()
self.skinInfo:genAllChildren() self.equipInfo:genAllChildren()
self.compSkin = self.skinInfo:addLuaComponent(COMP_SKIN) self.compEquip = self.equipInfo:addLuaComponent(COMP_EQUIP)
self.compSkin:setParentUI(self) self.compEquip:setParentUI(self)
end end
self.compSkin:setHeroData(self.heroEntity) self.compEquip:setHeroData(self.heroEntity)
self.compSkin:refresh() self.compEquip:refresh()
end end
-- 是否显示左箭头 -- 是否显示左箭头

View File

@ -33,7 +33,7 @@ function EquipData:init(data)
end end
function EquipData:setDirty() function EquipData:setDirty()
self.data.isDirty = not self.data.isDirty self.data.isDirty = not self.data.isDirty
end end
-- 武器功能是否开启 -- 武器功能是否开启
@ -105,6 +105,12 @@ end
function EquipData:getBaseAttr(id) function EquipData:getBaseAttr(id)
return self:getConfig(id).base_attr return self:getConfig(id).base_attr
end end
-- 装备名字
function EquipData:getName(id)
return I18N:getText("equip", id, "name")
end
--@endregion --@endregion
--@region 装备基础 --@region 装备基础
@ -127,6 +133,19 @@ function EquipData:getAllEquips()
return self.allEquips return self.allEquips
end end
function EquipData:getEquipListByPart(part)
local list = {}
for _, v in pairs(self.allEquips) do
if v:getPart() == part then
table.insert(list, v)
end
end
table.sort(list, function (a, b)
return a:getPower() > b:getPower()
end)
return list
end
function EquipData:getEquipByUid(uid) function EquipData:getEquipByUid(uid)
if self.allEquips[uid] then if self.allEquips[uid] then
return self.allEquips[uid] return self.allEquips[uid]
@ -134,6 +153,29 @@ function EquipData:getEquipByUid(uid)
end end
--@endregion --@endregion
--@region 穿戴
--装备穿戴
function EquipData:onWearSuccess(soltId, uids)
for i,uid in ipairs(uids) do
local equip = self:getEquipByUid(uid)
local part = equip:getPart()
if part then
local oldUid = self.slots[soltId].parts[part].equip_uid
for i,info in ipairs(self.slots) do
if i ~= soltId then
if info.parts[part].equip_uid == uid then
info.parts[part].equip_uid = oldUid
end
end
end
self.slots[soltId].parts[part].equip_uid = uid
end
end
self:setDirty()
-- DataManager.ForceData:updateTeamPower()
end
--@endregion
--@region 六个部位装备的强化与精炼 --@region 六个部位装备的强化与精炼
--获取对应位置的装备Id --获取对应位置的装备Id
function EquipData:getPartEquipUid(slotId, part) function EquipData:getPartEquipUid(slotId, part)
@ -183,7 +225,7 @@ function EquipData:getPartRefineFailPro(slotId, part)
if partInfo then if partInfo then
local cfgRefine = self:getRefineConfig(partInfo.refine + 1) local cfgRefine = self:getRefineConfig(partInfo.refine + 1)
if cfgRefine then if cfgRefine then
return (cfgRefine.base_chance + partInfo.refine_fail * cfgRefine.chance_fail) / GConst.DEFAULT_FACTOR return (cfgRefine.base_chance + partInfo.refine_fail * cfgRefine.chance_fail) / GConst.DEFAULT_FACTOR
end end
end end
end end

View File

@ -1,7 +1,10 @@
local EquipEntity = class("EquipEntity", BaseData) local EquipEntity = class("EquipEntity", BaseData)
local EquipCfg = ConfigManager:getConfig("equip")
function EquipEntity:setDirty() function EquipEntity:setDirty()
self.allAttrs = nil self.allAttrs = nil
self.curPower = nil
end end
function EquipEntity:ctor(equip) function EquipEntity:ctor(equip)
@ -24,6 +27,7 @@ end
function EquipEntity:setId(id) function EquipEntity:setId(id)
self.id = id self.id = id
self.config = EquipCfg[id]
self:setDirty() self:setDirty()
end end
@ -34,19 +38,19 @@ end
--@region 配置 --@region 配置
function EquipEntity:getPart() function EquipEntity:getPart()
return DataManager.EquipData:getPart(self:getId()) return self.config.type
end end
function EquipEntity:getQlt() function EquipEntity:getQlt()
return DataManager.EquipData:getQlt(self:getId()) return self.config.qlt
end end
function EquipEntity:getStar() function EquipEntity:getStar()
return DataManager.EquipData:getStar(self:getId()) return self.config.star
end end
function EquipEntity:getIconRes() function EquipEntity:getIconRes()
return DataManager.EquipData:getIconRes(self:getId()) return self.config.icon
end end
function EquipEntity:getEntityType() function EquipEntity:getEntityType()
@ -57,18 +61,18 @@ function EquipEntity:getName()
return DataManager.EquipData:getName(self:getId()) return DataManager.EquipData:getName(self:getId())
end end
function EquipEntity:getNameQltColor() -- function EquipEntity:getNameQltColor()
return string.format("<color=%s>%s</color>", GFunc.getQltColor(self:getQlt()), self:getName()) -- return string.format("<color=%s>%s</color>", GFunc.getQltColor(self:getQlt()), self:getName())
end -- end
function EquipEntity:getPartName() -- function EquipEntity:getPartName()
return I18N:getGlobalText(GConst.EquipConst.EQUIP_PART_NAME[self:getPart()]) -- return I18N:getGlobalText(GConst.EquipConst.EQUIP_PART_NAME[self:getPart()])
end -- end
--@endregion --@endregion
--@region 属性 --@region 属性
function EquipEntity:initBaseAttr() function EquipEntity:initBaseAttr()
self.baseAttr = DataManager.EquipData:getBaseAttr(self:getId()) self.baseAttrs = DataManager.EquipData:getBaseAttr(self:getId())
end end
function EquipEntity:setExtraAttr(attr) function EquipEntity:setExtraAttr(attr)
@ -102,9 +106,10 @@ function EquipEntity:getAllAttr()
if self.allAttrs == nil then if self.allAttrs == nil then
self.allAttrs = {} self.allAttrs = {}
-- 基础 -- 基础
for attrName, attrNum in pairs(self:getBaseAttrs()) do -- for attrName, attrNum in pairs(self:getBaseAttrs()) do
self.allAttrs[attrName] = (self.allAttrs[attrName] or 0) + attrNum -- self.allAttrs[attrName] = (self.allAttrs[attrName] or 0) + attrNum
end -- end
self.allAttrs[self.baseAttrs.type] = (self.allAttrs[self.baseAttrs.type] or 0) + self.baseAttrs.num
-- 额外属性 -- 额外属性
for attrName, attrNum in pairs(self:getExtraAttrs()) do for attrName, attrNum in pairs(self:getExtraAttrs()) do
self.allAttrs[attrName] = (self.allAttrs[attrName] or 0) + attrNum self.allAttrs[attrName] = (self.allAttrs[attrName] or 0) + attrNum
@ -119,55 +124,43 @@ end
--@region 战力 --@region 战力
function EquipEntity:setPowerDirty() function EquipEntity:setPowerDirty()
self.data.isPowerDirty = not self.data.isPowerDirty self.data.isPowerDirty = not self.data.isPowerDirty
end end
function EquipEntity:getPower() function EquipEntity:getPower()
return self.curPower if not self.curPower then
self:getAllAttr()
end
return self.curPower
end end
-- 计算战斗力 -- 计算战斗力
function EquipEntity:calcPower() function EquipEntity:calcPower()
if self.lastPower then if self.lastPower then
self.lastPower = self.curPower self.lastPower = self.curPower
end end
self.curPower = math.floor(self:_getAttrPower()) self.curPower = math.floor(self:_getAttrPower())
if not self.lastPower then if not self.lastPower then
self.lastPower = self.curPower self.lastPower = self.curPower
end end
if self.lastPower ~= self.curPower then if self.lastPower ~= self.curPower then
self:setPowerDirty() self:setPowerDirty()
end end
end end
function EquipEntity:_getAttrPower() function EquipEntity:_getAttrPower()
-- local atk = self.baseAttr.num + (self.extraAttrs[GConst.BattleConst.ATTR_NAME.ATTR_ATK_PRIVATE] or 0)
-- local atkPower = AttrNameCfg[GConst.BattleConst.ATTR_NAME.ATTR_ATK_PRIVATE].power or 0
-- local crit = self.extraAttrs[GConst.BattleConst.ATTR_NAME.CRIT_PRIVATE] or 0 --暴击
-- local critPower = AttrNameCfg[GConst.BattleConst.ATTR_NAME.CRIT_PRIVATE].power or 0
-- local critTime = self.extraAttrs[GConst.BattleConst.ATTR_NAME.CRIT_TIME_PRIVATE] or 0 --暴伤
-- local critTimePower = AttrNameCfg[GConst.BattleConst.ATTR_NAME.CRIT_TIME_PRIVATE].power or 0
-- local def = self.extraAttrs[GConst.BattleConst.ATTR_NAME.DEF_DEC_PRIVATE] or 0 --破防
-- local defPower = AttrNameCfg[GConst.BattleConst.ATTR_NAME.DEF_DEC_PRIVATE].power or 0
-- def = def / GConst.DEFAULT_FACTOR / (10 * GFunc.getBattleConstIntValue("def_dec_constant_k") + def/ GConst.DEFAULT_FACTOR)
-- local score = atk/GConst.DEFAULT_FACTOR
-- *(1+crit/GConst.DEFAULT_FACTOR*(critPower / GConst.DEFAULT_FACTOR )
-- *critTime/GConst.DEFAULT_FACTOR*(critTimePower/ GConst.DEFAULT_FACTOR))
-- *(1+def*defPower/GConst.DEFAULT_FACTOR)
-- return math.floor(score)
local power = 0 local power = 0
for attrName, attrNum in pairs(self:getAllAttr()) do local attr = self:getAllAttr()
for attrName, attrNum in pairs(attr) do
local cfg = GFunc.getAttrNameCfg()[attrName] local cfg = GFunc.getAttrNameCfg()[attrName]
if cfg then if cfg then
local realValue = attrNum local realValue = attrNum
-- 特殊处理,玩家基础暴击伤害不算 -- 特殊处理,玩家基础暴击伤害不算
if attrName == GConst.BattleConst.ATTR_NAME.CRIT_TIME then if attrName == GConst.BattleConst.ATTR_NAME.CRIT_TIME then
realValue = attrNum - 15000 realValue = attrNum - 15000
end end
power = power + math.floor(realValue * cfg.power / GConst.DEFAULT_FACTOR + 0.0000001)
power = power + math.floor(realValue * cfg.power / GConst.DEFAULT_FACTOR / GConst.DEFAULT_FACTOR + 0.0000001)
end end
end end
@ -175,4 +168,9 @@ function EquipEntity:_getAttrPower()
end end
--@endregion --@endregion
--@region 数据
function EquipEntity:getPartLevel(slotId)
return DataManager.EquipData:getPartLevel(slotId, self:getPart())
end
--@endregion
return EquipEntity return EquipEntity

View File

@ -610,4 +610,111 @@ function PlayerData:getPlayerExpCfg()
return PlayerExpCfg return PlayerExpCfg
end end
--@endregion --@endregion
--@region 战斗力
function PlayerData:getShowPower()
if self.curPower == nil then
self:calcPower()
end
return self.curPower
end
function PlayerData:getLastPower()
return self.lastPower or 0
end
function PlayerData:clearLastPower()
self.lastPower = nil
end
-- 计算战斗力
function PlayerData:calcPower()
if self.lastPower then
self.lastPower = self.curPower
end
local attrPower = 0
local formation = DataManager.FormationData:getStageFormation()
for matchType, heroEntity in pairs(formation) do
-- 属性战力
for attrName, value in pairs(heroEntity:getAllAttr()) do
local cfg = GFunc.getAttrNameCfg()[attrName]
if cfg and cfg.power then
-- 特殊处理,玩家基础暴击伤害不算
if attrName == GConst.BattleConst.ATTR_NAME.CRIT_TIME then
value = value - 15000
end
attrPower = attrPower + math.floor(value * cfg.power / GConst.DEFAULT_FACTOR + 0.0000001)
end
end
end
-- -- 天赋战力
-- local talentPower = DataManager.TalentData:getPower()
-- -- 英雄战力
-- local forcePower = DataManager.ForceData:getPower()
-- -- 英雄皮肤战力
-- local forceSkinPower = DataManager.ForceData:getSkinPower()
-- -- 英雄装备战力
-- local equipPower = DataManager.ForceEquipData:getPower()
-- -- 领主时装战力
-- local skinPower = DataManager.SkinData:getPower()
-- -- 宝物战力
-- local collectionPower = DataManager.CollectionData:getPower()
-- -- 防线战力
-- local defenseLinePower = DataManager.DefenseLineData:getPower()
-- -- 防线皮肤战力
-- local defenseLineSkinPower = DataManager.DefenseLineData:getSkinPower()
-- -- 宠物战力
-- local petPower = DataManager.PetData:getPower()
-- -- 魔法书战力
-- local magicBookPower = DataManager.MagicBookData:getPower()
-- -- 魔法阵战力
-- local magicCirclePower = DataManager.MagicCircleData:getPower()
self.curPower = 0
self.curPower = self.curPower + attrPower
-- self.curPower = self.curPower + talentPower
-- self.curPower = self.curPower + forcePower
-- self.curPower = self.curPower + forceSkinPower
-- self.curPower = self.curPower + equipPower
-- self.curPower = self.curPower + skinPower
-- self.curPower = self.curPower + collectionPower
-- self.curPower = self.curPower + defenseLinePower
-- self.curPower = self.curPower + defenseLineSkinPower
-- self.curPower = self.curPower + petPower
-- self.curPower = self.curPower + magicBookPower
-- self.curPower = self.curPower + magicCirclePower
-- if EDITOR_MODE and self:getIsSelf() then
-- Logger.logHighlight("PlayerEntity 总战力:" .. self.curPower)
-- Logger.logHighlight("PlayerEntity 属性战力:" .. attrPower)
-- Logger.logHighlight("PlayerEntity 天赋战力:" .. talentPower)
-- Logger.logHighlight("PlayerEntity 英雄战力:" .. forcePower)
-- Logger.logHighlight("PlayerEntity 英雄皮肤战力:" .. forceSkinPower)
-- Logger.logHighlight("PlayerEntity 英雄装备战力:" .. equipPower)
-- Logger.logHighlight("PlayerEntity 领主时装战力:" .. skinPower)
-- Logger.logHighlight("PlayerEntity 宝物战力:" .. collectionPower)
-- Logger.logHighlight("PlayerEntity 防线战力:" .. defenseLinePower)
-- Logger.logHighlight("PlayerEntity 防线皮肤战力:" .. defenseLineSkinPower)
-- Logger.logHighlight("PlayerEntity 宠物战力:" .. petPower)
-- Logger.logHighlight("PlayerEntity 魔法书战力:" .. magicBookPower)
-- Logger.logHighlight("PlayerEntity 魔法阵战力:" .. magicCirclePower)
-- end
if self:getIsSelf() then
if not self.lastPower then
self.lastPower = self.curPower
end
if self.lastPower ~= self.curPower then
self:setPowerDirty()
end
end
end
function PlayerData:setPowerDirty()
self.data.isPowerDirty = not self.data.isPowerDirty
end
--@endregion
return PlayerData return PlayerData