查看: 2938|回复: 0

[已经解决] 关闭170-189行脚本光标不可以向下移动,开启有黑背景

[复制链接]
梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2016-2-21 18:59:49 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 金芒芒 于 2016-2-22 20:33 编辑
  1. #==============================================================================
  2. # ■ Window_Selectable
  3. #------------------------------------------------------------------------------
  4. #  拥有光标的移动以及滚动功能的窗口类。
  5. #==============================================================================

  6. class Window_Selectable_New < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 定义实例变量
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :index                    # 光标位置
  11.   attr_reader   :help_window              # 帮助窗口
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始画对像
  14.   #     x      : 窗口的 X 坐标
  15.   #     y      : 窗口的 Y 坐标
  16.   #     width  : 窗口的宽
  17.   #     height : 窗口的高
  18.   #--------------------------------------------------------------------------
  19.   def initialize(x, y, width, height)
  20.     super(x, y, width, height)
  21.     @item_max = 1
  22.     @column_max = 1
  23.     @index = -1
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 设置光标的位置
  27.   #     index : 新的光标位置
  28.   #--------------------------------------------------------------------------
  29.   def index=(index)
  30.     @index = index
  31.     # 刷新帮助文本 (update_help 定义了继承目标)
  32.     if self.active and @help_window != nil
  33.       update_help
  34.     end
  35.     # 刷新光标矩形
  36.     update_cursor_rect
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 获取行数
  40.   #--------------------------------------------------------------------------
  41.   def row_max
  42.     # 由项目数和列数计算出行数
  43.     return (@item_max + @column_max - 1) / @column_max
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取开头行
  47.   #--------------------------------------------------------------------------
  48.   def top_row
  49.     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
  50.     return self.oy / 32
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 设置开头行
  54.   #     row : 显示开头的行
  55.   #--------------------------------------------------------------------------
  56.   def top_row=(row)
  57.     # row 未满 0 的场合更正为 0
  58.     if row < 0
  59.       row = 0
  60.     end
  61.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  62.     if row > row_max - 1
  63.       row = row_max - 1
  64.     end
  65.     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
  66.     self.oy = row * 32
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 获取 1 页可以显示的行数
  70.   #--------------------------------------------------------------------------
  71.   def page_row_max
  72.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  73.     return (self.height - 32) / 32
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 获取 1 页可以显示的项目数
  77.   #--------------------------------------------------------------------------
  78.   def page_item_max
  79.     # 将行数 page_row_max 乘上列数 @column_max
  80.     return page_row_max * @column_max
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 帮助窗口的设置
  84.   #     help_window : 新的帮助窗口
  85.   #--------------------------------------------------------------------------
  86.   def help_window=(help_window)
  87.     @help_window = help_window
  88.     # 刷新帮助文本 (update_help 定义了继承目标)
  89.     if self.active and @help_window != nil
  90.       update_help
  91.     end
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 更新光标举行
  95.   #--------------------------------------------------------------------------
  96.   def update_cursor_rect
  97.     # 光标位置不满 0 的情况下
  98.     if @index < 0
  99.       self.cursor_rect.empty
  100.       return
  101.     end
  102.     # 获取当前的行
  103.     row = @index / @column_max
  104.     # 当前行被显示开头行前面的情况下
  105.     if row < self.top_row
  106.       # 从当前行向开头行滚动
  107.       self.top_row = row
  108.     end
  109.     # 当前行被显示末尾行之后的情况下
  110.     if row > self.top_row + (self.page_row_max - 1)
  111.       # 从当前行向末尾滚动
  112.       self.top_row = row - (self.page_row_max - 1)
  113.     end
  114.     # 计算光标的宽
  115.     cursor_width = self.width / @column_max - 32
  116.     # 计算光标坐标
  117.     x = @index % @column_max * (cursor_width + 32)
  118.     y = @index / @column_max * 32 - self.oy
  119.     # 更新国标矩形
  120.     self.cursor_rect.set(x, y, cursor_width, 32)
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新画面
  124.   #--------------------------------------------------------------------------
  125.   def update
  126.     super
  127.     # 可以移动光标的情况下
  128.     if self.active and @item_max > 0 and @index >= 0
  129.       # 方向键下被按下的情况下
  130.       if Input.repeat?(Input::DOWN)
  131.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  132.         # 或光标位置在(项目数-列数)之前的情况下
  133.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  134.            @index < @item_max - @column_max
  135.           # 光标向下移动
  136.           $game_system.se_play($data_system.cursor_se)
  137.           @index = (@index + @column_max) % @item_max
  138.         end
  139.       end
  140.       # 方向键上被按下的情况下
  141.       if Input.repeat?(Input::UP)
  142.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  143.         # 或光标位置在列之后的情况下
  144.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  145.            @index >= @column_max
  146.           # 光标向上移动
  147.           $game_system.se_play($data_system.cursor_se)
  148.           @index = (@index - @column_max + @item_max) % @item_max
  149.         end
  150.       end
  151.       # 方向键右被按下的情况下
  152.       if Input.repeat?(Input::RIGHT)
  153.         # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  154.         if @column_max >= 2 and @index < @item_max - 1
  155.           # 光标向右移动
  156.           $game_system.se_play($data_system.cursor_se)
  157.           @index += 1
  158.         end
  159.       end
  160.       # 方向键左被按下的情况下
  161.       if Input.repeat?(Input::LEFT)
  162.         # 列数为 2 以上并且、光标位置在 0 之后的情况下
  163.         if @column_max >= 2 and @index > 0
  164.           # 光标向左移动
  165.           $game_system.se_play($data_system.cursor_se)
  166.           @index -= 1
  167.         end
  168.       end
  169.       # R 键被按下的情况下
  170. #     if Input.repeat?(Input::R)
  171.         # 显示的最后行在数据中最后行上方的情况下
  172. #       if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  173.           # 光标向后移动一页
  174. #         $game_system.se_play($data_system.cursor_se)
  175. #         @index = [@index + self.page_item_max, @item_max - 1].min
  176. #         self.top_row += self.page_row_max
  177. #       end
  178. #     end
  179.       # L 键被按下的情况下
  180. #     if Input.repeat?(Input::L)
  181.         # 显示的开头行在位置 0 之后的情况下
  182. #       if self.top_row > 0
  183.           # 光标向前移动一页
  184. #         $game_system.se_play($data_system.cursor_se)
  185. #         @index = [@index - self.page_item_max, 0].max
  186. #         self.top_row -= self.page_row_max
  187. #       end
  188. #     end
  189.     end
  190.     # 刷新帮助文本 (update_help 定义了继承目标)
  191.     if self.active and @help_window != nil
  192.       update_help
  193.     end
  194.     # 刷新光标矩形
  195.     update_cursor_rect
  196.   end
  197. end
复制代码





  1. #透明脚本




  2. module Opacity_Menu
  3.   def create_screen
  4.     @screen = Spriteset_Map.new
  5.   end
  6.   def dispose_screen
  7.     @screen.dispose
  8.   end
  9. end

  10. class Window_Base < Window
  11.   def initialize(x, y, width, height)
  12.     super()
  13.     @windowskin_name = $game_system.windowskin_name
  14.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  15.     self.x = x
  16.     self.y = y
  17.     self.width = width
  18.     self.height = height
  19.     self.z = 100
  20.     if $scene.is_a?(Scene_Menu) or
  21.       $scene.is_a?(Scene_Item) or
  22.       $scene.is_a?(Scene_Skill) or
  23.       $scene.is_a?(Scene_Equip) or
  24.       $scene.is_a?(Scene_Status) or
  25.       $scene.is_a?(Scene_Change_Turn) or
  26.       $scene.is_a?(Scene_Save) or
  27.       $scene.is_a?(Scene_End) or
  28.       $scene.is_a?(Scene_Shop)
  29.       self.back_opacity = HS::OPACITY
  30.     end
  31.   end
  32. end

  33. class Scene_Menu
  34.   include Opacity_Menu
  35.   alias main_old main
  36.   def main
  37.     create_screen
  38.     main_old
  39.     dispose_screen
  40.   end
  41. end

  42. class Scene_Item
  43.   include Opacity_Menu
  44.   alias main_old main
  45.   def main
  46.     create_screen
  47.     main_old
  48.     dispose_screen
  49.   end
  50. end

  51. class Scene_Skill
  52.   include Opacity_Menu
  53.   alias main_old main
  54.   def main
  55.     create_screen
  56.     main_old
  57.     dispose_screen
  58.   end
  59. end

  60. class Scene_Equip
  61.   include Opacity_Menu
  62.   alias main_old main
  63.   def main
  64.     create_screen
  65.     main_old
  66.     dispose_screen
  67.   end
  68. end

  69. class Scene_Status
  70.   include Opacity_Menu
  71.   alias main_old main
  72.   def main
  73.     create_screen
  74.     main_old
  75.     dispose_screen
  76.   end
  77. end

  78. class Scene_Change_Turn
  79.   include Opacity_Menu
  80.   alias main_old main
  81.   def main
  82.     create_screen
  83.     main_old
  84.     dispose_screen
  85.   end
  86. end
复制代码


#####只能用手动箭头向下
光标不能向下移动.jpg
光标可以向下移动.jpg
透明.jpg

点评

https://yunpan.cn/cxWZZTTT5i63J (提取码:963a)  发表于 2016-2-22 19:43
看起来即使不关闭那19行脚本也会这样…………  发表于 2016-2-21 23:19
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部