0
焦点头条

【小雪】插件制作教学系列(一)《一切都从零开始》

2014-02-23 13:06| 查看: 13447 |作者: 小雪



设置弹出菜单

由于输入路径跟窗口名字并不是太常用,而且快捷键设置多了自己的键位又不够用,所以我们来设置一个弹出菜单。
function ToolsForEditing.Menu()
local menu = {
szOption = "插件调试工具",
{
szOption = "请输入窗口路径",fnAction =function() ToolsForEditing.Enterdir() end,
},
{
szOption = "请输入窗口名字",fnAction =function() ToolsForEditing.Enterwindowname() end,
},
}
return menu
end
szOption=菜单的名字,如果再菜单名字后面再加个{}就表明是二级菜单,以此类推,注意加逗号。
fnAction=按下后做什么功能,function()表示执行函数,记得加end

我们并没有一个专门存储菜单的地方,为了简便我们可以利用系统菜单作为存储位置。
ToolsForEditing._InsertPlayerMenu = InsertPlayerMenu; --建立一个变量,将这个变量等于系统调用函数的名字,用于保存系统函数
function ToolsForEditing.InsertPlayerMenu(_menu) --建立一个函数
ToolsForEditing._InsertPlayerMenu(_menu) --执行系统的函数
local _MyMenu = ToolsForEditing.Menu() --将自己的目录赋值
table.insert(_menu,_MyMenu) --加入自己的目录
end
InsertPlayerMenu = ToolsForEditing.InsertPlayerMenu --让系统函数等于我们的函数
这么一来系统在调用InsertPlayerMenu的时候就会执行ToolsForEditing.InsertPlayerMenu这个函数,在执行这个函数的时候会先执行原来的系统函数,然后再执行我们的函数。
效果见图:



收藏 分享 邀请

游客 2016-05-16 10:41
mi9VMU You produced  ...
引用
游客 2016-05-14 03:17
You have brought up  ...
引用
游客 2016-04-06 01:43
bYohsZ very couple o ...
引用
游客 2016-03-31 18:45
bjfls4 Wow, great ar ...
引用
游客 2016-01-31 02:30
AWZu3D ugg australia ...
引用
游客 2016-01-01 20:43
boQTg6
引用
游客 2015-02-26 22:14
RqaqJn  <a href="htt ...
引用
游客 2014-11-23 07:13
紫檀手串的价值也是很大的:在本草纲目上就有记载,紫檀能够止痛止血,还能够调节气血;紫檀木所散发出来的香气对人们的心脏肾脏肝脏有很好的调节保养作用;紫檀手串戴在身上,还能够稳定人的情绪,使人遇事平静、沉稳,还有助于睡眠和安神醒脑,长期佩戴能够促进新细胞再生,预防皱纹的出现;紫檀对肠胃也很好,有的人就是把紫檀屑放到枕芯里当抱枕睡觉,对肠胃有很好的舒缓作用;在蒙古族的医学上还有记载,紫檀能够消除关节肿痛,和 ...
引用
游客 2014-09-28 10:26
1、春天,山坡的朝阳处雪开始融化,慢慢地露出黄黑色的地皮;雪水滋润着泥土,浸湿了去年的草楂;被雪盖着过了冬眠的草根苏醒复活了,渐渐地倔强有力地推去陈旧的草楂烂叶,奋力地生长起来。与此同时,去年秋天随风摇落下来的草木种子,也被湿土裹住,在孳殖着根须,争取它们的生命。山的背阴处虽然还寒气凛凛,可是寒冷的威力已在渐渐衰弱。朝阳处的温暖雪水顺着斜谷流过来,融化了硬硬的雪层,开始冲开山涧溪水的冰面。巨大的冻 ...
引用
游客 2014-09-28 06:27
每到春天,红得如火的木棉花,粉得如霞的芍药花,白得如玉的月季花竞相开放。它们有的花蕾满枝,有的含苞初绽,有的昂首怒放。一阵阵沁人心肺的花香引来了许许多多的小蜜蜂,嗡嗡嗡地边歌边舞。 <br><br>盼望着,盼望着,(表现急切喜悦的心情)东风来了,春天的脚步近了。 <br><br>清晨,春姑娘穿着美丽的衣裳,舞着暖风,招展地笑着向我们走来,给大自然披上了新装,使万物显现出无限生机.一缕缕金黄色的阳光撒向刚披上新装的草地,阳 ...
引用
游客 2014-09-24 20:58
ahF8QM I have been absent for some time, but now I remember why I used to love this blog. Thanks , I'll try and check back more frequently. How frequently you update your site?
引用
游客 2014-08-26 06:10
A lot of thanks for each of your work on this web site. My mom really loves going through investigation and it is simple to grasp why. Many of us notice all relating to the dynamic ways you make invaluable information by means of this web blog and even cause response from others on the issue so our favorite princess is certainly studying a whole lot. Take advantage of the remaining portion of the  ...
引用
游客 2014-08-09 08:42
I have been exploring for a bit for any high quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this site. Reading this information So i¡¦m happy to convey that I've a very just right uncanny feeling I discovered exactly what I needed. I most indisputably will make sure to don¡¦t overlook this website and provides it a glance regularly.
gebrauchte  ...
引用
游客 2014-08-08 21:10
What i don't understood is actually how you are no longer really a lot more smartly-liked than you might be right now. You're so intelligent. You already know therefore considerably in terms of this topic, produced me individually consider it from a lot of varied angles. Its like women and men are not involved unless it is one thing to accomplish with Lady gaga! Your own stuffs nice. All the time  ...
引用
游客 2014-08-08 20:06
Good ¡V I should certainly pronounce, impressed with your site. I had no trouble navigating through all the tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your customer to communicate. Excellent task..
Che ...
引用
游客 2014-08-04 14:04
I would like to convey my gratitude for your generosity supporting men and women who really need help with your theme. Your personal commitment to passing the solution up and down ended up being amazingly interesting and have consistently empowered many people just like me to get to their aims. Your useful help signifies a whole lot to me and even more to my colleagues. Thanks a lot; from all of u ...
引用
n5012346 2014-07-05 11:49
: Well written. Who's number four? Lately Ive been following Damon Vickers, a finacial luminary from Seattle. If you havnt read his book The Day after t ...
oh ·····can you speak  Chinese?
引用
游客 2014-07-05 09:01
有剑网三pak v3的解包工具么?
引用
游客 2014-06-18 04:52
Well written. Who's number four? Lately Ive been following Damon Vickers, a finacial luminary from Seattle. If you havnt read his book The Day after the Dollar Crashes, you should get plan a trip to the bookstore. I feel that people dont really fathom the magnitude of the situation we face today. To have a great manager like Damon Vickers, who called the market plummet in both 2000 and 2008, publi ...
引用
游客 2014-04-14 15:47
请问一下有没有交流群?
引用

查看全部评论(20)

关注订阅号"剑网3PVE"
获取第一手剑三资讯

关闭
您当前使用的浏览器版本过低,网站部分功能可能失效,请更换合适的浏览器。了解更多
返回顶部