Update NPC list data
62
Mirserver/Mir200/Envir/QuestDiary/游戏功能/A2_二大陆/神甲融合.lua
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
ShenJiaRongHeOBJ = Up_BaseClass:new()
|
||||
|
||||
|
||||
ShenJiaRongHeOBJ._name = "ShenJiaRongHeOBJ"
|
||||
-- NPCID
|
||||
|
||||
ShenJiaRongHeOBJ.id = { 192 }
|
||||
|
||||
for i, v in ipairs(ShenJiaRongHeOBJ.id or {}) do
|
||||
Npc.clicknpcCfg[v] = ShenJiaRongHeOBJ
|
||||
end
|
||||
|
||||
-- 配置文件
|
||||
ShenJiaRongHeOBJ.cfg = Func.require("cfg_神甲融合")
|
||||
|
||||
|
||||
|
||||
---* 加入上线同步数据
|
||||
Player.sycCfg[ShenJiaRongHeOBJ._name] = ShenJiaRongHeOBJ.cfg
|
||||
|
||||
|
||||
ShenJiaRongHeOBJ.CaChe = {}
|
||||
|
||||
---* 允许前端调用的函数
|
||||
ShenJiaRongHeOBJ.allowFunc = { "up" }
|
||||
|
||||
|
||||
function ShenJiaRongHeOBJ:up(actor, p1, p2, p3, data)
|
||||
LOGDump(data)
|
||||
local id = data[1]
|
||||
|
||||
if not id then
|
||||
return
|
||||
end
|
||||
|
||||
local cfg = table.Copy(self.cfg[id])
|
||||
LOGDump(cfg)
|
||||
|
||||
local _xh = {}
|
||||
|
||||
for i, v in ipairs(cfg.cost or {}) do
|
||||
table.insert(_xh, {v.itemname, v.itemnum, v.itembind})
|
||||
end
|
||||
|
||||
if Func.batchcheckitem(actor, _xh, true, true) then
|
||||
if Func.random(cfg.success or 20) then
|
||||
|
||||
local _gives = {}
|
||||
for i, v in ipairs(cfg.reward or {}) do
|
||||
table.insert(_gives, string.format("%s#%d#%d", v.givename, v.givenum, v.bind))
|
||||
end
|
||||
gives(actor, table.concat(_gives, "&"))
|
||||
Func.sendmsg9(actor, "[提示]:#70|神甲融合成功!")
|
||||
else
|
||||
Func.sendmsg9(actor, "[提示]:#70|神甲融合失败,请重新尝试!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return ShenJiaRongHeOBJ
|
||||
100
client/dev/GUIExport/game/B/ShenJiaRongHeUI.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
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 Layer
|
||||
local Layer = GUI:Node_Create(parent, "Layer", 0, 0)
|
||||
GUI:setTag(Layer, -1)
|
||||
|
||||
-- Create bg_close
|
||||
local bg_close = GUI:Layout_Create(Layer, "bg_close", 0, 0, 1136, 640, false)
|
||||
GUI:Layout_setBackGroundColorType(bg_close, 1)
|
||||
GUI:Layout_setBackGroundColor(bg_close, "#000000")
|
||||
GUI:Layout_setBackGroundColorOpacity(bg_close, 0)
|
||||
GUI:setAnchorPoint(bg_close, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(bg_close, true)
|
||||
GUI:setTag(bg_close, -1)
|
||||
|
||||
-- Create nd_root
|
||||
local nd_root = GUI:Node_Create(Layer, "nd_root", 568, 320)
|
||||
GUI:setTag(nd_root, 670)
|
||||
TAGOBJ["670"] = nd_root
|
||||
|
||||
-- Create img_bg
|
||||
local img_bg = GUI:Image_Create(nd_root, "img_bg", 0, 0, "res/custom/41/bg.png")
|
||||
GUI:setChineseName(img_bg, "背景图片")
|
||||
GUI:setAnchorPoint(img_bg, 0.50, 0.50)
|
||||
GUI:setTouchEnabled(img_bg, true)
|
||||
GUI:setTag(img_bg, -1)
|
||||
|
||||
-- Create btn_close
|
||||
local btn_close = GUI:Button_Create(img_bg, "btn_close", 758, 429, "res/public/1900000510.png")
|
||||
GUI:Button_loadTexturePressed(btn_close, "res/public/1900000511.png")
|
||||
GUI:setContentSize(btn_close, 26, 42)
|
||||
GUI:setIgnoreContentAdaptWithSize(btn_close, false)
|
||||
GUI:Button_setTitleText(btn_close, [[]])
|
||||
GUI:Button_setTitleColor(btn_close, "#ffffff")
|
||||
GUI:Button_setTitleFontSize(btn_close, 14)
|
||||
GUI:Button_titleDisableOutLine(btn_close)
|
||||
GUI:setAnchorPoint(btn_close, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(btn_close, true)
|
||||
GUI:setTag(btn_close, -1)
|
||||
|
||||
-- Create btn_ListView
|
||||
local btn_ListView = GUI:ListView_Create(img_bg, "btn_ListView", 61, 32, 141, 398, 1)
|
||||
GUI:setAnchorPoint(btn_ListView, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(btn_ListView, true)
|
||||
GUI:setTag(btn_ListView, 0)
|
||||
|
||||
-- Create Button_1
|
||||
local Button_1 = GUI:Button_Create(btn_ListView, "Button_1", 0, 350, "res/custom/41/btn/1.png")
|
||||
GUI:Button_setTitleText(Button_1, [[按钮]])
|
||||
GUI:Button_setTitleColor(Button_1, "#ffffff")
|
||||
GUI:Button_setTitleFontSize(Button_1, 16)
|
||||
GUI:Button_titleEnableOutline(Button_1, "#000000", 1)
|
||||
GUI:setAnchorPoint(Button_1, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(Button_1, true)
|
||||
GUI:setTag(Button_1, 0)
|
||||
|
||||
-- Create ItemShow
|
||||
local ItemShow = GUI:ItemShow_Create(img_bg, "ItemShow", 470, 290, {index = 1, count = 1, look = true, bgVisible = false, color = 255})
|
||||
GUI:setAnchorPoint(ItemShow, 0.50, 0.50)
|
||||
GUI:setTag(ItemShow, 0)
|
||||
|
||||
-- Create cost_Layout
|
||||
local cost_Layout = GUI:Layout_Create(img_bg, "cost_Layout", 317, 132, 304, 81, false)
|
||||
GUI:setAnchorPoint(cost_Layout, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(cost_Layout, false)
|
||||
GUI:setTag(cost_Layout, 0)
|
||||
|
||||
-- Create Text_success
|
||||
local Text_success = GUI:Text_Create(img_bg, "Text_success", 472, 106, 16, "#00ff00", [[成功率:20%]])
|
||||
GUI:Text_enableOutline(Text_success, "#000000", 1)
|
||||
GUI:setAnchorPoint(Text_success, 0.50, 0.50)
|
||||
GUI:setTouchEnabled(Text_success, false)
|
||||
GUI:setTag(Text_success, 0)
|
||||
|
||||
-- Create up_btn
|
||||
local up_btn = GUI:Button_Create(img_bg, "up_btn", 406, 41, "res/custom/41/2.png")
|
||||
GUI:Button_setTitleText(up_btn, [[]])
|
||||
GUI:Button_setTitleColor(up_btn, "#ffffff")
|
||||
GUI:Button_setTitleFontSize(up_btn, 16)
|
||||
GUI:Button_titleEnableOutline(up_btn, "#000000", 1)
|
||||
GUI:setAnchorPoint(up_btn, 0.00, 0.00)
|
||||
GUI:setTouchEnabled(up_btn, true)
|
||||
GUI:setTag(up_btn, 0)
|
||||
|
||||
ui.update(__data__)
|
||||
return Layer
|
||||
end
|
||||
|
||||
function ui.update(data)
|
||||
for _, func in pairs(FUNCQUEUE) do
|
||||
if func then func(data) end
|
||||
end
|
||||
end
|
||||
|
||||
return ui
|
||||
115
client/dev/GUILayout/game/B/ShenJiaRongHeOBJ.lua
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
ShenJiaRongHeOBJ = Up_BaseClassOBJ:new()
|
||||
|
||||
ShenJiaRongHeOBJ.__cname = "ShenJiaRongHeOBJ"
|
||||
|
||||
-- 配置文件
|
||||
ShenJiaRongHeOBJ.cfg = {}
|
||||
|
||||
ShenJiaRongHeOBJ.UIfile = "game/B/ShenJiaRongHeUI"
|
||||
|
||||
ShenJiaRongHeOBJ.leftNum = 8
|
||||
ShenJiaRongHeOBJ.id = 1 --当前选中按钮 id
|
||||
|
||||
function ShenJiaRongHeOBJ:updata()
|
||||
self.id = self.id or 1
|
||||
local listview = self.ui.btn_ListView
|
||||
local imgDir = "res/custom/41/btn/"
|
||||
GUI:ListView_removeAllItems(listview)
|
||||
for i = 1, self.leftNum do
|
||||
local btnKey = string.format("list_btn_%d", i)
|
||||
local isSelected = (self.id == i)
|
||||
self.ui[btnKey] = GUI:Button_Create(listview, btnKey, 0, 0,
|
||||
string.format("%s%s.png", imgDir, isSelected and tostring(i) or (i .. "a")))
|
||||
GUI:addOnClickEvent(self.ui[btnKey], function()
|
||||
if self.id == i then return end --重复点击不刷新
|
||||
local oldId = self.id
|
||||
self.id = i
|
||||
--旧按钮换为非选中态
|
||||
GUI:Button_loadTextures(self.ui[string.format("list_btn_%d", oldId)],
|
||||
string.format("%s%s.png", imgDir, oldId .. "a"), "", "", 0)
|
||||
--新按钮换为选中态
|
||||
GUI:Button_loadTextures(self.ui[btnKey],
|
||||
string.format("%s%s.png", imgDir, tostring(i)), "", "", 0)
|
||||
self:init()
|
||||
end)
|
||||
end
|
||||
self:init()
|
||||
end
|
||||
|
||||
function ShenJiaRongHeOBJ:init()
|
||||
local cfg = self.cfg[self.id]
|
||||
if not cfg then
|
||||
return
|
||||
end
|
||||
|
||||
if GUI:Win_IsNotNull(self.ui.ItemShow) then
|
||||
GUI:removeFromParent(self.ui.ItemShow)
|
||||
end
|
||||
|
||||
self.ui.ItemShow = GUI:ItemShow_Create(self.ui.img_bg, "ItemShow", 470, 290,
|
||||
{ index = SL:GetMetaValue("ITEM_INDEX_BY_NAME", cfg.name), count = 1, look = true, bgVisible = false, color = 255 })
|
||||
GUI:setAnchorPoint(self.ui.ItemShow, 0.50, 0.50)
|
||||
|
||||
GUI:removeAllChildren(self.ui.cost_Layout)
|
||||
for i, v in ipairs(cfg.cost or {}) do
|
||||
local costItemBg = string.format("costItemBg_%d", i)
|
||||
self.ui[costItemBg] = GUI:Image_Create(self.ui.cost_Layout, costItemBg, 0, 0, "res/public/1900000651_1.png")
|
||||
GUI:Win_SetParam(self.ui[costItemBg], i)
|
||||
|
||||
local bg_size = GUI:getContentSize(self.ui[costItemBg])
|
||||
|
||||
local costItem = string.format("costItem_%d", i)
|
||||
self.ui[costItem] = GUI:ItemShow_Create(self.ui[costItemBg], costItem, bg_size.width / 2, bg_size.height / 2,
|
||||
{ index = SL:GetMetaValue("ITEM_INDEX_BY_NAME", v.itemname), count = v.itemnum, look = true, bgVisible = false, color = 255 })
|
||||
GUI:setAnchorPoint(self.ui[costItem], 0.50, 0.50)
|
||||
end
|
||||
|
||||
GUI:UserUILayout(self.ui.cost_Layout, {
|
||||
dir = 2,
|
||||
addDir = 2,
|
||||
interval = 1,
|
||||
gap = { x = 30 },
|
||||
sortfunc = function(lists)
|
||||
table.sort(lists, function(a, b)
|
||||
return (GUI:Win_GetParam(a) or 0) > (GUI:Win_GetParam(b) or 0)
|
||||
end)
|
||||
end
|
||||
})
|
||||
|
||||
GUI:Text_setString(self.ui.Text_success, string.format("成功率:%d%%", cfg.success))
|
||||
|
||||
GUI:addOnClickEvent(self.ui.up_btn, function()
|
||||
ssrMessage:SubLink(string.format("%s_%s", self.__cname, "up"), self.id)
|
||||
end)
|
||||
end
|
||||
|
||||
---* 注册事件
|
||||
function ShenJiaRongHeOBJ:EventBind()
|
||||
local function ShenJiaRongHeOBJ_EQUIP_CHANGE(data)
|
||||
if GUI:Win_IsNotNull(self._parent) then
|
||||
if data.Where == 16 then
|
||||
self:updata()
|
||||
end
|
||||
end
|
||||
end
|
||||
SL:RegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname, ShenJiaRongHeOBJ_EQUIP_CHANGE)
|
||||
|
||||
--关闭窗口
|
||||
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
|
||||
self:OnClose(widgetName)
|
||||
end)
|
||||
end
|
||||
|
||||
--关闭窗口
|
||||
function ShenJiaRongHeOBJ:OnClose(widgetName)
|
||||
if widgetName == self.__cname then
|
||||
self:UnRegisterEvent()
|
||||
end
|
||||
end
|
||||
|
||||
function ShenJiaRongHeOBJ:UnRegisterEvent()
|
||||
SL:UnRegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname)
|
||||
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
|
||||
end
|
||||
|
||||
return ShenJiaRongHeOBJ
|
||||
BIN
client/dev/res/custom/41/2.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/1.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/1a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/2.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/2a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/3.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/3a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/4.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/4a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/5.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/5a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/6.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/6a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/7.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/7a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
client/dev/res/custom/41/btn/8.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
client/dev/res/custom/41/btn/8a.png
Normal file
|
After Width: | Height: | Size: 17 KiB |