local ui = {}
local _V = function(...) return SL:GetMetaValue(...) end
local FUNCQUEUE = {}
local TAGOBJ = {}
function ui.init(parent, __data__, __update__)
if __update__ then return ui.update(__data__) end
-- Create Node_1
local Node_1 = GUI:Nod
🤖 回答引擎: 浮生梦专用2 |
🕒 时间: 2026-03-04 00:48:16 |
👁️ 阅读: 10
--前端开始]]
local npc = { } -- 类
npc.CONFIG = { -- 配置
MSG_ID = 6008, -- 通信协议号
UI_NAME = "my_bshc", -- UI界面名称
}
function npc:Lmain() -- 前端的入口处
local ui = GUI:npcUi(self.CONFIG.UI_NAME) -- 调用export
self.ui = ui
-- 关闭按钮
GUI:onClick(ui.close, function()
GUI:closeAll()
end)
-- 马凯回收按钮
GUI:onClick(ui.Button_1, function()
SL:toServer(self.CONFIG.MSG_ID, 1)
end)
-- 打造马凯按钮
GUI:onClick(ui.Button_2, function()
SL:toServer(self.CONFIG.MSG_ID, 2)
end)
-- 另一个打造马凯按钮(horse_btn)
GUI:onClick(ui.horse_btn, function()
SL:toServer(self.CONFIG.MSG_ID, 2)
end)
end
--前端结束]]
function npc:Smain(actor,p1,p2,p3,str)
local player = class(actor) -- 面向对象获取人物对象
if not player then return end
-- 路由分发机制
local dis = {
[1] = self.func1, -- 方法1:马凯回收
[2] = self.func2, -- 方法2:打造马凯
}
local handler = dis[p1]
if handler then
handler(self, actor, player, p2, p3, str)
else
player:send("未知的操作请求! 错误码:" .. tostring(p1))
-- 下日志!
end
end
function npc:func1(actor, player, p2, p3, str) -- 马凯回收
-- 这里实现马凯回收的业务逻辑
player:send("执行马凯回收")
end
function npc:func2(actor, player, p2, p3, str) -- 打造马凯
-- 这里实现打造马凯的业务逻辑
player:send("执行打造马凯")
end
return npc
--前端开始]]
local npc = { } -- 类
npc.CONFIG = { -- 配置
MSG_ID = 6008, -- 通信协议号
UI_NAME = "my_bshc", -- UI界面名称
}
function npc:Lmain() -- 前端的入口处
local ui = GUI:npcUi(self.CONFIG.UI_NAME) -- 调用export
self.ui = ui
-- 关闭按钮
GUI:onClick(ui.close, function()
GUI:closeAll()
end)
-- 马凯回收按钮
GUI:onClick(ui.Button_1, function()
SL:toServer(self.CONFIG.MSG_ID, 1)
end)
-- 打造马凯按钮
GUI:onClick(ui.Button_2, function()
SL:toServer(self.CONFIG.MSG_ID, 2)
end)
-- 另一个打造马凯按钮(horse_btn)
GUI:onClick(ui.horse_btn, function()
SL:toServer(self.CONFIG.MSG_ID, 2)
end)
end
--前端结束]]
function npc:Smain(actor,p1,p2,p3,str)
local player = class(actor) -- 面向对象获取人物对象
if not player then return end
-- 路由分发机制
local dis = {
[1] = self.func1, -- 方法1:马凯回收
[2] = self.func2, -- 方法2:打造马凯
}
local handler = dis[p1]
if handler then
handler(self, actor, player, p2, p3, str)
else
player:send("未知的操作请求! 错误码:" .. tostring(p1))
-- 下日志!
end
end
function npc:func1(actor, player, p2, p3, str) -- 马凯回收
-- 这里实现马凯回收的业务逻辑
player:send("执行马凯回收")
end
function npc:func2(actor, player, p2, p3, str) -- 打造马凯
-- 这里实现打造马凯的业务逻辑
player:send("执行打造马凯")
end
return npc
← 返回问答库