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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2012-10-25
帖子
53
跳转到指定楼层
1
发表于 2013-1-2 04:02:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 孤客 于 2013-1-3 02:22 编辑

VA的选择窗口都是在最右边的= =眼神不好的都要把这个选择窗口给看漏了,我想把它给改居中,但不知道要怎么改。。
我是在Window_Command里面改的,但要不是出错就是没有一点反应。。如果不是在这里改要在哪里改呢??
脚本废等高人指点。。

Lv1.梦旅人

梦石
0
星屑
54
在线时间
409 小时
注册时间
2012-5-14
帖子
615
2
发表于 2013-1-2 10:34:29 | 只看该作者
一切为了经验!
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_MenuCommand
  4. #------------------------------------------------------------------------------
  5. #  [新]菜单画面中显示指令的窗口   (选项菜单居中显示) by折戬沉沙
  6. #==============================================================================

  7. class Window_MenuCommand < Window_Command
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化指令选择位置(类方法)
  10.   #--------------------------------------------------------------------------
  11.   def self.init_command_position
  12.     @@last_command_symbol = nil
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 初始化对象
  16.   #--------------------------------------------------------------------------
  17.   def initialize
  18.     super(window_x, 0)
  19.     select_last
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 获取窗口的宽度
  23.   #--------------------------------------------------------------------------
  24.   def window_width
  25.     return 160
  26.   end
  27.   #-------------------------------------------------------------------------
  28.   #【】定义横坐标
  29.   #-------------------------------------------------------------------------
  30.   def window_x
  31.   Graphics.width * 0.5 - 80
  32.     end
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取显示行数
  35.   #--------------------------------------------------------------------------
  36.   def visible_line_number
  37.     item_max
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 生成指令列表
  41.   #--------------------------------------------------------------------------
  42.   def make_command_list
  43.     add_main_commands
  44.     add_formation_command
  45.     add_original_commands
  46.     add_save_command
  47.     add_game_end_command
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 向指令列表添加主要的指令
  51.   #--------------------------------------------------------------------------
  52.   def add_main_commands
  53.     add_command(Vocab::item,   :item,   main_commands_enabled)
  54.     add_command(Vocab::skill,  :skill,  main_commands_enabled)
  55.     add_command(Vocab::equip,  :equip,  main_commands_enabled)
  56.     add_command(Vocab::status, :status, main_commands_enabled)
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 添加整队指令
  60.   #--------------------------------------------------------------------------
  61.   def add_formation_command
  62.     add_command(Vocab::formation, :formation, formation_enabled)
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 独自添加指令用
  66.   #--------------------------------------------------------------------------
  67.   def add_original_commands
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 添加存档指令
  71.   #--------------------------------------------------------------------------
  72.   def add_save_command
  73.     add_command(Vocab::save, :save, save_enabled)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 添加游戏结束指令
  77.   #--------------------------------------------------------------------------
  78.   def add_game_end_command
  79.     add_command(Vocab::game_end, :game_end)
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 获取主要指令的有效状态
  83.   #--------------------------------------------------------------------------
  84.   def main_commands_enabled
  85.     $game_party.exists
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 获取整队的有效状态
  89.   #--------------------------------------------------------------------------
  90.   def formation_enabled
  91.     $game_party.members.size >= 2 && !$game_system.formation_disabled
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 获取存档的有效状态
  95.   #--------------------------------------------------------------------------
  96.   def save_enabled
  97.     !$game_system.save_disabled
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 按下确定键时的处理
  101.   #--------------------------------------------------------------------------
  102.   def process_ok
  103.     @@last_command_symbol = current_symbol
  104.     super
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 返回最后一个选项的位置
  108.   #--------------------------------------------------------------------------
  109.   def select_last
  110.     select_symbol(@@last_command_symbol)
  111.   end
  112. end
复制代码

点评

0.0我用了后完全没有变化啊?不过还是谢谢你的回答~  发表于 2013-1-3 02:04
回复 支持 反对

使用道具 举报

Lv3.寻梦者

死亡颂唱者

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

开拓者

3
发表于 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精美好人卡一张.

查看全部评分

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
54
在线时间
409 小时
注册时间
2012-5-14
帖子
615
4
发表于 2013-1-3 12:52:35 | 只看该作者
{:2_270:}{:2_270:}{:2_270:}啊啊啊啊我看错题意了!!!!!!!!!!
{:2_276:}所以我写了一个让ESC菜单的选项栏居中的脚本。
{:2_253:}我错了……
{:2_252:}果然用兔斯基卖萌最方便了。

点评

没事没事~我有时也会理解错误题目的~~O(∩_∩)O~  发表于 2013-1-3 20:00
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-30 10:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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