master
parent
c1c3d3ca76
commit
78057035d4
|
|
@ -2,31 +2,33 @@
|
||||||
--author:--
|
--author:--
|
||||||
|
|
||||||
BaseWindow = {
|
BaseWindow = {
|
||||||
--view description
|
--view description
|
||||||
_view = nil,
|
_view = nil,
|
||||||
|
|
||||||
--View 是否被销毁
|
--View 是否被销毁
|
||||||
_is_destroy = false,
|
_is_destroy = false,
|
||||||
--是否播放动画
|
--是否播放动画
|
||||||
_animation = true,
|
_animation = true,
|
||||||
--弹出动画,0关闭,1左边,2右边
|
--弹出动画,0关闭,1左边,2右边
|
||||||
_anim_pop = 0,
|
_anim_pop = 0,
|
||||||
--关闭摧毁
|
--关闭摧毁
|
||||||
_close_destroy = false,
|
_close_destroy = false,
|
||||||
|
|
||||||
--点击窗口以外关闭
|
--点击窗口以外关闭
|
||||||
_close_zone = true,
|
_close_zone = true,
|
||||||
|
|
||||||
--队列
|
--队列
|
||||||
_queue = true,
|
_queue = true,
|
||||||
--全屏
|
--全屏
|
||||||
_full = false,
|
_full = false,
|
||||||
--全屏偏移
|
--缩放全屏
|
||||||
_full_offset = true,
|
_scale = false,
|
||||||
--新窗口隐藏队列
|
--全屏偏移
|
||||||
_new_hide = true,
|
_full_offset = true,
|
||||||
--模糊组件对象
|
--新窗口隐藏队列
|
||||||
_put_map = true
|
_new_hide = true,
|
||||||
|
--模糊组件对象
|
||||||
|
_put_map = true
|
||||||
}
|
}
|
||||||
|
|
||||||
--window 列表
|
--window 列表
|
||||||
|
|
@ -41,216 +43,223 @@ local WindowQueue = {
|
||||||
local M = BaseWindow
|
local M = BaseWindow
|
||||||
|
|
||||||
function BaseWindow.new(url, blur_view)
|
function BaseWindow.new(url, blur_view)
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "BaseWindow"
|
self.class = "BaseWindow"
|
||||||
-- self._blur_view = blur_view
|
-- self._blur_view = blur_view
|
||||||
self:init(url)
|
self:init(url)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local win_url = {
|
local win_url = {
|
||||||
"ui://Common/Gcm_Window",
|
"ui://Common/Gcm_Window",
|
||||||
"ui://Common/Gcm_Window_Full"
|
"ui://Common/Gcm_Window_Full"
|
||||||
}
|
}
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
self._root_view = UIPackage.CreateObjectFromURL(self._full and win_url[2] or win_url[1])
|
self._root_view = UIPackage.CreateObjectFromURL(self._full and win_url[2] or win_url[1])
|
||||||
local contentPane = self._root_view:GetChild("contentPane")
|
local contentPane = self._root_view:GetChild("contentPane")
|
||||||
local ctr_hide_bg = self._root_view:GetController("hide_bg")
|
local ctr_hide_bg = self._root_view:GetController("hide_bg")
|
||||||
if self._anim_pop ~= 0 then
|
if self._anim_pop ~= 0 then
|
||||||
ctr_hide_bg.selectedIndex = 1
|
ctr_hide_bg.selectedIndex = 1
|
||||||
PopPanel = contentPane:GetChild("PopPanel")
|
PopPanel = contentPane:GetChild("PopPanel")
|
||||||
else
|
else
|
||||||
ctr_hide_bg.selectedIndex = 0
|
ctr_hide_bg.selectedIndex = 0
|
||||||
end
|
end
|
||||||
printlog(url)
|
printlog(url)
|
||||||
self._view = UIPackage.CreateObjectFromURL(url)
|
self._view = UIPackage.CreateObjectFromURL(url)
|
||||||
printlog(self._view)
|
printlog(self._view)
|
||||||
-- self._view.fairyBatching = true
|
-- self._view.fairyBatching = true
|
||||||
local btn_close = self._view:GetChild("btn_close")
|
local btn_close = self._view:GetChild("btn_close")
|
||||||
if (btn_close) then
|
if (btn_close) then
|
||||||
btn_close.onClick:Set(function()
|
btn_close.onClick:Set(function()
|
||||||
self:CloseEvent()
|
self:CloseEvent()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local win_mode = self._root_view:GetChild("win_mode")
|
local win_mode = self._root_view:GetChild("win_mode")
|
||||||
win_mode.onClick:Set(function()
|
win_mode.onClick:Set(function()
|
||||||
if not self._close_zone then
|
if not self._close_zone then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
win_mode.touchable = false
|
win_mode.touchable = false
|
||||||
self:CloseEvent()
|
self:CloseEvent()
|
||||||
end)
|
end)
|
||||||
printlog("======================================", self._full)
|
printlog("======================================", self._full)
|
||||||
if self._full then
|
if self._full then
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
if self._anim_pop == 0 then
|
if self._anim_pop == 0 then
|
||||||
self._view:AddRelation(contentPane, RelationType.Size)
|
self._view:AddRelation(contentPane, RelationType.Size)
|
||||||
contentPane:AddChild(self._view)
|
contentPane:AddChild(self._view)
|
||||||
else
|
else
|
||||||
contentPane:RemoveRelation(self._root_view, RelationType.Center_Center)
|
contentPane:RemoveRelation(self._root_view, RelationType.Center_Center)
|
||||||
contentPane:AddRelation(self._root_view, RelationType.Middle_Middle)
|
contentPane:AddRelation(self._root_view, RelationType.Middle_Middle)
|
||||||
PopPanel:AddChild(self._view)
|
PopPanel:AddChild(self._view)
|
||||||
local click_item = PopPanel:GetChild("click_item")
|
local click_item = PopPanel:GetChild("click_item")
|
||||||
if self._anim_pop == 1 then
|
if self._anim_pop == 1 then
|
||||||
contentPane:AddRelation(self._root_view, RelationType.Left_Left)
|
contentPane:AddRelation(self._root_view, RelationType.Left_Left)
|
||||||
self._view.x = 0
|
self._view.x = 0
|
||||||
elseif self._anim_pop == 2 then
|
elseif self._anim_pop == 2 then
|
||||||
contentPane:AddRelation(self._root_view, RelationType.Right_Right)
|
contentPane:AddRelation(self._root_view, RelationType.Right_Right)
|
||||||
self._view.x = GRoot.inst.width - self._view.width - offset
|
self._view.x = GRoot.inst.width - self._view.width - offset
|
||||||
end
|
end
|
||||||
print("lingmeng", PopPanel.height, self._view.height)
|
print("lingmeng", PopPanel.height, self._view.height)
|
||||||
self._view.y = (PopPanel.height - self._view.height) * 0.5
|
self._view.y = (PopPanel.height - self._view.height) * 0.5
|
||||||
click_item.xy = self._view.xy
|
click_item.xy = self._view.xy
|
||||||
click_item.width = self._view.width
|
click_item.width = self._view.width
|
||||||
click_item.height = self._view.height
|
click_item.height = self._view.height
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
contentPane:AddChild(self._view)
|
contentPane:AddChild(self._view)
|
||||||
contentPane.height = self._view.height
|
contentPane.height = self._view.height
|
||||||
contentPane.width = self._view.width
|
contentPane.width = self._view.width
|
||||||
contentPane:Center()
|
contentPane:Center()
|
||||||
end
|
end
|
||||||
self._contentPane = contentPane
|
self._contentPane = contentPane
|
||||||
if self._put_map then
|
if self._put_map then
|
||||||
WindowMap[#WindowMap + 1] = self
|
WindowMap[#WindowMap + 1] = self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 显示窗口
|
-- 显示窗口
|
||||||
function M:Show()
|
function M:Show()
|
||||||
-- print("===========================================entershow",M.class)
|
-- print("===========================================entershow",M.class)
|
||||||
local contentPane = self._root_view:GetChild("contentPane")
|
local contentPane = self._root_view:GetChild("contentPane")
|
||||||
if self._anim_pop == 1 then
|
if self._anim_pop == 1 then
|
||||||
contentPane:GetTransition("left_pop"):Play()
|
contentPane:GetTransition("left_pop"):Play()
|
||||||
elseif self._anim_pop == 2 then
|
elseif self._anim_pop == 2 then
|
||||||
contentPane:GetTransition("right_pop"):Play()
|
contentPane:GetTransition("right_pop"):Play()
|
||||||
elseif self._animation then
|
elseif self._animation then
|
||||||
local ani_in = self._root_view:GetTransition("in")
|
local ani_in = self._root_view:GetTransition("in")
|
||||||
if ani_in then
|
if ani_in then
|
||||||
ani_in:Play()
|
ani_in:Play()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- if self._blur_view then
|
-- if self._blur_view then
|
||||||
-- BlurView(self._blur_view,true)
|
-- BlurView(self._blur_view,true)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- 判断当前窗口是否已经在队列中,如果在就不重复添加
|
-- 判断当前窗口是否已经在队列中,如果在就不重复添加
|
||||||
local _inQueue = false
|
local _inQueue = false
|
||||||
|
|
||||||
if self._new_hide then
|
if self._new_hide then
|
||||||
for i = 1, #WindowQueue do
|
for i = 1, #WindowQueue do
|
||||||
local win = WindowQueue[i]
|
local win = WindowQueue[i]
|
||||||
if win == self then
|
if win == self then
|
||||||
_inQueue = true
|
_inQueue = true
|
||||||
end
|
end
|
||||||
if win._queue then
|
if win._queue then
|
||||||
win._root_view:RemoveFromParent()
|
win._root_view:RemoveFromParent()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self._queue and not _inQueue then
|
if self._queue and not _inQueue then
|
||||||
WindowQueue[#WindowQueue + 1] = self
|
WindowQueue[#WindowQueue + 1] = self
|
||||||
end
|
end
|
||||||
AddPanel(self._root_view)
|
AddPanel(self._root_view)
|
||||||
if self._full then
|
|
||||||
local offset = get_offset(self._full_offset)
|
if self._scale then
|
||||||
self._contentPane.width = GRoot.inst.width - 2 * offset
|
local scaleY = GRoot.inst.height / self._contentPane.height
|
||||||
self._contentPane.height = GRoot.inst.height
|
local scaleX = GRoot.inst.width / self._contentPane.width
|
||||||
self._contentPane.x = offset
|
self._contentPane:SetScale(scaleX, scaleY)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self._full then
|
||||||
|
local offset = get_offset(self._full_offset)
|
||||||
|
self._contentPane.width = GRoot.inst.width - 2 * offset
|
||||||
|
self._contentPane.height = GRoot.inst.height
|
||||||
|
self._contentPane.x = offset
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 关闭窗口
|
-- 关闭窗口
|
||||||
function M:Close()
|
function M:Close()
|
||||||
-- if self._blur_view then
|
-- if self._blur_view then
|
||||||
-- BlurView(self._blur_view,false)
|
-- BlurView(self._blur_view,false)
|
||||||
-- end
|
-- end
|
||||||
if self._queue then
|
if self._queue then
|
||||||
for i, v in ipairs(WindowQueue) do
|
for i, v in ipairs(WindowQueue) do
|
||||||
if v == self then
|
if v == self then
|
||||||
table.remove(WindowQueue, i)
|
table.remove(WindowQueue, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._new_hide then
|
if self._new_hide then
|
||||||
local win = WindowQueue[#WindowQueue]
|
local win = WindowQueue[#WindowQueue]
|
||||||
if win and win._queue then
|
if win and win._queue then
|
||||||
AddPanel(win._root_view)
|
AddPanel(win._root_view)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self._root_view:RemoveFromParent()
|
self._root_view:RemoveFromParent()
|
||||||
end
|
end
|
||||||
|
|
||||||
local _destroy_all = false
|
local _destroy_all = false
|
||||||
-- 销毁窗口
|
-- 销毁窗口
|
||||||
function M:Destroy()
|
function M:Destroy()
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not _destroy_all then
|
if not _destroy_all then
|
||||||
self:Close()
|
self:Close()
|
||||||
if self._put_map then
|
if self._put_map then
|
||||||
for i, v in ipairs(WindowMap) do
|
for i, v in ipairs(WindowMap) do
|
||||||
if v == self then
|
if v == self then
|
||||||
table.remove(WindowMap, i)
|
table.remove(WindowMap, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self._is_destroy = true
|
self._is_destroy = true
|
||||||
self._root_view:Dispose()
|
self._root_view:Dispose()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CloseEvent()
|
function M:CloseEvent()
|
||||||
local win_mode = self._root_view:GetChild("win_mode")
|
local win_mode = self._root_view:GetChild("win_mode")
|
||||||
if self._anim_pop == 0 then
|
if self._anim_pop == 0 then
|
||||||
if self._close_destroy then
|
if self._close_destroy then
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
else
|
else
|
||||||
self:Close()
|
self:Close()
|
||||||
win_mode.touchable = true
|
win_mode.touchable = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:ActionWithAnim(function()
|
self:ActionWithAnim(function()
|
||||||
if self._close_destroy then
|
if self._close_destroy then
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
else
|
else
|
||||||
self:Close()
|
self:Close()
|
||||||
win_mode.touchable = true
|
win_mode.touchable = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ActionWithAnim(callback)
|
function M:ActionWithAnim(callback)
|
||||||
local contentPane = self._root_view:GetChild("contentPane")
|
local contentPane = self._root_view:GetChild("contentPane")
|
||||||
if self._anim_pop == 1 then
|
if self._anim_pop == 1 then
|
||||||
contentPane:GetTransition("left_pop_back"):Play()
|
contentPane:GetTransition("left_pop_back"):Play()
|
||||||
elseif self._anim_pop == 2 then
|
elseif self._anim_pop == 2 then
|
||||||
contentPane:GetTransition("right_pop_back"):Play()
|
contentPane:GetTransition("right_pop_back"):Play()
|
||||||
end
|
end
|
||||||
if callback then
|
if callback then
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
callback()
|
callback()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseWindow.DestroyAll()
|
function BaseWindow.DestroyAll()
|
||||||
_destroy_all = true
|
_destroy_all = true
|
||||||
local list = WindowMap
|
local list = WindowMap
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
local win = list[i]
|
local win = list[i]
|
||||||
win:Destroy()
|
win:Destroy()
|
||||||
end
|
end
|
||||||
_destroy_all = false
|
_destroy_all = false
|
||||||
WindowQueue = {}
|
WindowQueue = {}
|
||||||
WindowMap = {}
|
WindowMap = {}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,25 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="1980,234">
|
<component size="1980,234">
|
||||||
<displayList>
|
<displayList>
|
||||||
<image id="n0_yk1o" name="n0" src="yk1o7d3r" fileName="MyFamily/Image/Rectangle 259.png" xy="0,0" size="1980,249"/>
|
<image id="n0_yk1o" name="n0" src="yk1o7d3r" fileName="MyFamily/Image/Rectangle 259.png" xy="0,0" size="1980,249">
|
||||||
<loader id="n1_yk1o" name="loader_icon" xy="30,24" size="186,186" align="center" vAlign="middle" fill="scaleMatchHeight"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
<image id="n2_yk1o" name="n2" src="yk1o7d3s" fileName="MyFamily/Image/Rectangle 260.png" xy="246,24" size="1710,186"/>
|
</image>
|
||||||
<component id="n3_yk1o" name="btn_rank" src="yk1o7d3x" fileName="MyFamily/Component/btn_familyRank.xml" xy="912,57"/>
|
<image id="n2_yk1o" name="n2" src="yk1o7d3s" fileName="MyFamily/Image/Rectangle 260.png" xy="246,24" size="1710,186">
|
||||||
<component id="n4_yk1o" name="btn_record" src="yk1o7d3y" fileName="MyFamily/Component/btn_familyRecord.xml" xy="1299,57"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
<component id="n5_yk1o" name="btn_familyManage" src="yk1o7d3z" fileName="MyFamily/Component/btn_familyManage.xml" xy="1623,57"/>
|
</image>
|
||||||
<image id="n6_yk1o" name="n6" src="yk1o7d40" fileName="MyFamily/Image/hall_club_common_club_liebiao_icon_renshu.png" xy="555,54"/>
|
<loader id="n1_yk1o" name="loader_icon" xy="30,24" size="186,186" group="n10_q3uh" align="center" vAlign="middle" fill="scaleMatchHeight"/>
|
||||||
<text id="n7_yk1o" name="tex_familyId" xy="282,52" size="243,49" font="ui://27vd145bg2mo7ij0" fontSize="36" color="#940f0e" vAlign="middle" autoSize="none" text="940F0E"/>
|
<image id="n6_yk1o" name="n6" src="yk1o7d40" fileName="MyFamily/Image/hall_club_common_club_liebiao_icon_renshu.png" xy="555,54" group="n10_q3uh"/>
|
||||||
<text id="n8_yk1o" name="tex_familyName" xy="282,112" size="292,64" font="ui://27vd145bg2mo7ij0" fontSize="48" color="#333333" vAlign="middle" autoSize="none" text="333333"/>
|
<text id="n7_yk1o" name="tex_familyId" xy="282,52" size="243,49" group="n10_q3uh" font="ui://27vd145bg2mo7ij0" fontSize="36" color="#940f0e" vAlign="middle" autoSize="none" text="940F0E"/>
|
||||||
<text id="n9_yk1o" name="tex_familyNumber" xy="595,43" size="272,56" font="ui://27vd145bg2mo7ij0" fontSize="42" color="#333333" vAlign="middle" autoSize="none" text="333333"/>
|
<text id="n8_yk1o" name="tex_familyName" xy="282,112" size="292,64" group="n10_q3uh" font="ui://27vd145bg2mo7ij0" fontSize="48" color="#333333" vAlign="middle" autoSize="none" text="333333"/>
|
||||||
|
<text id="n9_yk1o" name="tex_familyNumber" xy="595,43" size="272,56" group="n10_q3uh" font="ui://27vd145bg2mo7ij0" fontSize="42" color="#333333" vAlign="middle" autoSize="none" text="333333"/>
|
||||||
|
<group id="n10_q3uh" name="n10" xy="30,24" size="837,186" advanced="true">
|
||||||
|
<relation target="" sidePair="left-left"/>
|
||||||
|
</group>
|
||||||
|
<component id="n3_yk1o" name="btn_rank" src="yk1o7d3x" fileName="MyFamily/Component/btn_familyRank.xml" xy="912,57" group="n11_q3uh"/>
|
||||||
|
<component id="n4_yk1o" name="btn_record" src="yk1o7d3y" fileName="MyFamily/Component/btn_familyRecord.xml" xy="1299,57" group="n11_q3uh"/>
|
||||||
|
<component id="n5_yk1o" name="btn_familyManage" src="yk1o7d3z" fileName="MyFamily/Component/btn_familyManage.xml" xy="1623,57" group="n11_q3uh"/>
|
||||||
|
<group id="n11_q3uh" name="n11" xy="912,57" size="1021,120" advanced="true">
|
||||||
|
<relation target="" sidePair="right-right"/>
|
||||||
|
</group>
|
||||||
</displayList>
|
</displayList>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -11,13 +11,18 @@
|
||||||
<relation target="n2_yk1o" sidePair="right-right"/>
|
<relation target="n2_yk1o" sidePair="right-right"/>
|
||||||
</image>
|
</image>
|
||||||
<group id="n1_yk1o" name="n1" xy="967,27" size="598,99"/>
|
<group id="n1_yk1o" name="n1" xy="967,27" size="598,99"/>
|
||||||
<image id="n5_yk1o" name="n5" src="mc627d05" fileName="Main/Image/Rectangle 91.png" xy="228,186" size="2076,960"/>
|
<image id="n5_yk1o" name="n5" src="mc627d05" fileName="Main/Image/Rectangle 91.png" xy="228,186" size="2076,960">
|
||||||
<image id="n6_yk1o" name="n6" src="ieus7d1e" fileName="Main/Image/Rectangle 121.png" xy="246,204" size="2040,924"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
<component id="n4_yk1o" name="btn_close" src="in3i7cu9" fileName="Main/Component/btn_close.xml" xy="54,6"/>
|
</image>
|
||||||
<list id="n7_yk1o" name="list_familys" xy="246,234" size="2040,865" layout="flow_vt" overflow="scroll" lineGap="36" defaultItem="ui://htcn7v3ryk1o7d3q" align="center" autoClearItems="true">
|
<image id="n6_yk1o" name="n6" src="ieus7d1e" fileName="Main/Image/Rectangle 121.png" xy="246,204" size="2040,924">
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
|
</image>
|
||||||
|
<list id="n7_yk1o" name="list_familys" xy="276,234" size="1980,865" overflow="scroll" lineGap="36" defaultItem="ui://htcn7v3ryk1o7d3q" align="center" autoClearItems="true">
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
</list>
|
</list>
|
||||||
|
<component id="n4_yk1o" name="btn_close" src="in3i7cu9" fileName="Main/Component/btn_close.xml" xy="54,6"/>
|
||||||
</displayList>
|
</displayList>
|
||||||
</component>
|
</component>
|
||||||
Binary file not shown.
Loading…
Reference in New Issue