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

Project1

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

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
跳转到指定楼层
1
发表于 2016-2-21 18:59:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 金芒芒 于 2016-2-22 20:33 编辑

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






RUBY 代码复制
  1. #透明脚本
  2.  
  3.  
  4.  
  5.  
  6. module Opacity_Menu
  7.   def create_screen
  8.     @screen = Spriteset_Map.new
  9.   end
  10.   def dispose_screen
  11.     @screen.dispose
  12.   end
  13. end
  14.  
  15. class Window_Base < Window
  16.   def initialize(x, y, width, height)
  17.     super()
  18.     @windowskin_name = $game_system.windowskin_name
  19.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  20.     self.x = x
  21.     self.y = y
  22.     self.width = width
  23.     self.height = height
  24.     self.z = 100
  25.     if $scene.is_a?(Scene_Menu) or
  26.       $scene.is_a?(Scene_Item) or
  27.       $scene.is_a?(Scene_Skill) or
  28.       $scene.is_a?(Scene_Equip) or
  29.       $scene.is_a?(Scene_Status) or
  30.       $scene.is_a?(Scene_Change_Turn) or
  31.       $scene.is_a?(Scene_Save) or
  32.       $scene.is_a?(Scene_End) or
  33.       $scene.is_a?(Scene_Shop)
  34.       self.back_opacity = HS::OPACITY
  35.     end
  36.   end
  37. end
  38.  
  39. class Scene_Menu
  40.   include Opacity_Menu
  41.   alias main_old main
  42.   def main
  43.     create_screen
  44.     main_old
  45.     dispose_screen
  46.   end
  47. end
  48.  
  49. class Scene_Item
  50.   include Opacity_Menu
  51.   alias main_old main
  52.   def main
  53.     create_screen
  54.     main_old
  55.     dispose_screen
  56.   end
  57. end
  58.  
  59. class Scene_Skill
  60.   include Opacity_Menu
  61.   alias main_old main
  62.   def main
  63.     create_screen
  64.     main_old
  65.     dispose_screen
  66.   end
  67. end
  68.  
  69. class Scene_Equip
  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.  
  79. class Scene_Status
  80.   include Opacity_Menu
  81.   alias main_old main
  82.   def main
  83.     create_screen
  84.     main_old
  85.     dispose_screen
  86.   end
  87. end
  88.  
  89. class Scene_Change_Turn
  90.   include Opacity_Menu
  91.   alias main_old main
  92.   def main
  93.     create_screen
  94.     main_old
  95.     dispose_screen
  96.   end
  97. end


#####只能用手动箭头向下

光标不能向下移动.jpg (103.63 KB, 下载次数: 4)

光标不能向下移动.jpg

光标可以向下移动.jpg (88.89 KB, 下载次数: 5)

光标可以向下移动.jpg

透明.jpg (36.42 KB, 下载次数: 8)

透明.jpg

点评

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

本版积分规则

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

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

GMT+8, 2024-9-22 17:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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