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

Project1

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

[已经解决] 求教 拓展存档数量后 怎么让存档首尾相连?

[复制链接]

Lv4.逐梦者

梦石
0
星屑
5699
在线时间
1190 小时
注册时间
2013-12-3
帖子
278
跳转到指定楼层
1
发表于 2013-12-4 16:58:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
用的是下面这个脚本,请问怎么改写在移动到最下面后回到存档1?
RUBY 代码复制
  1. class Scene_File
  2. SAVEFILE_MAX=25
  3. def initialize(help_text)
  4. @help_text=help_text
  5. end
  6. def main
  7. @help_window=Window_Help.new
  8. @help_window.set_text(@help_text)
  9. @savefile_windows=[]
  10. @cursor_displace=0
  11. for i in 0..3
  12. @savefile_windows.push(Window_SaveFile.new(i,make_filename(i),i))
  13. end
  14. @file_index=0
  15. @savefile_windows[@file_index].selected=true
  16. Graphics.transition
  17. loop do
  18. Graphics.update
  19. Input.update
  20. update
  21. if $scene != self
  22. break
  23. end
  24. end
  25. Graphics.freeze
  26. @help_window.dispose
  27. for i in @savefile_windows
  28. i.dispose
  29. end
  30. end
  31. def update
  32. @help_window.update
  33. for i in @savefile_windows
  34. i.update
  35. end
  36. if Input.trigger?(Input::C)
  37. on_decision(make_filename(@file_index))
  38. $game_temp.last_file_index=@file_index
  39. return
  40. end
  41. if Input.trigger?(Input::B)
  42. on_cancel
  43. return
  44. end
  45. if Input.repeat?(Input::DOWN)
  46. if Input.trigger?(Input::DOWN) or @file_index<SAVEFILE_MAX-1
  47. if @file_index==SAVEFILE_MAX-1
  48. $game_system.se_play($data_system.buzzer_se)
  49. return
  50. end
  51. @cursor_displace+=1
  52. if @cursor_displace==4
  53. @cursor_displace=3
  54. for i in @savefile_windows
  55. i.dispose
  56. end
  57. @savefile_windows=[]
  58. for i in 0..3
  59. f=i-2+@file_index
  60. name= make_filename(f)
  61. @savefile_windows.push(Window_SaveFile.new(f,name,i))
  62. @savefile_windows[i].selected=false
  63. end
  64. end
  65. $game_system.se_play($data_system.cursor_se)
  66. @file_index=(@file_index+1)
  67. if @file_index==SAVEFILE_MAX
  68. @file_index= SAVEFILE_MAX-1
  69. end
  70. for i in 0..3
  71. @savefile_windows[i].selected=false
  72. end
  73. @savefile_windows[@cursor_displace].selected=true
  74. return
  75. end
  76. end
  77. if Input.repeat?(Input::UP)
  78. if Input.trigger?(Input::UP) or @file_index>0
  79. if @file_index==0
  80. $game_system.se_play($data_system.buzzer_se)
  81. return
  82. end
  83. @cursor_displace-=1
  84. if @cursor_displace==-1
  85. @cursor_displace=0
  86. for i in @savefile_windows
  87. i.dispose
  88. end
  89. @savefile_windows=[]
  90. for i in 0..3
  91. f=i-1+@file_index
  92. name= make_filename(f)
  93. @savefile_windows.push(Window_SaveFile.new(f,name,i))
  94. @savefile_windows[i].selected=false
  95. end
  96. end
  97. $game_system.se_play($data_system.cursor_se)
  98. @file_index=(@file_index-1)
  99. if @file_index ==-1
  100. @file_index=0
  101. end
  102. for i in 0..3
  103. @savefile_windows[i].selected=false
  104. end
  105. @savefile_windows[@cursor_displace].selected=true
  106. return
  107. end
  108. end
  109. end
  110.  
  111.  
  112. def make_filename(file_index)
  113. return "Save#{file_index+1}.rxdata"
  114. end
  115. end
  116.  
  117.  
  118. class Window_SaveFile<Window_Base
  119. def initialize(file_index,filename,position)
  120. y=64+position*104
  121. super(0,y,640,104)
  122. self.contents=Bitmap.new(width-32,height-32)
  123. @file_index=file_index
  124. @filename="Save#{file_index+1}.rxdata"
  125. @time_stamp=Time.at(0)
  126. @file_exist=FileTest.exist?(@filename)
  127. if @file_exist
  128. file=File.open(@filename,"r")
  129. @time_stamp=file.mtime
  130. @characters=Marshal.load(file)
  131. @frame_count=Marshal.load(file)
  132. @game_system=Marshal.load(file)
  133. @game_switches=Marshal.load(file)
  134. @game_variables=Marshal.load(file)
  135. @total_sec=@frame_count/Graphics.frame_rate
  136. file.close
  137. end
  138. refresh
  139. @selected=false
  140. end
  141. end

Lv1.梦旅人

梦石
0
星屑
50
在线时间
378 小时
注册时间
2013-10-14
帖子
215
2
发表于 2013-12-4 17:59:26 | 只看该作者
本帖最后由 batfjtn 于 2013-12-4 18:02 编辑

RPG Maker XP v1.03 DK加强v1.00a版(简称DKRM v1.00a)

直接就可以的~!!

你那个脚本看起来太乱了~~!!

是不是你自己自定义的按下按上出了问题~!!

2更:

修改循环的问题修改Window_Selectable~!

附带个DKRM的脚本:

RUBY 代码复制下载
  1. #==============================================================================
  2. # ■ Window_Selectable
  3. #------------------------------------------------------------------------------
  4. #  拥有光标的移动以及滚动功能的窗口类。
  5. #==============================================================================
  6.  
  7. class Window_Selectable < 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.     [url=home.php?mod=space&uid=370741]@Index[/url] = -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

评分

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

查看全部评分

最简单的学习方法就是努力回答别人的问题...
任何教程都没有实践来的重要...
XP小问题都能自己解决了,剩下的就是脚本了...
╰⋛⋋⊱⋋๑角⊱☠c色๑⋌⊰⋌⋚╯
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5699
在线时间
1190 小时
注册时间
2013-12-3
帖子
278
3
 楼主| 发表于 2013-12-4 18:06:53 | 只看该作者
batfjtn 发表于 2013-12-4 17:59
RPG Maker XP v1.03 DK加强v1.00a版(简称DKRM v1.00a)

直接就可以的~!!

好的 我去看看0.0
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-10 04:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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