源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1415 rivejä
68 KiB

GoodsTooltips = GoodsTooltips or BaseClass(BaseView)
function GoodsTooltips:__init()
self.base_file = "common"
self.layout_file = "goodsTooltips"
self.layer_name = "Top"
self.is_set_zdepth = true
self.use_background = true
self.click_bg_toClose = true
self.hide_maincancas = false
self.hide_clear_role_model = false
self.blur_activity_bg = true
self.use_show_anim = true
self.use_hide_anim = true
self.base_height = 497
self.pos_x = 0
self.pos_y = 0
self.goods_vo = nil
self.is_show_btn = nil
self.show_get_way = false
-- self.close_fog = true
self.get_way_item_list = {}
self.attr_item_list = {}
self.text_item_list = {}
self.model = GoodsModel:getInstance()
self.mainVo = RoleManager.Instance.mainRoleInfo
self.shop_model = ShopModel:getInstance()
self.market_model = MarketModel:getInstance()
self.open_guide_close = true
self.sound_id = false
--self.use_local_view = true
self.load_callback = function ()
self:LoadSuccess()
end
self.open_callback = function ()
self.layout.gameObject:SetActive(false)
if self:IsNeedDynamic() then
local callback = function (dynamic)
self.goods_vo.expire_time = dynamic.expire_time
self:SetData()
end
GoodsModel:getInstance():GetDynamic(self.goods_vo.goods_id, callback)
else
self:SetData()
end
end
self.close_callback = function ()
GlobalEventSystem:Fire(EventName.EQUIP_TOOL_TIP_CLOSE)
end
self.destroy_callback = function ()
self:Remove()
end
end
function GoodsTooltips:LoadSuccess()
self.layout = self:GetChild("layout")
self.icon_con = self:GetChild("layout/base_con/icon_con")
self.nameText = self:GetChild("layout/base_con/nameText"):GetComponent("TextMeshProUGUI")
self.countTextObj = self:GetChild("layout/base_con/countText").gameObject
self.countText = self:GetChild("layout/base_con/countText"):GetComponent("TextMeshProUGUI")
self.levelText = self:GetChild("layout/base_con/levelText"):GetComponent("TextMeshProUGUI")
self.overdueText = self:GetChild("layout/base_con/overdueText"):GetComponent("TextMeshProUGUI")
self.overdue = self:GetChild("layout/base_con/overdueText").gameObject
self.overdue_bg = self:GetChild("layout/base_con/overdue_bg"):GetComponent("Image")
self.overdue_bg_obj = self:GetChild("layout/base_con/overdue_bg").gameObject
self.getwayUrlText = self:GetChild("layout/base_con/getwayUrlText"):GetComponent("TextMeshProUGUI")
self.getwayUrlText_obj = self:GetChild("layout/base_con/getwayUrlText").gameObject
self.base_con_obj = self:GetChild("layout/base_con").gameObject
self.get_way_btn = self:GetChild("layout/base_con/get_way_btn").gameObject
self.getWayConObj = self:GetChild("layout/get_way_con").gameObject
self.conversionTimeText = self:GetChild("layout/base_con/conversionTimeText"):GetComponent("TextMeshProUGUI")
self.getWayScroll,self.getWayScrollContent,self.getWayCon = GetChildTransforms(self.transform,
{
"layout/get_way_con/ScrollView","layout/get_way_con/ScrollView/Viewport/Content","layout/get_way_con/ScrollView/Viewport/Content"
})
self.btns_con = self:GetChild("layout/btns_con")
self.shiyongBtn = self:GetChild("layout/btns_con/shiyongBtn").gameObject
self.hechengBtn = self:GetChild("layout/btns_con/hechengBtn").gameObject
self.chushouBtn = self:GetChild("layout/btns_con/chushouBtn").gameObject
self.yulanBtn = self:GetChild("layout/btns_con/yulanBtn").gameObject
self.storeBtn = self:GetChild("layout/btns_con/storeBtn").gameObject
self.takeBtn = self:GetChild("layout/btns_con/takeBtn").gameObject
self.splitBtn = self:GetChild("layout/btns_con/splitBtn").gameObject
self.shelvesUpBtn = self:GetChild("layout/btns_con/shelvesUpBtn").gameObject
self.shelvesDownBtn = self:GetChild("layout/btns_con/shelvesDownBtn").gameObject
self.decomposeBtn = self:GetChild("layout/btns_con/decomposeBtn").gameObject
self.oneKeyBuyBtn = self:GetChild("layout/btns_con/oneKeyBuyBtn").gameObject
self.replaceBtn = self:GetChild("layout/btns_con/replaceBtn").gameObject
self.dropBtn = self:GetChild("layout/btns_con/dropBtn").gameObject
self.marketBuyBtn = self:GetChild("layout/btns_con/market_buy_btn").gameObject
self.marketActionBtn = self:GetChild("layout/btns_con/market_auction_btn").gameObject
self.capsuleEggTakeBtn = self:GetChild("layout/btns_con/capsuleEggTakeBtn").gameObject
self.tmBatchUseBtn = self:GetChild("layout/btns_con/tm_batch_use").gameObject -- 藏宝图批量使用按钮
self.attrCon_trf = self:GetChild("layout/base_con/attrCon")
self.attrCon_obj = self:GetChild("layout/base_con/attrCon").gameObject
self.normalDecomposeBtn = self:GetChild("layout/btns_con/normalDecomposeBtn").gameObject
---新加的
local nodes = {
"layout/market_con:obj",
"layout/shop_con:obj",
"layout/base_con/bg:img",
"layout/get_way_con/get_way_bg:img",
"layout/base_con/content_scrollview:obj",
"layout/base_con/content_scrollview/Viewport/content_con",
"layout/left_extra_con:obj",
--外观类
"layout/nice_con/nice_designation_con/nice_designation_text:tmp",
"layout/nice_con/nice_roleCon:obj",
"layout/nice_con/nice_childCon:obj",
"layout/nice_con/nice_name_text:tmp",
"layout/nice_con/nice_designation_con:obj",
"layout/nice_con/nice_power_text:txt",
"layout/nice_con:obj",
"layout/nice_con/nice_designation_con/nice_designation_effect:obj",
"layout/nice_con/nice_designation_con/nice_designation_image:img:obj",
"layout/nice_con/nice_designation_con/nice_designation_raw:raw:obj",
"layout/nice_con/nice_bg:raw:obj",
"layout/nice_con/nice_headCon:obj",
"layout/nice_con/nice_figureBubbleCon:obj:img",
"layout/nice_con/nice_figureBubbleCon_desc:obj:tmp",
"layout/nice_con/nice_figureHeadCon:obj:img",
"layout/nice_con/wardrobe_text:tmp",
--幻光模型
"layout/base_con/daily_skill_con/daily_skill_bg:raw",
"layout/base_con/daily_skill_con:obj",
"layout/base_con/daily_skill_con/daily_skill_level:tmp",
"layout/base_con/daily_skill_con/daily_skill_desc:tmp",
"layout/base_con/daily_skill_con/daily_skill_name:tmp",
"layout/base_con/daily_skill_con/daily_skill_icon:img",
"layout/nice_con/daily_switch_btn:obj",
}
self:GetChildren(nodes)
self.btns_list = {self.shiyongBtn, self.hechengBtn, self.chushouBtn,
self.yulanBtn, self.storeBtn, self.takeBtn, self.splitBtn,
self.shelvesUpBtn, self.shelvesDownBtn,
self.oneKeyBuyBtn, self.decomposeBtn, self.replaceBtn,
self.dropBtn,self.marketBuyBtn, self.marketActionBtn,
self.capsuleEggTakeBtn, self.tmBatchUseBtn, self.normalDecomposeBtn}
lua_resM:setOutsideImageSprite(self,self.bg_img,GameResPath.GetViewBigBg("goods_tool_tip_bg"),false)
lua_resM:setOutsideImageSprite(self,self.get_way_bg_img,GameResPath.GetViewBigBg("goods_tool_tip_bg"),false)
self.icon_item = AwardItem.New(self.icon_con, false, self.layer_name)
self.icon_item:SetItemSize(62,62)
self.icon_item:ChangeCountVisible(false)
self:InitEvent()
end
function GoodsTooltips:InitEvent()
local function onClickBtnHandler(target)
if target == self.get_way_btn then
self.show_get_way = not self.show_get_way
self.getWayConObj:SetActive(self.show_get_way)
self:ShowShopItem()
return
elseif (self.goods_vo and (self.is_show_btn or CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn() or self:ForeceTriggerEvt())) then
if target == self.shiyongBtn then
local callback = function(case)
if case == GoodsController.TryToUseGoodsResult.Case1 or GoodsController.TryToUseGoodsResult.Case2 then
self:Close()
end
end
GoodsModel:getInstance():Fire(GoodsModel.TRY_TO_USE_GOODS, self.goods_vo, callback)
elseif target == self.hechengBtn then
self:JumpComposeFunc()
elseif target == self.chushouBtn then
GlobalEventSystem:Fire(EventName.OPEN_SEll_VIEW, self.goods_vo)
elseif target == self.storeBtn then
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15003, self.goods_vo.goods_id, GoodsModel.GOODS_POS_TYPE.bag, GoodsModel.GOODS_POS_TYPE.warehouse)
elseif target == self.takeBtn then
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15003, self.goods_vo.goods_id, GoodsModel.GOODS_POS_TYPE.warehouse, GoodsModel.GOODS_POS_TYPE.bag)
elseif target == self.splitBtn then
BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.SPLIT)
elseif target == self.yulanBtn then
if self.goods_vo.type == GoodsModel.TYPE.FASHION then --时装
GlobalEventSystem:Fire(EventName.OPEN_FASHION_VIEW, self.goods_vo.subtype, self.goods_vo.type_id)
elseif self.goods_vo.type == 32 or self.goods_vo.type == 34 then --礼包
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15087,self.goods_vo.type_id)
end
elseif target == self.shelvesUpBtn then
if not GetModuleIsOpen(155) then
Message.show(string.format("%d级开启市场", GetModuleOpenLevel(155)))
else
GlobalEventSystem:Fire(EventName.OPEN_MARKET_VIEW, MarketConst.TabId.SalesHall, nil, self.goods_vo)
end
elseif target == self.shelvesDownBtn then
MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15508,self.goods_vo.id)
elseif target == self.oneKeyBuyBtn then
elseif target == self.decomposeBtn then
BagModel:getInstance():Fire(BagModel.OPEN_EQUIP_DECOMPOSE_VIEW, self.goods_vo)
elseif target == self.dropBtn then
if self.goods_vo.goods_num == 1 then
local function ok()
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT,15051, 0 , {[1] ={ goods_id = self.goods_vo.goods_id, type_id = self.goods_vo.type_id, num = self.goods_vo.goods_num} })
end
Alert.show("是否丢弃 <color=" .. ColorUtil.RED_DARK .. ">" .. self.goods_vo.goods_name .. "</color> ?", Alert.Type.Two,ok)
else
BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.BAT_DROP)
end
elseif target == self.replaceBtn then
if self.goods_vo then
local has_vo, main, sub = HorseModel:getInstance():CheckVoIsOnMaterialTab(self.goods_vo)
if has_vo then
local typ = (self.parm_list and self.parm_list.material_type and self.parm_list.material_type ~= 0) and self.parm_list.material_type or main
local pos = (self.parm_list and self.parm_list.material_pos and self.parm_list.material_pos ~= 0) and self.parm_list.material_pos or sub
HorseModel:getInstance():Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, typ, true, pos)
self:Close()
return
end
end
elseif target == self.market_buy_btn_obj then
MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.ONE_PRICE_TYPE)
elseif target == self.market_auction_btn_obj then
MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.AUCTION_PRICE_TYPE)
elseif target == self.guild_btn_obj then--上架到社团
if self.up_market_range == 1 then
Message.show("该商品只能上架到世界拍卖哦~")
self.no_close = true
else
local data = self.goods_vo
local is_to_world = self.market_toggle_tog.isOn and 1 or 0
MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15506,data.goods_id,data.type_id, self.market_count,MarketModel.AUCTION_GUILD_TYPE, is_to_world)
end
elseif target == self.world_btn_obj then--上架到世界
if self.up_market_range == 2 then
Message.show("该商品只能上架到社团拍卖哦~")
self.no_close = true
else
local data = self.goods_vo
MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15506,data.goods_id,data.type_id, self.market_count,MarketModel.AUCTION_WORLD_TYPE, 1)
end
elseif target == self.marketBuyBtn then
MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.ONE_PRICE_TYPE)
elseif target == self.marketActionBtn then
MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.AUCTION_PRICE_TYPE)
elseif target == self.capsuleEggTakeBtn then --龙神宝库临时仓库取出按钮
local now_warehouse_selected_goods_id = CapsuleEggModel:getInstance():GetWarehouseNowSelectedGoodsId()
CapsuleEggModel:getInstance():Fire(CapsuleEggConst.REQUEST_CCMD_EVENT,17008,now_warehouse_selected_goods_id)
CapsuleEggModel:getInstance():ResetWarehouseNowSelectedGoodsId()
elseif target == self.tmBatchUseBtn then -- 藏宝图批量使用
GlobalEventSystem:Fire(EventName.OPEN_TREASUREMAP_BATCH_USE_VIEW, true)
elseif target == self.daily_switch_btn_obj then -- 幻光模型切换状态
elseif target == self.normalDecomposeBtn then --批量分解按钮
if self.goods_vo.goods_num == 1 then
local function ok()
local decompose_goods_list = {}
decompose_goods_list[1] = {
goods_id = self.goods_vo.goods_id,
type_id = self.goods_vo.type_id,
goods_num = 1,
}
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT,15019,decompose_goods_list)
end
local goods_name = GoodsModel:getInstance():getGoodsName(self.goods_vo.type_id,true)
Alert.show("是否分解 <color=" .. ColorUtil.RED_DARK .. ">" .. goods_name .. "</color> ?", Alert.Type.Two,ok)
else
BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.BAT_DECOMPOSE)
end
end
if self.no_close then--不要点了就关
self.no_close = false
else
self:Close()
end
end
end
AddClickEvent(self.shiyongBtn, onClickBtnHandler)
AddClickEvent(self.hechengBtn, onClickBtnHandler)
AddClickEvent(self.chushouBtn, onClickBtnHandler)
AddClickEvent(self.storeBtn, onClickBtnHandler)
AddClickEvent(self.takeBtn, onClickBtnHandler)
AddClickEvent(self.splitBtn, onClickBtnHandler)
AddClickEvent(self.yulanBtn, onClickBtnHandler)
AddClickEvent(self.shelvesUpBtn, onClickBtnHandler)
AddClickEvent(self.shelvesDownBtn, onClickBtnHandler)
AddClickEvent(self.oneKeyBuyBtn, onClickBtnHandler)
AddClickEvent(self.decomposeBtn, onClickBtnHandler)
AddClickEvent(self.replaceBtn, onClickBtnHandler)
AddClickEvent(self.dropBtn, onClickBtnHandler)
-- AddClickEvent(self.world_btn_obj, onClickBtnHandler)
-- AddClickEvent(self.guild_btn_obj, onClickBtnHandler)
AddClickEvent(self.marketBuyBtn, onClickBtnHandler)
AddClickEvent(self.marketActionBtn, onClickBtnHandler)
AddClickEvent(self.capsuleEggTakeBtn,onClickBtnHandler)
AddClickEvent(self.tmBatchUseBtn,onClickBtnHandler)
AddClickEvent(self.get_way_btn,onClickBtnHandler)
AddClickEvent(self.normalDecomposeBtn,onClickBtnHandler)
AddClickEvent(self.daily_switch_btn_obj,onClickBtnHandler)
local function update_func()
self:SetData()
end
self.update_event = GlobalEventSystem:Bind(EventName.UPDATE_GOODS_TIPS, update_func)
self.event_odc = GlobalEventSystem:Bind(EventName.ORIENTATION_DID_CHANGE, function ()
self:AdjustLayoutPos()
end)
local function on_close( )
self:Close()
end
self:BindEvent(self.shop_model,ShopModel.CLOSE_SHOP_BUY_VIEW, on_close)
self:BindEvent(self.market_model,MarketModel.CLOSE_MARKET_UP_SHELVES_VIEW, on_close)
local onUpdate = function (id)
if id == KfActivityModel.TabID.LimitShop then
if self.show_left_extra_view then
self:UpdateLimitShop()
end
end
end
self:BindEvent(KfActivityModel:getInstance(), KfActivityModel.ANS_UPDATE_VIEW, onUpdate)
end
function GoodsTooltips:GetEnlargNum(num)
local info = GoodsModel:getInstance().slot_info_pos_2
local slot_num = info.slot_num or 0 --开放格子
local def_num = info.def_cell or 0 --默认开放格子数
local all_slot = info.all_slot or 0 --总共格子
local left_num = all_slot - slot_num
local isOpenedNum = slot_num - def_num + 1
local isOpenNum = isOpenedNum
local own_num = num
while(own_num > 0) do
own_num = own_num - self:GetEnlargeCost(isOpenNum)
if own_num >= 0 then
isOpenNum = isOpenNum + 1
end
if isOpenNum > left_num then
break
end
end
isOpenNum = isOpenNum - isOpenedNum
return isOpenNum
end
function GoodsTooltips:GetEnlargeCost(open_index)
local num = 0
for k, v in pairs(Config.Expandbagcosts) do
if GoodsModel.GOODS_POS_TYPE.bag == v.bag_type and v.min_cell <= open_index and v.max_cell >= open_index then
local list = ErlangParser:GetInstance():Parse(v.cost_goods_list)
if list then
num = list[1][3]
break
end
end
end
return num
end
--合成按钮跳转
function GoodsTooltips:JumpComposeFunc()
ComposeModel.Instance:TryComposeJump(self.goods_vo.type_id)
end
--goods_vo通过这个vo来判断是否是背包中存在的物品,
-- parm_list 有什么其他参数 可以添加进这个table中 自己定义想要的字段
--not_show_getway 获得途径的按钮以及内容是否显示
--open_show_get_way 有些需求需要开界面就显示获得途径
--force_open_show_get_way 强制必须打开获取途径界面
function GoodsTooltips:Open(type_id, x, y, goods_vo, show_btn_list, parm_list, not_show_getway,open_show_get_way,force_open_show_get_way)
print('---- GoodsTooltips.lua 659-- type_id=',type_id)
self.type_id = type_id
self.is_show_btn = goods_vo ~= nil
self.show_btn_list = show_btn_list
self.parm_list = parm_list
self.not_show_getway = not_show_getway
self.open_show_get_way = open_show_get_way
self.force_open_show_get_way = force_open_show_get_way
self.shop_data = parm_list and parm_list.shop_data or nil
self.market_data = parm_list and parm_list.market_data or nil
self.show_limit_shop = parm_list and parm_list.show_limit_shop or nil
self.foster_recharge_show = parm_list and parm_list.foster_recharge_show or nil
self.goods_vo = goods_vo or GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
self.pos_x = x
self.pos_y = y
BaseView.Open(self)
end
function GoodsTooltips:SetData()
if self.goods_vo == nil then return end
self.layout.gameObject:SetActive(true)
if self.shop_data and self.shop_data.is_empower_shop then
self.icon_item:ChangeCountVisible(true)
self.icon_item:SetData(self.goods_vo.type_id, self.shop_data.num)
else
self.icon_item:ChangeCountVisible(false)
self.icon_item:SetData(self.goods_vo.type_id)
end
--双属性宝石
if self.goods_vo.type == 14 and (self.goods_vo.subtype == 9 or self.goods_vo.subtype == 10) then
self.icon_item:SetDataDoubleStone(self.goods_vo.goods_id)
end
local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.goods_vo.type_id)
self.basic = basic
local goods_name = self.basic.goods_name
print(">>物品信息 name =", basic.goods_name, " goods_id=", self.goods_vo.goods_id, " type_id=", self.goods_vo.type_id, " type=", basic.type," subtype=", basic.subtype)
if self.goods_vo.type == 11 then
if self.goods_vo.subtype == 11 then --装备鉴定物碎片
local type_id, name, icon = EquipModel:getInstance():GetIdentifyGoodsNameAndIcon(self.goods_vo.type_id, self.mainVo.career, self.goods_vo.color)
goods_name = name
end
end
self.is_facion_goods = self.model:IsShowFashionTypeGoodsTip(self.basic)
self:UpdateFactionCon()
if self.goods_vo.type == 51 then
if ClientConfig.vip_gift_data then
local table = StrToTable(ClientConfig.vip_gift_data)
if table then
for _,v in pairs(table) do
if tonumber(v.goods_id) == self.goods_vo.type_id then
goods_name = v.goods_name
break
end
end
end
end
end
self.countText.text = "类型:" .. HtmlColorTxt( WordManager:GetGoodsTypeStr(self.basic.type, self.basic.subtype) , "#ffffff")
self.levelText.text = "等级:".. (basic.level == 0 and "不限" or basic.level)
self.nameText.text = Language.substitute("<color={0}>{1}</color>", WordManager.GetGoodsColor(self.goods_vo.color or basic.color), Trim(goods_name))
self:UpdateLimitTime()
self:UpdateConvertTime()--运营活动道具过期自动转化
self.attrCon_obj:SetActive(false)
self.getwayUrlText.text = basic.getway
for i,v in ipairs(self.get_way_item_list) do
v:SetVisible(false)
end
if self.show_limit_shop then
self:UpdateLimitShop()
end
if self.market_data then
self.market_con_obj:SetActive(true)
-- self.btn_con_obj:SetActive(false)
self:UpdateMarketView()
else
self.market_con_obj:SetActive(false)
end
if self.foster_recharge_show then
self:UpdateFosterRechargeShow()
end
local function callback()
--某些界面跳转时要关掉界面,比如改名界面
GlobalEventSystem:Fire(EventName.OPEN_RENAME_VIEW,false,true) --强制关闭改名界面
NewMainRoleModel:getInstance():Fire(NewMainRoleModel.OPEN_HATRED_VIEW,true) --强制关闭罪恶值界面
FosterModel:GetInstance():Fire(FosterConst.CloseSkillTips) --强制关闭进阶技能培养界面
GlobalEventSystem:Fire(EventName.CLICK_GET_WAY_ITEM)--加个通用的的
self:Close()
end
-------------------------
self.show_get_way = self.open_show_get_way and true or false
self.getWayConObj:SetActive(self.show_get_way)
if self.parm_list and self.parm_list.not_show_goods then
self.base_con_obj:SetActive(false)
self.getWayConObj:SetActive(true)
end
-------------------------
-- basic.getway_url = [[ [{153,1},{153,3},{157,0}] ]]
if self.open_show_get_way or (basic.getway_url and Trim(basic.getway_url) ~= "[]" and not self.not_show_getway or (self.parm_list and self.parm_list.get_way)) then
self.get_way_btn:SetActive(true)
local getway = {}
if self.parm_list and self.parm_list.get_way then
getway = self.parm_list.get_way
else
getway = ErlangParser:GetInstance():Parse( basic.getway_url)
end
for i,v in ipairs(getway) do
local item = self.get_way_item_list[i]
if not item then
item = GetGoodsItem.New(self.getWayCon)
self.get_way_item_list[i] = item
item:SetPosition(0, -91 * (i - 1))
end
item:SetVisible(true)
item:SetData(v, basic.type_id, callback)
end
SetSizeDeltaY(self.getWayCon, #getway * 100)
if #getway == 0 then
self.getWayConObj:SetActive(false)
self.get_way_btn:SetActive(false)
self.show_get_way = false
--如果只有1个,并且显示为 [{}] 说明是显示 运营活动 就默认不展开了
elseif #getway == 1 and Trim(basic.getway_url) == "[{}]" and not self.force_open_show_get_way then
self.getWayConObj:SetActive(false)
self.show_get_way = false
end
else
self.get_way_btn:SetActive(false)
self.getWayConObj:SetActive(false)
end
-------------------------
if self.shop_data then
self:ShowShopItem()--用到了self.show_get_way 参数,代码位置请不要随意移动
self:UpdateShopView()
else
self.shop_con_obj:SetActive(false)
end
for i, v in pairs(self.btns_list) do
v:SetActive(false)
end
local btns_list = {}
if self.model:IsShowPreviewBtn(self.type_id) then
table.insert(btns_list, self.yulanBtn)
self.yulanBtn:SetActive(true)
else
self.yulanBtn:SetActive(false)
end
if self.is_show_btn then
if self.basic and self.basic.drop == 1 then
table.insert(btns_list, self.dropBtn)
end
if self.basic.jump > 0 then--and self.mainVo.level >= self.basic.level then
table.insert(btns_list, self.jumpBtn)
end
if self.basic.compose > 0 then
table.insert(btns_list, self.hechengBtn)
end
if self.goods_vo.goods_num > 1 then
table.insert(btns_list, self.splitBtn)
end
if self.basic.sell > 0 then
table.insert(btns_list, self.chushouBtn)
end
if MarketModel:GetInstance():IsGoodsCanUpShelves(self.goods_vo) then--在背包中的 如果可以上架要显示上架按钮
table.insert(btns_list, self.shelvesUpBtn)
end
if (self.basic.use > 0 or Trim(self.basic.use_way) ~= "") and self.mainVo.level >= self.basic.level then
local limit_state = BagModel:getInstance():GetGoodsLimitState(self.goods_vo)--过期了就不要有使用按钮了
if limit_state ~= BagModel.GoodsLimitState.TimeOut then
table.insert(btns_list, self.shiyongBtn)
end
end
if self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.clothing_factory_bag then
table.insert(btns_list, self.normalDecomposeBtn)
end
end
local hide_yulan_btn = false
if GoodsModel:getInstance().show_warehouse == true and self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.bag then
hide_yulan_btn = true
btns_list = {self.storeBtn}
-- table.insert(btns_list,self.storeBtn)
elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.warehouse then
hide_yulan_btn = true
btns_list = {self.takeBtn}
elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.hunt_store then
hide_yulan_btn = true
btns_list = {self.takeBtn}
-- elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.clothing_factory_bag then
-- hide_yulan_btn = true
-- btns_list = {self.normalDecomposeBtn}
end
if hide_yulan_btn then
self.yulanBtn:SetActive(false)
end
if CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn() then--龙神宝库扭蛋临时仓库显示取出按钮
btns_list = {self.capsuleEggTakeBtn}
end
if self.goods_vo.type_id == TreasureMapConst.GoodId[1] then -- 普通藏宝图批量使用按钮
if TreasureMapModel:getInstance():CanBatchUseNormalTreasureMap() then
table.insert(btns_list, self.tmBatchUseBtn)
end
end
--自定义显示的按钮
local force_show_btn_con = false
if self.show_btn_list then
btns_list, force_show_btn_con = self:ShowCustomBtns()
end
local btns_len = #btns_list
self.btns_con.gameObject:SetActive((btns_len>0 or force_show_btn_con) and not self.market_data and not self.shop_data)
local local_index = 0
local local_offset_h = 41
for k, v in ipairs(btns_list) do
local b = self.is_show_btn
or CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn()--龙神宝库仓库需要显示按钮
v:SetActive(b)
if b then
print(v)
SetAnchoredPosition(v.transform, 2, local_index * local_offset_h - 406)
local_index = local_index + 1
end
end
if not hide_yulan_btn then
if self.goods_vo.type == 32 or self.goods_vo.type == 34 then
self.yulanBtn:SetActive(true)
end
end
self:SetTextData()
self:AdjustLayoutPos()
end
function GoodsTooltips:AdjustLayoutPos()
-- if self.pos_x and self.pos_y then
--自定义显示的按钮
-- local buy_pos_x, buy_pos_y = 0, 0
-- if self.show_btn_list then
-- -- btns_list = self:ShowCustomBtns()
-- if TableContains(self.show_btn_list, "buyCon") then
-- buy_pos_x = 100
-- buy_pos_y = 100
-- end
-- end
-- local layout_width = self.bg.sizeDelta.x + self.btns_con.sizeDelta.x
-- local layout_height = self.bg.sizeDelta.y
-- local x, y = ScreenToViewportPoint(self.pos_x, self.pos_y)
-- local iphone_x_offset = math.max(ClientConfig.iphone_x_offset_left, ClientConfig.iphone_x_offset_right)
-- if x + layout_width + 50 + iphone_x_offset * 2 > SrcScreenWidth then
-- x = SrcScreenWidth - layout_width - 90 - iphone_x_offset * 2
-- end
-- if y < layout_height + 50 then
-- y = layout_height + 50
-- end
-- self.layout.anchoredPosition = Vector2(x, y)
-- end
end
function GoodsTooltips:ShowCustomBtns()
local temp_list = {}
local force_show_btn_con = false
for _, v in pairs(self.btns_list) do
v:SetActive(false)
end
for _, v in pairs(self.show_btn_list) do
if self[v] then
table.insert(temp_list, self[v])
end
end
return temp_list,force_show_btn_con
end
function GoodsTooltips:ChangeBuyNum(num)
self.buyNum = num
end
-- 一些特殊物品需要请求动态信息
function GoodsTooltips:IsNeedDynamic()
if not self.is_show_btn then return false end
return self.type_id == 1011000006
end
function GoodsTooltips:ForeceTriggerEvt()
if not self.goods_vo then
return false
end
if self.goods_vo.type == 32 or self.goods_vo.type == 34 then
return true
end
end
-- 属性信息
function GoodsTooltips:SetTextData()
if not self.text_item_list[1] then
self.text_item_list[1] = GoodsTooltipsTextItem.New(self.content_con)
self.text_item_list[1]:SetColor("F3FCFF" )
end
if not self.text_item_list[2] then
self.text_item_list[2] = GoodsTooltipsTextItem.New(self.content_con)
self.text_item_list[2]:SetColor("9EB3CF")
end
local is_paid_gift = self.model:IsPaidGift(self.type_id)
local goods_list = nil
local intro = ChuanWenManager:getInstance():FormatColorTag(Trim(self.basic.intro))
local attr_intor = ChuanWenManager:getInstance():FormatColorTag(Trim(self.basic.attr_intor))
local str = intro
if is_paid_gift then
local reward_list = GiftModel:getInstance():getRewardConfig(self.type_id)
goods_list = reward_list.fixed_list
for i,v in ipairs(goods_list) do
local goods_name = GoodsModel:getInstance():getGoodsName(v.goods_id, true)
str = str.."\n"..goods_name.." x"..v.goods_count
end
end
self.text_item_list[1]:SetData("基础信息", str, goods_list, is_paid_gift)
self.text_item_list[2]:SetData("物品说明", attr_intor,nil, is_paid_gift)
end
function GoodsTooltips:UpdateMarketView( )
if not self.market_view then
self.market_view = MarketUpShelvesView.New(self.market_con)
end
self.market_view:SetData(self.market_data)
self.market_view:SetPosition(2,-69)
end
function GoodsTooltips:UpdateShopView( )
if not self.shop_view then
self.shop_view = ShopBuySubView.New(self.shop_con,nil,self.layer_name)
end
self.shop_view:SetData(self.shop_data)
self.shop_view:SetPosition(2,-69)
end
function GoodsTooltips:Remove()
if self.icon_item then
self.icon_item:DeleteMe()
self.icon_item = nil
end
if self.addNumComponent then
if self.change_count_id then
self.addNumComponent:UnBind(self.change_count_id)
self.change_count_id = nil
end
self.addNumComponent:DeleteMe()
self.addNumComponent = nil
end
for i, v in pairs(self.get_way_item_list) do
v:DeleteMe()
v = nil
end
self.get_way_item_list = {}
if self.update_event then
GlobalEventSystem:UnBind(self.update_event)
self.update_event = nil
end
if self.event_odc then
GlobalEventSystem:UnBind(self.event_odc)
self.event_odc = nil
end
if #self.attr_item_list > 0 then
for k, v in pairs(self.attr_item_list) do
v:DeleteMe()
v = nil
end
self.attr_item_list = {}
end
if #self.text_item_list > 0 then
for k, v in pairs(self.text_item_list) do
v:DeleteMe()
v = nil
end
self.text_item_list = {}
end
if self.change_jin_id then
self.mainVo:UnBind(self.change_jin_id)
self.change_jin_id = nil
end
if self.change_lockJin_id then
self.mainVo:UnBind(self.change_lockJin_id)
self.change_lockJin_id = nil
end
if self.change_silver_id then
self.mainVo:UnBind(self.change_silver_id)
self.change_silver_id = nil
end
if self.score_change_event_id then
GoodsModel:getInstance():UnBind(self.score_change_event_id)
self.score_change_event_id = nil
end
if self.market_view then
self.market_view:DeleteMe()
self.market_view = nil
end
if self.shop_view then
self.shop_view:DeleteMe()
self.shop_view = nil
end
lua_resM:clearRoleMode(self)
self:StopLimitTimer()
if self.sound_id then
lua_soundM:StopEffect(self, LuaSoundManager.SOUND_TYPE.GUIDE, self.sound_id)
self.sound_id = nil
end
end
function GoodsTooltips:UpdateLimitTime()
self:StopLimitTimer()
self.getwayUrlText_obj:SetActive(true)
if (not self.goods_vo.expire_time or self.goods_vo.expire_time == 0) and (not self.parm_list or not self.parm_list.expire_time) and (not self.parm_list or not self.parm_list.force_show_limit) then
self.overdueText.text = ""
self.overdue:SetActive(false)
self.icon_item:ShowLimitIcon(false)
self.overdue_bg_obj:SetActive(false)
self.getwayUrlText_obj:SetActive(true)
else
--强制显示限时状态
if self.parm_list and self.parm_list.force_show_limit then
self.icon_item:ShowLimitIcon(true,1)
self.overdue_bg_obj:SetActive(true)
self.getwayUrlText_obj:SetActive(false)
lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">物品会在一段时间后过期</color>")
return
end
--没有获得的道具,特殊处理
if (self.goods_vo.goods_id == 0 or self.goods_vo.goods_id == nil) and not (self.parm_list and self.parm_list.expire_time) then
self.icon_item:ShowLimitIcon(true,1)
self.overdue_bg_obj:SetActive(true)
self.getwayUrlText_obj:SetActive(false)
if self.basic.expire_type == 1 or self.basic.expire_type == 5 then
local time = self.basic.expire_time
lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">领取后 ".. TimeUtil:timeConvert15(time) .. " 后过期</color>")
else
local time = 0
--开服多少天后过期
if self.basic.expire_type == 3 then
time = ServerTimeModel:getInstance():GetOpenServerTime() + 3600 *24 * self.basic.expire_time
--合服多少天数后过期
elseif self.basic.expire_type == 4 then
time = ServerTimeModel:getInstance():GetMergeServerTime() + 3600 *24 * self.basic.expire_time
--特定时间到期
-- self.basic.expire_type == 2
else
time = self.basic.expire_time
end
lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_2", true)
if time == 0 then
self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">已过期</color>")
else
self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">"..TimeUtil:timeConversion(time, "yyyy年mm月dd日 hh") .. " 过期</color>")
end
end
return
end
local expire_time = (self.parm_list and self.parm_list.expire_time) or (self.goods_vo and self.goods_vo.expire_time)
if expire_time then
local function timer_func()
self.overdue_bg_obj:SetActive(true)
self.getwayUrlText_obj:SetActive(false)
SetAnchoredPositionX( self.overdue_bg.transform, -28)
if self.basic.expire_type == 1 or self.basic.expire_type == 5 or (self.parm_list and self.parm_list.expire_type == "expire_type") then
local time = expire_time - TimeUtil:getServerTime()
if time <= 0 then
self.icon_item:ShowLimitIcon(true,2)
self.overdue_bg_obj:SetActive(false)
self.getwayUrlText_obj:SetActive(true)
self.overdueText.text = ""
self:StopLimitTimer()
GlobalEventSystem:Fire(EventName.UPDATE_BAG_TIMEOUT_GOODS, self.goods_vo.goods_id)
else
self.icon_item:ShowLimitIcon(true,1)
SetSizeDeltaY(self.content_scrollview, 254)
lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
if self.basic.expire_type == 1 then
self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">".. TimeUtil:timeConvert15(time) .. " 后过期</color>")
else
self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">".. TimeUtil:timeConvert15(time) .. " 过期</color>")
end
end
else
if TimeUtil:getServerTime() > expire_time then
self.icon_item:ShowLimitIcon(true,2)
self.overdue_bg_obj:SetActive(false)
self.getwayUrlText_obj:SetActive(true)
self.overdueText.text = ""
self:StopLimitTimer()
GlobalEventSystem:Fire(EventName.UPDATE_BAG_TIMEOUT_GOODS, self.goods_vo.goods_id)
else
lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_2", true)
self.icon_item:ShowLimitIcon(true,1)
SetSizeDeltaY(self.content_scrollview, 254)
self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">"..TimeUtil:timeConversion(expire_time, "yyyy年mm月dd日 hh") .. " 过期</color>")
end
end
end
if not self.limit_timer then
self.limit_timer = GlobalTimerQuest:AddPeriodQuest(timer_func, 1)
end
timer_func()
else
self.icon_item:ShowLimitIcon(false)
self.overdue:SetActive(false)
self.overdue_bg_obj:SetActive(false)
self.getwayUrlText_obj:SetActive(true)
self.overdueText.text = ""
end
end
end
--运营活动道具过期自动转化时间戳
function GoodsTooltips:UpdateConvertTime( )
if self.goods_vo.convert_time and self.goods_vo.convert_time ~= 0 then--没有转化时间
self.conversionTimeText.text = string.format("该物品将在以下期限后自动转化\n<size=16><%s>%s</color></size>",ColorUtil.GREEN_TIPS,TimeUtil:timeConversion(self.goods_vo.convert_time, "yyyy年mm月dd日 hh-MM"))
else
self.conversionTimeText.text = ""
end
end
function GoodsTooltips:StopLimitTimer()
if self.limit_timer then
GlobalTimerQuest:CancelQuest(self.limit_timer)
self.limit_timer = nil
end
end
function GoodsTooltips:SetLimitText(text)
self.overdueText.text = text
local width = self.overdueText.preferredWidth
SetAnchoredPositionX(self.overdue_bg.transform, -width/2 - 20)
end
--更新外观显示类部分
function GoodsTooltips:UpdateFactionCon()
self.power_show_num = false
local show_model_cfg = self.model:IsShowModelGoods(self.type_id)
if self.is_facion_goods or show_model_cfg then
self.attr_list = {}
self.nice_bg_obj:SetActive(true)
self.nice_con_obj:SetActive(true)
local basic = self.basic
self.nice_designation_con_obj:SetActive(false)
self.nice_roleCon_obj:SetActive(false)
self.nice_childCon_obj:SetActive(false)
self.nice_headCon_obj:SetActive(false)
self.nice_figureBubbleCon_obj:SetActive(false)
self.nice_figureBubbleCon_desc_obj:SetActive(false)
self.nice_figureHeadCon_obj:SetActive(false)
self.nice_designation_raw_obj:SetActive(false)
self.daily_skill_con_obj:SetActive(false)
self.daily_switch_btn_obj:SetActive(false)
lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("goods_tool_tip_fashion_bg"))
local show_type = show_model_cfg and show_model_cfg.show_type or basic.type
print('Cat:GoodsTooltips.lua[873] basic.type', show_type)
local wardrobe_value = WardrobeModel:getInstance():GetWardrobeAppearanceValue(show_type, basic.subtype, basic.color)
if not wardrobe_value or wardrobe_value == 0 then
self.wardrobe_text_tmp.text = ""
else
self.wardrobe_text_tmp.text = string.format("风采值:%s", HtmlColorTxt(wardrobe_value, "#fafaf6"))
end
if self.dynamic_image_obj then
self.dynamic_image_obj:SetActive(false)
end
if show_type == GoodsModel.TYPE.DESIGNATION then
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
local cfg = Config.Dsgt
local designation_id = DesignationModel:GetInstance():GetDesignationIdByGoodsId(self.type_id)
self.attr_list = stringtotable(cfg[designation_id].attr_list)
self.nice_designation_image_obj:SetActive(false)
self.nice_designation_effect_obj:SetActive(false)
self.nice_name_text_tmp.text = ""
cc.ActionManager:getInstance():removeAllActionsFromTarget(self.nice_designation_image)
if cfg[designation_id].type == 1 then--文字称号(文字称号也用图片了)
self.nice_designation_image_obj:SetActive(true)
local function callback( )
SetLocalScale(self.nice_designation_image, 1.5, 1.5, 1.5)
end
lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetDesignImage(cfg[designation_id].id), true,callback)
self.nice_designation_text_tmp.text = ""
elseif cfg[designation_id].type == 2 then--图片称号
self.nice_designation_image_obj:SetActive(true)
local function callback( )
SetLocalScale(self.nice_designation_image, 1.5, 1.5, 1.5)
end
lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetDesignImage(cfg[designation_id].id), true,callback)
self.nice_designation_text_tmp.text = ""
elseif cfg[designation_id].type == 3 then--特效称号
if not self.dynamic_image_obj then
self.dynamic_image_obj = UiFactory.createChild(self.nice_designation_image, UIType.Image, "dynamic_image")
self.dynamic_image_img = self.dynamic_image_obj:GetComponent("Image")
self.dynamic_image = self.dynamic_image_obj.transform
SetAnchoredPosition(self.dynamic_image,0,0)
else
self.dynamic_image_obj:SetActive(true)
end
self.nice_designation_image_obj:SetActive(true)
local data = DesignationModel:GetInstance():GetDynamicDesignationCFG(designation_id)
local res = Split(data[1].res,"_")--分割出来配置 然后取文字
local font_res = res[1] or ""
lua_resM:setImageSprite(self, self.dynamic_image_img, data[1].ab, font_res.."_font", true)
self.nice_designation_text_tmp.text = ""
self.nice_designation_image_obj:SetActive(true)
local action = cc.Animation.New(data,0.15)
cc.ActionManager:getInstance():addAction(cc.RepeatForever.New(action),self.nice_designation_image.transform)
end
self.nice_designation_con_obj:SetActive(true)
elseif show_type == GoodsModel.TYPE.CHILDTOY then
local child_type = ChildConst.GOODS_TPYE
if basic.subtype == child_type.TOY then -- 玩具 显示原画
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,
-- GameResPath.GetViewBigBg("designation_tip_bg"))
self.nice_designation_con_obj:SetActive(true)
self.nice_designation_image_obj:SetActive(true)
local cfg = Config.Childtoynew[basic.type_id]
if cfg then
self.attr_list = stringtotable(cfg.attr_list)
end
lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetChildHandbookIcon(basic.type_id), true)
elseif basic.subtype == child_type.DRESS then -- 时装 显示模型
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
self.nice_childCon_obj:SetActive(true)
local chat_model = ChildModel:getInstance()
local fashion_id = chat_model:GetFashionIdByGoodsId(self.type_id)
local show_figure_id = chat_model:GetFashionModelID(fashion_id)
local res_data = {
father_node = self,
transform = self.nice_childCon,
fashion_type = FuncOpenModel.TypeId.Child,
figure_id = show_figure_id,
ui_model_type = UIModelCommon.ModelType.Model,
action_name_list = action_name_list,
position = Vector3(0, -15, 0),
}
FuncOpenModel:getInstance():SetModelRes(res_data)
-- 显示1级的战力
local cfg = Config.Childfashion[fashion_id .. "@1"]
if cfg then
self.attr_list = stringtotable(cfg.attr_list)
end
elseif basic.subtype == child_type.VEHICLE then -- 载具 显示模型
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
self.nice_childCon_obj:SetActive(true)
local child_model = ChildModel:getInstance()
local vehicle_id = child_model:GetVehicleIdByGoodsId(self.type_id)
local can_on_age = Config.Childvehicle[vehicle_id .. "@" .. 1].can_on_age
local cur_state = child_model:GetChildCurState()
local clothe_res_id = false
if can_on_age == ChildConst.BABY_STATE.YOUNG then
if cur_state < ChildConst.BABY_STATE.YOUNG then -- 还没会走路
clothe_res_id = child_model:GetBaseChildModelID( ChildConst.BABY_STATE.YOUNG,
child_model.childInfo.child_sex )
else -- 会走路就拿当前形象
clothe_res_id = child_model:GetChildCloth()
end
else -- 是爬或襁褓 则用默认形象
clothe_res_id = child_model:GetBaseChildModelID( can_on_age,
child_model.childInfo.child_sex or 1 )
end
local figure_id = child_model:GetVehicleModelID(vehicle_id)
local res_data = {
father_node = self,
transform = self.nice_childCon,
fashion_type = FuncOpenModel.TypeId.ChildInVehicle,
figure_id = figure_id,
ui_model_type = UIModelCommon.ModelType.Model,
action_name_list = {"idle"},
clothe_res_id = clothe_res_id,
position = {0,0,0}
}
FuncOpenModel:getInstance():SetModelRes(res_data)
-- 显示1级的战力
local cfg = Config.Childvehicle[vehicle_id .. "@1"]
if cfg then
self.attr_list = stringtotable(cfg.add_attr)
end
end
elseif show_type == GoodsModel.TYPE.FASHION or (show_type == GoodsModel.TYPE.FASHIONCHIP and basic.subtype == 1) then
--类型是FASHIONCHIP的话 需要额外判断子类型为1的才是时装 其他碎片不要配成子类型1
local fashion_id,color_id = FashionModel:getInstance():GetFashionIdByGoodsId(self.type_id)
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
local is_limit = FashionModel:GetInstance():IsFashionLimitTime(fashion_id,color_id)
self.nice_roleCon_obj:SetActive(true)
local cur_cfg = Config.Fashionstarup[fashion_id.."@"..color_id.."@0"]
if cur_cfg then
self.attr_list = stringtotable(cur_cfg.attr_list)
end
local career = RoleManager.Instance.mainRoleInfo.career
local fashion_type = FuncOpenModel.TypeId.Clothes
local figure_id = nil
if fashion_id then
if cur_cfg.pos_id == FashionModel.FashionType.HAT then--头饰
career = 0 --目前头饰 是通用的
figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
fashion_type = FuncOpenModel.TypeId.Hat
elseif cur_cfg.pos_id == FashionModel.FashionType.CLOTHES then--服饰
figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
if figure_id < 1000 then
figure_id = figure_id + career * 1000
end
if color_id > 1 then
figure_id = figure_id .. color_id
end
elseif cur_cfg.pos_id == FashionModel.FashionType.WING then--背饰
figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
fashion_type = FuncOpenModel.TypeId.wing
elseif cur_cfg.pos_id == FashionModel.FashionType.WEAPON then--武器
fashion_type = FuncOpenModel.TypeId.Weapon
figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
if figure_id < 1000 then
figure_id = figure_id + career * 1000
end
elseif cur_cfg.pos_id == FashionModel.FashionType.HEAD then--头发
fashion_type = FuncOpenModel.TypeId.Head
figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
if figure_id < 1000 then
figure_id = figure_id + career * 1000
end
if color_id > 1 then
figure_id = figure_id .. color_id
end
end
end
local res_data = {
father_node = self,
transform = self.nice_roleCon,
fashion_type = fashion_type,
layer_name = self.layer_name,
size = Vector2(720,720),
scale = 150,
figure_id = figure_id,
ui_model_type = UIModelCommon.ModelType.Model,
position = Vector3(0,0,0)
}
FuncOpenModel:getInstance():SetModelRes(res_data)
elseif show_type == GoodsModel.TYPE.ROLEHEAD then
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
self.nice_headCon_obj:SetActive(true)
self.head_item = self.head_item or self:CreateItem(HeadRoleItem, self.nice_headCon, self.layer_name)
self.head_item:SetCareerIconVisible(false)
self.head_item:SetItemSize(165,165)
local head_data = {
vo = {id=0,level=nil,sex=nil,turn=nil,do_not_click = true,use_bg = 3,
board = nil,picture_ver = nil,picture = nil,
profile_photo_id = self.type_id},
}
self.head_item:SetData(head_data)
-------------------------
local conf_head = NewMainRoleModel:getInstance():GetRoleHeadInfoByPhotoId(self.type_id)
if conf_head and conf_head.attr_list then
self.attr_list = stringtotable(conf_head.attr_list)
end
elseif show_type == GoodsModel.TYPE.CHATBUBBLE then -- 气泡
self.nice_figureBubbleCon_obj:SetActive(true)
self.nice_figureBubbleCon_desc_obj:SetActive(true)
Obj_img = self.nice_figureBubbleCon_img
for k,v in pairs(ChatDressModel:getInstance():GetChatDressFigure(ChatDressSubType.BUBBLE)) do
if v.dress_id == self.type_id then
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
-- self.nice_figureBubbleCon_desc_tmp.text = HtmlColorTxt(v.dress_desc, ColorUtil.BLUE_DARK)
-- self.nice_figureBubbleCon.sizeDelta = Vector2(self.nice_figureBubbleCon_desc_tmp.preferredWidth + 50, self.nice_figureBubbleCon_desc_tmp.preferredHeight + 30)
-- ---不同框的偏移
-- local addTable = Config.ConfigChatDress.Pos[tostring(self.type_id)]
-- SetSizeDeltaX(self.nice_figureBubbleCon, GetSizeDeltaX(self.nice_figureBubbleCon) + addTable.size_x )
-- SetSizeDeltaY(self.nice_figureBubbleCon, GetSizeDeltaY(self.nice_figureBubbleCon) + addTable.size_y )
self.nice_figureBubbleCon_desc_tmp.text = ""
SetSizeDelta(self.nice_figureBubbleCon, 200, 50)
lua_resM:setOutsideImageSprite(self, Obj_img, GameResPath.GetChatDressIcon(self.type_id), false)
self.attr_list = stringtotable(v.dress_attr)
break
end
end
elseif show_type == GoodsModel.TYPE.ROLEWINDOW then -- 头像框
self.nice_figureHeadCon_obj:SetActive(true)
--lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
-- 拿属性
for k,v in pairs(ChatDressModel:getInstance():GetChatDressFigure(ChatDressSubType.HEAD)) do
if v.dress_id == self.type_id then
self.attr_list = stringtotable(v.dress_attr)
break
end
end
lua_resM:setOutsideImageSprite(self, self.nice_figureHeadCon_img, GameResPath.GetChatDressIcon(self.type_id), false)
elseif show_type == GoodsModel.TYPE.GALAXY then -- 星辰
-- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
self.nice_designation_con_obj:SetActive(true)
local model_id = GalaxyModel:getInstance():GetGalaxySkinModelId(self.basic.type_id)
if model_id then
local data = {
clothe_res_id = model_id,
type = SceneBaseType.Galaxy,
layer_name = self.layer_name,
on_name_list = {"show"},
scale = 500,
position = Vector3(0,-50,-100),
}
lua_resM:SetRoleModel(self,self.nice_designation_raw,data)
self.nice_designation_raw_obj:SetActive(true)
else
self.nice_designation_raw_obj:SetActive(false)
end
elseif show_type == GoodsModel.TYPE.DailyLight then
--幻光
--lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
self.daily_skill_con_obj:SetActive(true)
local show_conf = false
if show_model_cfg then
show_conf = {type = show_model_cfg.model_type, model = show_model_cfg.model_id, power = show_model_cfg.power}
end
local scale = 2
local possition = Vector3(0, 0,0)
local res_data = {
father_node = self,
transform = self.nice_roleCon,
fashion_type = show_conf.type,
layer_name = self.layer_name,
size = Vector2(720,720),
scale = scale,
figure_id = show_conf.model,
ui_model_type = UIModelCommon.ModelType.Model,
position = possition,
}
local pos_x, pos_y, pos_z = GetLocalPosition(self.nice_roleCon)
SetLocalPosition(self.nice_roleCon, pos_x, pos_y,pos_z - 300)
self.nice_roleCon_obj:SetActive(true)
FuncOpenModel:getInstance():SetModelRes(res_data)
self.power_show_num = show_conf.power
self.wardrobe_text_tmp.text = ""
local daily_skill_cfg = Config.Visus[show_model_cfg.dialy_skill_id]
if not daily_skill_cfg then
print('Ych:GoodsTooltips.lua[1227] error can not find daily skill item ', show_model_cfg.dialy_skill_id)
return
end
local skill_table = stringtotable(daily_skill_cfg.skill)
local daily_skill_vo = SkillVo.New(tonumber(skill_table[1]) )
daily_skill_vo.level = tonumber(skill_table[2])
local name_color = ColorUtil.BLUE_DARK
if daily_skill_vo.level == 2 then
name_color = ColorUtil.PURPLE_DARK
elseif daily_skill_vo.level == 3 then
name_color = ColorUtil.ORANGE_DARK
end
self.daily_skill_name_tmp.text = HtmlColorTxt(daily_skill_vo:getName(), name_color)
if show_model_cfg.up_level_tips == 1 then
self.daily_skill_level_tmp.text = "等级:" .. HtmlColorTxt(tostring(daily_skill_vo.level), "#fdffc2" ) .. HtmlColorTxt("(激活高阶圣光可升级)", "#cb8336")
else
self.daily_skill_level_tmp.text = "等级:" .. HtmlColorTxt(tostring(daily_skill_vo.level), "#fdffc2" ) .. HtmlColorTxt("(已升至最高级)", ColorUtil.RED_DARK)
end
self.daily_skill_desc_tmp.text = daily_skill_vo:GetDesc()
lua_resM:setOutsideRawImage(self,self.daily_skill_bg_raw,GameResPath.GetViewBigBg("goods_tool_tip_daily_skill_bg"))
lua_resM:setOutsideImageSprite(self,self.daily_skill_icon_img,GameResPath.GetSkillIcon(daily_skill_vo.id), false)
elseif show_type == GoodsModel.TYPE.FosterSkin or show_type == GoodsModel.TYPE.Foster then
--珍宝
--lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
local show_conf = false
if show_model_cfg then
show_conf = {type = show_model_cfg.model_type, model_size = Vector2(720, 720),
model = show_model_cfg.model_id, career = show_model_cfg.career,power = show_model_cfg.power}
SetLocalScale(self.nice_roleCon.transform, 0.6,0.6,0.6)
local node1 = self.nice_roleCon
local change_x,change_y = 0,30
local x,y = GetAnchoredPosition( node1.transform )
SetAnchoredPosition( node1.transform, x+change_x, y+change_y )
elseif basic.subtype == 6 then --AI娘皮肤
local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FJarvis, basic.type_id)
if not conf then return end
show_conf = {type = FuncOpenModel.TypeId.FJarvis - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
position = Vector3(0, -35, -700),
scale = 200,
power = GetFighting(stringtotable(conf.attr_list, true))}
elseif basic.subtype == 7 then --磁炮皮肤
local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FGun, basic.type_id)
show_conf = {type = FuncOpenModel.TypeId.FGun - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
position = Vector3(0, 0,-700),
power = GetFighting(stringtotable(conf.attr_list, true))}
elseif basic.subtype == 8 then --星翼皮肤
local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FCloud, basic.type_id)
show_conf = {type = FuncOpenModel.TypeId.FCloud - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
position = Vector3(0, 0, -700),
power = GetFighting(stringtotable(conf.attr_list, true))}
elseif basic.subtype == 9 then --幻甲皮肤
local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FArmour, basic.type_id)
show_conf = {type = FuncOpenModel.TypeId.FArmour - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
position = Vector3(-15, 0, -700),
power = GetFighting(stringtotable(conf.attr_list, true))}
else
show_conf = ShapeModel:GetInstance():GetConfByGoodsId( self.basic.type_id )
show_conf.model_size = Vector2(720,720)
SetLocalScale(self.nice_roleCon.transform, 0.6,0.6,0.6)
local node1 = self.nice_roleCon
local change_x,change_y = 0,30
local x,y = GetAnchoredPosition( node1.transform )
SetAnchoredPosition( node1.transform, x+change_x, y+change_y )
end
self.nice_roleCon_obj:SetActive(true)
local res_data = {
father_node = self,
transform = self.nice_roleCon,
fashion_type = show_conf.type + 1000,
layer_name = self.layer_name,
size = show_conf.model_size,
position = show_conf.position,
figure_id = show_conf.model,
scale = show_conf.scale,
ui_model_type = UIModelCommon.ModelType.Model,
career = show_conf.career,
}
FuncOpenModel:getInstance():SetModelRes(res_data)
-------------------------
-------------------------
self.power_show_num = show_conf.power and show_conf.power or ShapeModel:GetInstance():GetPowerById( show_conf.type, show_conf.id )
else
--其他类道具显示
--lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
self.nice_designation_con_obj:SetActive(true)
self.nice_designation_image_obj:SetActive(true)
--lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetChildHandbookIcon(basic.type_id), true)
end
self:UpdateAttrCon()
self.nice_name_text_tmp.text = basic.goods_name
else
self.nice_con_obj:SetActive(false)
end
end
function GoodsTooltips:UpdateAttrCon()
if self.power_show_num then
self.nice_power_text_txt.text = self.power_show_num
return
end
local attr_list = self.attr_list
self.nice_power_text_txt.text = GetFighting(attr_list)
end
--限时抢购用
function GoodsTooltips:UpdateLimitShop( )
self.show_left_extra_view = false--保存一个参数,存在的时候 商城con和获取途径 互斥存在
if not self.type_id then return end
local data = KfActivityModel:getInstance():GetRushQuickBuy( self.type_id )
if data then
self.left_extra_con_obj:SetActive(true)
if not self.limit_shop_view then
self.limit_shop_view = self:CreateItem(KfActivityLimitShopTip, self.left_extra_con, self.layer_name)
end
self.limit_shop_view:SetData(self.type_id)
self.limit_shop_view:SetPosition(4,-4)
self.show_left_extra_view = true
else
self.left_extra_con_obj:SetActive(false)
end
end
function GoodsTooltips:ShowShopItem( )
local need_show = false
if self.shop_data then
if self.show_left_extra_view and self.show_get_way then
need_show = false
else
need_show = true
end
end
self.shop_con_obj:SetActive(need_show)
end
-- 进阶首充弹窗
function GoodsTooltips:UpdateFosterRechargeShow( )
if KfActivityModel:getInstance():CheckFosterRechargeAdsShow( self.parm_list.foster_data.type, self.parm_list.foster_data.grade) then
self.left_extra_con_obj:SetActive(true)
if not self.foster_recharge_view then
self.foster_recharge_view = self:CreateItem(FosterRechargeItem, self.left_extra_con, self.layer_name)
end
local click_cb = function( )
self:Close()
end
if not RechargeActivityModel:getInstance():IsRecharge() then
self.sound_id = lua_soundM:PlayEffect(self, "guide_10", false, LuaSoundManager.SOUND_TYPE.GUIDE)
end
self.foster_recharge_view:SetData( self.parm_list.foster_data.type, click_cb)
else
self.left_extra_con_obj:SetActive(false)
end
end
function GoodsTooltips:Close( )
--完成引导
local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_HORSE,4)
if helpVo then
GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP,helpVo)
end
BaseView.Close(self)
end