| 赞 | 0  | 
 
| VIP | 258 | 
 
| 好人卡 | 2 | 
 
| 积分 | 0 | 
 
| 经验 | 11030 | 
 
| 最后登录 | 2016-8-20 | 
 
| 在线时间 | 36 小时 | 
 
 
 
 
 
Lv1.梦旅人 ~琉璃の雪~< 
	- 梦石
 - 0 
 
        - 星屑
 - 49 
 
        - 在线时间
 - 36 小时
 
        - 注册时间
 - 2008-11-6
 
        - 帖子
 - 3678
 
 
 
 | 
	
送你一个: 
n久已前保存的,没想到现在还有机会出手: 
- #==============================================================================
 
 - # rmvx时钟 by 沉影不器
 
 - #------------------------------------------------------------------------------
 
 - # 功能描述: 显示一个带指针的时钟
 
 - # 素材准备: 时钟指针分别命名为 hour_hand、minute_hand、second_hand
 
 - #           时钟背景命名为 clock_bg,另需要一个盖住指针的圆扣命名为 top_button
 
 - # 使用方法: Main之前插入脚本,在需要时钟的场景中调用:
 
 - #           Sprite_Clock.new(x坐标, y坐标, 不透明度)
 
 - #           (参考范例Scene_Map添加时钟)
 
 - #           脚本第18行设定控制时钟显示的变量号
 
 - #==============================================================================
 
 - # □ Sprite_Clock
 
 - #==============================================================================
 
 - class Sprite_Clock
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 常量
 
 -   #--------------------------------------------------------------------------
 
 -   SHOW_SWITCH_ID = 1
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 初始化对象
 
 -   #     x      : 时钟中心的 X 坐标
 
 -   #     y      : 时钟中心的 Y 坐标
 
 -   #     alpha  : 不透明度
 
 -   #--------------------------------------------------------------------------
 
 -   def initialize(x, y, alpha = 255)
 
 -     @x = x
 
 -     @y = y
 
 -     @alpha = alpha
 
 -     # 暂停标志
 
 -     @time_pause = false
 
 -     # 为指针更新初始化计数器
 
 -     @second_count = 0
 
 -     @minute_count = 0
 
 -     @hour_count = 0
 
 -     create_clock_bg
 
 -     # 本来想控制是否生成秒针
 
 -     for type in 0..2
 
 -       create_hands(type)
 
 -     end
 
 -     create_top_button
 
 -     # 初始化时间
 
 -     set_time
 
 -     # 显示标志
 
 -     change_visible
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose
 
 -     dispose_clock_bg
 
 -     dispose_hands
 
 -     dispose_top_button
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 刷新画面
 
 -   #--------------------------------------------------------------------------
 
 -   def update
 
 -     # 按确定键时切换暂停标志
 
 -     if Input.repeat?(Input::L)
 
 -       @time_pause = !@time_pause
 
 -     end
 
 -     return if @time_pause
 
 -     # 以秒为单位更新指针
 
 -     update_time_now
 
 -     # 检查显示
 
 -     change_visible
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 设定时间
 
 -   #--------------------------------------------------------------------------
 
 -   def set_time
 
 -     time = Time.now
 
 -     @second = time.sec
 
 -     @second = 0 if @second == 60
 
 -     @minute = time.min
 
 -     @hour = time.hour
 
 -     @second_hand.angle = -@second*6
 
 -     @minute_hand.angle = -@minute*6 - @second.to_f/10
 
 -     @hour_hand.angle = -@hour*30 - (@minute.to_f/60)*30 - @second.to_f*(1.0/144)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 生成时钟背景
 
 -   #--------------------------------------------------------------------------
 
 -   def create_clock_bg
 
 -     @clock_bg = Sprite.new
 
 -     @clock_bg.bitmap = Cache.picture("clock_bg")
 
 -     @clock_bg.opacity = @alpha
 
 -     @clock_bg.x = @x - @clock_bg.width/2
 
 -     @clock_bg.y = @y - @clock_bg.height/2
 
 -     @clock_bg.z = 999
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 生成顶端固定扣
 
 -   #--------------------------------------------------------------------------
 
 -   def create_top_button
 
 -     @top_button = Sprite.new
 
 -     @top_button.bitmap = Cache.picture("top_button")
 
 -     @top_button.opacity = @alpha
 
 -     @top_button.x = @x - @top_button.width/2
 
 -     @top_button.y = @y - @top_button.height/2
 
 -     @top_button.z = @second_hand.z + 1
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 生成指针
 
 -   #     type : 类型(0:时针; 1:分针; 2: 秒针)
 
 -   #--------------------------------------------------------------------------
 
 -   def create_hands(type)
 
 -     case type
 
 -     when 0
 
 -       @hour_hand = Sprite.new
 
 -       @hour_hand.bitmap = Cache.picture("hour_hand")
 
 -       @hour_hand.opacity = @alpha
 
 -       @hour_hand.angle_center(@x, @y)
 
 -       @hour_hand.z = @clock_bg.z + 1
 
 -     when 1
 
 -       @minute_hand = Sprite.new
 
 -       @minute_hand.bitmap = Cache.picture("minute_hand")
 
 -       @minute_hand.opacity = @alpha
 
 -       @minute_hand.angle_center(@x, @y)
 
 -       @minute_hand.z = @hour_hand.z + 1
 
 -     when 2
 
 -       @second_hand = Sprite.new
 
 -       @second_hand.bitmap = Cache.picture("second_hand")
 
 -       @second_hand.opacity = @alpha
 
 -       @second_hand.angle_center(@x, @y)
 
 -       @second_hand.z = @minute_hand.z + 1
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放背景
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose_clock_bg
 
 -     @clock_bg.dispose
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放指针
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose_hands
 
 -     @hour_hand.dispose if @hour_hand != nil
 
 -     @minute_hand.dispose if @minute_hand != nil
 
 -     @second_hand.dispose if @second_hand != nil
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放顶端固定扣
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose_top_button
 
 -     @top_button.dispose
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新指针
 
 -   #--------------------------------------------------------------------------
 
 -   def update_hands
 
 -     @hour_hand.angle -= 1.0/144
 
 -     @minute_hand.angle -= 1.0/10
 
 -     @second_hand.angle -= 6
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新时间
 
 -   #--------------------------------------------------------------------------
 
 -   def update_time_now
 
 -     time = Time.now
 
 -     second = time.sec
 
 -     if second != @second
 
 -       @second = second
 
 -       update_hands
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更改不透明度
 
 -   #--------------------------------------------------------------------------
 
 -   def alpha=(alpha)
 
 -     @alpha = alpha if alpha.is_a?(Integer)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更改可见标志
 
 -   #--------------------------------------------------------------------------
 
 -   def change_visible
 
 -     if @clock_show == $game_switches[SHOW_SWITCH_ID]
 
 -       return
 
 -     else
 
 -       @clock_show = $game_switches[SHOW_SWITCH_ID]
 
 -     end
 
 -     for i in [@clock_bg, @hour_hand, @minute_hand, @second_hand, @top_button]
 
 -       i.visible = $game_switches[SHOW_SWITCH_ID]
 
 -     end
 
 -   end
 
 - end
 
  
- #==============================================================================
 
 - # ■ Sprite
 
 - #==============================================================================
 
 - class Sprite < Object
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 设定中心旋转
 
 -   #--------------------------------------------------------------------------
 
 -   def angle_center(x, y)
 
 -     self.ox = self.width/2
 
 -     self.oy = self.height/2
 
 -     self.x = x
 
 -     self.y = y
 
 -   end
 
 - end
 
  复制代码 |   
 
 
 
 |