|
--社团协助前往确认界面
|
|
GuildSupportGoView = GuildSupportGoView or BaseClass(BaseView)
|
|
local GuildSupportGoView = GuildSupportGoView
|
|
|
|
function GuildSupportGoView:__init()
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildSupportGoView"
|
|
self.layer_name = "Top"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.hide_maincancas = false --全屏界面需要放开隐藏主UI
|
|
self.change_scene_close = true
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
self.blur_activity_bg = true
|
|
self.model = GuildModel:getInstance()
|
|
self.item_list = {}
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:OpenSuccess()
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function GuildSupportGoView:DestroySuccess()
|
|
for k, v in pairs(self.item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.item_list = {}
|
|
end
|
|
|
|
function GuildSupportGoView:LoadSuccess()
|
|
local nodes = {
|
|
"btnOK:obj","Window/windowCloseBtn:obj","award_con","btnCancel:obj",
|
|
"bg:img","pass_name:tmp","name:tmp","Window:raw","Window/windowTitleCon/windowTitleText:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"), false)
|
|
lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetGuildImage("guild_support_go_bg"), false)
|
|
|
|
self.windowTitleText_tmp.text = "协助提示"
|
|
|
|
if self.need_refreshData then
|
|
self:UpdateView( )
|
|
end
|
|
end
|
|
|
|
function GuildSupportGoView:AddEvent()
|
|
local function onBtnClickHandler(target,x,y)
|
|
if target == self.windowCloseBtn_obj then--关闭
|
|
self:Close()
|
|
elseif target == self.btnCancel_obj then--关闭
|
|
self:Close()
|
|
elseif target == self.btnOK_obj then--立即前往
|
|
if self.data and self.data.role_id ~= RoleManager.Instance.mainRoleInfo.role_id and self.cfg then
|
|
if self.cfg.is_conflict ~= 1 then--可以接着协助其他人
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40052,self.data.support_sid)
|
|
else
|
|
if self.model:GetGuildSupportStatus() == 1 then--请求他人协助
|
|
Message.show("您已经请求协助,不可协助其他玩家")
|
|
return
|
|
elseif self.model:GetGuildSupportStatus() == 2 then--正在协助他人
|
|
Message.show("您正在协助中")
|
|
return
|
|
elseif self.model:GetGuildSupportStatus() == 0 then
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40052,self.data.support_sid)
|
|
end
|
|
end
|
|
end
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.windowCloseBtn_obj,onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE)
|
|
AddClickEvent(self.btnOK_obj,onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE)
|
|
AddClickEvent(self.btnCancel_obj,onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE)
|
|
|
|
end
|
|
|
|
function GuildSupportGoView:Open( data )
|
|
self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuildSupportGoView:OpenSuccess( )
|
|
self:UpdateView()
|
|
end
|
|
|
|
function GuildSupportGoView:UpdateView( )
|
|
if self.is_loaded then
|
|
self.need_refreshData = false
|
|
else
|
|
self.need_refreshData = true
|
|
return
|
|
end
|
|
if not self.data then return end
|
|
--Boss形象
|
|
local boss_type = BossModel:GetInstance():GetBossTypeByBossId( self.data.boss_id )
|
|
local monster = ConfigItemMgr.Instance:GetMonsterDataItem(self.data.boss_id)
|
|
local boss_type_name = self.model:GetSupportTypeName(boss_type) or ""
|
|
local support_text = GuildModel.SupportTypeStr[self.data.support_cfg_id] or "协助击杀"
|
|
self.name_tmp.text = "前往协助社团成员:"..HtmlColorTxt(self.data.name, "#d322ff")
|
|
|
|
if self.data.support_cfg_id == GuildSupportInfoItem.CFG_TYPE.ANSWER or
|
|
self.data.support_cfg_id == GuildSupportInfoItem.CFG_TYPE.GUILD_BOSS then
|
|
local cfg = self.model:GetGuildSupportCfg(self.data.support_cfg_id)
|
|
if cfg then
|
|
self.pass_name_tmp.text = string.format("协助完成%s协助任务可获得协助奖励", HtmlColorTxt(Trim(cfg.mod_name), "#d322ff"))
|
|
end
|
|
else
|
|
self.pass_name_tmp.text = string.format("%s%s可获得协助奖励", support_text, HtmlColorTxt(boss_type_name, "#d322ff"))
|
|
end
|
|
|
|
self:UpdateItemList()
|
|
end
|
|
|
|
function GuildSupportGoView:BtnCloseEvt()--关闭按钮回调
|
|
self:Close()
|
|
end
|
|
|
|
function GuildSupportGoView:UpdateItemList( )
|
|
local cfg = self.model:GetGuildSupportCfg(self.data.support_cfg_id)
|
|
if not cfg then return end
|
|
self.cfg = cfg
|
|
for k,v in pairs(self.item_list) do
|
|
v:SetVisible(false)
|
|
end
|
|
local item_list = {{0,100003,cfg.reward_reputation}}
|
|
if not item_list or TableSize(item_list) == 0 then return end
|
|
local offer_x = 0
|
|
local offer_y = 0
|
|
local x = 0
|
|
local y = 0
|
|
for i, v in ipairs(item_list) do
|
|
local item = self.item_list[i]
|
|
if item == nil then
|
|
item = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.award_con)
|
|
item:SetItemSize(62,62)
|
|
self.item_list[i] = item
|
|
end
|
|
-- y = offer_y
|
|
-- x = (78+offer_x) * (i-1)
|
|
-- item:SetPosition(x,y)
|
|
local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2])
|
|
local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id)
|
|
if goodVo then
|
|
item:SetData(goods_Id, v[3] , goodVo.color, 0, lock,true,nil)
|
|
else
|
|
-- error("没有找到物品信息 "..v.typeId)
|
|
end
|
|
item:SetVisible(true)
|
|
end
|
|
end
|