ExitConView = ExitConView or BaseClass(BaseView) local ExitConView = ExitConView function ExitConView:__init() self.base_file = "common" self.layout_file = "ExitConView" self.layer_name = "Main" self.destroy_imm = true self.change_scene_close = false self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 ------------------------ -- 一级全屏界面: self.hide_maincancas = false --隐藏主界面 self.use_background = false --不一定显示遮罩 self.load_callback = function () self:LoadSuccess() end self.open_callback = function ( ) self:OpenSuccess() end self.close_win_callback = function ( ) self:Close() end self.destroy_callback = function ( ) self:DestroySuccess() end self.wait_add_list = {} self.cur_node_list = {} end function ExitConView:Open( ) BaseView.Open(self) end function ExitConView:LoadSuccess() self:AddEvent() SetAnchoredPosition( self.transform, -ClientConfig.iphone_x_offset_right, 0 ) self.wait_add_list = StartToEnd(self.wait_add_list) for i=#self.wait_add_list ,1 ,-1 do local temp = table.remove(self.wait_add_list,i) self:AddNode( temp.node,temp.parent_node,temp.tag_str,temp.off_x, temp.off_y ) end self:LittleMove(false) end function ExitConView:AddEvent() local function onOrientationChange() SetAnchoredPosition( self.transform, -ClientConfig.iphone_x_offset_right, 0 ) end self:BindEvent(GlobalEventSystem, EventName.ORIENTATION_DID_CHANGE, onOrientationChange) local function activity_icon_changeFunc(is_hide) if self.gameObject then self.gameObject:SetActive(is_hide) end end self:BindEvent(GlobalEventSystem, EventName.NOTIFY_ACTIVITY_ICON_HIDE_STATE, activity_icon_changeFunc) local function onSceneStartHandler( ) --场景加载完之后,没内容就关界面吧 if (TableSize(self.wait_add_list) == 0) and (TableSize(self.cur_node_list) == 0) then self:Close() end end self:BindEvent(GlobalEventSystem, EventName.SCENE_LOAD_VIEW_COMPLETE, onSceneStartHandler) local function onLittleMove(is_out) self:LittleMove(is_out) end self:BindEvent(GlobalEventSystem, EventName.PLAY_MAINUI_MOVIE_EVENT, onLittleMove) end function ExitConView:LittleMove( is_out) if self.tween_lite_id_1 then TweenLite.Stop(self.tween_lite_id_1) self.tween_lite_id_1 = nil end if is_out then self.transform.anchoredPosition = Vector2(-ClientConfig.iphone_x_offset_right, 0) self.tween_lite_id_1 = TweenLite.to(self, self.transform, TweenLite.UiAnimationType.ANCHORED_POSY, MainUIModel.LITTLE_MOVE_OUT_DIST, MainUIModel.LITTLE_MOVE_OUT_TIME) else self.transform.anchoredPosition = Vector2( -ClientConfig.iphone_x_offset_right, MainUIModel.LITTLE_MOVE_DIST) self.tween_lite_id_1 = TweenLite.to(self, self.transform, TweenLite.UiAnimationType.ANCHORED_POSY, 0, MainUIModel.LITTLE_MOVE_TIME) end end function ExitConView:OpenSuccess() self:UpdateView() end function ExitConView:UpdatePosition( ) for i,v in ipairs(self.cur_node_list) do SetAnchoredPosition( v.node.transform, - 67 * (i-1) -249.5 + v.off_x,-31.5 + v.off_y ) end end function ExitConView:AddNode( node,parent_node,tag_str,off_x,off_y ) local data = {tag_str = tag_str,node = node,parent_node = parent_node,off_x = off_x or 0,off_y = off_y or 0} if not self.is_loaded then for k,v in pairs(self.wait_add_list) do if v.tag_str == tag_str then print('---- ExitConView.lua -- 预备队列重复添加节点,请检查') return end end table.insert( self.wait_add_list, data ) else for k,v in pairs(self.cur_node_list) do if v.tag_str == tag_str then print('---- ExitConView.lua -- 重复添加节点,请检查') return end end node.transform:SetParent(self.transform) table.insert( self.cur_node_list, data ) self:UpdatePosition() end end function ExitConView:RemoveNode( node,tag_str ) if not self.is_loaded then self.wait_add_list[tag_str] = nil for k,v in pairs(self.wait_add_list) do if v.tag_str == tag_str then table.remove(self.wait_add_list,k) break end end else --节点不见了?? for k,v in pairs(self.cur_node_list) do if v.tag_str == tag_str then --送回父节点去 local data = table.remove(self.cur_node_list,k) data.node.transform:SetParent(data.parent_node.transform) return end end self:UpdatePosition() end end function ExitConView:UpdateView() end function ExitConView:DestroySuccess( ) if self.tween_lite_id_1 then TweenLite.Stop(self.tween_lite_id_1) self.tween_lite_id_1 = nil end end