|
mush4.7以上版本怎么弄miniwindow?
怎么下面代码无法画出miniwindow呢?请教下哪里有问题哦??
- ---------miniwindows 模块------------
- --字体
- FONT_NAME1 = "Arial"
- FONT_NAME2 = "Webdings"
- FONT_NAME3 = "Lucida Console"
- FONT_SIZE_11 = 11
- FONT_SIZE_12 = 12
- --尺寸
- EDGE_WIDTH = 3
- --位置
- WINDOW_POSITION = 6 -- see below (6 is top right)
- --[[
- 常用positions:
- 4 = top left
- 5 = center left-right at top
- 6 = top right
- 7 = on right, center top-bottom
- 8 = on right, at bottom
- 9 = center left-right at bottom
- --]]
- -- colours
- WINDOW_BACKGROUND_COLOUR = ColourNameToRGB ("white")
- BOX_COLOUR = ColourNameToRGB ("royalblue") -- Box boarder's colour
- WINDOW_TEXT_COLOUR = ColourNameToRGB ("black")
- -- offset of text from edge
- TEXT_INSET = 5
- -- get a unique name
- win = GetPluginID () -- get a unique name
- -- end configuration
- function draw_window()
- --[[
- print("----------------------")
- tprint(basic)
- print("----------------------")
- tprint(special)
- --]]
- skills_table={}
- for i = 1,#basic do
- table.insert(skills_table,basic[i])
- end
- for i = 1,#special do
- table.insert(skills_table,special[i])
- end
- local _skills_ch = {}
- local _skills_lev = {}
- for i = 1,#skills_table do
- _skills_ch[i] = me.skills[skills_table[i]].name
- _skills_lev[i] = me.skills[skills_table[i]].lv
- if skills_table[i] == cur_lingwu_skill then
- _lx_special = special[i]
- end
- end
- -- window size in pixels
- WINDOW_WIDTH = 250
- WINDOW_HEIGHT = (#skills_table + 1)*20+35
- -- Create the window
- --WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 0, WINDOW_BACKGROUND_COLOUR) -- create window
- WindowCreate (win, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 4, 0x000010)
- -- define the fonts
- WindowFont (win, "f1", FONT_NAME1, FONT_SIZE_12)
- WindowFont (win, "f2", FONT_NAME2, FONT_SIZE_11)
- WindowFont (win, "f3", FONT_NAME1, FONT_SIZE_12, true)
- WindowFont (win, "f4", FONT_NAME3, FONT_SIZE_11, true)
- -- work out how high the font is
- font_height = WindowFontInfo (win, "f1", 1) -- height of the font
- -- draw the border of the whole box
- --WindowCircleOp (win, 2, 0, 0, 0, 0, BOX_COLOUR, 6, EDGE_WIDTH, 0x000000, 1)
- WindowCircleOp (win, miniwin.circle_round_rectangle, 0, 2, WINDOW_WIDTH-2, WINDOW_HEIGHT, 0xc0c0c0, 0, 1,0, 0, 9, 9)
- -- ensure window visible
- local head_width = (WINDOW_WIDTH - WindowTextWidth (win, "f1", "领悟技能列表"))/2
- local head_width1 = (WindowTextWidth (win, "f1", "(")) + 5
- local head_width2 = (WindowTextWidth (win, "f1", "( 为领悟中,")) + 5
- WindowText (win, "f1",
- "技能列表", -- text
- head_width, 5, 0, 0, -- rectangle
- ColourNameToRGB ("green"), -- colour
- false) -- not Unicode
- WindowText (win, "f1",
- "( 为领悟中, 为练习中)", -- text
- 5, 25, 0, 0, -- rectangle
- ColourNameToRGB ("green"), -- colour
- false) -- not Unicode
- WindowText (win, "f1",
- "红色", -- text
- head_width1, 25, 0, 0, -- rectangle
- ColourNameToRGB ("red"), -- colour
- false) -- not Unicode
- WindowText (win, "f1",
- "蓝色", -- text
- head_width2, 25, 0, 0, -- rectangle
- ColourNameToRGB ("blue"), -- colour
- false) -- not Unicode
- for i = 1,#skills_table do
- if _skills_ch[i] == "" or _skills_ch[i] == nil then
- _skills_ch[i] = "数据丢失"
- end
- if skills_table[i] == "" or skills_table[i] == nil then
- skills_table[i] = "数据丢失"
- end
- if _skills_lev[i] == "" or _skills_lev[i] == nil then
- _skills_lev[i] = "数据丢失"
- end
- if skills_table[i] == cur_lingwu_skill then
- _colour = "red"
- elseif skills_table[i] == cur_lingwu_skill or skills_table[i] == _lx_special then
- _colour = "blue"
- else
- _colour = "green"
- end
- local txt2 = _skills_ch[i].."("..skills_table[i].."):".._skills_lev[i]
- local _high = i*20 + 25
- WindowText (win, "f1",
- txt2, -- text
- 5, _high, 0, 0, -- rectangle
- ColourNameToRGB (_colour), -- colour
- false) -- not Unicode
- end
- WindowShow (win, true)
- end
复制代码
北大侠客行MUD,中国最好的MUD |
|