|
|
- GuildCollectSupportTip = GuildCollectSupportTip or BaseClass(BaseItem)
- local GuildCollectSupportTip = GuildCollectSupportTip
-
- function GuildCollectSupportTip:__init()
- self.base_file = "guildScene"
- self.layout_file = "GuildCollectSupportTip"
- self.model = GuildModel:getInstance()
-
- self:Load()
- end
-
- function GuildCollectSupportTip:Load_callback()
- self.nodes = {
- "name:tmp",
- "goBtn:obj:img", "goBtn/btnText:tmp", "vipCon",
- "bg:obj", "selfFlag:obj",
- "selfGoBtn:obj",
- }
- self:GetChildren(self.nodes)
-
- self.vip_item = self:CreateItem(RoleVipItem, self.vipCon, self.layer_name)
-
- self:AddEvents()
- if self.need_refreshData then
- self:UpdateView()
- end
- end
-
- function GuildCollectSupportTip:AddEvents( )
- local on_click = function ( click_obj )
- if self.goBtn_obj == click_obj then
- self:GoSupport()
- elseif self.bg_obj == click_obj then
- if self.data.is_my_support then
- self:GoFindMyMon()
- else
- self:GoSupport()
- end
- elseif self.selfGoBtn_obj == click_obj then
- self:GoFindMyMon()
- end
- end
- AddClickEvent(self.goBtn_obj, on_click)
- AddClickEvent(self.bg_obj, on_click)
- AddClickEvent(self.selfGoBtn_obj, on_click)
-
- end
-
- function GuildCollectSupportTip:GoSupport( )
- if self.data.is_in_my_support then--如果是自己请求的协助,寻路去杀怪
- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,self.data.support_sid)
- return
- end
-
- self.model.need_go_support_guild_collect_after_40046 = true--需要在更新40046之后请求40808寻路杀怪
-
- local guild_collect_support_id = self.model:GetSelfGuildCollectSupportId()
- if guild_collect_support_id ~= 0 then--正在协助他人,先请求53协议结束当前的协助,后面再去协助
- self.model.need_change_collect_support = self.data.support_sid
- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40053)
- else
- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40052,self.data.support_sid)
- end
-
- end
-
- function GuildCollectSupportTip:GoFindMyMon( )
- --直接寻路过去杀自己的宝箱怪
- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,self.data.support_sid)
- end
-
- function GuildCollectSupportTip:UpdateView( )
- if self.data.is_my_support then
- self.name_tmp.text = "<color=#2CF86F>"..self.data.name.."</color>"
- self.selfGoBtn_obj:SetActive(true)
- self.goBtn_obj:SetActive(false)
- else
- self.name_tmp.text = self.data.name
- self.selfGoBtn_obj:SetActive(false)
- self.goBtn_obj:SetActive(true)
- end
- if self.data.is_in_my_support then
- self.btnText_tmp.text = "协助中"
- SetImageGray(self.goBtn_img,true)
- SetTMPSharedMaterial(self.btnText_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn)
- else
- self.btnText_tmp.text = "前往协助"
- SetImageGray(self.goBtn_img,false)
- SetTMPSharedMaterial(self.btnText_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
- end
-
- self.vip_item:SetData(self.data.vip_flag,self.data.sup_vip_type)
- if self.data.vip_flag == 0 then
- SetAnchoredPositionX(self.name,-45)
- else
- SetAnchoredPositionX(self.name,-22)
- end
-
- end
-
- function GuildCollectSupportTip:SetData( data )
- self.data = data
- if self.is_loaded then
- self.need_refreshData = false
- self:UpdateView()
- else
- self.need_refreshData = true
- end
- end
-
- function GuildCollectSupportTip:__delete( )
-
- end
|