设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1439|回复: 2
打印 上一主题 下一主题

[已经解决] rpgmakerxp菜单排版

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
70 小时
注册时间
2013-6-26
帖子
11
跳转到指定楼层
1
发表于 2013-8-6 10:51:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
默认的菜单是竖着排版的,我想把它改为横着排版的,求有这样功能的脚本

默认.png (16.36 KB, 下载次数: 5)

默认.png

菜单.jpg (7.78 KB, 下载次数: 12)

菜单.jpg

Lv3.寻梦者

梦石
0
星屑
2744
在线时间
2630 小时
注册时间
2013-1-16
帖子
5657

贵宾

2
发表于 2013-8-6 10:58:10 | 只看该作者
  1. #==============================================================================
  2. # ■ Window_Command
  3. #------------------------------------------------------------------------------
  4. #  一般的命令选择行窗口。
  5. #==============================================================================

  6. class Window_Command < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     width    : 窗口的宽
  10.   #     commands : 命令字符串序列
  11.   #--------------------------------------------------------------------------
  12.   def initialize(width, commands)
  13.     # 由命令的个数计算出窗口的宽
  14.     super(0, 0, commands.size * width + 32, 64)
  15.     @item_max = commands.size
  16.     @commands = commands
  17.     @column_max = commands.size
  18.     @save_width = width
  19.     self.contents = Bitmap.new(@item_max * width,64 - 32)
  20.     refresh
  21.     self.index = 0
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 刷新
  25.   #--------------------------------------------------------------------------
  26.   def refresh
  27.     self.contents.clear
  28.     for i in 0...@item_max
  29.       draw_item(i, normal_color)
  30.     end
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 描绘项目
  34.   #     index : 项目编号
  35.   #     color : 文字色
  36.   #--------------------------------------------------------------------------
  37.   def draw_item(index, color)
  38.     self.contents.font.color = color
  39.     rect = Rect.new(@save_width / 4 + @save_width * index, 4, @save_width - 8, 32)
  40.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  41.     self.contents.draw_text(rect, @commands[index])
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● 项目无效化
  45.   #     index : 项目编号
  46.   #--------------------------------------------------------------------------
  47.   def disable_item(index)
  48.     draw_item(index, disabled_color)
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 更新光标矩形
  52.   #--------------------------------------------------------------------------
  53.   def update_cursor_rect
  54.     self.cursor_rect.set([url=home.php?mod=space&uid=370741]@Index[/url] * @save_width - 4, 4, @save_width, 32)
  55.   end
  56. end
复制代码
代码插入 main 前~
话说论坛里有,你没搜索吧....

评分

参与人数 1星屑 +90 收起 理由
︶ㄣ牛排ぶ + 90 认可答案

查看全部评分

(Created by @喵kano)


施工现场:hotege.github.io
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
413
在线时间
214 小时
注册时间
2011-3-21
帖子
161
3
发表于 2013-8-7 12:35:43 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. #==============================================================================
  5. # ■ Window_Command
  6. #
  7. #     与Window_Command功能一致,不同点就是可以自己给定行、列的值,使菜单像轩辕剑
  8. # 系列的排列……
  9. #
  10. # 举例:                            行  列               -命令列表-
  11. #      Window_Command.new(160, ["攻击","法术","物品","绝技","防御","逃跑"],2)
  12. #==============================================================================

  13. #==============================================================================
  14. # ■ Window_Command
  15. #------------------------------------------------------------------------------
  16. #  一般的命令选择行窗口。
  17. #==============================================================================

  18. class Window_Command < Window_Selectable
  19. #--------------------------------------------------------------------------
  20. # ● 初始化对像
  21. #     width    : 每格的的宽
  22. #     row      : 行数   自己根据命令数算好行列的值,否则^^b
  23. #     column   : 列数
  24. #     commands : 命令字符串序列
  25. #--------------------------------------------------------------------------
  26. def initialize(width, commands, column=1)
  27.    row = commands.size / column
  28.    # 由命令的个数计算出窗口的宽和高
  29.     super(0, 320, width, row * 32 + 32)
  30.     @item_max = commands.size
  31.     @commands = commands
  32.    @row = row
  33.    @width_txt = (width-32)/column
  34.    @column_max = column
  35.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  36.     refresh
  37.     self.index = 0
  38. end
  39. #--------------------------------------------------------------------------
  40. # ● 刷新
  41. #--------------------------------------------------------------------------
  42. def refresh
  43.    self.contents.clear
  44.    for i in 0...@item_max
  45.      draw_item(i, normal_color)
  46.    end
  47. end
  48. #--------------------------------------------------------------------------
  49. # ● 描绘项目
  50. #     index : 项目编号
  51. #     color : 文字色
  52. #--------------------------------------------------------------------------
  53. def draw_item(index, color)
  54.    self.contents.font.color = color
  55.    # 计算得出当前index所对应的内容所在的行
  56.    row_index = index / @column_max
  57.    # 根据余数得出所在的列
  58.    for y in 0...@column_max
  59.      if index % @column_max == y
  60.        rect = Rect.new(y * @width_txt, 32 * row_index , @width_txt, 32)
  61.        self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  62.        self.contents.draw_text(rect, @commands[index],1)
  63.        break
  64.      end
  65.    end
  66. end
  67. #--------------------------------------------------------------------------
  68. # ● 项目无效化
  69. #     index : 项目编号
  70. #--------------------------------------------------------------------------
  71. def disable_item(index)
  72.    draw_item(index, disabled_color)
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 项目有效化
  76. #     index : 项目编号
  77. #--------------------------------------------------------------------------
  78. def able_item(index)
  79.    draw_item(index, normal_color)
  80. end
  81.   #--------------------------------------------------------------------------
  82.   # ● 更新光标举行
  83.   #--------------------------------------------------------------------------
  84.   def update_cursor_rect
  85.     # 光标位置不满 0 的情况下
  86.     if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
  87.       self.cursor_rect.empty
  88.       return
  89.     end
  90.     # 获取当前的行
  91.     row = @index / @column_max
  92.     # 当前行被显示开头行前面的情况下
  93.     if row < self.top_row
  94.       # 从当前行向开头行滚动
  95.       self.top_row = row
  96.     end
  97.     # 当前行被显示末尾行之后的情况下
  98.     if row > self.top_row + (self.page_row_max - 1)
  99.       # 从当前行向末尾滚动
  100.       self.top_row = row - (self.page_row_max - 1)
  101.     end
  102.     # 计算光标的宽
  103.     cursor_width = @width_txt
  104.     # 计算光标坐标
  105.     x = @index % @column_max * cursor_width
  106.     y = @index / @column_max * 32 - self.oy
  107.     # 更新国标矩形
  108.     self.cursor_rect.set(x, y, cursor_width, 32)
  109.   end
  110. end

  111. #==============================================================================
  112. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  113. #==============================================================================
复制代码
然后把Scene_Menu的26行改成@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6],6)
再加上一行@command_window.x = 0

评分

参与人数 1星屑 +90 收起 理由
︶ㄣ牛排ぶ + 90 认可答案

查看全部评分

签名是什么 好吃么
好吃
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-6-30 06:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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