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

Project1

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

[已经解决] 我想改选择窗口的位置

[复制链接]

Lv3.寻梦者

死亡颂唱者

梦石
0
星屑
1154
在线时间
1794 小时
注册时间
2011-10-21
帖子
2245

开拓者

1
发表于 2013-1-2 10:48:10 | 显示全部楼层
替换你的Window_ChoiceList

RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_ChoiceList
  4. #------------------------------------------------------------------------------
  5. #  此窗口使用于事件指令中的“显示选项”的功能。
  6. #==============================================================================
  7.  
  8. class Window_ChoiceList < Window_Command
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对象
  11.   #--------------------------------------------------------------------------
  12.   def initialize(message_window)
  13.     @message_window = message_window
  14.     super(0, 0)
  15.     self.openness = 0
  16.     deactivate
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 开始输入的处理
  20.   #--------------------------------------------------------------------------
  21.   def start
  22.     update_placement
  23.     refresh
  24.     select(0)
  25.     open
  26.     activate
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 更新窗口的位置
  30.   #--------------------------------------------------------------------------
  31.   def update_placement
  32.     self.width = [max_choice_width + 12, 96].max + padding * 1#调窗口宽度,#2
  33.     self.width = [width, Graphics.width].min                  #数值越大窗口越宽
  34.     self.height = fitting_height($game_message.choices.size)
  35.     self.x = Graphics.width - 330#改这里,数值越小窗口越向右# - width
  36.     if @message_window.y >= Graphics.height / 2
  37.       self.y = @message_window.y - height
  38.     else
  39.       self.y = @message_window.y + @message_window.height
  40.     end
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 获取选项的最大宽度
  44.   #--------------------------------------------------------------------------
  45.   def max_choice_width
  46.     $game_message.choices.collect {|s| text_size(s).width }.max
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 计算窗口内容的高度
  50.   #--------------------------------------------------------------------------
  51.   def contents_height
  52.     item_max * item_height
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 生成指令列表
  56.   #--------------------------------------------------------------------------
  57.   def make_command_list
  58.     $game_message.choices.each do |choice|
  59.       add_command(choice, :choice)
  60.     end
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 绘制项目
  64.   #--------------------------------------------------------------------------
  65.   def draw_item(index)
  66.     rect = item_rect_for_text(index)
  67.     draw_text_ex(rect.x, rect.y, command_name(index))
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 获取“取消处理”的有效状态
  71.   #--------------------------------------------------------------------------
  72.   def cancel_enabled?
  73.     $game_message.choice_cancel_type > 0
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 调用“确定”的处理方法
  77.   #--------------------------------------------------------------------------
  78.   def call_ok_handler
  79.     $game_message.choice_proc.call(index)
  80.     close
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 调用“取消”的处理方法
  84.   #--------------------------------------------------------------------------
  85.   def call_cancel_handler
  86.     $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  87.     close
  88.   end
  89. end

点评

谢谢!O(∩_∩)O~终于居中了!!  发表于 2013-1-3 02:05

评分

参与人数 1梦石 +1 收起 理由
Mic_洛洛 + 1 认可答案,附赠6R精美好人卡一张.

查看全部评分

这家伙很懒,什么也没有留下
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-21 14:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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