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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: david50407

[讨论] XP 脚本 模组化运动 & 全系列补完

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
462 小时
注册时间
2007-7-30
帖子
643
 楼主| 发表于 2010-11-20 14:55:08 | 显示全部楼层
本帖最后由 david50407 于 2010-11-20 14:55 编辑
  1. #==============================================================================
  2. # ■ WShow
  3. #------------------------------------------------------------------------------
  4. #  显示特定值的视窗。
  5. #==============================================================================

  6. class WShow < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化视窗
  9.   #--------------------------------------------------------------------------
  10.   def initialize(*args)
  11.     if args[0].is_a?(Hash)
  12.       width = args[0][:width]
  13.       height = args[0][:height]
  14.       args.shift
  15.     end
  16.     @kinds = args
  17.     width = 160 if width.nil?
  18.     height = 32 * args.length + 32 if height.nil?
  19.     super(0, 0, width, height)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     refresh
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 更新
  25.   #--------------------------------------------------------------------------
  26.   def refresh
  27.     self.contents.clear
  28.     x = 4
  29.     y = 0
  30.     for c in @kinds
  31.       case c
  32.       when :gold
  33.         cx = contents.text_size($data_system.words.gold).width
  34.         self.contents.font.color = normal_color
  35.         self.contents.draw_text(x, y, width - cx - 42, 32, $game_party.gold.to_s, 2)
  36.         self.contents.font.color = system_color
  37.         self.contents.draw_text(width - 36 - cx, y, cx, 32, $data_system.words.gold, 2)
  38.         y += 32
  39.         
  40.       when :playtime
  41.         self.contents.font.color = system_color
  42.         self.contents.draw_text(x, y, width - 40, 32, "游戏时间")
  43.         @total_sec = Graphics.frame_count / Graphics.frame_rate
  44.         hour = @total_sec / 60 / 60
  45.         min = @total_sec / 60 % 60
  46.         sec = @total_sec % 60
  47.         text = sprintf("%02d:%02d:%02d", hour, min, sec)
  48.         self.contents.font.color = normal_color
  49.         self.contents.draw_text(x, y + 32, width - 40, 32, text, 2)
  50.         y += 64
  51.         
  52.       when :steps
  53.         self.contents.font.color = system_color
  54.         self.contents.draw_text(x, y, 120, 32, "步数")
  55.         self.contents.font.color = normal_color
  56.         self.contents.draw_text(x, y + 32, 120, 32, $game_party.steps.to_s, 2)
  57.         y += 64
  58.         
  59.       end
  60.     end
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 更新画面
  64.   #--------------------------------------------------------------------------
  65.   def update
  66.     super
  67.     if @kinds.include?(:playtime)
  68.       if Graphics.frame_count / Graphics.frame_rate != @total_sec
  69.         refresh
  70.       end
  71.     end
  72.   end
  73. end
复制代码
用法...
@window = WShow.new({:height => 128 + 32}, :steps, :gold)
第一个参数可以是Hash {:height => 128, :width => 180}
也可以不是
剩下的参数是 :steps :gold :playtime
RGE这万年大坑 啥时填起来@@

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
1
星屑
8785
在线时间
4363 小时
注册时间
2005-10-22
帖子
6722

开拓者贵宾

发表于 2010-11-20 14:57:23 | 显示全部楼层
其实我疯狂地想在update和refresh那种东西里加EVAL……
然后再给个@属性的东西里塞上要EVAL的东西
然后从此就彻底成万用型诡异物了……

点评

蛇前辈的东西怎么都是诡异的……  发表于 2010-11-20 16:16
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 17:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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