This commit is contained in:
puxuan 2025-09-11 10:45:22 +08:00
parent 00f30b9ab3
commit c8e5d669ab
17 changed files with 850 additions and 94 deletions

View File

@ -685,6 +685,43 @@ local LocalizationGlobalConst =
EQUIP_DESC_30 = "EQUIP_DESC_30", EQUIP_DESC_30 = "EQUIP_DESC_30",
EQUIP_DESC_31 = "EQUIP_DESC_31", EQUIP_DESC_31 = "EQUIP_DESC_31",
EQUIP_DESC_32 = "EQUIP_DESC_32", EQUIP_DESC_32 = "EQUIP_DESC_32",
EQUIP_HERO_DESC_1 = "EQUIP_HERO_DESC_1",
EQUIP_HERO_LV_1 = "EQUIP_HERO_LV_1",
EQUIP_HERO_LV_2 = "EQUIP_HERO_LV_2",
EQUIP_HERO_LV_3 = "EQUIP_HERO_LV_3",
EQUIP_HERO_DESC_2 = "EQUIP_HERO_DESC_2",
EQUIP_HERO_DESC_3 = "EQUIP_HERO_DESC_3",
EQUIP_HERO_DESC_4 = "EQUIP_HERO_DESC_4",
EQUIP_HERO_DESC_5 = "EQUIP_HERO_DESC_5",
EQUIP_HERO_DESC_6 = "EQUIP_HERO_DESC_6",
EQUIP_HERO_DESC_7 = "EQUIP_HERO_DESC_7",
EQUIP_HERO_DESC_8 = "EQUIP_HERO_DESC_8",
EQUIP_HERO_DESC_9 = "EQUIP_HERO_DESC_9",
EQUIP_HERO_DESC_10 = "EQUIP_HERO_DESC_10",
EQUIP_HERO_DESC_11 = "EQUIP_HERO_DESC_11",
EQUIP_HERO_DESC_12 = "EQUIP_HERO_DESC_12",
EQUIP_HERO_DESC_13 = "EQUIP_HERO_DESC_13",
EQUIP_HERO_DESC_14 = "EQUIP_HERO_DESC_14",
EQUIP_HERO_DESC_15 = "EQUIP_HERO_DESC_15",
EQUIP_HERO_DESC_16 = "EQUIP_HERO_DESC_16",
EQUIP_HERO_DESC_17 = "EQUIP_HERO_DESC_17",
EQUIP_HERO_DESC_18 = "EQUIP_HERO_DESC_18",
EQUIP_HERO_DESC_19 = "EQUIP_HERO_DESC_19",
EQUIP_HERO_DESC_20 = "EQUIP_HERO_DESC_20",
EQUIP_HERO_DESC_21 = "EQUIP_HERO_DESC_21",
EQUIP_HERO_DESC_22 = "EQUIP_HERO_DESC_22",
EQUIP_HERO_DESC_23 = "EQUIP_HERO_DESC_23",
EQUIP_HERO_DESC_24 = "EQUIP_HERO_DESC_24",
EQUIP_HERO_DESC_25 = "EQUIP_HERO_DESC_25",
EQUIP_HERO_DESC_26 = "EQUIP_HERO_DESC_26",
EQUIP_HERO_DESC_27 = "EQUIP_HERO_DESC_27",
EQUIP_HERO_DESC_28 = "EQUIP_HERO_DESC_28",
EQUIP_HERO_DESC_29 = "EQUIP_HERO_DESC_29",
EQUIP_HERO_DESC_30 = "EQUIP_HERO_DESC_30",
EQUIP_HERO_DESC_31 = "EQUIP_HERO_DESC_31",
EQUIP_HERO_DESC_32 = "EQUIP_HERO_DESC_32",
EQUIP_HERO_DESC_33 = "EQUIP_HERO_DESC_33",
EQUIP_HERO_DESC_34 = "EQUIP_HERO_DESC_34",
} }
return LocalizationGlobalConst return LocalizationGlobalConst

View File

@ -681,10 +681,50 @@ 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"] = "穿戴", ["EQUIP_DESC_30"] = "穿戴",
["EQUIP_DESC_31"] = "一键穿戴", ["EQUIP_PARTS_1"] = "头盔",
["EQUIP_DESC_32"] = "装备培养", ["EQUIP_PARTS_2"] = "护臂",
["EQUIP_PARTS_3"] = "胸甲",
["EQUIP_PARTS_4"] = "裤子",
["EQUIP_PARTS_5"] = "鞋子",
["EQUIP_PARTS_6"] = "护手",
["EQUIP_HERO_DESC_1"] = "没有多余装备",
["EQUIP_HERO_LV_1"] = "强化共鸣{0}级",
["EQUIP_HERO_LV_2"] = "品质共鸣{0}级",
["EQUIP_HERO_LV_3"] = "精炼共鸣{0}级",
["EQUIP_HERO_DESC_2"] = "一键穿戴",
["EQUIP_HERO_DESC_3"] = "装备培养",
["EQUIP_HERO_DESC_4"] = "装备共鸣",
["EQUIP_HERO_DESC_5"] = "6件装备培养进度相同可激活装备共鸣",
["EQUIP_HERO_DESC_6"] = "装备共鸣可提供额外属性",
["EQUIP_HERO_DESC_7"] = "只有上阵英雄才可穿戴装备",
["EQUIP_HERO_DESC_8"] = "装备详情",
["EQUIP_HERO_DESC_9"] = "部位",
["EQUIP_HERO_DESC_10"] = "评分",
["EQUIP_HERO_DESC_11"] = "基础属性",
["EQUIP_HERO_DESC_12"] = "附加属性",
["EQUIP_HERO_DESC_13"] = "替换",
["EQUIP_HERO_DESC_14"] = "养成",
["EQUIP_HERO_DESC_15"] = "装备替换",
["EQUIP_HERO_DESC_16"] = "交换",
["EQUIP_HERO_DESC_17"] = "没有可穿戴的装备",
["EQUIP_HERO_DESC_18"] = "装备养成",
["EQUIP_HERO_DESC_19"] = "强化",
["EQUIP_HERO_DESC_20"] = "精炼",
["EQUIP_HERO_DESC_21"] = "取消全选",
["EQUIP_HERO_DESC_22"] = "强化",
["EQUIP_HERO_DESC_23"] = "一键强化",
["EQUIP_HERO_DESC_24"] = "分解装备",
["EQUIP_HERO_DESC_25"] = "成功率:{0}%(失败等级不变)",
["EQUIP_HERO_DESC_26"] = "已精炼至满级",
["EQUIP_HERO_DESC_27"] = "已强化至满级",
["EQUIP_HERO_DESC_28"] = "分解可得",
["EQUIP_HERO_DESC_29"] = "一键全选",
["EQUIP_HERO_DESC_30"] = "分解",
["EQUIP_HERO_DESC_31"] = "请先选择装备",
["EQUIP_HERO_DESC_32"] = "没有可以强化的装备",
["EQUIP_HERO_DESC_33"] = "共鸣激活",
["EQUIP_HERO_DESC_34"] = "强化至<color=#00FF15>{0}</color>级可继续精炼",
} }
return localization_global return localization_global

View File

@ -508,6 +508,27 @@ GConst.QLT_COLOR = {
[6] = "#f6aeff", [6] = "#f6aeff",
} }
-- 没描边的文本颜色
GConst.QLT_COLOR_NO_OUTLINE = {
[0] = "#FFFFFF",
[1] = "#146F3B",
[2] = "#23429C",
[3] = "#952BA8",
[4] = "#C45F0E",
[5] = "#C40E0E",
[6] = "#C40E0E",
[7] = "#C40E0E",-- 炫彩
}
GConst.QLT_TYPE = {
NORMAL = 1,
RARE = 2,
EXCELLENT = 3,
EPIC = 4,
LEGEND = 5,
MYTHIC = 6,
}
GConst.QLT_LABLE = { GConst.QLT_LABLE = {
DEFAULT = "equip_quality_1", DEFAULT = "equip_quality_1",
GRAY = "equip_quality_1", GRAY = "equip_quality_1",

View File

@ -2007,6 +2007,18 @@ function GFunc.getFinalAttrValue(allAttrs, fixedId, factorId)
end end
end end
-- 通用
function GFunc.getQltColor(qlt)
qlt = qlt or GConst.QLT_TYPE.NORMAL
return GConst.QLT_COLOR[qlt]
end
-- 无描边用
function GFunc.getQltColorNoOutline(qlt)
qlt = qlt or GConst.QLT_TYPE.NORMAL
return GConst.QLT_COLOR_NO_OUTLINE[qlt]
end
---- 返回一个显示等间距但是数值不等间距的sliderValue ---- 返回一个显示等间距但是数值不等间距的sliderValue
-- defaultValue 值代表第一段少了平均每段的值 -- defaultValue 值代表第一段少了平均每段的值
function GFunc.getUnevenSliderValue(list, value, defaultValue) function GFunc.getUnevenSliderValue(list, value, defaultValue)

View File

@ -10,4 +10,25 @@ EquipConst.PART_TYPE = {
EQUIP_6 = 6, EQUIP_6 = 6,
} }
EquipConst.EQUIP_PART_NAME = {
[EquipConst.PART_TYPE.EQUIP_1] = "EQUIP_PARTS_1", --"头盔",
[EquipConst.PART_TYPE.EQUIP_2] = "EQUIP_PARTS_2", --"护臂",
[EquipConst.PART_TYPE.EQUIP_3] = "EQUIP_PARTS_3", --"胸甲",
[EquipConst.PART_TYPE.EQUIP_4] = "EQUIP_PARTS_4", --"裤子",
[EquipConst.PART_TYPE.EQUIP_5] = "EQUIP_PARTS_5", --"鞋子",
[EquipConst.PART_TYPE.EQUIP_6] = "EQUIP_PARTS_6", --"护手",
}
EquipConst.INFO_SHOW_TYPE = {
PREVIEW = 1, --预览
BASE_ATTR = 2, --基础属性
ALL_ATTR = 3, --所有属性
}
EquipConst.RESONATE_PAGE = {
LV_UP = 1, --强化共鸣
QLT = 2, --品质共鸣
REFINE = 3, --精炼共鸣
}
return EquipConst return EquipConst

View File

@ -4,11 +4,18 @@ function EquipManager:showEquipListUI(heroEntity, part)
UIManager:showUI("app/ui/equip/equip_list_ui", {heroEntity = heroEntity, part = part}) UIManager:showUI("app/ui/equip/equip_list_ui", {heroEntity = heroEntity, part = part})
end end
-- 展示材料获取弹窗(英雄id部位材料id材料数量) function EquipManager:showEquipGrowthUI(slotId)
function EquipManager:showItemGetPop(heroId, part, id, num) UIManager:showUI("app/ui/equip/equip_growth_ui", {slotId = slotId})
self:reqEquipUpgradeGift(heroId, part) end
UIManager:showUI("app/ui/dungeon/item_get_ui", {heroId = heroId, part = part, id = id, value = num}) function EquipManager:showEquipInfoUI(params)
local uiObj = UIManager:checkOpen(UIManager.UI_PATH.EQUIP_INFO_UI)
if uiObj then
uiObj:ctor(params)
uiObj:onRefresh()
else
UIManager:showUI(UIManager.UI_PATH.EQUIP_INFO_UI, params)
end
end end
-- 请求触发装备升级礼包 -- 请求触发装备升级礼包

View File

@ -27,7 +27,7 @@ function EquipCell:refresh(entity, slotId, showMask, showCheck, showLock)
if entity == nil then if entity == nil then
return return
end end
self:_refreshShow(entity:getQlt(), entity:getIconRes(), entity:getPartLevel(slotId), showMask, showCheck, showLock) self:_refreshShow(entity:getQlt(), entity:getIconRes(), entity:getPartLv(slotId), showMask, showCheck, showLock)
end end
function EquipCell:refreshByUid(uid) function EquipCell:refreshByUid(uid)

View File

@ -6,26 +6,31 @@ function EquipListCell:init()
self.nameTx = uiMap["cell.name_tx"] self.nameTx = uiMap["cell.name_tx"]
self.powerTx = uiMap["cell.power_tx"] self.powerTx = uiMap["cell.power_tx"]
self.wearBtn = uiMap["cell.wear_btn"] self.wearBtn = uiMap["cell.wear_btn"]
self.wearBtnIcon = uiMap["cell.wear_btn.icon"]
self.wearBtnTx = uiMap["cell.wear_btn.text"] self.wearBtnTx = uiMap["cell.wear_btn.text"]
self.wearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_30)) self.wearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_30))
self.wearBtn:addClickListener(function() self.wearBtn:addClickListener(function()
-- local ids = {} ModuleManager.EquipManager:onEquipWearReq(self.slotId, {self.equipEntity:getUid()})
-- for i = 1, GConst.EquipConst.PART_TYPE.EQUIP_6 do
-- ids[i] = DataManager.EquipData:getPartEquipUid(self.slotId, i)
-- end
-- ids[self.equipPart] = self.entity:getUid()
ModuleManager.EquipManager:onEquipWearReq(self.slotId, {self.entity:getUid()})
end) end)
end end
function EquipListCell:refresh(entity, slotId, equipPart) function EquipListCell:refresh(equipEntity, slotId, equipPart)
self.entity = entity self.equipEntity = equipEntity
self.slotId = slotId self.slotId = slotId
self.equipPart = equipPart self.equipPart = equipPart
self.nameTx:setText(entity:getName()) self.nameTx:setText(equipEntity:getName())
self.powerTx:setText(entity:getPower()) self.powerTx:setText(equipEntity:getPower())
self.equipCell:refresh(entity, slotId) self.equipCell:refresh(equipEntity, slotId)
local useHero = DataManager.EquipData:getEquipUseHero(equipEntity:getUid())
if useHero then
local heroEntity = DataManager.HeroData:getHeroById(useHero)
self.wearBtnIcon:setActive(true)
self.wearBtnIcon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroEntity:getIcon())
else
self.wearBtnIcon:setActive(false)
end
end end
return EquipListCell return EquipListCell

View File

@ -0,0 +1,242 @@
local EquipGrowthUI = class("EquipGrowthUI", BaseUI)
local EQUIP_LIST_CELL = "app/ui/equip/cell/equip_list_cell"
function EquipGrowthUI:isFullScreen()
return false
end
function EquipGrowthUI:getPrefabPath()
return "assets/prefabs/ui/equip/equip_growth_ui.prefab"
end
function EquipGrowthUI:onPressBackspace()
self:closeUI()
end
function EquipGrowthUI:ctor(parmas)
self.slotId = parmas.slotId
self.equipPart = 1
self.page = 1
end
function EquipGrowthUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["equip_growth_ui.mask"]:addClickListener(function()
self:closeUI()
end)
uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.bg.info_btn"]:addClickListener(function()
self:closeUI()
end)
-- uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
-- self:closeUI()
-- end)
self.nameTx = uiMap["equip_growth_ui.bg.name_tx"]
self.equipCell = uiMap["equip_growth_ui.bg.equip_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
-- 强化
self.upCurrLvTx = uiMap["equip_growth_ui.bg.page_info_1.curr_lv_tx"]
self.upNextLvTx = uiMap["equip_growth_ui.bg.page_info_1.next_lv_tx"]
self.upDescTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.desc_tx"]
self.upAttrNameTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.attr_name_tx"]
self.upAttrCurrTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.attr_curr_tx"]
self.upAttrNextTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.attr_next_tx"]
-- self.upInfoBtn = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.bg.info_btn"]
self.upDescTx1 = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.bg.desc_tx"]
self.upCostBg = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.cost_bg"]
self.upCostIcon = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.cost_bg.cost_icon"]
self.upCostTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.cost_bg.cost_tx"]
self.upUpBtn = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.up_btn"]
-- self.upUpBtnTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.up_btn.text"]
self.upAutoBtn = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn"]
-- self.upAutoBtnTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]
self.upMaxDescTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.max_desc_tx"]
self.upUpBtn:addClickListener(function()
self:closeUI()
end)
self.upAutoBtn:addClickListener(function()
self:closeUI()
end)
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.up_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3))
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_23))
self.upMaxDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_27))
-- 精炼
-- self.refineNowBg = uiMap["equip_growth_ui.bg.page_info_2.now_bg"]
self.refineCurrLvTx = uiMap["equip_growth_ui.bg.page_info_2.now_bg.lv_tx"]
-- self.refineNextBg = uiMap["equip_growth_ui.bg.page_info_2.next_bg"]
self.refineNextLvTx = uiMap["equip_growth_ui.bg.page_info_2.next_bg.lv_tx"]
self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx"]
-- self.list = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list"]
-- self.attrExtraCell1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1"]
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.point"]
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_name_tx"]
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_curr_tx"]
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.img_arrow"]
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_next_tx"]
-- self.attrExtraCell2 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2"]
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.point"]
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_name_tx"]
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_curr_tx"]
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.img_arrow"]
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_next_tx"]
-- self.attrExtraCell3 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3"]
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.point"]
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_name_tx"]
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_curr_tx"]
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.img_arrow"]
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_next_tx"]
-- self.attrExtraCell4 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4"]
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.point"]
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_name_tx"]
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_curr_tx"]
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.img_arrow"]
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_next_tx"]
-- self.bg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg"]
self.refineInfoBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]
self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.desc_tx"]
self.refineCostBg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg"]
self.refineCostIcon = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_icon"]
self.refineCostTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_tx"]
self.refineUpBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn"]
self.refineUpBtnTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn.text"]
self.refineRateTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.rate_tx"]
self.refineDescTx1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx_1"]
self.refineResolveBtn = uiMap["equip_growth_ui.bg.resolve_btn"]
self.refineResolveBtnTx = uiMap["equip_growth_ui.bg.resolve_btn.text"]
self.refineAttrCells = {}
self.refineAttrNameTxs = {}
self.refineAttrCurrTxs = {}
self.refineAttrNextTxs = {}
for i = 1, 4 do
self.refineAttrCells[i] = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_" .. i]
self.refineAttrNameTxs[i] = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_" .. i .. ".attr_name_tx"]
self.refineAttrCurrTxs[i] = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_" .. i .. ".attr_curr_tx"]
self.refineAttrNextTxs[i] = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_" .. i .. ".attr_next_tx"]
end
self.equipCells = {}
for i = 1, 6 do
self.equipCells[i] = uiMap["equip_growth_ui.bg.equip_list.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.equipCells[i]:addClickListener(function()
if self.page == i then
return
end
self.page = i
self:onRefresh()
-- ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i)
end)
end
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)}
self.pageInfos = {}
self.pageBtns = {}
self.pageBtnTxs = {}
for i = 1, 2 do
self.pageInfos[i] = uiMap["equip_growth_ui.bg.page_info_" .. i]
self.pageBtns[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i]
self.pageBtnTxs[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i .. ".text"]
self.pageBtns[i] :addClickListener(function()
if not self:getIsOpen(i) or self.equipPart == i then
return
end
self.equipPart = i
self:onRefresh()
end)
end
uiMap["equip_growth_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1))
-- self:bind(DataManager.HeroData, "isDirty", function()
-- self:closeUI()
-- end)
end
function EquipGrowthUI:onRefresh()
self:initList()
self:refreshPageBtn()
self:refreshPageInfo()
self:refreshEquipCell()
end
function EquipGrowthUI:refreshEquipCell()
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, self.equipPart)
if eid and eid > 0 then
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
self.equipCell:refresh(equipEntity, self.equipPart)
else
self.equipCell:refreshEmpty(self.equipPart)
end
end
function EquipGrowthUI:refreshPageBtn()
for i = 1, 2 do
if self.page == i then
self.pageInfos[i]:setActive(true)
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
self.pageBtnTxs[i]:setText(self.btnTxs[i])
else
self.pageInfos[i]:setActive(false)
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_2")
self.pageBtnTxs[i]:setText("<color=#72778C>" .. self.btnTxs[i] .. "</color>")
end
end
end
function EquipGrowthUI:refreshPageInfo()
if self.page == 1 then
self:refreshPageUp()
else
self:refreshPageRefine()
end
end
--@region 强化
function EquipGrowthUI:refreshPageUp()
local lv = DataManager.EquipData:getPartLv(self.slotId, self.equipPart)
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, self.equipPart)
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
-- if eid and eid > 0 then
-- local equipEntity = DataManager.EquipData:getEquipByUid(eid)
-- self.equipCell:refresh(equipEntity, self.equipPart)
-- else
-- self.equipCell:refreshEmpty(self.equipPart)
-- end
self.upCurrLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
self.upNextLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv + 1))
self.upDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
self.upAttrNameTx:setText(equipEntity:getName())
self.upAttrCurrTx:setText(equipEntity:getBaseAttrWithLv(lv))
self.upAttrNextTx:setText(equipEntity:getBaseAttrWithLv(lv + 1))
self.upDescTx1:setText("adasd")
self.upCostTx:setText("1323")
end
--@endregion
--@region 精炼
function EquipGrowthUI:refreshPageRefine()
-- self.refineInfoBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]
-- self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.desc_tx"]
-- self.refineCostBg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg"]
-- self.refineCostIcon = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_icon"]
-- self.refineCostTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_tx"]
-- self.refineUpBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn"]
-- self.refineUpBtnTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn.text"]
-- self.refineRateTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.rate_tx"]
-- self.refineDescTx1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx_1"]
-- self.refineResolveBtn = uiMap["equip_growth_ui.bg.resolve_btn"]
-- self.refineResolveBtnTx = uiMap["equip_growth_ui.bg.resolve_btn.text"]
end
--@endregion
return EquipGrowthUI

View File

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

View File

@ -0,0 +1,194 @@
local EquipInfoUI = class("EquipInfoUI", BaseUI)
function EquipInfoUI:isFullScreen()
return false
end
function EquipInfoUI:getPrefabPath()
return "assets/prefabs/ui/equip/equip_info_ui.prefab"
end
function EquipInfoUI:onPressBackspace()
self:closeUI()
end
function EquipInfoUI:ctor(params)
self.showType = GConst.EquipConst.INFO_SHOW_TYPE.BASE_ATTR
if params.showType then
self.showType = params.showType
end
self.id = params and params.id --配置id
self.uid = params and params.uid --唯一id
self.slotId = params and params.slotId --上阵槽位
end
function EquipInfoUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["equip_info_ui.mask"]:addClickListener(function ()
self:closeUI()
end)
uiMap["equip_info_ui.bg.close_btn"]:addClickListener(function()
self:closeUI()
end)
self.equipCell = uiMap["equip_info_ui.bg.equip_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.nameTx = uiMap["equip_info_ui.bg.name_tx"]
self.partTx = uiMap["equip_info_ui.bg.part_desc_tx.part_tx"]
self.powerTx = uiMap["equip_info_ui.bg.power_desc_tx.power_tx"]
self.attrNameTx = uiMap["equip_info_ui.bg.attr_base.attr_name_tx"]
self.attrValueTx = uiMap["equip_info_ui.bg.attr_base.attr_value_tx"]
self.attrValueAddTx = uiMap["equip_info_ui.bg.attr_base.attr_value_add_tx"]
self.attrExtraCells = {}
for i = 1, 4 do
local attrExtraCell = uiMap["equip_info_ui.bg.attr_extra.list.attr_extra_cell_"..i]
local point = uiMap["equip_info_ui.bg.attr_extra.list.attr_extra_cell_"..i..".point"]
local attrNameTx = uiMap["equip_info_ui.bg.attr_extra.list.attr_extra_cell_"..i..".attr_name_tx"]
local attrValueTx = uiMap["equip_info_ui.bg.attr_extra.list.attr_extra_cell_"..i..".attr_value_tx"]
local attrValueAddTx = uiMap["equip_info_ui.bg.attr_extra.list.attr_extra_cell_"..i..".attr_value_add_tx"]
table.insert(self.attrExtraCells, {attrExtraCell = attrExtraCell, point = point, attrNameTx = attrNameTx, attrValueTx = attrValueTx, attrValueAddTx = attrValueAddTx})
end
self.replaceBtn = uiMap["equip_info_ui.bg.replace_btn"]
self.upBtn = uiMap["equip_info_ui.bg.up_btn"]
uiMap["equip_info_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_8))
uiMap["equip_info_ui.bg.part_desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_9))
uiMap["equip_info_ui.bg.power_desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_10))
uiMap["equip_info_ui.bg.replace_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_13))
uiMap["equip_info_ui.bg.up_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_14))
uiMap["equip_info_ui.bg.attr_base.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_11))
uiMap["equip_info_ui.bg.attr_extra.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_12))
self.replaceBtn:addClickListener(function()
local list = DataManager.EquipData:getAllEquipsSort(self.part)
if table.nums(list) == 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_17))
return
end
ModuleManager.EquipManager:showReplaceUI(self.slotId, self.part)
end)
self.upBtn:addClickListener(function()
ModuleManager.EquipManager:showGrowthUI(self.slotId, self.part)
end)
self:bind(DataManager.EquipData, "isDirty", function()
self:closeUI()
end)
end
function EquipInfoUI:onRefresh()
if self.showType == GConst.EquipConst.INFO_SHOW_TYPE.PREVIEW then
self:refreshPreview()
elseif self.showType == GConst.EquipConst.INFO_SHOW_TYPE.BASE_ATTR then
self:refreshBaseAttr()
elseif self.showType == GConst.EquipConst.INFO_SHOW_TYPE.ALL_ATTR then
self:refreshAllAttr()
end
self:refreshInfo()
end
function EquipInfoUI:refreshInfo()
self.nameTx:setText(self.entity:getNameQltColor())
self.partTx:setText(self.entity:getPartName())
self.powerTx:setText(self.entity:getPower())
local attr = self.entity:getBaseAttr()
self.attrNameTx:setText(GFunc.getAttrName(GFunc.getAttrIdByName(attr.type)))
self.attrValueTx:setText(attr.num // GConst.DEFAULT_FACTOR)
local txW = self.attrValueTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
self.attrValueTx:setSizeDeltaX(txW)
self.attrValueAddTx:setAnchoredPositionX(self.attrValueTx:getAnchoredPositionX() + txW + 5)
end
function EquipInfoUI:refreshPreview()
if self.id == nil then
self:closeUI()
return
end
self.entity = DataManager.EquipData:createEquipEntity({cfg_id = self.id})
self.equipCell:refreshById(self.id)
self.attrValueAddTx:setText(GConst.EMPTY_STRING)
for i,cell in ipairs(self.attrExtraCells) do
cell.attrExtraCell:setActive(true)
local extraAttr = DataManager.EquipData:getExtraAttr(self.id, i)
cell.attrNameTx:setText(GFunc.getAttrName(GFunc.getAttrIdByName(extraAttr.type)))
cell.attrValueTx:setText(GConst.EMPTY_STRING)
cell.attrValueAddTx:setActive(true)
-- cell.attrValueAddTx:setText("<color=#FFFFFF>".. DataManager.EquipData:getFinalAttr(extraAttr.type, extraAttr.minnum) .. "-".. DataManager.EquipData:getFinalAttr(extraAttr.type, extraAttr.maxnum) .."</color>")
end
self.replaceBtn:setActive(false)
self.upBtn:setActive(false)
end
function EquipInfoUI:refreshBaseAttr()
self.entity = DataManager.EquipData:getEquipByUid(self.uid)
self.equipCell:refreshById(self.entity:getId())
local attrs = self.entity:getExtraMap()
local count = #attrs
for i,cell in ipairs(self.attrExtraCells) do
if count >= i then
cell.attrExtraCell:setActive(true)
local extraAttr = attrs[i]
cell.attrNameTx:setText(GFunc.getAttrName(extraAttr.id))
-- cell.attrValueTx:setText(DataManager.EquipData:getFinalAttr(GFunc.getAttrNameById(extraAttr.id), extraAttr.value))
cell.attrValueTx:setAnchoredPositionX(-10)
cell.attrValueAddTx:setActive(false)
else
cell.attrExtraCell:setActive(false)
end
end
self.attrValueAddTx:setText(GConst.EMPTY_STRING)
self.replaceBtn:setActive(false)
self.upBtn:setActive(false)
end
function EquipInfoUI:refreshAllAttr()
if self.uid == 0 then
self:closeUI()
return
end
self.entity = DataManager.EquipData:getEquipByUid(self.uid)
if self.entity == nil then
return
end
self.part = self.entity:getPart()
self.equipCell:refresh(self.entity, self.slotId)
self.level = DataManager.EquipData:getPartLv(self.slotId, self.part)
self.refine = DataManager.EquipData:getPartRefine(self.slotId, self.part)
local resonateLv, resonateNextLv, resonateAttrNum, resonateAttrNextNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, self.slotId)
local baseValueAdd = DataManager.EquipData:getBaseAttrLvAdd(self.level) + resonateAttrNum
if baseValueAdd <= 0 then
self.attrValueAddTx:setText(GConst.EMPTY_STRING)
else
self.attrValueAddTx:setText("<color=#09FF00>(+".. math.floor(baseValueAdd) ..")</color>")
end
local attrs = self.entity:getExtraMap()
local count = table.nums(attrs)
for i,cell in ipairs(self.attrExtraCells) do
if count >= i then
cell.attrExtraCell:setActive(true)
local extraAttr = attrs[i]
cell.attrNameTx:setText(GFunc.getAttrName(extraAttr.id))
-- cell.attrValueTx:setText(DataManager.EquipData:getFinalAttr(GFunc.getAttrNameById(extraAttr.id), extraAttr.value))
local attrAdd = DataManager.EquipData:getRefineAttrAdd(self.refine, extraAttr.id)
local anchorX = -3
if attrAdd.num <= 0 then
cell.attrValueAddTx:setActive(false)
else
cell.attrValueAddTx:setActive(true)
-- cell.attrValueAddTx:setText("<color=#09FF00>(+".. DataManager.EquipData:getFinalAttr(attrAdd.type, attrAdd.num) ..")</color>")
local meshProCompNext = cell.attrValueAddTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
local nowTipsNextX = meshProCompNext.preferredWidth
cell.attrValueAddTx:setSizeDeltaX(nowTipsNextX)
anchorX = anchorX - nowTipsNextX - 15
end
cell.attrValueTx:setAnchoredPositionX(anchorX)
else
cell.attrExtraCell:setActive(false)
end
end
self.replaceBtn:setActive(true)
self.upBtn:setActive(true)
end
return EquipInfoUI

View File

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

View File

@ -64,7 +64,7 @@ function EquipListUI:refreshEquipCell()
end end
function EquipListUI:initList() function EquipListUI:initList()
self.equipList = DataManager.EquipData:getEquipListByPart(self.equipPart) self.equipList = DataManager.EquipData:getAllEquipsSort(self.equipPart, nil, nil, self.heroEntity:getCfgId())
end end
function EquipListUI:refreshScrollrect() function EquipListUI:refreshScrollrect()

View File

@ -20,9 +20,9 @@ function EquipInfoComp:init()
self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2)) self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3)) self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_29)) self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_7))
self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_32)) self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3))
self.autoWaerBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_31)) self.autoWaerBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_2))
self.equipCells = {} self.equipCells = {}
self.suitTxs = {} self.suitTxs = {}
@ -30,9 +30,24 @@ function EquipInfoComp:init()
self.suitTxs[i] = uiMap["equip_info.equip_node.up.suit_tx_" .. i] 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] = uiMap["equip_info.equip_node.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
self.equipCells[i]:addClickListener(function() self.equipCells[i]:addClickListener(function()
ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i) local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), i)
if eid and eid > 0 then
-- local equipEntity = DataManager.EquipData:getEquipByUid(eid)
-- self.equipCells[part]:refresh(equipEntity, part)
-- EquipManager:showEquipGrowthUI(slotId)
local parmas = {}
parmas.slotId = self.heroEntity:getMatchType()
parmas.part = i
parmas.uid = eid
parmas.showType = GConst.EquipConst.INFO_SHOW_TYPE.ALL_ATTR
ModuleManager.EquipManager:showEquipInfoUI(parmas)
else
ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i)
end
end) end)
end end
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_4))
self.descTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_5))
self.autoWaerBtn:addClickListener(function() self.autoWaerBtn:addClickListener(function()
local soltId = self.heroEntity:getMatchType() local soltId = self.heroEntity:getMatchType()
@ -47,7 +62,7 @@ function EquipInfoComp:init()
end) end)
self.upBtn:addClickListener(function() self.upBtn:addClickListener(function()
-- UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity}) -- UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_32)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3))
end) end)
self.attrBtn:addClickListener(function() self.attrBtn:addClickListener(function()
UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity}) UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
@ -66,6 +81,7 @@ end
function EquipInfoComp:refresh() function EquipInfoComp:refresh()
self:refreshAttr() self:refreshAttr()
self:refreshEquip() self:refreshEquip()
self:refreshEquipSuit()
end end
function EquipInfoComp:refreshAttr() function EquipInfoComp:refreshAttr()
@ -119,4 +135,16 @@ function EquipInfoComp:refreshEquip()
end end
end end
function EquipInfoComp:refreshEquipSuit()
local suitLvs = {1, 2, 3}
local suitDescs = {
I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_LV_1, suitLvs[1]),
I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_LV_2, suitLvs[2]),
I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_LV_3, suitLvs[3])
}
for i = 1, 3 do
self.suitTxs[i]:setText(suitDescs[i])
end
end
return EquipInfoComp return EquipInfoComp

View File

@ -24,6 +24,8 @@ UIManager.UI_PATH = {
HERO_DETAIL_UI = "app/ui/hero/hero_detail_ui", HERO_DETAIL_UI = "app/ui/hero/hero_detail_ui",
ARENA_MATCH_UI = "app/ui/arena/arena_match_ui", ARENA_MATCH_UI = "app/ui/arena/arena_match_ui",
BATTLE_PVP_UI = "app/ui/battle/battle_ui_pvp", BATTLE_PVP_UI = "app/ui/battle/battle_ui_pvp",
EQUIP_INFO_UI = "app/ui/equip/equip_info_ui",
} }
-- 动画类型 -- 动画类型

View File

@ -29,6 +29,10 @@ function EquipData:init(data)
self:addEquip(equip) self:addEquip(equip)
end end
end end
-- int64 equip_uid = 1;
-- int32 level = 2;
-- int32 refine = 3;
-- int64 refine_fail = 4;
self.slots = data.slots or {} self.slots = data.slots or {}
end end
@ -111,6 +115,39 @@ function EquipData:getName(id)
return I18N:getText("equip", id, "name") return I18N:getText("equip", id, "name")
end end
--附加属性
function EquipData:getExtraAttr(id, index)
return self:getConfig(id)["extra_attr_" .. index]
end
--精炼额外数值总和
function EquipData:getRefineAttrAdd(refine, attrId)
local attrName = GFunc.getAttrNameById(attrId)
local attrAll = {type = attrName, num = 0}
for i = 1, refine do
if i <= refine then
local attr = self:getRefineAttr(i, attrName)
if attr then
attrAll.num = attrAll.num + attr.num
end
end
end
return attrAll
end
--对应精炼等级的额外数值
function EquipData:getRefineAttr(refine, attrName)
local cfg = self:getRefineConfig(refine)
if attrName == "attr_atk_private" then
return cfg.extra_attr_add_1
elseif attrName == "def_dec_private" then
return cfg.extra_attr_add_2
elseif attrName == "crit_private" then
return cfg.extra_attr_add_3
elseif attrName == "crit_time_private" then
return cfg.extra_attr_add_4
end
end
--@endregion --@endregion
--@region 装备基础 --@region 装备基础
@ -129,19 +166,61 @@ function EquipData:createEquipEntity(equip)
return EquipEntity:create(equip) return EquipEntity:create(equip)
end end
function EquipData:getAllEquips() function EquipData:getAllEquips(part, qlt, star, useHeroId)
return self.allEquips
end
function EquipData:getEquipListByPart(part)
local list = {} local list = {}
for _, v in pairs(self.allEquips) do for _, v in pairs(self.allEquips) do
if v:getPart() == part then local matchAll = true -- 默认全部匹配
-- 品质+星级筛选(必须同时满足)
if qlt ~= nil then
if qlt ~= 0 then
-- 先判断品质,再判断星级
if not (v:getQlt() <= qlt and (v:getQlt() ~= qlt or v:getStar() <= star)) then
matchAll = false
end
end
end
-- 部位筛选
if matchAll and part ~= nil and part ~= 0 then
if v:getPart() ~= part then
matchAll = false
end
end
-- 使用状态筛选
if matchAll and useHeroId ~= nil then
local heroId = self:getEquipUseHero(v:getUid())
if heroId and heroId == useHeroId then
matchAll = false
end
end
-- 只有全部条件满足才加入
if matchAll then
table.insert(list, v) table.insert(list, v)
end end
end end
table.sort(list, function (a, b)
return a:getPower() > b:getPower() return list
end
-- 获取所有装备数据
function EquipData:getAllEquipsSort(part, qlt, star, useHeroId)
local list = self:getAllEquips(part, qlt, star, useHeroId)
return self:sortEquipsList(list)
end
--排序
function EquipData:sortEquipsList(list)
for _, equip in ipairs(list) do
equip._sort = equip:getPower() * 10000000 + (10000000 - equip:getUid())
end
-- 先品质后等级排序
table.sort(list, function(equip1, equip2)
-- 权重相同的情况下,再单独比较评分(从高到低)
-- 评分也相同则按UID排序
return equip1._sort > equip2._sort
end) end)
return list return list
end end
@ -175,35 +254,58 @@ function EquipData:onWearSuccess(soltId, uids)
end end
function EquipData:getEquipMaxScore(soltId, part) function EquipData:getEquipMaxScore(soltId, part)
local equip = nil local equip = nil
local maxScore = 0 local maxScore = 0
local useUid = self:getPartEquipUid(soltId, part) local useUid = self:getPartEquipUid(soltId, part)
if useUid ~= 0 then if useUid ~= 0 then
local useEquip = self:getEquipByUid(useUid) local useEquip = self:getEquipByUid(useUid)
maxScore = useEquip:getPower() maxScore = useEquip:getPower()
end end
for i, v in pairs(self.allEquips) do for i, v in pairs(self.allEquips) do
if v:getPart() == part then if v:getPart() == part then
local isEquip = false local isEquip = false
for k2, info in ipairs(self.slots) do for k2, info in ipairs(self.slots) do
if info.parts[part] and info.parts[part].equip_uid == v:getUid() then if info.parts[part] and info.parts[part].equip_uid == v:getUid() then
isEquip = true isEquip = true
break break
end end
end end
if not isEquip then if not isEquip then
local score = v:getPower() local score = v:getPower()
if score > maxScore then if score > maxScore then
equip = v equip = v
maxScore = score maxScore = score
end end
end end
end end
end end
return equip return equip
end end
--@endregion --@endregion
--@region 装备强化
-----获取强化等级
function EquipData:getPartLv(slotId, part)
local parts = self.slots[slotId].parts
if parts then
local partInfo = parts[part]
if partInfo then
return partInfo.level
end
end
return 0
end
--基础属性额外强化值
function EquipData:getBaseAttrLvAdd(lv)
local baseAttrAdd = 0
for i = 1, lv do
baseAttrAdd = baseAttrAdd + self:getLevelConfig(i).base_attr_add.num
end
return baseAttrAdd
end
--@endregion
--@region 六个部位装备的强化与精炼 --@region 六个部位装备的强化与精炼
--获取对应位置的装备Id --获取对应位置的装备Id
function EquipData:getPartEquipUid(slotId, part) function EquipData:getPartEquipUid(slotId, part)
@ -220,19 +322,6 @@ function EquipData:getPartEquipUid(slotId, part)
end end
return 0 return 0
end end
-----获取强化等级
function EquipData:getPartLevel(slotId, part)
local parts = self.slots[slotId].parts
if parts then
local partInfo = parts[part]
if partInfo then
return partInfo.level
end
end
return 0
end
--获取精炼等级 --获取精炼等级
function EquipData:getPartRefine(slotId, part) function EquipData:getPartRefine(slotId, part)
local parts = self.slots[slotId].parts local parts = self.slots[slotId].parts
@ -260,10 +349,32 @@ function EquipData:getPartRefineFailPro(slotId, part)
return 0 return 0
end end
function EquipData:getResonateList(type)
if self.listResonate == nil then
self.listResonate = {}
local list = self:getResonateConfig()
for i,v in pairs(list) do
if self.listResonate[v.type] == nil then
self.listResonate[v.type] = {}
end
v.id = i
table.insert(self.listResonate[v.type], v)
end
for _,l in ipairs(self.listResonate) do
table.sort(l, function (a, b)
return a.id < b.id
end)
end
end
if self.listResonate[type] then
return self.listResonate[type]
end
end
function EquipData:getSlotAllAttr(slotId) function EquipData:getSlotAllAttr(slotId)
local attr = {} local attr = {}
for part = 1, 6 do for part = 1, 6 do
local level = self:getPartLevel(slotId, part) local level = self:getPartLv(slotId, part)
local refine = self:getPartRefine(slotId, part) local refine = self:getPartRefine(slotId, part)
for i = 1, level do for i = 1, level do
local cfg = self:getLevelConfig(i) local cfg = self:getLevelConfig(i)
@ -353,10 +464,10 @@ function EquipData:getResonateLevelValue(type, value, value2)
if type == 1 or type == 3 then if type == 1 or type == 3 then
if v.parameter[1] <= value then if v.parameter[1] <= value then
lv = i lv = i
attrNum = attrNum + v.attr.num attrNum = attrNum + v.attr[1].num
else else
nextLv = v.parameter nextLv = v.parameter
attrNextNum = attrNum + v.attr.num attrNextNum = attrNum + v.attr[1].num
break break
end end
elseif type == 2 then elseif type == 2 then
@ -368,10 +479,10 @@ function EquipData:getResonateLevelValue(type, value, value2)
end end
if isTrue then if isTrue then
lv = i lv = i
attrNum = attrNum + v.attr.num attrNum = attrNum + v.attr[1].num
else else
nextLv = v.parameter nextLv = v.parameter
attrNextNum = attrNum + v.attr.num attrNextNum = attrNum + v.attr[1].num
break break
end end
end end
@ -383,7 +494,7 @@ function EquipData:getResonateLevel(type, slotId)
if type == 1 then if type == 1 then
local minLv = 999 local minLv = 999
for i = 1, 6 do for i = 1, 6 do
local level = self:getPartLevel(slotId, i) local level = self:getPartLv(slotId, i)
if level < minLv then if level < minLv then
minLv = level minLv = level
end end
@ -444,13 +555,13 @@ function EquipData:getRefineNeedLevel(refine)
end end
end end
function EquipData:getEquipUseForce(uid) function EquipData:getEquipUseHero(uid)
local equip = self:getEquipByUid(uid) local equip = self:getEquipByUid(uid)
local mainTeam = DataManager.ForceData:getTeamList(ModuleManager.BattleManager.BATTLE_TYPE.STAGE) local formation = DataManager.FormationData:getStageFormation()
local part = equip:getPart() local part = equip:getPart()
for i,info in ipairs(self.slots) do for i,info in ipairs(self.slots) do
if info.parts[part] and info.parts[part].equip_uid and info.parts[part].equip_uid == uid then if info.parts[part] and info.parts[part].equip_uid and info.parts[part].equip_uid == uid then
return mainTeam[i] return formation[i]
end end
end end
end end

View File

@ -61,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.baseAttrs = DataManager.EquipData:getBaseAttr(self:getId()) self.baseAttr = self.config.base_attr
end end
function EquipEntity:setExtraAttr(attr) function EquipEntity:setExtraAttr(attr)
@ -90,8 +90,15 @@ function EquipEntity:setExtraAttr(attr)
self.allAttrs = nil self.allAttrs = nil
end end
function EquipEntity:getBaseAttrs() function EquipEntity:getBaseAttr()
return self.baseAttrs return self.baseAttr
end
function EquipEntity:getBaseAttrWithLv(lv)
local attr = {}
attr.type = self.baseAttr.type
attr.num = self.baseAttr.num + DataManager.EquipData:getBaseAttrLvAdd(lv)
return attr
end end
function EquipEntity:getExtraMap() function EquipEntity:getExtraMap()
@ -106,10 +113,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:getBaseAttr()) 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 self.allAttrs[self.baseAttr.type] = (self.allAttrs[self.baseAttr.type] or 0) + self.baseAttr.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
@ -169,8 +176,17 @@ end
--@endregion --@endregion
--@region 数据 --@region 数据
function EquipEntity:getPartLevel(slotId) function EquipEntity:getPartLv(slotId)
return DataManager.EquipData:getPartLevel(slotId, self:getPart()) return DataManager.EquipData:getPartLv(slotId, self:getPart())
end
function EquipEntity:getMaxLv(slotId)
return #DataManager.EquipData:getLevelConfig()
end
function EquipEntity:getIsLvMax()
local lv = self:getPartLv()
return lv >= self:getMaxLv()
end end
--@endregion --@endregion
return EquipEntity return EquipEntity