169 lines
5.4 KiB
Lua
169 lines
5.4 KiB
Lua
JiuMiOBJ = Up_BaseClassOBJ:new()
|
|
|
|
JiuMiOBJ.__cname = "JiuMiOBJ"
|
|
|
|
-- 配置文件
|
|
JiuMiOBJ.cfg = {}
|
|
|
|
JiuMiOBJ.UIfile = "game/B/JiuMiUI"
|
|
JiuMiOBJ.lightpos = {
|
|
{ 98, 176 },
|
|
{ 136, 204 },
|
|
{ 180, 200 },
|
|
{ 210, 164 },
|
|
{ 206, 116 },
|
|
{ 168, 88 },
|
|
{ 120, 94 },
|
|
{ 92, 130 },
|
|
}
|
|
|
|
JiuMiOBJ.btnpos = {
|
|
{ 121, 214 },
|
|
{ 190, 186 },
|
|
{ 216, 120 },
|
|
{ 188, 52 },
|
|
{ 122, 26 },
|
|
{ 56, 56 },
|
|
{ 30, 120 },
|
|
{ 56, 186 },
|
|
{ 120, 118 },
|
|
|
|
}
|
|
|
|
|
|
|
|
function JiuMiOBJ:updata()
|
|
GUI:removeAllChildren(self.ui.btn_bg)
|
|
for i = 1, 9, 1 do
|
|
if self.id == i and i <= #self.lightpos then
|
|
self.ui.light_bg = GUI:Image_Create(self.ui.btn_bg, "light_bg", self.lightpos[i][1], self.lightpos[i][2], "res/private/JiuMiUI/8_0.png")
|
|
GUI:setRotation(self.ui.light_bg, (i - 1) * 45)
|
|
end
|
|
|
|
local select_btn = string.format("select_btn_%d", i)
|
|
self.ui[select_btn] = GUI:Button_Create(self.ui.btn_bg, select_btn, self.btnpos[i][1], self.btnpos[i][2], string.format("res/private/JiuMiUI/a%d.png", i))
|
|
if self.id ~= i then
|
|
GUI:setGrey(self.ui[select_btn], true)
|
|
GUI:addOnClickEvent(self.ui[select_btn], function()
|
|
self.id = i
|
|
self:updata()
|
|
end)
|
|
end
|
|
end
|
|
self:GetBuff()
|
|
self:GetInfo()
|
|
self:wen()
|
|
end
|
|
|
|
function JiuMiOBJ:wen()
|
|
-- Button_10
|
|
GUI:setVisible(self.ui.w_Layout, false)
|
|
GUI:addOnClickEvent(self.ui.Button_10, function()
|
|
GUI:setVisible(self.ui.w_Layout, true)
|
|
GUI:addOnClickEvent(self.ui.w_Layout, function()
|
|
GUI:setVisible(self.ui.w_Layout, false)
|
|
end)
|
|
end)
|
|
end
|
|
|
|
---* 获取当前等级
|
|
function JiuMiOBJ:GetInfo()
|
|
local levelData = hk.getkeytbl("HUMAN(STR_九秘等级)") or {}
|
|
|
|
local level = levelData[self.id] and levelData[self.id] or 0
|
|
GUI:Text_setString(self.ui.level_Text, string.format("%d级", level))
|
|
local cfg = self.cfg.up[self.id]
|
|
if level < cfg.level then
|
|
local shibai_num = hk.getkeycount("HUMAN(STR_九秘升级失败记录)", self.id) or 0
|
|
|
|
local cgl = cfg.cgl + (shibai_num * 0.1)
|
|
if cgl > 100 then
|
|
cgl = 100
|
|
end
|
|
GUI:Text_setString(self.ui.Up_Cgl_Text, string.format("%.1f%%", cgl))
|
|
self.xh = cfg.xh
|
|
GUI:Button_loadTextureNormal(self.ui.Up_btn, "res/private/JiuMiUI/4.png")
|
|
GUI:Button_loadTexturePressed(self.ui.Up_btn, "res/private/JiuMiUI/5.png")
|
|
GUI:addOnClickEvent(self.ui.Up_btn, function()
|
|
ssrMessage:SubLink(self.__cname .. "_up", self.id)
|
|
end)
|
|
else
|
|
self.xh = self.cfg.xl.xh
|
|
GUI:Text_setString(self.ui.Up_Cgl_Text, string.format("%d%%", 100))
|
|
GUI:Button_loadTextureNormal(self.ui.Up_btn, "res/private/JiuMiUI/6.png")
|
|
GUI:Button_loadTexturePressed(self.ui.Up_btn, "res/private/JiuMiUI/7.png")
|
|
GUI:addOnClickEvent(self.ui.Up_btn, function()
|
|
-- GUI:setTouchEnabled(self.ui.Up_btn, false)
|
|
ssrMessage:SubLink(self.__cname .. "_xl", self.id)
|
|
end)
|
|
end
|
|
self:seIitemShow(1)
|
|
end
|
|
|
|
|
|
---* 获取当前已获得的BUFF
|
|
function JiuMiOBJ:GetBuff()
|
|
local BuffData = hk.getkeytbl("HUMAN(STR_九秘BUFF)") or {}
|
|
GUI:ListView_removeAllItems(self.ui.Buff_Layout)
|
|
for i = 1, 9, 1 do
|
|
local BuffName = BuffData[i] and string.format("<a href='openwin#boss'><font color='#00ff00' size='16'><u>%s</u></font></a>", BuffData[i]) or "<font color='#ff0000' size='16'>暂未获得</font>"
|
|
|
|
|
|
local buff_Layout = string.format("buff_Layout_%d", i)
|
|
self.ui[buff_Layout] = GUI:Layout_Create(self.ui.Buff_Layout, buff_Layout, 0, 284, 164, 28, false)
|
|
|
|
local Layout_Size = GUI:getContentSize(self.ui[buff_Layout])
|
|
|
|
local buff_Text = string.format("buff_Text_%d", i)
|
|
|
|
self.ui[buff_Text] = GUI:RichText_Create(self.ui[buff_Layout], buff_Text, Layout_Size.width / 2, Layout_Size.height / 2, BuffName, 160, 16, "#ffffff", 5, nil)
|
|
GUI:RichText_setOpenUrlEvent(self.ui[buff_Text], function(sender, BuffName)
|
|
local Text_pos = GUI:getPosition(self.ui[buff_Text])
|
|
local data = {
|
|
width = 1136,
|
|
str = self.cfg.xl.cfg[BuffData[i]].buff,
|
|
worldPos = GUI:getWorldPosition(self.ui[buff_Layout]),
|
|
anchorPoint = { x = 0, y = 1 }
|
|
}
|
|
UIOperator:OpenCommonDescTipsUI(data)
|
|
end)
|
|
|
|
GUI:setAnchorPoint(self.ui[buff_Text], 0.50, 0.50)
|
|
end
|
|
end
|
|
|
|
---* 注册事件
|
|
function JiuMiOBJ:EventBind()
|
|
local function JiuMiOBJ_Var_Change(data)
|
|
if GUI:Win_IsNotNull(self._parent) then
|
|
if data.key == "HUMAN(STR_九秘等级)" then
|
|
self:GetInfo()
|
|
end
|
|
if data.key == "HUMAN(STR_九秘BUFF)" then
|
|
-- GUI:setTouchEnabled(self.ui.Up_btn, true)
|
|
self:GetBuff()
|
|
end
|
|
end
|
|
end
|
|
SL:RegisterLUAEvent(LUA_EVENT_SERVER_VALUE_CHANGE, self.__cname, JiuMiOBJ_Var_Change, self._parent)
|
|
|
|
|
|
--关闭窗口
|
|
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
|
|
self:OnClose(widgetName)
|
|
end)
|
|
end
|
|
|
|
--关闭窗口
|
|
function JiuMiOBJ:OnClose(widgetName)
|
|
if widgetName == self.__cname then
|
|
self:UnRegisterEvent()
|
|
end
|
|
end
|
|
|
|
function JiuMiOBJ:UnRegisterEvent()
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_SERVER_VALUE_CHANGE, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
|
|
end
|
|
|
|
return JiuMiOBJ
|