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

Project1

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

[已经解决] 想请教关于存档页面

 关闭 [复制链接]

Lv4.逐梦者

梦石
7
星屑
2585
在线时间
567 小时
注册时间
2009-4-30
帖子
271
跳转到指定楼层
1
发表于 2011-9-11 00:18:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在下想请教关于存档页面的选择方式,
通常一个页面会显示4个档案(01、02、03、04),
当我们选到04按「下」,
看到页面会是02、03、04、05,

请问该如何固定一个页面就是4个档案,
在04按下的时候,页面呈现05、06、07、08。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
54 小时
注册时间
2011-8-4
帖子
87
2
发表于 2011-9-11 07:06:06 | 只看该作者
写一个当选到某个档案号码时,再按下“下键”,就出现后面四个
我也大一了啊~~
哇咔咔咔咔,癫狂侠客给我现场教学了,你们没有吧~~

梦幻西游高仿版制作进程:
剧情:★★★☆☆☆☆☆☆☆
脚本:★☆☆☆☆☆☆☆☆☆
音乐:★★★☆☆☆☆☆☆☆
界面:★☆☆☆☆☆☆☆☆☆
回复

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
3
发表于 2011-9-11 08:48:48 | 只看该作者
LZ应该用了某增加存档的脚本吧?

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv4.逐梦者

梦石
7
星屑
2585
在线时间
567 小时
注册时间
2009-4-30
帖子
271
4
 楼主| 发表于 2011-9-11 14:35:47 | 只看该作者
本帖最后由 timmyyayaya 于 2011-9-11 14:41 编辑

是的,在下使用了其他的存盘脚本,不知该如何设置当选到某个档案按下时,跳出后面四个。
  1. timmyyayaya于2011-9-11 14:38补充以下内容:
  2. #==============================================================================
  3. # ■ Window_SaveFile
  4. #------------------------------------------------------------------------------
  5. #==============================================================================

  6. class Window_SaveFile < Window_Selectable  
  7.   
  8.   
  9. attr_reader :file_exist
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化物件
  12.   #--------------------------------------------------------------------------
  13.   def initialize(x, y, width, height)
  14.     super(x, y, width, height)
  15.     #super(260, 110, 360, 300)
  16.     cursorOffset(70)  # 游标大小70
  17.     @item_max = $SAVE_FILE_MAX_NUM
  18.     @column_max = 1     #只有两列
  19.     self.index = 0
  20.     #确认档案是否存在
  21.     @file_exist = []
  22.     for i in 0..($SAVE_FILE_MAX_NUM - 1)
  23.       filename = "Save#{i + 1}.rxdata"
  24.       file_exist_temp = FileTest.exist?(filename)
  25.       if file_exist_temp
  26.         @file_exist[i] = 1
  27.       else
  28.         @file_exist[i] = 0
  29.       end
  30.     end
  31.     @filename = []
  32.     @time_stamp = []
  33.     @characters = []
  34.     @frame_count = []
  35.     @game_system = []
  36.     @game_switches = []
  37.     @game_variables = []
  38.     @total_sec = []
  39.    
  40.      #打开档案读数据
  41.     for i in 0..($SAVE_FILE_MAX_NUM - 1)
  42.       @time_stamp[i] = Time.at(0)
  43.       if @file_exist[i] == 1
  44.         filename = "Save#{i + 1}.rxdata"
  45.         file = File.open(filename, "r")
  46.         @filename[i] = filename
  47.         @time_stamp[i] = file.mtime
  48.         @characters[i] = Marshal.load(file)
  49.         @frame_count[i] = Marshal.load(file)
  50.         @game_system[i] = Marshal.load(file)
  51.         @game_switches[i] = Marshal.load(file)
  52.         @game_variables[i] = Marshal.load(file)
  53.         @total_sec[i] = @frame_count[i] / Graphics.frame_rate
  54.         file.close
  55.       end
  56.     end
  57.     refresh
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更新
  61.   #--------------------------------------------------------------------------
  62.   def refresh
  63.     if self.contents != nil
  64.       self.contents.dispose
  65.       self.contents = nil
  66.     end
  67.    # self.contents = Bitmap.new(width - 32, $SAVE_FILE_MAX_NUM * 72)
  68.     self.contents = Bitmap.new(width - 32, ($SAVE_FILE_MAX_NUM-1) * 75-32)
  69.     for i in 0..($SAVE_FILE_MAX_NUM - 1)
  70.       draw_item(i)
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 描绘项目
  75.   #     index : 项目编号
  76.   #--------------------------------------------------------------------------
  77.   def draw_item(index)
  78.     x = 0
  79.     y = index * 70#75
  80.     rect = Rect.new(x, y, 200, 36)
  81.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  82.     self.contents.font.color = system_color

  83.     #描绘文件编号
  84.     if index + 1 < 10
  85.     name = "DATA 0#{index + 1}"
  86.     self.contents.draw_text(x, y, 80, 32, name)
  87.     else
  88.     name = "DATA #{index + 1}"
  89.     self.contents.draw_text(x, y, 80, 32, name)
  90.     end

  91.     if @file_exist[index] == 1
  92.       # 描绘角色
  93.       for i in 0...@characters[index].size
  94.         first_one_pos = 160
  95.         stand_distance = 32
  96.         height_of_ground = 22
  97.         bitmap = RPG::Cache.character(@characters[index][i][0], @characters[index][i][1])
  98.         cw = bitmap.rect.width / 4
  99.         ch = bitmap.rect.height / 4
  100.         src_rect = Rect.new(0, 0, cw, ch)
  101.         cx = first_one_pos - @characters[index].size * stand_distance + i * 32 - cw / 2
  102.         self.contents.blt(cx, y+height_of_ground, bitmap, src_rect)
  103.         #cw = bitmap.rect.width / 4
  104.         #h = bitmap.rect.height / 4
  105.         #rect = Rect.new(x + 60 + (cw * index), y + 36, cw, ch)
  106.         #cx = 300 - @characters[index].size * 32 + index * 64 - cw / 2
  107.         #self.contents.blt(cx, 68 - ch, bitmap, rect)
  108.       end
  109.       # 描绘游戏时间
  110.       hour = @total_sec[index] / 60 / 60
  111.       min = @total_sec[index] / 60 % 60
  112.       time_string = sprintf("%02d:%02d", hour,min)
  113.       
  114.       self.contents.draw_text(x+150, y + 22, 160, 32, time_string, 2)
  115.       # 描绘时间标记
  116.       time_string = @time_stamp[index].strftime("%Y/%m/%d %H:%M")
  117.       self.contents.draw_text(x+150, y + 44, 160, 32, time_string, 2)
  118.     end
  119.   end

  120.   def save_window_update
  121.     #update_cursor_rect
  122.     if Input.trigger?(Input::B)
  123.       # 演奏取消 SE
  124.       $game_system.se_play($data_system.cancel_se)
  125.       # 切换到选单画面
  126.       $scene = Scene_Menu.new(5)
  127.       return
  128.     end
  129.     # 按下C键的场合下
  130.     #if Input.trigger?(Input::C)
  131.       # 命令窗口光标位置分歧
  132.     #  case self.index
  133.     #  when 0  # 返回标题画面
  134.     #    command_to_title
  135.     #  when 1  # 退出
  136.     #    command_shutdown
  137.     #  end
  138.     #  return
  139.     #end
  140.   end
  141.   
  142.   def make_filename(file_index)
  143.     return "Save#{file_index + 1}.rxdata"
  144.   end

  145. end
复制代码
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
486 小时
注册时间
2009-7-23
帖子
449
5
发表于 2011-9-11 16:10:39 | 只看该作者
86行,把
  1. if index + 1 < 10
复制代码
10改成5试试?
回复

使用道具 举报

Lv4.逐梦者

梦石
7
星屑
2585
在线时间
567 小时
注册时间
2009-4-30
帖子
271
6
 楼主| 发表于 2011-9-11 16:12:32 | 只看该作者
本帖最后由 timmyyayaya 于 2011-9-11 16:13 编辑
2578699 发表于 2011-9-11 16:10
86行,把10改成5试试?


那个是文件的编号名称…

点评

呃....在俺這邊套用上去會出錯的...|||  发表于 2011-9-11 16:31
额,算我没说  发表于 2011-9-11 16:13
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6805
在线时间
1666 小时
注册时间
2008-10-29
帖子
6710

贵宾

7
发表于 2011-9-11 16:41:59 | 只看该作者
你贴的脚本只是其中的一部分吧











你知道得太多了

回复

使用道具 举报

Lv4.逐梦者

梦石
7
星屑
2585
在线时间
567 小时
注册时间
2009-4-30
帖子
271
8
 楼主| 发表于 2011-9-11 16:46:28 | 只看该作者
后知后觉 发表于 2011-9-11 16:41
你贴的脚本只是其中的一部分吧

因为用了很多脚本,听朋友说主要的问题可能是在这个脚本,不知是否能从这里找出些问题?
  1. class Window_Selectable < Window_Base
  2.   #以下是控制游標選取區域大小的腳本
  3.   #--------------------------------------------------------------------------
  4.   # ● 用來定義游標選取區域大小的函式
  5.   #--------------------------------------------------------------------------
  6.   def cursorOffset(cursorOffsetVar)
  7.      @cursorOffset = cursorOffsetVar
  8.    end

  9.   #--------------------------------------------------------------------------
  10.   # ● 取得行數
  11.   #--------------------------------------------------------------------------
  12.   def row_max
  13.     # 由項目數和列數計算出行數
  14.     return (@item_max + @column_max - 1) / @column_max
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 取得開頭行
  18.   #--------------------------------------------------------------------------
  19.   def top_row
  20.     # 將視窗內容的傳送源 Y 座標、1 行的高 32 等分
  21.     return self.oy / @cursorOffset
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 設定開頭行
  25.   #     row : 顯示開頭的行
  26.   #--------------------------------------------------------------------------
  27.   def top_row=(row)
  28.     # row 未滿 0 的場合更正為 0
  29.     if row < 0
  30.       row = 0
  31.     end
  32.     # row 超過 row_max - 1 的情況下更正為 row_max - 1
  33.     if row > row_max - 1
  34.       row = row_max - 1
  35.     end
  36.     # row 1 行高的 32 倍、視窗內容的傳送源 Y 座標
  37.     self.oy = row * @cursorOffset
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 獲取 1 頁可以顯示的行數
  41.   #--------------------------------------------------------------------------
  42.   def page_row_max
  43.     # 視窗的高度,設定畫面的高度減去 32 ,除以 1 行的高度 32
  44.     return (self.height - @cursorOffset) / @cursorOffset
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 獲取 1 頁可以顯示的項目數
  48.   #--------------------------------------------------------------------------
  49.   def page_item_max
  50.     # 將行數 page_row_max 乘上列數 @column_max
  51.     return page_row_max * @column_max
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 更新游標矩形
  55.   #--------------------------------------------------------------------------
  56.   def update_cursor_rect
  57.     #定義游標矩形與左右兩側的距離
  58.     cursor_width_grid = 32
  59.     #Null Guard
  60.     if @cursorOffset == nil  
  61.        #沒有調用cursorOffset的,都幫他將上一個預設值
  62.       @cursorOffset = 32
  63.     end  
  64.     # 游標位置不滿 0 的情況下
  65.     if @index < 0
  66.       self.cursor_rect.empty
  67.       return
  68.     end
  69.     # 取得當前的行
  70.     row = @index / @column_max
  71.     # 當前行被顯示開頭行前面的情況下
  72.     if row < self.top_row
  73.       # 從當前行向開頭行捲動
  74.       self.top_row = row
  75.     end
  76.     # 當前行被顯示末尾行之後的情況下
  77.    # if row > self.top_row + (self.page_row_max-1)
  78.     if row > self.top_row + (self.page_row_max)
  79.       # 從當前行向末尾捲動
  80.     #   self.top_row = row - (self.page_row_max-1)
  81.       self.top_row = row - (self.page_row_max)
  82.     end
  83.     # 計算游標的寬度
  84.     #cursor_width = self.width / @column_max - @cursorOffset
  85.     cursor_width = self.width / @column_max - cursor_width_grid
  86.     # 計算游標座標
  87.     x = @index % @column_max * (cursor_width + @cursorOffset)
  88.     y = @index / @column_max * @cursorOffset - self.oy
  89.     # 更新游標矩形
  90.     self.cursor_rect.set(x, y, cursor_width, @cursorOffset)
  91.   end
  92. end
复制代码
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6805
在线时间
1666 小时
注册时间
2008-10-29
帖子
6710

贵宾

9
发表于 2011-9-11 16:59:32 | 只看该作者
这是选项窗口的父类.也的确可以对这个类下手.
但是改了后.那所有的以这个类为父类的窗口就都被改了.
不过要改的地方也不在你放的这段脚本里. 是改  def update 里的内容

点评

似乎是没有改到原本的update,现在脚本的Pagedown和up有点怪, 一页4个存档,在01按Pagedown会翻页可是是选在04, 不知道是什么原因不会选在05…  发表于 2011-9-11 17:06











你知道得太多了

回复

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
10
发表于 2011-9-11 17:12:03 | 只看该作者
LZ有一个外来脚本是调用到Window_SaveFile的,请全局搜索找找

点评

在4楼  发表于 2011-9-11 17:21

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-20 07:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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