171 lines
5 KiB
Lua
171 lines
5 KiB
Lua
local ssrUIManager = {}
|
|
|
|
|
|
ssrUIManager.addShow = true
|
|
ssrUIManager.Red = {}
|
|
ssrUIManager.Red_reloadCd = 0
|
|
ssrUIManager.Red_widget = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 初始化UIManager
|
|
function ssrUIManager:INIT()
|
|
SL:ScheduleOnce(function() ssrUIManager:createSkillBtn() end, 0.5)
|
|
return self
|
|
end
|
|
|
|
-- 打开UI界面
|
|
-- @param objcfg: UI界面的配置信息
|
|
-- @param data: 传递给UI界面的数据
|
|
function ssrUIManager:OPEN(objcfg, data, ...)
|
|
SL:JumpTo(objcfg)
|
|
end
|
|
|
|
--- 窗口初始化居中与动作
|
|
function ssrUIManager:OpenAlgin(obj)
|
|
if obj then
|
|
GUI:Timeline_Window2(obj._parent)
|
|
GUI:setContentSize(obj.ui.bg_close, SL:GetMetaValue("SCREEN_WIDTH"), SL:GetMetaValue("SCREEN_HEIGHT"))
|
|
local pos = GUI:getPosition(obj.ui.img_bg)
|
|
GUI:setPosition(obj.ui.nd_root, SL:GetMetaValue("SCREEN_WIDTH") / 2, SL:GetMetaValue("SCREEN_HEIGHT") / 2)
|
|
GUI:setAnchorPoint(obj.ui.nd_root, 0.50, 0.50)
|
|
|
|
|
|
-- 界面浮起
|
|
GUI:Win_SetZPanel(obj._parent, obj.ui.img_bg)
|
|
|
|
--界面拖拽
|
|
-- GUI:Win_SetDrag(obj._parent, obj.ui.img_bg)
|
|
end
|
|
end
|
|
|
|
|
|
local handle
|
|
|
|
-----------------------------------------------------------------
|
|
-----------------------↓↓↓ 右侧功能按钮 ↓↓↓-----------------------
|
|
-----------------------------------------------------------------
|
|
local right_icon_cfg = {
|
|
["btn_icon_1"] = {
|
|
1,
|
|
x = 0,
|
|
y = 160,
|
|
icon = "1900012583",
|
|
wnd = ssrConstCfg.Friend
|
|
}, -- 好友
|
|
["btn_icon_2"] = {
|
|
2,
|
|
x = 70,
|
|
y = 160,
|
|
icon = "1900013012",
|
|
wnd = ssrConstCfg.Skill
|
|
}, -- 技能
|
|
["btn_icon_3"] = {
|
|
3,
|
|
x = 140,
|
|
y = 160,
|
|
icon = "1900013014",
|
|
wnd = ssrConstCfg.Team
|
|
}, -- 组队
|
|
["btn_icon_4"] = {
|
|
4,
|
|
x = 0,
|
|
y = 80,
|
|
icon = "1900013015",
|
|
wnd = ssrConstCfg.Auction
|
|
}, -- 拍卖
|
|
["btn_icon_5"] = {
|
|
5,
|
|
x = 70,
|
|
y = 80,
|
|
icon = "1900012590",
|
|
wnd = ssrConstCfg.Mail
|
|
}, -- 邮件
|
|
["btn_icon_6"] = {
|
|
6,
|
|
x = 140,
|
|
y = 80,
|
|
icon = "1900013013",
|
|
wnd = ssrConstCfg.Guild
|
|
}, -- 行会
|
|
["btn_icon_8"] = {
|
|
8,
|
|
x = 70,
|
|
y = 0,
|
|
icon = "1900013017",
|
|
wnd = ssrConstCfg.Setting
|
|
}, -- 设置
|
|
["btn_icon_9"] = {
|
|
9,
|
|
x = 140,
|
|
y = 0,
|
|
icon = "1900013018",
|
|
wnd = ssrConstCfg.ExitToRole
|
|
} -- 退出
|
|
}
|
|
|
|
-- 创建右侧功能按钮
|
|
function ssrUIManager:createSkillBtn()
|
|
if ssrConstCfg.isWinMode == 2 then
|
|
local parent = GUI:Win_FindParent(109)
|
|
if parent then
|
|
GUI:removeAllChildren(parent)
|
|
for key, val in pairs(right_icon_cfg) do
|
|
-- private/main/bottom/1900013017.png
|
|
handle = GUI:Button_Create(parent, key, val.x, val.y, "res/private/main/bottom/" .. val.icon .. ".png")
|
|
GUI:addOnClickEvent(handle, function() ssrUIManager:OPEN(val.wnd) end)
|
|
end
|
|
end
|
|
|
|
parent = GUI:Win_FindParent(107)
|
|
if parent then
|
|
GUI:removeAllChildren(parent)
|
|
-- 角色
|
|
handle = GUI:Button_Create(parent, "role", -135, 60, "res/private/main/bottom/1900013010.png")
|
|
GUI:addOnClickEvent(handle, function() ssrUIManager:OPEN(ssrConstCfg.Equip) end)
|
|
|
|
-- 背包
|
|
handle = GUI:Button_Create(parent, "bag", -65, 60, "res/private/main/bottom/1900013011.png")
|
|
GUI:addOnClickEvent(handle, function() ssrUIManager:OPEN(ssrConstCfg.Bag) end)
|
|
|
|
-- 挂机
|
|
local battle_is_afk = SL:GetMetaValue("BATTLE_IS_AFK")
|
|
|
|
if battle_is_afk then
|
|
auto_attack = GUI:Button_Create(parent, "auto_attack", -135, -5, "res/private/main/Skill/1900012709.png")
|
|
GUI:addOnClickEvent(auto_attack, function()
|
|
SL:SetMetaValue("BATTLE_AFK_END")
|
|
end)
|
|
else
|
|
auto_attack = GUI:Button_Create(parent, "auto_attack", -135, -5, "res/private/main/Skill/1900012708.png")
|
|
GUI:addOnClickEvent(auto_attack, function()
|
|
SL:SetMetaValue("BATTLE_AFK_BEGIN")
|
|
end)
|
|
end
|
|
end
|
|
elseif ssrConstCfg.isWinMode == 1 then
|
|
parent = GUI:Win_FindParent(107)
|
|
|
|
if parent then
|
|
GUI:removeAllChildren(parent)
|
|
local battle_is_afk = SL:GetMetaValue("BATTLE_IS_AFK")
|
|
|
|
if battle_is_afk then
|
|
auto_attack = GUI:Button_Create(parent, "auto_attack", -70, -5, "res/private/main/Skill/1900012709.png")
|
|
GUI:addOnClickEvent(auto_attack, function()
|
|
SL:SetMetaValue("BATTLE_AFK_END")
|
|
end)
|
|
else
|
|
auto_attack = GUI:Button_Create(parent, "auto_attack", -70, -5, "res/private/main/Skill/1900012708.png")
|
|
GUI:addOnClickEvent(auto_attack, function()
|
|
SL:SetMetaValue("BATTLE_AFK_BEGIN")
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return ssrUIManager
|