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

Project1

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

[已经解决] 关于选择项横着选择

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
550
在线时间
21 小时
注册时间
2011-3-27
帖子
4
跳转到指定楼层
1
发表于 2011-4-24 20:12:34 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 毛欢 于 2011-4-26 18:18 编辑

选择项横着选择

这个相关的脚本:


    # 生成命令窗口
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "状态"
    s5 = "存档"
    s6 = "结束游戏"
    @command_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.x = 0
    @command_window.y = 412
    @command_window.opacity = 150


急求高手帮助!谢谢
(不要给我范例啊最好直接给我脚本谢谢)
℡孟婆↘来碗汤╮

Lv1.梦旅人

梦石
0
星屑
55
在线时间
323 小时
注册时间
2010-8-21
帖子
666
3
发表于 2011-4-26 18:03:25 | 只看该作者
回复 毛欢 的帖子

脚本默认Window_Commad是竖着显示的,我们可以对他进行修改就可实现横着选择...
比如:
  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, column_max=1)
  13.     # 由命令的个数计算出窗口的高
  14.     super(0, 0, width, (commands.size / column_max.to_f).ceil*32  + 32)
  15.     @item_max = commands.size
  16.     @commands = commands
  17.     @column_max = column_max
  18.     self.contents = Bitmap.new(width - 32, (@item_max.to_f/column_max).ceil* 32)
  19.     refresh
  20.     self.index = 0
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 刷新
  24.   #--------------------------------------------------------------------------
  25.   def refresh
  26.     self.contents.clear
  27.     for i in 0...@item_max
  28.       draw_item(i, normal_color)
  29.     end
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 描绘项目
  33.   #     index : 项目编号
  34.   #     color : 文字色
  35.   #--------------------------------------------------------------------------
  36.   def draw_item(index, color)
  37.     self.contents.font.color = color
  38.     rect = Rect.new(4+index%@column_max*self.width/@column_max,
  39.              32 * (index/@column_max), self.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. end
复制代码
试着看看吧....使用方法:比如

你的
@command_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6])

改为:

@command_window = Window_Command.new(640, [s1, s2, s3, s4, s5, s6], 6)


就是一行显示6个,改为3就是一行3个...

评分

参与人数 1星屑 +200 梦石 +2 收起 理由
「旅」 + 200 + 2

查看全部评分

>>猛戳>>MetalSagaR游戏主页<<这里<<
欢迎提供您的意见
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
88
在线时间
331 小时
注册时间
2010-10-24
帖子
778
2
发表于 2011-4-26 13:47:55 | 只看该作者
打多点空格啊.....
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-22 01:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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