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

Project1

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

[已经解决] 截图存档的问题。

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
17 小时
注册时间
2008-9-18
帖子
14
跳转到指定楼层
1
发表于 2009-8-7 10:35:29 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 第二疯子 于 2009-8-14 22:10 编辑



为了美化遂将window窗弄成背景透明,但在Title里读取游戏的时候十分难看。
能不能将“存档/读取”框单独使用一个window窗呢?
或者还原成系统默认那种读取时淡化背景。
再或者有没有办法用事件调取读取框?貌似只能打开存档界面。。。

...

截图存档脚本:
  1. #==============================================================================
  2. # ■ Window_SaveFile
  3. #==============================================================================

  4. class Window_SaveFile < Window_Base
  5.   #--------------------------------------------------------------------------
  6.   # ◎ 定义实例变量
  7.   #--------------------------------------------------------------------------
  8.   attr_reader   :filename                 # 文件名
  9.   attr_reader   :file_exist               # 文件存在标志
  10.   #--------------------------------------------------------------------------
  11.   # ◎ 初始化对象
  12.   #     file_index : 存档文件索引 (0~3)
  13.   #     filename   : 文件名
  14.   #--------------------------------------------------------------------------
  15.   def initialize(file_index, filename)
  16.     super(176, 59, 304, 298)
  17.     @file_index = file_index
  18.     @filename = filename
  19.     make_dir(SAVE_DIR) if SAVE_DIR != nil
  20.     load_gamedata
  21.     refresh(@file_index)
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ◎ 读取部分游戏数据
  25.   #--------------------------------------------------------------------------
  26.   def load_gamedata
  27.     @file_exist = FileTest.exist?(SAVE_DIR + @filename)
  28.     if @file_exist
  29.       file = File.open(SAVE_DIR + @filename, "r")
  30.       begin
  31.         @characters          = Marshal.load(file)
  32.         @frame_count         = Marshal.load(file)
  33.         @last_bgm            = Marshal.load(file)
  34.         @last_bgs            = Marshal.load(file)
  35.         @game_system         = Marshal.load(file)
  36.         @game_message        = Marshal.load(file)
  37.         @game_switches       = Marshal.load(file)
  38.         @game_variables      = Marshal.load(file)
  39.         @game_self_switches  = Marshal.load(file)
  40.         @game_actors         = Marshal.load(file)
  41.         @game_party          = Marshal.load(file)
  42.         @game_troop          = Marshal.load(file)
  43.         @game_map            = Marshal.load(file)
  44.         @game_player         = Marshal.load(file)
  45.         # 读取截图
  46.         @file_bitmap         = Marshal.load(file)
  47.         @total_sec = @frame_count / Graphics.frame_rate
  48.       rescue
  49.         @file_exist = false
  50.       ensure
  51.         file.close
  52.       end
  53.     end
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ◎ 刷新
  57.   #     index : 索引
  58.   #--------------------------------------------------------------------------
  59.   def refresh(index)
  60.     file_index = index
  61.     self.contents.clear
  62.     self.contents.font.color = normal_color
  63.     if @file_exist
  64.       # 描绘底部阴影
  65.       self.contents.fill_rect(0, 0, 272,210, Color.new(0,0,64))
  66.       # 描绘截图
  67.       draw_snap_bitmap(0, 0)
  68.       draw_map_name(0, 180)
  69.       draw_party_characters(108, 232)
  70.       draw_gold(0, 240)
  71.       draw_playtime(0, 240, contents.width, 2)
  72.     else
  73.       self.contents.draw_text(0, 288-56, contents.width-4,WLH, "- 无此存档 -", 1)
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ◎ 更改索引
  78.   #     index : 索引
  79.   #--------------------------------------------------------------------------
  80.   def file_index=(file_index)
  81.     @file_index = file_index
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ◎ 描绘游戏人物
  85.   #     x : 描画先 X 座標
  86.   #     y : 描画先 Y 座標
  87.   #--------------------------------------------------------------------------
  88.   def draw_party_characters(x, y)
  89.     for i in [email protected]
  90.       name = @characters[i][0]
  91.       index = @characters[i][1]
  92.       actor_id = @game_party.members[i].id
  93.       level = @game_actors[actor_id].level
  94.       draw_character(name, index, x + i * 48, y)
  95.       self.contents.font.size = 14
  96.       self.contents.draw_text(x + i * 48, y-16, WLH-8, WLH, level.to_s, 2)
  97.       self.contents.font.size = Font.default_size
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ◎ 描绘游戏时间
  102.   #     x     : 描绘目标 X 坐标
  103.   #     y     : 描绘目标 Y 坐标
  104.   #     width : 宽
  105.   #     align : 配置
  106.   #--------------------------------------------------------------------------
  107.   def draw_playtime(x, y, width, align)
  108.     self.contents.font.color = system_color
  109.     self.contents.font.size = 16
  110.     hour = @total_sec / 60 / 60
  111.     min = @total_sec / 60 % 60
  112.     sec = @total_sec % 60
  113.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  114.     cx = contents.text_size(time_string).width
  115.     self.contents.draw_text(x, y, width, WLH, "游戏时间")
  116.     self.contents.font.color = normal_color
  117.     self.contents.draw_text(x+cx+4, y, width-cx-4, WLH, time_string)
  118.     self.contents.font.size = Font.default_size
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ◎ 描绘地图名称
  122.   #     x : 描画先 X 座標
  123.   #     y : 描画先 Y 座標
  124.   #--------------------------------------------------------------------------
  125.   def draw_map_name(x, y)
  126.     mapinfo = load_data("Data/MapInfos.rvdata")
  127.     result = mapinfo[@game_map.map_id].name
  128.     map_name = result.split(/,/)[0]
  129.     # 地图名包含@时不描绘
  130.     return if map_name =~ /@/
  131.     color1 = Color.new(0,0,0,96)
  132.     color2 = Color.new(0,0,0,32)
  133.     self.contents.gradient_fill_rect(x, y, width, 18, color1, color2)
  134.     self.contents.font.color = system_color
  135.     self.contents.font.size = 16
  136.     self.contents.font.shadow = false
  137.     self.contents.draw_text(x+4, y-4, width, WLH, "◎ " + map_name)
  138.     self.contents.font.color = normal_color
  139.     self.contents.font.size = Font.default_size
  140.     self.contents.font.shadow = Font.default_shadow
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ◎ 描绘金钱
  144.   #     x : 描画先 X 座標
  145.   #     y : 描画先 Y 座標
  146.   #--------------------------------------------------------------------------
  147.   def draw_gold(x, y)
  148.     self.contents.font.size = 16
  149.     cx = contents.text_size(Vocab::gold).width
  150.     self.contents.font.color = normal_color
  151.     value = @game_party.gold
  152.     width = self.contents.width
  153.     self.contents.draw_text(x, y, width-cx-2, WLH, value, 2)
  154.     self.contents.font.color = system_color
  155.     self.contents.draw_text(x, y, width, WLH, Vocab::gold, 2)
  156.     self.contents.font.size = Font.default_size
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ◎ 生成保存路径
  160.   #     path : 路径
  161.   #--------------------------------------------------------------------------
  162.   def make_dir(path)
  163.     dir = path.split("/")
  164.     for i in 0...dir.size
  165.       unless dir == "."
  166.         add_dir = dir[0..i].join("/")
  167.         begin
  168.           Dir.mkdir(add_dir)
  169.         rescue
  170.         end
  171.       end
  172.     end
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ◎ 生成文件名
  176.   #     file_index : 存档文件索引 (0~3)
  177.   #--------------------------------------------------------------------------
  178.   def make_filename(file_index)
  179.     return "Save#{file_index + 1}.rvdata"
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ◎ 描绘截图
  183.   #     x : 描画先 X 座標
  184.   #     y : 描画先 Y 座標
  185.   #--------------------------------------------------------------------------
  186.   def draw_snap_bitmap(x, y)
  187.     bitmap = @file_bitmap
  188.     if bitmap == nil
  189.       self.contents.draw_text(0, 112, 384-32, WLH, "- 找不到截图文件 -", 1)
  190.     else
  191.       self.contents.blur
  192.       rect = Rect.new(0, 0, 0, 0)
  193.       rect.width = bitmap.width
  194.       rect.height = bitmap.height
  195.       self.contents.blt(x, y, bitmap, rect)
  196.     end
  197.   end
  198. end
复制代码
马甲,马甲。

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6087
在线时间
6588 小时
注册时间
2007-12-16
帖子
4501

贵宾

2
发表于 2009-8-7 14:26:36 | 只看该作者
在第17行下面插入
  1. self.back_opacity = 200
复制代码

还在龟速填坑中
回复 支持 反对

使用道具 举报

Lv2.观梦者 (管理员)

八云紫的式神

梦石
0
星屑
564
在线时间
1243 小时
注册时间
2008-1-1
帖子
4282

烫烫烫

3
发表于 2009-8-13 07:57:01 | 只看该作者
这跟背景透明度有啥关系- -
截图存档的Window_SaveFile的initialize里加上
self.windowskin = Cache.system("window")
rm for linux(wine)制作中,期待夏娜SAMA能实现到webrm上
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
17 小时
注册时间
2008-9-18
帖子
14
4
 楼主| 发表于 2009-8-14 21:11:38 | 只看该作者
已经解决……
方法是挪了存档的坐标,
去掉了图片显示。
存档数改为,2
是不是很强大……

马甲,马甲。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-1 05:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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