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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: 勇敢的馒头
打印 上一主题 下一主题

[已经解决] 选项之间如何空一格的距离或者调整单独选项位置?

[复制链接]

Lv2.观梦者

梦石
0
星屑
319
在线时间
371 小时
注册时间
2010-8-23
帖子
418
11
 楼主| 发表于 2010-10-22 09:46:59 | 只看该作者
回复 逸豫 的帖子
只会控制draw_text文字的坐标,set_cursor_rect的研究了一会儿,没弄明白
回复 支持 反对

使用道具 举报

Lv3.寻梦者

宛若

梦石
0
星屑
1583
在线时间
526 小时
注册时间
2007-8-19
帖子
1493

极短24参与开拓者

12
发表于 2010-10-22 10:14:44 | 只看该作者
本帖最后由 逸豫 于 2010-10-22 10:15 编辑
  1. $选项间距离 = 7
  2. class Window_Title < Window_Base
  3.   attr :index,true
  4.   def initialize(width, arr)
  5.     @arr = arr
  6.     arr.push("") if arr.empty?
  7.     super(0,0,width,arr.size*32 + $选项间距离+32)
  8.     self.contents = Bitmap.new(width - 32,self.height - 32)
  9.     @index = 0
  10.     refresh
  11.     @cmax = arr.size
  12.   end
  13.   def refresh
  14.     y = 0
  15.     for i in @arr
  16.       self.contents.draw_text(0,y,self.width-32,32,i,1)
  17.       if @arr.index(i) == 0
  18.         y += $选项间距离
  19.       end
  20.       y += 32
  21.     end
  22.   end
  23.   def update
  24.     if Input.repeat?(Input::DOWN) && self.active and @cmax > 0 and @index >= 0
  25.       @index += 1
  26.       @index %= @cmax
  27.       $game_system.se_play($data_system.cursor_se)
  28.     end
  29.     if Input.repeat?(Input::UP) && self.active and @cmax > 0 and @index >= 0
  30.       @index -= 1
  31.       @index = @cmax - 1 if @index == -1
  32.       $game_system.se_play($data_system.cursor_se)
  33.     end
  34.     update_cursor
  35.   end
  36.   def update_cursor
  37.     case @index
  38.     when 0
  39.       self.cursor_rect = Rect.new(0,0,self.width-32,32)
  40.     when 1
  41.       self.cursor_rect = Rect.new(0,32+$选项间距离,self.width-32,32)
  42.     when 2
  43.       self.cursor_rect = Rect.new(0,64+$选项间距离,self.width-32,32)
  44.     end
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 描绘项目
  48.   #     index : 项目编号
  49.   #     color : 文字色
  50.   #--------------------------------------------------------------------------
  51.   def draw_item(index, color)
  52.     self.contents.font.color = color
  53.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  54.     if index > 0
  55.       rect.y += $选项间距离
  56.     end
  57.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  58.     self.contents.draw_text(rect, @arr[index],1)
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 项目无效化
  62.   #     index : 项目编号
  63.   #--------------------------------------------------------------------------
  64.   def disable_item(index)
  65.     draw_item(index, disabled_color)
  66.   end
  67. end
  68.       
复制代码
自行在Scene_Title中使用,把Window_Command.new换成Window_Title.new

评分

参与人数 1星屑 +376 收起 理由
fux2 + 376 认可答案

查看全部评分

[url=http://rpg.blue/thread-219730-1-1.html]http://unhero.sinaapp.com/wi.php[/url]
[color=Red]如你所见这是个死坑,没错这就是打我的脸用的[/color]
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
319
在线时间
371 小时
注册时间
2010-8-23
帖子
418
13
 楼主| 发表于 2010-10-22 13:18:56 | 只看该作者
回复 逸豫 的帖子
搞懂了,谢谢!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-3-12 20:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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