|
ComposeInstructionView = ComposeInstructionView or BaseClass(BaseView)
|
|
|
|
function ComposeInstructionView:__init()
|
|
self.base_file = "common"
|
|
self.layout_file = "InstructionSmallView"
|
|
self.layer_name = "Activity"
|
|
self.use_background = true
|
|
self.click_bg_toClose = true
|
|
self.background_alpha = 0
|
|
self:AddPreLoadList("common",{"InstructionSmallItem"})
|
|
self.model = ComposeModel:getInstance()
|
|
|
|
self.item_list = {}
|
|
self.load_callback = function()
|
|
self:LoadSuccess()
|
|
self:SetData()
|
|
end
|
|
self.close_callback = function ()
|
|
self:Clear()
|
|
end
|
|
end
|
|
|
|
function ComposeInstructionView:Clear()
|
|
for i,item in ipairs(self.item_list) do
|
|
item:DeleteMe()
|
|
end
|
|
self.item_list = {}
|
|
end
|
|
|
|
function ComposeInstructionView:LoadSuccess()
|
|
self.window = self:GetChild("Window")
|
|
self.scroll_content = self:GetChild("Window/ScrollView/Viewport/Content")
|
|
end
|
|
|
|
function ComposeInstructionView:Open(data)
|
|
self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function ComposeInstructionView:SetData()
|
|
--self.windowTitleText.text = "合成说明"
|
|
local height = 10
|
|
local info_list = self:GetInstruction()
|
|
if info_list then
|
|
local item = nil
|
|
for i,vo in ipairs(info_list) do
|
|
item = InstructionSmallItem.New(self.scroll_content)
|
|
table.insert(self.item_list,item)
|
|
item:SetData(vo)
|
|
item:SetPosition(0,-height)
|
|
height = height + item:GetHeight()
|
|
end
|
|
end
|
|
self.scroll_content.sizeDelta = Vector2(self.scroll_content.sizeDelta.x, height)
|
|
height = height + 30
|
|
height = height > 400 and 400 or height
|
|
self.window.sizeDelta = Vector2(self.window.sizeDelta.x, height)
|
|
--self.scroll_content.localPosition = Vector3.zero
|
|
end
|
|
|
|
function ComposeInstructionView:GetInstruction()
|
|
local info_list = {[1] = {itemTitle = "", content = ""}}
|
|
|
|
if self.model.cur_panel_id and self.data then
|
|
local consumable = ErlangParser:GetInstance():Parse(self.data.regular_mat)
|
|
local Irr_list = ErlangParser:GetInstance():Parse(self.data.irregular_mat)
|
|
local ratio = ErlangParser:GetInstance():Parse(self.data.ratio)
|
|
local is_god = false
|
|
local str = ""
|
|
local unit
|
|
if consumable and #consumable > 0 then
|
|
is_god = true
|
|
for i, v in ipairs(consumable) do
|
|
local goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(tonumber(v[2]))
|
|
if goods_basic then
|
|
if goods_basic.type == GoodsModel.TYPE.EQUIP then
|
|
local attr = Config.Equipattr[goods_basic.type_id]
|
|
if attr then
|
|
str = str..string.format("%d件<color=%s>%d阶%d星</color><color=%s>%s%s</color>,",
|
|
tonumber(v[3]), ColorUtil.GREEN, attr.stage, attr.star, ColorUtil:GetColor(goods_basic.color), ColorUtil:getColorName(goods_basic.color), Config.ConfigEquipShow[goods_basic.subtype] and Config.ConfigEquipShow[goods_basic.subtype].name or "")
|
|
end
|
|
else
|
|
str = str..tonumber(v[3]).."个<color="..ColorUtil:GetColor(goods_basic.color)..">"..Trim(goods_basic.goods_name).."</color>,"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if ratio and #ratio > 0 then
|
|
local min = 0
|
|
local max = #ratio
|
|
for i, v in ipairs(ratio) do
|
|
if tonumber(v[2]) > 0 then
|
|
min = v[1]
|
|
break
|
|
end
|
|
end
|
|
if max then
|
|
if min then
|
|
str = str..min.."~"..max.."件"
|
|
else
|
|
str = str..max.."件"
|
|
end
|
|
end
|
|
str = "1.本次合成需要消耗"..min.."~"..max.."件装备 \n2.少于最低数量合成概率为0"
|
|
end
|
|
local equip_attr
|
|
local irr_basic
|
|
if Irr_list and #Irr_list > 0 then
|
|
irr_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(tonumber(Irr_list[1]))
|
|
if self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_BEAST then
|
|
equip_attr = Config.Eudemonsequipattr[tonumber(Irr_list[1])]
|
|
else
|
|
equip_attr = Config.Equipattr[tonumber(Irr_list[1])]
|
|
end
|
|
end
|
|
|
|
if self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_BOY or self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_GIRL then
|
|
local sex = "装备"
|
|
--[[if self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_BOY then
|
|
sex = "男装"
|
|
else
|
|
sex = "女装"
|
|
end--]]
|
|
if equip_attr and irr_basic then
|
|
str = str..string.format("<color=%s>%d阶%d星</color><color=%s>%s%s</color>",
|
|
ColorUtil.GREEN, equip_attr.stage, equip_attr.star, ColorUtil:GetColor(irr_basic.color), ColorUtil:getColorName(irr_basic.color), sex)
|
|
end
|
|
str = str.."合成该装备;\n"
|
|
str = str.."2"..self:GetInstructionString(1).."\n"
|
|
str = str.."3"..self:GetInstructionString(is_god and 3 or 2)
|
|
elseif self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_GUARD then
|
|
if equip_attr and irr_basic then
|
|
str = str..string.format("<color=%s>%d阶%d星</color><color=%s>%s%s</color>",
|
|
ColorUtil.GREEN, equip_attr.stage, equip_attr.star, ColorUtil:GetColor(irr_basic.color), ColorUtil:getColorName(irr_basic.color), Config.ConfigEquipShow[irr_basic.subtype] and Config.ConfigEquipShow[irr_basic.subtype].name or "")
|
|
end
|
|
str = str.."合成该装备;\n"
|
|
str = str.."2"..self:GetInstructionString(1).."\n"
|
|
str = str.."3"..self:GetInstructionString(is_god and 3 or 2)
|
|
elseif self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_RING then
|
|
if equip_attr and irr_basic then
|
|
str = str..string.format("<color=%s>%d阶%d星</color><color=%s>%s%s</color>",
|
|
ColorUtil.GREEN, equip_attr.stage, equip_attr.star, ColorUtil:GetColor(irr_basic.color), ColorUtil:getColorName(irr_basic.color), Config.ConfigEquipShow[irr_basic.subtype] and Config.ConfigEquipShow[irr_basic.subtype].name or "")
|
|
end
|
|
str = str.."合成该装备;\n"
|
|
str = str.."2"..self:GetInstructionString(1).."\n"
|
|
elseif self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_BEAST then
|
|
if equip_attr and irr_basic then
|
|
str = str..string.format("<color=%s>%d星</color><color=%s>%s幻兽装备</color>",
|
|
ColorUtil.GREEN, equip_attr.star, ColorUtil:GetColor(irr_basic.color), ColorUtil:getColorName(irr_basic.color))
|
|
end
|
|
str = str.."合成该装备;\n"
|
|
str = str.."2"..self:GetInstructionString(4).."\n"
|
|
elseif self.model.cur_panel_id == ComposeModel.ComposePanelID.EQUIP_SEAL then
|
|
--[[if equip_attr and irr_basic then
|
|
str = str..string.format("<color=%s>%d阶%d星</color><color=%s>%s%s</color>",
|
|
ColorUtil.GREEN, equip_attr.stage, equip_attr.star, ColorUtil:GetColor(irr_basic.color), ColorUtil:getColorName(irr_basic.color), Config.ConfigEquipShow[irr_basic.subtype] and Config.ConfigEquipShow[irr_basic.subtype].name or "")
|
|
end
|
|
str = str.."合成该装备;\n"
|
|
str = str.."2"..self:GetInstructionString(1).."\n"--]]
|
|
end
|
|
|
|
info_list[1].content = str
|
|
end
|
|
|
|
return info_list
|
|
end
|
|
|
|
function ComposeInstructionView:GetInstructionString(index)
|
|
local ins_list = {
|
|
[1] = "、带有强化、镶嵌、套装、洗练属性的装备,以及绑定、穿戴中的装备不可合成;",
|
|
[2] = "、合成有概率失败,放入的装备越多,成功率越高;",
|
|
[3] = "、神装合成后可无损拆解,返还所有合成材料和装备,返还的装备部位随机;",
|
|
[4] = "、合成后的装备的强化经验为消耗装备的经验之和;",
|
|
}
|
|
|
|
return ins_list[index] or ""
|
|
end
|