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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,93 +1,100 @@
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材料数量)
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})
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
UIManager:showUI("app/ui/dungeon/item_get_ui", {heroId = heroId, part = part, id = id, value = num})
end
-- 请求触发装备升级礼包
function EquipManager:reqEquipUpgradeGift(heroId, part)
if DataManager.EquipData:getCanShowGiftId(heroId, part) ~= nil then
return
end
if DataManager.EquipData:getCanShowGiftId(heroId, part) ~= nil then
return
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
function EquipManager:rspEquipUpgradeGift(result)
DataManager.EquipData:initGifts(result.info)
DataManager.EquipData:initGifts(result.info)
end
-- 升级装备
function EquipManager:reqUpgrade(id, part)
local entity = DataManager.EquipData:getEquip(id, part)
if not entity then
return
end
local entity = DataManager.EquipData:getEquip(id, part)
if not entity then
return
end
local heroEntity = DataManager.HeroData:getHeroById(id)
if heroEntity == nil or not heroEntity:isUnlock() then
return
end
local heroEntity = DataManager.HeroData:getHeroById(id)
if heroEntity == nil or not heroEntity:isUnlock() then
return
end
for index, cost in ipairs(entity:getUpgradeMaterials()) do
if cost.num > DataManager.BagData.ItemData:getItemNumById(cost.id) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8))
self:showItemGetPop(id, part, cost.id, cost.num)
return
end
end
for index, cost in ipairs(entity:getUpgradeMaterials()) do
if cost.num > DataManager.BagData.ItemData:getItemNumById(cost.id) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8))
self:showItemGetPop(id, part, cost.id, cost.num)
return
end
end
if not entity:isEnoughGold() then
if not ModuleManager.ShopManager:tryTriggerCoinGift() then
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD)
end
return
end
if not entity:isEnoughGold() then
if not ModuleManager.ShopManager:tryTriggerCoinGift() then
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD)
end
return
end
if entity:isMaxLevel() then
if entity:getPart() == GConst.EquipConst.PART_TYPE.WEAPON then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_7, DataManager.PlayerData:getLv() + 1))
else
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_9, entity:getLevel() + 1))
end
return
end
if entity:isMaxLevel() then
if entity:getPart() == GConst.EquipConst.PART_TYPE.WEAPON then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_7, DataManager.PlayerData:getLv() + 1))
else
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_9, entity:getLevel() + 1))
end
return
end
local itemGetType = BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE
if part ~= GConst.EquipConst.PART_TYPE.WEAPON then
itemGetType = BIReport.ITEM_GET_TYPE.ARMOR_UPGRADE
end
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, itemGetType)
local itemGetType = BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE
if part ~= GConst.EquipConst.PART_TYPE.WEAPON then
itemGetType = BIReport.ITEM_GET_TYPE.ARMOR_UPGRADE
end
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, itemGetType)
end
function EquipManager:rspUpgrade(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position)
if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position)
if result.reqData.position == GConst.EquipConst.PART_TYPE.WEAPON then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_WEAPON)
else
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_ARMOR)
end
end
if result.reqData.position == GConst.EquipConst.PART_TYPE.WEAPON then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_WEAPON)
else
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_ARMOR)
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

View File

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

View File

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

View File

@ -1,65 +1,141 @@
local EquipCell = class("EquipCell", BaseCell)
function EquipCell:refresh(entity, showMask, showLv)
function EquipCell:init()
local uiMap = self:getUIMap()
local bg = uiMap["equip_cell.frame_bg"]
local icon = uiMap["equip_cell.icon"]
local partBg = uiMap["equip_cell.part_bg"]
local mask = uiMap["equip_cell.mask"]
local partIcon = uiMap["equip_cell.part_bg.icon"]
local lvTx = uiMap["equip_cell.lv_tx"]
self.imgQlt = uiMap["equip_cell.content.img_qlt"]
self.imgIcon = uiMap["equip_cell.content.img_icon"]
self.rankNode = uiMap["equip_cell.content.rank"]
self.txRank = uiMap["equip_cell.content.rank.tx_rank"]
self.levelNode = uiMap["equip_cell.content.level"]
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())
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)
-- self:hideEffectUp()
end
function EquipCell:refreshByCfg(id, showMask)
local cfg = ConfigManager:getConfig("equip")[id]
if not cfg then
-- function EquipCell:setParentUI(parent)
-- self.parentUI = parent
-- end
function EquipCell:refresh(entity, slotId, showMask, showCheck, showLock)
if entity == nil then
return
end
local uiMap = self:getUIMap()
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)
self:_refreshShow(entity:getQlt(), entity:getIconRes(), entity:getPartLevel(slotId), showMask, showCheck, showLock)
end
function EquipCell:refreshByPart(part)
local uiMap = self:getUIMap()
local bg = uiMap["equip_cell.frame_bg"]
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"]
function EquipCell:refreshByUid(uid)
self:refresh(DataManager.EquipData:getEntityByUid(uid))
end
bg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_empty")
icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "empty_" .. part)
-- message Equip {
-- 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)
partBg:setVisible(false)
mask:setVisible(false)
lvTx:setVisible(false)
-- message EquipInfo {
-- int32 cfg_id = 1; // 配置 ID
-- int32 level = 2; // 槽位等级
-- 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
function EquipCell:setTouchEnable(enable)
@ -70,6 +146,10 @@ function EquipCell:addClickListener(func)
self:getBaseObject():addClickListener(func)
end
function EquipCell:removeClickListener()
self:getBaseObject():removeClickListener()
end
function EquipCell:getAnchoredPositionX()
return self:getBaseObject():getAnchoredPositionX()
end
@ -82,12 +162,25 @@ function EquipCell:setActive(active)
self:getBaseObject():setActive(active)
end
function EquipCell:addRedPoint(posX, posY, scale)
self:getBaseObject():addRedPoint(posX, posY, scale)
end
-- function EquipCell:showEffectUp()
-- if self.effectUp == nil and self.parentUI then
-- 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:getBaseObject():removeRedPoint()
end
-- self.baseObject:performWithDelayGlobal(function()
-- self:hideEffectUp()
-- end, 0.5)
-- end)
-- end
-- end
-- function EquipCell:hideEffectUp()
-- if self.effectUp then
-- self.effectUp:setActive(false)
-- end
-- end
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 COMP_HERO = "app/ui/hero/hero_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_LOOK_HERO = 802
@ -37,26 +37,11 @@ function HeroDetailUI:onLoadRootComplete()
self:closeUI()
end)
-- self.commonInfo = uiMap["hero_detail_ui.common"]
self.heroInfo = uiMap["hero_detail_ui.hero_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.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.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.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.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.pageBtnTxs = {}
self.pageBtnLocks = {}
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.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"]
@ -92,29 +79,6 @@ function HeroDetailUI:onLoadRootComplete()
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()
if not self:isShowLeftArrow() then
return
@ -139,7 +103,7 @@ function HeroDetailUI:onLoadRootComplete()
if part == GConst.EquipConst.PART_TYPE.STAR then
self.compStar:playEffect(true, true)
else
self.compSkin:playUpgradeEffect(part)
self.compEquip:playUpgradeEffect(part)
end
self:refreshPageBtn()
end)
@ -147,7 +111,7 @@ function HeroDetailUI:onLoadRootComplete()
if part == GConst.EquipConst.PART_TYPE.STAR then
self.compStar:playEffect(true, false)
else
self.compSkin:playUpgradeEffect(part)
self.compEquip:playUpgradeEffect(part)
end
self:refreshPageBtn()
end)
@ -165,6 +129,8 @@ function HeroDetailUI:getIsOpen(page)
return true
elseif page == GConst.HeroConst.PANEL_TYPE.STAR then
return DataManager.HeroData:isStarOpen()
elseif page == GConst.HeroConst.PANEL_TYPE.EQUIP then
return true
end
return false
end
@ -220,8 +186,8 @@ function HeroDetailUI:refreshPageInfo()
self:showHeroInfo()
elseif self.page == GConst.HeroConst.PANEL_TYPE.STAR then
self:showStarInfo()
elseif self.page == GConst.HeroConst.PANEL_TYPE.SKIN then
self:showskinInfo()
elseif self.page == GConst.HeroConst.PANEL_TYPE.EQUIP then
self:showEquipInfo()
end
self:refreshPageBtn()
end
@ -231,14 +197,14 @@ function HeroDetailUI:refreshPageBtn()
if self.onlyLook then -- 仅查看的不显示升级和激活按钮
self.leftBtn:setActive(false)
self.rightBtn:setActive(false)
for i = 1, 2 do
for i = 1, 3 do
self.pageBtns[i]:setActive(false)
self.pageRedImgs[i]:setActive(false)
end
else
self.leftBtn:setActive(self:isShowLeftArrow())
self.rightBtn:setActive(self:isShowRightArrow())
for i = 1, 2 do
for i = 1, 3 do
self.pageBtns[i]:setActive(true)
if self.page == i then
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
@ -254,11 +220,8 @@ end
function HeroDetailUI:showHeroInfo()
self.heroInfo:setActive(true)
-- self.selectHero:setActive(true)
self.starInfo:setActive(false)
-- self.selectStar:setActive(false)
self.skinInfo:setActive(false)
-- self.selectSkin:setActive(false)
self.equipInfo:setActive(false)
self.bg:setActive(true)
local power = self.heroEntity:getPower()
@ -276,11 +239,8 @@ end
function HeroDetailUI:showStarInfo()
self.heroInfo:setActive(false)
-- self.selectHero:setActive(false)
self.starInfo:setActive(true)
-- self.selectStar:setActive(true)
self.skinInfo:setActive(false)
-- self.selectSkin:setActive(false)
self.equipInfo:setActive(false)
self.bg:setActive(true)
if not self.compStar then
@ -294,24 +254,21 @@ function HeroDetailUI:showStarInfo()
self.compStar:refresh()
end
function HeroDetailUI:showskinInfo()
function HeroDetailUI:showEquipInfo()
self.heroInfo:setActive(false)
-- self.selectHero:setActive(false)
self.starInfo:setActive(false)
-- self.selectStar:setActive(false)
self.skinInfo:setActive(true)
-- self.selectSkin:setActive(true)
self.equipInfo:setActive(true)
self.bg:setActive(true)
if not self.compSkin then
self.skinInfo:initPrefabHelper()
self.skinInfo:genAllChildren()
self.compSkin = self.skinInfo:addLuaComponent(COMP_SKIN)
self.compSkin:setParentUI(self)
if not self.compEquip then
self.equipInfo:initPrefabHelper()
self.equipInfo:genAllChildren()
self.compEquip = self.equipInfo:addLuaComponent(COMP_EQUIP)
self.compEquip:setParentUI(self)
end
self.compSkin:setHeroData(self.heroEntity)
self.compSkin:refresh()
self.compEquip:setHeroData(self.heroEntity)
self.compEquip:refresh()
end
-- 是否显示左箭头

View File

@ -33,7 +33,7 @@ function EquipData:init(data)
end
function EquipData:setDirty()
self.data.isDirty = not self.data.isDirty
self.data.isDirty = not self.data.isDirty
end
-- 武器功能是否开启
@ -105,6 +105,12 @@ end
function EquipData:getBaseAttr(id)
return self:getConfig(id).base_attr
end
-- 装备名字
function EquipData:getName(id)
return I18N:getText("equip", id, "name")
end
--@endregion
--@region 装备基础
@ -127,6 +133,19 @@ function EquipData:getAllEquips()
return self.allEquips
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)
if self.allEquips[uid] then
return self.allEquips[uid]
@ -134,6 +153,29 @@ function EquipData:getEquipByUid(uid)
end
--@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 六个部位装备的强化与精炼
--获取对应位置的装备Id
function EquipData:getPartEquipUid(slotId, part)
@ -183,7 +225,7 @@ function EquipData:getPartRefineFailPro(slotId, part)
if partInfo then
local cfgRefine = self:getRefineConfig(partInfo.refine + 1)
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

View File

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

View File

@ -610,4 +610,111 @@ function PlayerData:getPlayerExpCfg()
return PlayerExpCfg
end
--@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