赞 | 4 |
VIP | 0 |
好人卡 | 0 |
积分 | 78 |
经验 | 15725 |
最后登录 | 2024-11-10 |
在线时间 | 1337 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7760
- 在线时间
- 1337 小时
- 注册时间
- 2015-8-15
- 帖子
- 751
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 金芒芒 于 2016-2-19 14:52 编辑
class Window_Command_New < Window_Selectable def initialize(actors=4,enemynums=0) super(160, 20, 968, 620) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = HS::OPACITY @commands = ["装备","物品","魔法","状态","战斗","队列","任务","系统"] @item_max = 8 @column_max = 8 # bitmap = RPG::Cache.icon("菜单") # self.contents.blt( - 22,-34, bitmap, Rect.new(-5, -34, 965, 569)) bitmap = RPG::Cache.icon("属性养成") self.contents.blt(32, 48, bitmap, Rect.new(0, 0, 65, 24)) bitmap = RPG::Cache.icon("上阵出战") self.contents.blt(99, 48, bitmap, Rect.new(0, 0, 65, 24)) bitmap = RPG::Cache.icon("出仕下野") self.contents.blt(164, 48, bitmap, Rect.new(0, 0, 65, 24)) bitmap = RPG::Cache.icon("合成进阶") self.contents.blt(232, 48, bitmap, Rect.new(0, 0, 65, 24)) bitmap = RPG::Cache.icon("载入史册") self.contents.blt(297, 48, bitmap, Rect.new(0, 0, 65, 24)) bitmap = RPG::Cache.icon("放马南山") self.contents.blt(364, 48, bitmap, Rect.new(0, 0, 65, 24)) @actors = actors @enemynums = enemynums draw_item(0, @actors==0 ? disabled_color : normal_color) draw_item(1, normal_color) draw_item(2, @actors==0 ? disabled_color : normal_color) draw_item(3, @actors==0 ? disabled_color : normal_color) draw_item(4, @actors==0 ? disabled_color : normal_color) draw_item(5, @actors==0 ? disabled_color : normal_color) draw_item(6, normal_color) draw_item(7, normal_color) self.index = 0 end def draw_item(index, color) self.contents.font.color = color x = 4 + index % 8 * 70 y = 2 # y = index / 2 * 32 rect = Rect.new(x+32, y+47, 0, 0) self.contents.fill_rect(rect, Color.new(200, 255,20, 200))#(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], 1) end ######################### def refresh self.contents.clear # Color.new(红色192, 绿192, 蓝192, 透明255) for i in 0...@item_max if i == self.index #@index # actors = Color.new(220, 200, 20, 255)# Color.new(红色192, 绿192, 蓝192, 透明255) font_name = "黑体" else actors = normal_color #Color.new(180, 150, 60, 255)# font_name = "黑体" end draw_item(i, color, font_name)#加入各种i=我,颜色,字体, end end ###################################################################### def update_cursor_rect # 光标位置不满 0 的情况下 if @index < 0 self.cursor_rect.empty return end # 获取当前的行 row = @index / @column_max # 当前行被显示开头行前面的情况下 if row < self.top_row # 从当前行向开头行滚动 self.top_row = row end # 当前行被显示末尾行之后的情况下 if row > self.top_row + (self.page_row_max - 1) # 从当前行向末尾滚动 self.top_row = row - (self.page_row_max - 1) end # 计算光标的宽 cursor_width = 68 #600 / (@column_max + 1) - 32 # 计算光标坐标 x = 4 + index % 8 * 70 y = 2 # 更新国标矩形 self.cursor_rect.set(x+32, y+47, 70, 28) end end
class Window_Command_New < Window_Selectable
def initialize(actors=4,enemynums=0)
super(160, 20, 968, 620)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = HS::OPACITY
@commands = ["装备","物品","魔法","状态","战斗","队列","任务","系统"]
@item_max = 8
@column_max = 8
# bitmap = RPG::Cache.icon("菜单")
# self.contents.blt( - 22,-34, bitmap, Rect.new(-5, -34, 965, 569))
bitmap = RPG::Cache.icon("属性养成")
self.contents.blt(32, 48, bitmap, Rect.new(0, 0, 65, 24))
bitmap = RPG::Cache.icon("上阵出战")
self.contents.blt(99, 48, bitmap, Rect.new(0, 0, 65, 24))
bitmap = RPG::Cache.icon("出仕下野")
self.contents.blt(164, 48, bitmap, Rect.new(0, 0, 65, 24))
bitmap = RPG::Cache.icon("合成进阶")
self.contents.blt(232, 48, bitmap, Rect.new(0, 0, 65, 24))
bitmap = RPG::Cache.icon("载入史册")
self.contents.blt(297, 48, bitmap, Rect.new(0, 0, 65, 24))
bitmap = RPG::Cache.icon("放马南山")
self.contents.blt(364, 48, bitmap, Rect.new(0, 0, 65, 24))
@actors = actors
@enemynums = enemynums
draw_item(0, @actors==0 ? disabled_color : normal_color)
draw_item(1, normal_color)
draw_item(2, @actors==0 ? disabled_color : normal_color)
draw_item(3, @actors==0 ? disabled_color : normal_color)
draw_item(4, @actors==0 ? disabled_color : normal_color)
draw_item(5, @actors==0 ? disabled_color : normal_color)
draw_item(6, normal_color)
draw_item(7, normal_color)
self.index = 0
end
def draw_item(index, color)
self.contents.font.color = color
x = 4 + index % 8 * 70
y = 2
# y = index / 2 * 32
rect = Rect.new(x+32, y+47, 0, 0)
self.contents.fill_rect(rect, Color.new(200, 255,20, 200))#(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#########################
def refresh
self.contents.clear
# Color.new(红色192, 绿192, 蓝192, 透明255)
for i in 0...@item_max
if i == self.index #@index #
actors = Color.new(220, 200, 20, 255)# Color.new(红色192, 绿192, 蓝192, 透明255)
font_name = "黑体"
else
actors = normal_color #Color.new(180, 150, 60, 255)#
font_name = "黑体"
end
draw_item(i, color, font_name)#加入各种i=我,颜色,字体,
end
end
######################################################################
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = 68 #600 / (@column_max + 1) - 32
# 计算光标坐标
x = 4 + index % 8 * 70
y = 2
# 更新国标矩形
self.cursor_rect.set(x+32, y+47, 70, 28)
end
end
|
评分
-
查看全部评分
|