北大侠客行MUD论坛

 找回密码
 注册
搜索
热搜: 新手 wiki 升级
查看: 4192|回复: 4

请教高手指点迷津。miniwindow下,

[复制链接]
发表于 2011-8-6 16:56:24 | 显示全部楼层 |阅读模式
mush4.7以上版本怎么弄miniwindow?
怎么下面代码无法画出miniwindow呢?请教下哪里有问题哦??

  1. ---------miniwindows 模块------------


  2. --字体
  3. FONT_NAME1 = "Arial"
  4. FONT_NAME2 = "Webdings"
  5. FONT_NAME3 = "Lucida Console"
  6. FONT_SIZE_11 = 11
  7. FONT_SIZE_12 = 12

  8. --尺寸
  9. EDGE_WIDTH = 3

  10. --位置
  11. WINDOW_POSITION = 6 -- see below (6 is top right)

  12. --[[
  13. 常用positions:
  14. 4 = top left
  15. 5 = center left-right at top
  16. 6 = top right
  17. 7 = on right, center top-bottom
  18. 8 = on right, at bottom
  19. 9 = center left-right at bottom
  20. --]]

  21. -- colours
  22. WINDOW_BACKGROUND_COLOUR = ColourNameToRGB ("white")
  23. BOX_COLOUR = ColourNameToRGB ("royalblue") -- Box boarder's colour
  24. WINDOW_TEXT_COLOUR = ColourNameToRGB ("black")

  25. -- offset of text from edge
  26. TEXT_INSET = 5

  27. -- get a unique name
  28. win = GetPluginID () -- get a unique name

  29. -- end configuration


  30. function draw_window()
  31. --[[
  32. print("----------------------")
  33. tprint(basic)
  34. print("----------------------")
  35. tprint(special)

  36. --]]
  37. skills_table={}

  38. for i = 1,#basic do
  39. table.insert(skills_table,basic[i])
  40. end
  41. for i = 1,#special do
  42. table.insert(skills_table,special[i])
  43. end
  44. local _skills_ch = {}
  45. local _skills_lev = {}
  46. for i = 1,#skills_table do

  47. _skills_ch[i] = me.skills[skills_table[i]].name
  48. _skills_lev[i] = me.skills[skills_table[i]].lv
  49. if skills_table[i] == cur_lingwu_skill then
  50. _lx_special = special[i]
  51. end
  52. end

  53. -- window size in pixels
  54. WINDOW_WIDTH = 250
  55. WINDOW_HEIGHT = (#skills_table + 1)*20+35

  56. -- Create the window
  57. --WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 0, WINDOW_BACKGROUND_COLOUR) -- create window
  58. WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 4, 0x000010)

  59. -- define the fonts
  60. WindowFont (win, "f1", FONT_NAME1, FONT_SIZE_12)
  61. WindowFont (win, "f2", FONT_NAME2, FONT_SIZE_11)
  62. WindowFont (win, "f3", FONT_NAME1, FONT_SIZE_12, true)
  63. WindowFont (win, "f4", FONT_NAME3, FONT_SIZE_11, true)

  64. -- work out how high the font is
  65. font_height = WindowFontInfo (win, "f1", 1) -- height of the font

  66. -- draw the border of the whole box
  67. --WindowCircleOp (win, 2, 0, 0, 0, 0, BOX_COLOUR, 6, EDGE_WIDTH, 0x000000, 1)
  68. WindowCircleOp (win, miniwin.circle_round_rectangle, 0, 2, WINDOW_WIDTH-2, WINDOW_HEIGHT, 0xc0c0c0, 0, 1,0, 0, 9, 9)

  69. -- ensure window visible
  70. local head_width = (WINDOW_WIDTH - WindowTextWidth (win, "f1", "领悟技能列表"))/2
  71. local head_width1 = (WindowTextWidth (win, "f1", "(")) + 5
  72. local head_width2 = (WindowTextWidth (win, "f1", "(  为领悟中,")) + 5

  73. WindowText (win, "f1",
  74. "技能列表", -- text
  75. head_width, 5, 0, 0, -- rectangle
  76. ColourNameToRGB ("green"), -- colour
  77. false) -- not Unicode

  78. WindowText (win, "f1",
  79. "(  为领悟中,  为练习中)", -- text
  80. 5, 25, 0, 0, -- rectangle
  81. ColourNameToRGB ("green"), -- colour
  82. false) -- not Unicode

  83. WindowText (win, "f1",
  84. "红色", -- text
  85. head_width1, 25, 0, 0, -- rectangle
  86. ColourNameToRGB ("red"), -- colour
  87. false) -- not Unicode

  88. WindowText (win, "f1",
  89. "蓝色", -- text
  90. head_width2, 25, 0, 0, -- rectangle
  91. ColourNameToRGB ("blue"), -- colour
  92. false) -- not Unicode

  93. for i = 1,#skills_table do
  94. if _skills_ch[i] == "" or _skills_ch[i] == nil then
  95. _skills_ch[i] = "数据丢失"
  96. end
  97. if skills_table[i] == "" or skills_table[i] == nil then
  98. skills_table[i] = "数据丢失"
  99. end
  100. if _skills_lev[i] == "" or _skills_lev[i] == nil then
  101. _skills_lev[i] = "数据丢失"
  102. end
  103. if skills_table[i] == cur_lingwu_skill then
  104. _colour = "red"
  105. elseif skills_table[i] == cur_lingwu_skill or skills_table[i] == _lx_special then
  106. _colour = "blue"
  107. else
  108. _colour = "green"
  109. end
  110. local txt2 = _skills_ch[i].."("..skills_table[i].."):".._skills_lev[i]
  111. local _high = i*20 + 25
  112. WindowText (win, "f1",
  113. txt2, -- text
  114. 5, _high, 0, 0, -- rectangle
  115. ColourNameToRGB (_colour), -- colour
  116. false) -- not Unicode
  117. end

  118. WindowShow (win, true)
  119. end
复制代码

北大侠客行MUD,中国最好的MUD
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2011-8-6 17:05:18 | 显示全部楼层
不能直接用getid后的值,要再加点字符才行。你可以看下论坛相关帖子
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
 楼主| 发表于 2011-8-6 17:33:34 | 显示全部楼层
原帖由 labaz 于 2011-8-6 05:05 PM 发表
不能直接用getid后的值,要再加点字符才行。你可以看下论坛相关帖子


哦,那是不是可以去掉那句话就可以了?
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
发表于 2011-8-6 17:49:45 | 显示全部楼层
win = littleknife..GetPluginID () -- get a unique name
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
 楼主| 发表于 2011-8-6 18:17:13 | 显示全部楼层

回复 4楼 的帖子

完成!谢谢啦。。新的领悟模块已经完成,再也不用设置诸如basic skills,special skills ,weapon了。呵呵。一个#lingwu,完活。
北大侠客行Mud(pkuxkx.net),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|北大侠客行MUD ( 京ICP备16065414号-1 )

GMT+8, 2024-11-17 01:26 AM , Processed in 0.011493 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表