|
|
-
- UITabWindow = UITabWindow or BaseClass(BaseComponent)
- local UITabWindow = UITabWindow
-
- --窗口类型
- UITabWindow.SizeLarge = 1 -- 全屏窗口,有tab
- UITabWindow.SizeSmall = 2 -- 非全屏窗口,有tab
- UITabWindow.SizeLargeNoTab = 3 -- 全屏窗口,没有tab
- UITabWindow.SizeSmallNoTab = 4 -- --非全屏二级窗口,没有tab
- UITabWindow.SizeSmallHall = 5 -- 伪全屏窗口,带tab 但是tab不带头像 具体参考副本大厅
- UITabWindow.SizeSmallSP = 6 -- 特殊的二级带tab界面 参考送礼记录界面
- UITabWindow.SizeSmallHallNoTab = 7 -- 伪全屏窗口,不带tab 具体参考多人副本
- UITabWindow.SizeSmallFolderNoTab = 8 -- 非全屏二级窗口,没有tab,背景底样式类似于文件夹,参考查看玩家界面
- UITabWindow.SizeSmallActHall = 9 -- 伪全屏活动窗口,带tab 但是tab不带头像 具体参考充值
-
-
- UITabWindow.DesignWidth = 1560
- UITabWindow.DesignHeight = 720
- UITabWindow.ShowWidth = math.min(UITabWindow.DesignWidth, ScreenWidth)
- UITabWindow.ShowHeigth = math.min(UITabWindow.DesignHeight, ScreenHeight)
-
- --窗口类型参数
- UITabWindow.Parms = {
- --全屏窗口,带tab
- [1] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew,
- position = Vector3(0,0,0),
- tabbar_style = 1,
- },
- --非全屏窗口,有tab
- [2] = {
- win_width = 1067,
- win_height = 557,
- win_name = UIType.WindowNew2,--背景资源默认是WindowNew2_bg
- position = Vector3(0,0),
- tabbar_style = 2,
- },
- --全屏窗口,没有tab
- [3] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew,
- position = Vector3(0,0,0),
- tabbar_style = 0,
- },
- --非全屏二级窗口,没有tab
- [4] = {
- win_width = 1067,
- win_height = 557,
- win_name = UIType.WindowNew2,--背景资源默认是WindowNew2_bg
- position = Vector3(0,0),
- tabbar_style = 0,
- },
- --伪全屏窗口,带tab 但是tab不带头像 具体参考副本大厅
- [5] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew4,
- position = Vector3(0,0,0),
- tabbar_style = 3,
- },
- --非全屏窗口,有tab
- [6] = {
- win_width = 1067,
- win_height = 557,
- win_name = UIType.WindowNew6,
- position = Vector3(2.5,-6),
- tabbar_style = 4,
- },
- --伪全屏窗口,不带tab 具体参考多人副本
- [7] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew5,
- position = Vector3(0,0,0),
- tabbar_style = 0,
- },
- -- 非全屏二级窗口,没有tab,背景底样式类似于文件夹,参考查看玩家界面
- [8] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew7,
- position = Vector3(0,0,0),
- tabbar_style = 0,
- },
- --伪全屏活动窗口,带tab 但是tab不带头像 具体参考充值
- [9] = {
- win_width = UITabWindow.ShowWidth,
- win_height = UITabWindow.ShowHeigth,
- win_name = UIType.WindowNew8,
- position = Vector3(0,0,0),
- tabbar_style = 8,
- },
- }
-
- function UITabWindow:__init(parent,tabbar_list,select_callback,close_win_callback,background_wnd,attach_node,view_style, bg_name,ues_new_tab, need_show_money,extra_arg_table)
- -------------------------
- self._is_uitabwindow = true
- -------------------------
- self:InitData(tabbar_list,select_callback,close_win_callback,background_wnd,attach_node,view_style, bg_name,ues_new_tab,need_show_money,extra_arg_table)
- self.parms = UITabWindow.Parms[view_style] or UITabWindow.Parms[1]
- self.tabbar_style = ues_new_tab or self.parms.tabbar_style
- self:CreateGameObject(self.parms.win_name)
-
- local function on_back_change( )
- if IsNull(self.transform) then
- return
- end
- if BaseView.LastTabIndex and BaseView.LastTabIndex > 0 then
- self:SetTabBarIndex(BaseView.LastTabIndex)
- BaseView.LastTabIndex = 0
- end
- end
- self.key_back_change_id = GlobalEventSystem:Bind(EventName.KEY_BACK_CHANGE, on_back_change)
- end
-
- function UITabWindow:InitData(tabbar_list,select_callback,close_win_callback,background_wnd,attach_node,view_style, bg_name,ues_new_tab, need_show_money, extra_arg_table)
- self.curr_tabBtn_index = 0
- self.tabbar_item_list = {}
- self.tabbar_prefab = nil
- self.do_open_ani = false
- self.old_ani_top_pos = false
- self.old_ani_right_pos = false
- self.back_target_view = false
-
- self.tabbar_list = self:CheckTabbarOpen(tabbar_list)
- self.select_callback = select_callback
- self.close_win_callback = close_win_callback
- self.background_wnd = background_wnd
- self.attach_node = attach_node
- self.bg_name = bg_name
- self.view_style = view_style
- self.tabbar_style = ues_new_tab
- self.need_show_money = need_show_money
- self.extra_arg_table = extra_arg_table
- end
-
- function UITabWindow:LoadSuccess()
- self.win_transform = self.transform
- if self.view_style == UITabWindow.SizeLarge or self.view_style == UITabWindow.SizeLargeNoTab then
- self.win_bg_obj = self.transform.gameObject
- -- self.win_bg = self.win_transform:GetComponent("RawImage")
- self.win_bg_tf = self:GetChild("windowBg")
- self.win_bg = self:GetChild("windowBg"):GetComponent("RawImage")
- self.win_bg_mask = self:GetChild("windowBgMask")
- self.win_close_btn = self:GetChild("di_head/windowCloseBtn").gameObject
- self.win_tab_scroll = self:GetChild("di_right/windowTabScroll")
- self.win_tab_cont_scroll = self:GetChild("di_right/windowTabScroll/Viewport/windowTabCont")
- self.win_tab_cont = self:GetChild("di_right/windowTabCont")
- self.win_title = self:GetChild("di_head/windowTitleImg")
- self.di_right_obj = self:GetChild("di_right").gameObject
- self.di_head_trans = self:GetChild("di_head")
- self.di_right_trans = self:GetChild("di_right")
- self.con_money = self:GetChild("di_head/con_money")
- self.lb_title_txt = self:GetChild("di_head/lb_title"):GetComponent(typeof(TMPro.TextMeshProUGUI))
-
- if self.win_title then
- self.win_title_bg = self.win_title:GetComponent("Image")
- end
-
- --全屏界面排行榜页签位置特殊处理
- if self.view_style == UITabWindow.SizeLarge then
- if self.tabbar_style == 6 then--排行榜使用样式6的侧边tab,并且位置要偏下
- SetAnchoredPositionY(self.win_tab_scroll, -106)
- SetAnchoredPositionY(self.win_tab_cont, -117)
- else
- SetAnchoredPositionY(self.win_tab_scroll, -60.5)
- SetAnchoredPositionY(self.win_tab_cont, -71.5)
- end
- end
-
- elseif self.view_style == UITabWindow.SizeSmall
- or self.view_style == UITabWindow.SizeSmallNoTab
- or self.view_style == UITabWindow.SizeSmallHall
- or self.view_style == UITabWindow.SizeSmallHallNoTab
- or self.view_style == UITabWindow.SizeSmallSP
- or self.view_style == UITabWindow.SizeSmallFolderNoTab
- or self.view_style == UITabWindow.SizeSmallActHall
- then
- self.win_bg_obj = self.transform.gameObject
- self.win_bg_tf = self:GetChild("windowBg")
- self.win_bg = self:GetChild("windowBg"):GetComponent("RawImage")
- self.win_close_btn = self:GetChild("di_head/windowCloseBtn").gameObject
- self.win_title = self:GetChild("di_head/windowTitleImg")
- self.win_title_obj = self:GetChild("di_head/windowTitleImg").gameObject
- self.win_tab_scroll = self:GetChild("di_right/windowTabScroll")
- self.win_tab_cont_scroll = self:GetChild("di_right/windowTabScroll/Viewport/windowTabCont")
- self.win_tab_cont = self:GetChild("di_right/windowTabCont")
- self.di_right_obj = self:GetChild("di_right").gameObject
- -- self.title_name_obj = self:GetChild("di_head/title_name").gameObject
- -- self.title_name_tmp = self:GetChild("di_head/title_name"):GetComponent("Text")
- self.di_head_trans = self:GetChild("di_head")
- self.di_right_trans = self:GetChild("di_right")
- self.con_money = self:GetChild("di_head/con_money")
-
- self.nodes = {
- "di_head/title_name:tmp:obj",
- }
- self:GetChildren(self.nodes)
-
- if self.win_title then
- self.win_title_bg = self.win_title:GetComponent("Image")
- end
- if self.view_style == UITabWindow.SizeSmallHall or self.view_style == UITabWindow.SizeSmallHallNoTab then
- self.win_bg_left_raw = self:GetChild("bgLeft"):GetComponent("RawImage")
- self.win_bg_right_raw = self:GetChild("bgRight"):GetComponent("RawImage")
- lua_resM:setOutsideRawImage(self, self.win_bg_left_raw, GameResPath.GetViewBigBg("default_bg_6_left"), true)
- lua_resM:setOutsideRawImage(self, self.win_bg_right_raw, GameResPath.GetViewBigBg("default_bg_6_right"), true)
- elseif self.view_style == UITabWindow.SizeSmallActHall then
- self.win_bg_left_raw = self:GetChild("bgLeft"):GetComponent("RawImage")
- self.win_bg_right_raw = self:GetChild("bgRight"):GetComponent("RawImage")
- lua_resM:setOutsideRawImage(self, self.win_bg_left_raw, GameResPath.GetViewBigBg("default_bg_7_left"), true)
- lua_resM:setOutsideRawImage(self, self.win_bg_right_raw, GameResPath.GetViewBigBg("default_bg_7_right"), true)
- self.di_right_img = self:GetChild("di_right"):GetComponent("Image")
- lua_resM:setOutsideImageSprite(self, self.di_right_img, GameResPath.GetViewBigBg("ui_tab_bg8"), false)
- elseif self.view_style == UITabWindow.SizeSmallFolderNoTab then
- -- self.win_bg_base_raw = self:GetChild("windowBg_base"):GetComponent("RawImage")
- -- self.win_bg_base_trm = self:GetChild("windowBg_base")
- -- lua_resM:setOutsideRawImage(self, self.win_bg_base_raw, GameResPath.GetViewBigBg("folder_like_view_bg_no_tab"), false)
- end
- end
-
-
- self:DoOpenViewAnimation()
-
- --[[已废弃,设置背景统一使用SetBackgroundRes
- --设置背景
- if self.bg_name and self.win_bg and (not ClientConfig.alpha_mode or not ClientConfig.view_style_ui or ClientConfig.view_style_ui == "") then
- lua_resM:setOutsideRawImage(self, self.win_bg, GameResPath.GetViewBigBg(self.bg_name))
- end
- ]]
-
- self:InitEvent()
- self:LayoutUI()
- self:LoadTabbarPrefab()
- self:CreateMoney()
-
- if ClientConfig.alpha_mode then
- if ClientConfig.view_style_ui and ClientConfig.view_style_ui ~= "" then
- self:InitAlphaState()
- end
- end
- end
-
- --窗口类型
- function UITabWindow:CreateMoney( )
- --除了13579 其他是二级界面都不需要UIMoneyView--2021.3.1鑫爷的需求
- if self.view_style == UITabWindow.SizeLarge--1
- or self.view_style == UITabWindow.SizeLargeNoTab--3
- or self.view_style == UITabWindow.SizeSmallHall--5
- or self.view_style == UITabWindow.SizeSmallHallNoTab--7
- or self.view_style == UITabWindow.SizeSmallActHall--9
- then
- else
- return
- end
- -- --显示金钱
- if self.need_show_money and self.con_money and not ClientConfig.alpha_mode then
- if not self.money_view then
- self.money_view = UIMoneyView.New(self.con_money)
- end
- self.money_view:SetPosition(0,0)
- self.money_view:SetData()
- if self.money_view_add_res then
- self.money_view:ChangeAddBtnRes(self.money_view_add_res)
- end
- --小窗口只显示最多两个货币
- if self.view_style == UITabWindow.SizeSmall or self.view_style == UITabWindow.SizeSmallNoTab
- or self.view_style == UITabWindow.SizeSmallHall
- or self.view_style == UITabWindow.SizeSmallSP
- or self.view_style == UITabWindow.SizeSmallHallNoTab
- or self.view_style == UITabWindow.SizeSmallFolderNoTab
- or self.view_style == UITabWindow.SizeSmallActHall
- then
- self.money_view:ChangeShowFlag("smallWindow")
- end
- end
- end
-
- --切换背景
- function UITabWindow:SetBackgroundRes(res)
- local load_bg_callback = function ()
- self.win_bg_obj:SetActive(true)
- if ClientConfig.is_use_model_render then
- self.win_bg.gameObject:SetActive(false)
- end
- end
- if res and self.win_bg and (not ClientConfig.alpha_mode or not ClientConfig.view_style_ui or ClientConfig.view_style_ui == "") then
- local is_auto_size = false
- lua_resM:setOutsideRawImage(self, self.win_bg, GameResPath.GetViewBigBg(res), is_auto_size, load_bg_callback)
- if ClientConfig.is_use_model_render then
- if not self.backward_bg then
- local back_canvae = GameObject.Find("root").transform:Find("BackCanvas")
- print("back_canvae " , back_canvae)
- self.backward_bg = back_canvae.transform:Find("Bg/bg_contain/bg"):GetComponent("RawImage")
- end
- self.backward_bg.gameObject:SetActive(true)
- lua_resM:setOutsideRawImage(self, self.backward_bg, GameResPath.GetViewBigBg(res))
- end
- end
- end
-
- --切换标题
- function UITabWindow:SetTitleRes(ab_name, res_name)
- if self.win_title_bg and ab_name and res_name then
- if self.view_style == UITabWindow.SizeLarge or self.view_style == UITabWindow.SizeLargeNoTab then
- --不用图片标题
- else
- if self.title_name_obj then
- self.title_name_obj:SetActive(false)
- end
- lua_resM:setImageSprite(self, self.win_title_bg, ab_name, res_name, true)
- end
- end
- end
-
- function UITabWindow:SetTitleText( str )
- if str then
- if self.win_title_obj then
- self.win_title_obj:SetActive(false)
- end
- if self.lb_title_txt then
- self.lb_title_txt.text = str
- end
- if self.title_name_tmp then
- self.title_name_tmp.text = str
- end
- end
- end
-
- --在父窗口调用
- function UITabWindow:__delete()
-
- if self.back_target_view then
- LuaViewManager:getInstance():HideBackData(self.back_target_view)
- self.back_target_view = false
- end
-
- if self.orientation_change_id then
- GlobalEventSystem:UnBind(self.orientation_change_id)
- self.orientation_change_id = nil
- end
- if self.key_back_change_id then
- GlobalEventSystem:UnBind(self.key_back_change_id)
- self.key_back_change_id = nil
- end
- BaseView.LastTabIndex = 0
- self.temp_cur_index = false
- self.tabbar_prefab = nil
- self.curr_tabBtn_index = 0
- if ClientConfig.is_use_model_render then
- if self.backward_bg then
- self.backward_bg.gameObject:SetActive(false)
- end
- end
-
-
- if self.money_view then
- self.money_view:DeleteMe()
- self.money_view = nil
- end
-
- if self.tab_view then
- self.tab_view:DeleteMe()
- self.tab_view = nil
- end
-
- if self.action_nodes then
- for k,v in pairs(self.action_nodes) do
- cc.ActionManager:getInstance():removeAllActionsFromTarget(v)
- end
- self.action_nodes = nil
- end
- self.do_open_ani = false
- end
-
- function UITabWindow:LayoutUI()
- self.win_transform.anchorMin = Vector2(0.5,0.5)
- self.win_transform.anchorMax = Vector2(0.5,0.5)
- self.win_transform.localPosition = Vector3(0,0,0)
- self.win_transform.sizeDelta = Vector2(self.parms.win_width,self.parms.win_height)
-
- if self.view_style == UITabWindow.SizeLarge or self.view_style == UITabWindow.SizeLargeNoTab then
- self:SetIpxMode()
- else
- --非全屏界面,有偏移
- if self.parms.position then
- self.transform.localPosition = self.parms.position
- end
- end
-
- if self.background_wnd then
- local index = self.background_wnd.transform:GetSiblingIndex()
- self.transform:SetSiblingIndex(index + 1)
- else
- self.transform:SetAsFirstSibling()
- end
-
- -- self.win_title_con.sizeDelta = Vector2(self.title_width,self.title_height)
-
- if self.attach_node then
- self.attach_node:SetParent(self.win_transform)
- self.attach_node:SetAsFirstSibling()
- end
-
- self.win_bg_tf:SetAsFirstSibling()
- if self.win_bg_base_trm then--参考副本主界面
- self.win_bg_base_trm:SetAsFirstSibling()
- end
- end
-
- function UITabWindow:SetIpxMode( )
- local temp_win_width = self.parms.win_width
- local temp_win_off_x, temp_mask_off_x = 0,0
- local need_change = false
-
- --全屏界面要适配刘海
- if self.view_style == UITabWindow.SizeLarge or self.view_style == UITabWindow.SizeLargeNoTab then
- if ClientConfig.iphone_x_model then
- if ClientConfig.iphone_x_offset_left > 0 then
- temp_win_width = temp_win_width - ClientConfig.iphone_x_offset_left
- temp_win_off_x = ClientConfig.iphone_x_offset_left/2
- temp_mask_off_x = 0
- need_change = true
- end
- if ClientConfig.iphone_x_offset_right > 0 then
- temp_win_width = temp_win_width - ClientConfig.iphone_x_offset_right
- temp_win_off_x = temp_win_off_x-ClientConfig.iphone_x_offset_right/2
- temp_mask_off_x = temp_win_width + 100 --100是遮罩本身的大小
- need_change = true
- end
- end
- SetSizeDeltaX(self.di_head_trans.transform, ScreenWidth - ClientConfig.iphone_x_offset_left - ClientConfig.iphone_x_offset_right)
- SetAnchoredPosition( self.di_head_trans.transform, 0, ScreenHeight/2 )
- end
-
- if not need_change then
- return
- end
-
- --窗口偏移
- self.win_transform.localPosition = Vector3(temp_win_off_x+self.parms.position.x,self.parms.position.y,0)
- self.win_transform.sizeDelta = Vector2(temp_win_width,self.parms.win_height)
- --刘海遮罩偏移
- -- if self.win_bg_mask and temp_win_off_x ~= 0 then
- -- self.win_bg_mask.gameObject:SetActive(true)
- -- self.win_bg_mask:SetAsLastSibling()
- -- SetAnchoredPositionX(self.win_bg_mask, temp_mask_off_x)
- -- end
- end
-
- function UITabWindow:LoadTabbarPrefab()
- if not self.parms.tabbar_style or self.parms.tabbar_style == 0 then
- self.di_right_obj:SetActive(false)
- return
- end
-
- local function click_callback( index )
- if self.temp_cur_index then
- BaseView.LastTabIndex = self.temp_cur_index
- end
- self.select_callback(index)
- self.temp_cur_index = index
- end
-
- local function set_linebg_size( w,h,con_h )--设置linebg大小 以及容器大小
- SetSizeDeltaY(self.win_tab_cont_scroll.transform,con_h)
- end
-
- local len = TableSize(self.tabbar_list)
- if not self.tab_view then
- if len > 6 then--大于六个页签才给予滚动
- self.tab_view = UITabBarView.New(self.win_tab_cont_scroll,nil,self.layer_name,self.view_style,true)
- self.win_tab_cont.gameObject:SetActive(false)
- else
- self.tab_view = UITabBarView.New(self.win_tab_cont,nil,self.layer_name,self.view_style)
- self.win_tab_scroll.gameObject:SetActive(false)
- end
- end
- self.tab_view:SetData(self.tabbar_list, click_callback, self.tabbar_style, len > 6 and set_linebg_size or nil, self.extra_arg_table)
- end
-
- function UITabWindow:InitEvent()
- local function onCloseBtnHandler(target)
- if self.close_win_callback ~= nil then
- self.close_win_callback()
- end
- end
- AddClickEvent(self.win_close_btn,onCloseBtnHandler,LuaSoundManager.SOUND_UI.NONE,true)
-
- local function onOrientationChange( )
- self:SetIpxMode()
- end
- if not self.orientation_change_id then
- self.orientation_change_id = GlobalEventSystem:Bind(EventName.ORIENTATION_DID_CHANGE, onOrientationChange)
- end
- end
-
- function UITabWindow:SetTabBarIndex(index, force, ignore_call_back)
- if self.tab_view and self.tab_view.SetTabBarIndex then
- self.tab_view:SetTabBarIndex(index, force, ignore_call_back)
- end
- end
-
- function UITabWindow:GetTabBarBtn(index)
- if self.tab_view and self.tab_view.GetTabbarBtn then
- return self.tab_view:GetTabbarBtn(index, force)
- end
- end
-
- function UITabWindow:GetCurrentSelectIndex()
- if self.tab_view and self.tab_view.GetCurrentSelectIndex then
- return self.tab_view:GetCurrentSelectIndex()
- end
- end
-
- function UITabWindow:ShowRedPoint(index,bool)
- if self.tab_view and self.tab_view.ShowRedPoint then
- self.tab_view:ShowRedPoint(index, bool)
- end
- end
-
- function UITabWindow:ShowRedPointWithNum(index, num, force_show)
- -- print("Saber:UITabWindow [526] index, num, force_show: ",index, num, force_show)
- if self.tab_view and self.tab_view.ShowRedPointWithNum then
- self.tab_view:ShowRedPointWithNum(index, num, force_show)
- end
- end
-
- function UITabWindow:SetSpeacialImg(index, state)
- if self.tab_view and self.tab_view.SetSpeacialImg then
- self.tab_view:SetSpeacialImg(index, state)
- end
- end
-
- function UITabWindow:SetTextSize(font_size)
- if self.tab_view and self.tab_view.SetTextSize then
- self.tab_view:SetTextSize(font_size)
- end
- end
-
- function UITabWindow:CheckTabbarOpen( tabbar_list )
- if not tabbar_list then return end
- local result = {}
- local open_status = true
- for k,v in pairsByKeys(tabbar_list) do
- open_status = true
- if (not v.open_lv) and (not v.open_task) and (not v.open_day) and v.module_id and (v.sub_id or v.id) then
- --不填开放条件的时候就走一下检测
- open_status = GetModuleIsOpen( v.module_id,(v.sub_id or v.id),true )
- elseif not MainUIModel:getInstance():GetFunOpenState(v.open_lv, v.open_task or 0) then
- open_status = false
- elseif v.open_day and v.open_day > ServerTimeModel:getInstance():GetOpenServerDay() then
- open_status = false
- end
- if open_status then
- table.insert( result, v )
- end
- end
- return result
- end
-
- function UITabWindow:RefeshTabbar(tabbar_list, switch_callback, tabbar_style, force)
- self.tabbar_list = self:CheckTabbarOpen(tabbar_list or self.tabbar_list)
- self.select_callback = switch_callback or self.select_callback
- self.parms.tabbar_style = tabbar_style or self.parms.tabbar_style
- if self.tab_view then
- self.tab_view:RefreshTabData(self.tabbar_list, self.select_callback, self.parms.tabbar_style)
- self:SetTabBarIndex(self:GetCurrentSelectIndex(),force)
- -- self.tab_view:RefeshTabBar()
- end
- end
-
- function UITabWindow:InitAlphaState( )
- if self.win_tab_cont_scroll and self.win_tab_cont_scroll.gameObject then
- self.win_tab_cont_scroll.gameObject:SetActive(false)
- end
- if self.win_tab_cont and self.win_tab_cont.gameObject then
- self.win_tab_cont.gameObject:SetActive(false)
- end
- self.win_title_con = self:GetChild("windowTitleCon").gameObject
- if self.win_title_con then
- self.win_title_con:SetActive(false)
- end
- if self.win_title and self.win_title.gameObject then
- self.win_title.gameObject:SetActive(false)
- end
- self.close_btn_img = self:GetChild("di_head/windowCloseBtn"):GetComponent("Image")
- local btn_res_name, btn_pos, btn_size = AlphaModel:getInstance():GetCloseBtnStyle()
- if self.close_btn_img then
- lua_resM:setImageSprite(self, self.close_btn_img, "alpha_asset", btn_res_name, true)
- end
- if self.win_close_btn then
- self.win_close_btn.transform.anchoredPosition = btn_pos
- end
- -- local bg_res_name, bg_pos, bg_size = AlphaModel:getInstance():GetWinBgStyle()
- local style = ClientConfig.view_style_ui or 1
- local alpha_bg_name = "alpha_win_bg_"..style
- print("tanar - [ UITabWindow ] [297] ==> alpha_bg_name: ",alpha_bg_name)
- lua_resM:setOutsideRawImage(self, self.win_bg, GameResPath.GetViewBigBg(alpha_bg_name), false)
- -- print("tanar - [ UITabWindow ] [296] ==> bg_res_name: ",bg_res_name)
- -- lua_resM:setRawImage(self,self.win_bg, "alpha_asset", bg_res_name)
- if self.win_bg_obj then
- self.win_bg_obj.transform.localPosition = Vector3(-25,-21,0)
- self.win_bg_obj.transform.sizeDelta = Vector2(1155, 650)
- local alpha_bg_size = AlphaModel:getInstance():GetBgSize()
- if alpha_bg_size then
- self.win_bg_obj.transform.sizeDelta = alpha_bg_size
- end
- end
- if self.parent_transform then
- local win_name = self.parent_transform.name or "UITabWindow"
- local error_str = "Alpha record: Open Win " .. win_name
- if GameError and GameError.Instance then
- GameError.Instance:SendErrorMsg(error_str)
- end
- end
- end
-
-
- function UITabWindow:DoOpenViewAnimation(force)
- if self.parms.win_name ~= UIType.WindowNew or ClientConfig.tabwin_ani_mode == false then
- return
- end
-
- if self.do_open_ani and not force then
- return
- end
- self.do_open_ani = true
- if self.di_head_trans then
- self.old_ani_top_pos = self.old_ani_top_pos or self.di_head_trans.anchoredPosition
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.di_head_trans)
- SetAnchoredPosition(self.di_head_trans, self.old_ani_top_pos.x, self.old_ani_top_pos.y + 74)
- local moveActionTop = cc.MoveTo.createAnchoredType(1.5, self.di_head_trans.anchoredPosition.x, self.old_ani_top_pos.y)
- moveActionTop = cc.EaseExponentialOut.New(moveActionTop)
- self:AddAction(moveActionTop, self.di_head_trans)
- end
-
- if self.di_right_trans then
- self.old_ani_right_pos = self.old_ani_right_pos or self.di_right_trans.anchoredPosition
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.di_right_trans)
- SetAnchoredPosition(self.di_right_trans, self.old_ani_right_pos.x + 145, self.old_ani_right_pos.y)
- local moveActionRight = cc.MoveTo.createAnchoredType(1.5, self.old_ani_right_pos.x, self.di_right_trans.anchoredPosition.y)
- moveActionRight = cc.EaseExponentialOut.New(moveActionRight)
- self:AddAction(moveActionRight, self.di_right_trans)
- end
- end
-
- --自销毁动作
- function UITabWindow:AddAction( action, node )
- self.action_nodes = self.action_nodes or {}
- self.action_nodes[node] = node
- cc.ActionManager:getInstance():addAction(action, node)
- end
-
- --自销毁动作
- function UITabWindow:SetUIBack(data)
- if self.background_wnd then
- self.background_wnd.gameObject:SetActive(false)
- end
-
- local target = data.target
- local bg1 = data.bg1
- local bg2 = data.bg2
- local node_list = data.node_list
- local back_camera_args = data.camera_args
-
- if target == nil then
- error(">>>>>>>>>>>>>需要传入tabwin所在的view")
- end
-
- if self.view_style == UITabWindow.SizeLarge then
- local camera_args = LuaViewManager.CameraArgs.DepthZero
- local bg_list = target.model_activity_bg and {} or -- 显示背景模型的情况不展示图片背景
- {
- [1] = {res = bg1, args = args1 },
- }
- LuaViewManager:getInstance():ShowBackData({
- target = target,
- bg_list = bg_list,
- camera_args = camera_args,
- activity = {is_show = true,}
- })
- self.back_target_view = target
- elseif self.view_style == UITabWindow.SizeLargeNoTab then
- if self.win_bg then
- self.win_bg.gameObject:SetActive(false)
- end
- local args1 = {size = {x = 1560, y = 720,} ,pos = {x = 0, y = 0,}}
- local bg_list =
- {
- [1] = {res = bg1, args = args1 },
- }
- local data =
- {
- target = target,
- bg_list = bg_list,
- camera_args = back_camera_args,
- activity = {is_show = true,}
- }
- LuaViewManager:getInstance():ShowBackData(data)
- self.back_target_view = target
- elseif self.view_style == UITabWindow.SizeSmallHall
- or self.view_style == UITabWindow.SizeSmallHallNoTab
- or self.view_style == UITabWindow.SizeSmallActHall
- then
- if self.win_bg then
- self.win_bg.gameObject:SetActive(false)
- end
-
- if self.win_bg_base_trm then
- self.win_bg_base_trm.gameObject:SetActive(false)
- end
- local args1 = {size = {x = 1280, y = 720,} ,pos = {x = 0, y = 0,}}
- local bg_list =
- {
- [1] = {res = bg1, args = args1 },
- }
- local data =
- {
- target = target,
- bg_list = bg_list,
- camera_args = back_camera_args,
- activity = {is_show = true,}
- }
-
- LuaViewManager:getInstance():ShowBackData(data)
- self.back_target_view = target
- end
- end
-
- -- function UITabWindow:SetSceneTextureLimit( flag )
- -- local limit_level = flag and 4 or 0
- -- QualitySettings.masterTextureLimit = limit_level
- -- end
- function UITabWindow:UpdateTabInfo( tabbar_list )
- self.tabbar_list = self:CheckTabbarOpen(tabbar_list)
- self.tab_view:RefreshTabData(self.tabbar_list, self.select_callback, self.parms.tabbar_style)
- -- self:LoadTabbarPrefab()
- end
-
- --改变金钱界面显示类型
- function UITabWindow:ChangeShowFlag( money_type,goods_id )
- if self.money_view then
- self.money_view:ChangeShowFlag(money_type,goods_id)
- end
- end
-
- function UITabWindow:ChangeAddBtnRes( res )
- if self.money_view then
- print("huangcong:UITabWindow [start:735] res:", res)
- self.money_view:ChangeAddBtnRes(res)
- else
- self.money_view_add_res = res
- end
- end
-
- --设置 Head 的 Siblingindex
- --Is_down 是否降低(为false表示还原)
- function UITabWindow:SetHeadSiblingIndex(is_down)
- if is_down then
- if self.win_bg_tf and self.di_head_trans then
- local sibing_index = self.win_bg_tf:GetSiblingIndex()
- self.di_head_trans:SetSiblingIndex(sibing_index + 1)
- end
- else
- if self.di_head_trans then
- local child_num = self.di_head_trans.parent.childCount
- self.di_head_trans:SetSiblingIndex(child_num)
- end
- end
- end
|