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

Project1

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

回来补课的某人.....大家来帮个忙吧

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2007-8-1
帖子
115
跳转到指定楼层
1
发表于 2008-1-7 01:42:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
    求助{/ll}求助{/ll}
  哪位大大能帮忙把这个脚本的背景换一下{/ll}
就素用Pic文件夹里的一张图片作为这个窗口的背景{/hx}
最好能帮我讲下{/hx}
  1. #================================================================================#
  2. #****Window_Time                                                                 #
  3. #--------------------------------------------------------------------------------#
  4. #    显示时间的窗口类                                                            #
  5. #================================================================================#
  6. class Window_Time < Window_Base
  7.   #----------------------#
  8.   #*初始化对象           #
  9.   #----------------------#
  10.   def initialize
  11.     #更新窗口坐标
  12.     $game_variables[$time_window_pattern] = $default_pattern
  13.     @pattern_now = $default_pattern
  14.     time_date_window_update
  15.    
  16.     #设定窗口
  17.     super($time_date_X, $time_date_Y, $time_date_W, $time_date_H)
  18.     self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
  19.     #self.contents.font.name = (["标楷体"]) #防错用
  20.     self.opacity = $time_window_opacity
  21.    
  22.     #开关初始化 -- 预设防错的 不喜欢再用事件初始化
  23.     $game_switches[$time_date_running] = true #时间功能开启
  24.     $game_switches[$time_date_tone] = true    #色调功能开启
  25.     $game_switches[$hide_window] = false      #隐藏功能关闭
  26.     $game_switches[$real_time_format] = true  #真实时间12小时制
  27.     $game_switches[$time_date_weather] = true #天气功能开启
  28.     $game_switches[$time_map_region] = true   #区域功能开启
  29.    
  30.     #变数归零
  31.     $weather_hour = nil
  32.     $weather_type_rand = 0
  33.     $hour_count = 0
  34.     $weather_hour = 0
  35.     $game_variables[$week] = 1
  36.     @id = $game_map.map_id
  37.     for i in [$min, $hour, $day, $month, $year]
  38.       if $game_variables[i] == 0
  39.         $game_variables[i] = 1
  40.         i+=1
  41.       end # end if
  42.     end # end for
  43.     #刷新窗口
  44.     refresh
  45.   end # end def initialize
  46.   #----------------------#
  47.   #*刷新                 #
  48.   #----------------------#
  49.   def refresh
  50.     self.contents.clear
  51.     self.contents.font.size = $time_window_font_size
  52.     self.contents.font.color = game_date
  53.    
  54.     #计算时间
  55.     if $game_switches[$time_date_running] == true
  56.       @total_sec = Graphics.frame_count
  57.       if @total_sec % $min_rate ==0
  58.         $game_variables[$min] += 1
  59.       end
  60.       if $game_variables[$min] >= $hour_rate + 1
  61.         $game_variables[$min] = 1
  62.         $game_variables[$hour] += 1
  63.         $hour_count += 1
  64.       end
  65.       if $game_variables[$hour] >= $day_rate + 1
  66.         $game_variables[$hour] = 1
  67.         $game_variables[$day] += 1
  68.         $game_variables[$week] += 1
  69.         if $game_variables[$week] == 8
  70.           $game_variables[$week] = 1
  71.         end
  72.       end
  73.       if $game_variables[$day] >= $month_rate + 1
  74.         $game_variables[$day] = 1
  75.         $game_variables[$month] += 1
  76.       end
  77.       if $game_variables[$month] >= $year_rate + 1
  78.         $game_variables[$month] = 1
  79.         $game_variables[$year] += 1
  80.       end
  81.     end
  82.    
  83.    
  84.     #判断是否在室内
  85.     newid = $game_map.map_id                        #获取地图ID
  86.     if newid != @id
  87.         @id = newid
  88.     end
  89.     $mapnames = load_data("Data/MapInfos.rxdata")   #读取地图名称
  90.     map_name = $mapnames[@id].name
  91.     if map_name.include?("内") or map_name.include?(",IN")
  92.     #如果地图名称包含"内"或",IN"
  93.       $game_switches[$time_date_weather] = false    #则不显示天气
  94.       $weather_hour = 0
  95.       $weather_type = 99                            #99是让窗口不会显示天气
  96.                                                     #应该不会有人定义99种天气吧
  97.       $game_variables[$time_map_region] = 98
  98.     end
  99.     time_date_window_update                         #窗口文字坐标调整
  100.     print_date                                      #显示文字
  101.     get_season_weather                              #计算季节天气机率
  102.     show_festival                                   #显示节日
  103.     get_region_weather                              #计算区域天气机率
  104.                                              
  105.    
  106.     if $game_switches[$time_date_weather] == true  #天气功能开关为ON时
  107.       #如果天气需要归零
  108.       if $hour_count >= $weather_hour or $weather_hour == 0
  109.         $hour_count = 0                             #天气持续时间归零
  110.         $weather_type_rand = rand(100) + 1          #随机数生成天气类型
  111.         $weather_power =     rand(9) + 1            #随机数生成天气强度
  112.         $weather_hour = rand($weather_hour_max) + 1 #随机数出现天气时间
  113.         $weather_dur = 50
  114.       else
  115.         $weather_1_min = 1                                #天气一最低机率
  116.         $weather_1_max = $weather_1_rate                  #天气一最高机率
  117.         $weather_2_min = $weather_1_max + 1               #天气二最低机率
  118.         $weather_2_max = $weather_2_min + $weather_2_rate #天气二最高机率
  119.         $weather_3_min = $weather_2_max + 1               #天气三最低机率
  120.         $weather_3_max = $weather_3_min + $weather_3_rate #天气三最高机率
  121.         $weather_4_min = $weather_3_max + 1               #天气四最低机率
  122.         $weather_4_max = $weather_4_min + $weather_4_rate #天气四最高机率
  123.         
  124.         if $weather_1_rate != 0
  125.           if $weather_type_rand >= $weather_1_min and $weather_type_rand <=$weather_1_max
  126.             $weather_type = 0 #无
  127.           end
  128.         end
  129.         if $weather_2_rate != 0
  130.           if $weather_type_rand >= $weather_2_min and $weather_type_rand <=$weather_2_max
  131.             $weather_type = 1 #雨
  132.           end
  133.         end
  134.         if $weather_3_rate != 0
  135.           if $weather_type_rand >= $weather_3_min and $weather_type_rand <=$weather_3_max
  136.             $weather_type = 2 #风
  137.           end
  138.         end
  139.         if $weather_4_rate != 0
  140.           if $weather_type_rand >= $weather_4_min and $weather_type_rand <=$weather_4_max
  141.             $weather_type = 3 #雪
  142.           end
  143.         end
  144.         
  145.         #播放天气BGS
  146.         #Audio.bgs_play("文件名",音量,节奏速度)
  147.         case $weather_type #当天气
  148.         when 0
  149.           Audio.bgs_stop
  150.         when 1             #是雨的情况下
  151.           Audio.bgs_play("Audio/BGS/005-Rain01", 60)
  152.          
  153.         when 2             #是风的情况下
  154.           Audio.bgs_play("Audio/BGS/001-Wind01", 70)
  155.          
  156.         when 3             #是雪的情况下
  157.           Audio.bgs_play("Audio/BGS/003-Wind03", 80)
  158.          
  159.         end# end case
  160.       end # end if
  161.       $weather_dur = 50
  162.     else                                            #如果天气开关为off
  163.       $weather_type, $weather_power, $weather_dur = [0,0,0]#将天气回复为无
  164.     end # end if
  165.    
  166.     $game_screen.weather($weather_type, $weather_power, $weather_dur)   #显示天气
  167.    
  168.     if $game_switches[$time_date_tone] == true      #如果色调开关为on
  169.       get_tone                                    #显示色调
  170.       $game_screen.start_tone_change(Tone.new($tone_R, $tone_G, $tone_B, $tone_K), 50)
  171.     else                                            #如果为off
  172.                                                     #色调回复正常
  173.       $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
  174.     end # end if
  175.    
  176.     #当人物走到窗口坐标时移动时间窗口
  177.     if $game_player.screen_x >= ($time_date_X - 16) && $game_player.screen_x <= ($time_date_X + $time_date_W + 16)
  178.       if $game_player.screen_y >= ($time_date_Y - 16) && $game_player.screen_y <= ($time_date_Y + $time_date_H + 16)
  179.                                             # +/- 16 像素是调整手感
  180.         self.x = $time_date_XM
  181.         self.y = $time_date_YM
  182.         time_date_screen_moved = true               #避免与自动隐藏功能互相冲突
  183.         
  184.         case $hide_direction                        #将隐藏方向改为相反的方向
  185.         when 2
  186.           $hide_direction = 8
  187.         when 4
  188.           $hide_direction = 6
  189.         when 6
  190.           $hide_direction = 4
  191.         when 8
  192.           $hide_direction = 2
  193.         end # end case
  194.         
  195.       else                                          #窗口回到原位
  196.         self.x = $time_date_X
  197.         self.y = $time_date_Y
  198.         time_date_screen_moved = false              #避免与自动隐藏功能互相冲突
  199.       end # end if
  200.     else                                            #窗口回到原位
  201.       self.x = $time_date_X
  202.       self.y = $time_date_Y
  203.       time_date_screen_moved = false                #避免与自动隐藏功能互相冲突
  204.     end # end if

  205.     mouse_x, mouse_y = [-1, -1]                     #没使用鼠标脚本时防错
  206.     #如果使用鼠标脚本的话就取消注释
  207.     #如果不使用鼠标脚本的话就注释掉,否则会报错
  208.     mouse_x, mouse_y = Mouse.get_mouse_pos         #获得鼠标位置
  209.    
  210.     #当按住A键时
  211.       #显示现实时间
  212.     if Input.press?(Input::A)
  213.       show_real_time      
  214.     end # end if
  215.    
  216.     #当鼠标移动到窗口时位置 或是按下Z键时
  217.       #显示已自动隐藏的时间窗口
  218.     if $game_switches[$hide_window] == true
  219.       case $hide_direction                          #调整隐藏方向
  220.       when 2
  221.         self.y = $time_date_Y + $time_date_H - $hide_window_width
  222.       when 4
  223.         self.x = -($time_date_W) + $hide_window_width
  224.       when 6
  225.         self.x = $time_date_X + $time_date_W - $hide_window_width
  226.       when 8
  227.         self.y = -($time_date_H) + $hide_window_width
  228.       end # end case
  229.       if Input.press?(Input::Z) or (mouse_x >= $time_date_X && mouse_x <= ($time_date_X + $time_date_W)) && (mouse_y >= $time_date_Y and mouse_y <= ($time_date_Y + $time_date_H))
  230.         if time_date_screen_moved == false          #避免与自动移动功能互相冲突
  231.           self.x = $time_date_X
  232.           self.y = $time_date_Y
  233.         else
  234.           self.x = $time_date_XM
  235.           self.y = $time_date_YM
  236.         end
  237.       end # end if
  238.     else
  239.       if time_date_screen_moved == false            #避免与自动移动功能互相冲突
  240.         self.x = $time_date_X
  241.         self.y = $time_date_Y
  242.       end
  243.     end # end if
  244.    
  245.     #更新窗口坐标等
  246.     if $game_variables[$time_window_pattern] != @pattern_now
  247.       time_date_window_update
  248.       self.x = $time_date_X
  249.       self.y = $time_date_Y
  250.       self.z = $time_window_z
  251.       self.width = $time_date_W
  252.       self.height = $time_date_H
  253.       self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
  254.       @pattern_now = $game_variables[$time_window_pattern]
  255.     end

  256.   end # end def refresh

  257.   #----------------------#
  258.   #*刷新画面             #
  259.   #----------------------#
  260.   def update
  261.     super
  262.     refresh
  263.   end # end def update
  264. end# end class Window_time

  265. #================================================================================#
  266. #****Scene_Map                                                                   #
  267. #--------------------------------------------------------------------------------#
  268. #    处理地图画面的类别。                                                        #
  269. #================================================================================#
  270. class Scene_Map
  271.   #--------------------------------------------------------------------------
  272.   # ● 主处理
  273.   #--------------------------------------------------------------------------
  274.   alias timedate_main main
  275.   def main
  276.     # 产生活动区块
  277.     @spriteset = Spriteset_Map.new
  278.     # 产生讯息窗口
  279.     @message_window = Window_Message.new
  280.     # 产生时间窗口
  281.     @time_window = Window_Time.new
  282.     if $game_switches[$time_date_running] == false
  283.       @time_window.visible = false
  284.     end # end if
  285.     # 执行过渡
  286.     Graphics.transition
  287.     # 主循环
  288.     loop do
  289.       # 更新游戏画面
  290.       Graphics.update
  291.       # 更新输入讯息
  292.       Input.update
  293.       # 更新画面
  294.       update
  295.       # 如果画面切换的话就中断循环
  296.       if $scene != self
  297.         break
  298.       end # end if
  299.     end # end loop
  300.     # 准备过渡
  301.     Graphics.freeze
  302.     # 释放活动区块
  303.     @spriteset.dispose
  304.     # 释放讯息窗口
  305.     @message_window.dispose
  306.     # 释放时间窗口
  307.     @time_window.dispose
  308.     # 标题画面切换中的情况下
  309.     if $scene.is_a?(Scene_Title)
  310.       # 淡入淡出画面
  311.       Graphics.transition
  312.       Graphics.freeze
  313.     end # end if
  314.   end # end def main
  315.   
  316.   alias timedate_update update
  317.   def update
  318.    
  319.     #如果时间日期功能开关为OFF则不显示时间窗口
  320.     if $game_switches[$time_date_running] == false
  321.       @time_window.visible = false
  322.     else
  323.       @time_window.visible = true
  324.     end # end if

  325.     @time_window.refresh
  326.     timedate_update
  327.   end # end def update
  328. end #end class Scene_Map

  329. #================================================================================#
  330. #****Window_Time                                                                 #
  331. #--------------------------------------------------------------------------------#
  332. #    显示时间的窗口类                                                            #
  333. #================================================================================#
  334. class Window_Time < Window_Base
  335.   
  336.   def show_real_time
  337.     @time = Time.now
  338.     @time_hour = @time.hour  # 用来计算十二小时制的 注意 . 和 _ 的差别
  339.    
  340.     #text = sprintf("%02d年%02d月%02d日 [   ] %02d:%002d ", @time.year, @time.month, @time.day, @time_hour, @time.min)
  341.     self.contents.clear
  342.     self.contents.font.color = real_date
  343.     self.contents.font.size = 22
  344.    
  345.     if $game_switches[$real_time_format] == true
  346.       if @time_hour >= 12
  347.         @time_hour -= 12
  348.         text = "PM"
  349.       else
  350.         text = "AM"
  351.       end # end if
  352.     else
  353.       text = ""
  354.     end # end if
  355.    
  356.     self.contents.draw_text($APM_x, $APM_y, 128, 32, text)
  357.     self.contents.draw_text($year_x, $year_y, 128, $year_font_size + 14, @time.year.to_s + "年")
  358.     self.contents.draw_text($month_x, $month_y, 128, $month_font_size + 14, @time.month.to_s + "月")
  359.     self.contents.draw_text($day_x, $day_y, 128, $day_font_size + 14, @time.day.to_s + "日")
  360.     self.contents.draw_text($hour_x , $hour_y, 128, $hour_font_size + 14, @time_hour.to_s)
  361.     self.contents.draw_text($hour_x + 26, $hour_y - 3, 128, $hour_font_size + 14, ":")
  362.     @time_min = sprintf("%02d", @time.min.to_s)
  363.     self.contents.draw_text($min_x - 3, $min_y, 128, $min_font_size + 14, @time_min)
  364.       
  365.     #!!!!注意!!!!
  366.     #这里是真实时间的星期名称,
  367.     #若是要改变游戏时间的星期名称,请到第二部分282行
  368.     case @time.wday
  369.     when 0
  370.       weektxt = "周日"
  371.     when 1
  372.       weektxt = "周一"
  373.     when 2
  374.       weektxt = "周二"
  375.     when 3
  376.       weektxt = "周三"
  377.     when 4
  378.       weektxt = "周四"
  379.     when 5
  380.       weektxt = "周五"
  381.     when 6
  382.       weektxt = "周六"
  383.     end # end case
  384.     self.contents.draw_text($week_x, $week_y, 128, $week_font_size + 14, weektxt)
  385.   end# end def show_real_time
  386.   
  387.   def get_season_weather
  388.     # 用季节区分天气类型出现机率

  389.     # 春天
  390.     case $game_variables[$season]
  391.     when 1
  392.       $weather_1_rate = $spring_none
  393.       $weather_2_rate = $spring_rain
  394.       $weather_3_rate = $spring_wind
  395.       $weather_4_rate = $spring_snow
  396.       
  397.     # 夏天
  398.     when 2
  399.       $weather_1_rate = $summer_none
  400.       $weather_2_rate = $summer_rain
  401.       $weather_3_rate = $summer_wind
  402.       $weather_4_rate = $summer_snow

  403.     # 秋天
  404.     when 3
  405.       $weather_1_rate = $autumn_none
  406.       $weather_2_rate = $autumn_rain
  407.       $weather_3_rate = $autumn_wind
  408.       $weather_4_rate = $autumn_snow

  409.     # 冬天
  410.     when 4
  411.       $weather_1_rate = $winter_none
  412.       $weather_2_rate = $winter_rain
  413.       $weather_3_rate = $winter_wind
  414.       $weather_4_rate = $winter_snow
  415.       
  416.     end # end case
  417.   end #end definition
  418.   
  419. end
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2007-8-1
帖子
115
2
 楼主| 发表于 2008-1-7 01:42:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
    求助{/ll}求助{/ll}
  哪位大大能帮忙把这个脚本的背景换一下{/ll}
就素用Pic文件夹里的一张图片作为这个窗口的背景{/hx}
最好能帮我讲下{/hx}
  1. #================================================================================#
  2. #****Window_Time                                                                 #
  3. #--------------------------------------------------------------------------------#
  4. #    显示时间的窗口类                                                            #
  5. #================================================================================#
  6. class Window_Time < Window_Base
  7.   #----------------------#
  8.   #*初始化对象           #
  9.   #----------------------#
  10.   def initialize
  11.     #更新窗口坐标
  12.     $game_variables[$time_window_pattern] = $default_pattern
  13.     @pattern_now = $default_pattern
  14.     time_date_window_update
  15.    
  16.     #设定窗口
  17.     super($time_date_X, $time_date_Y, $time_date_W, $time_date_H)
  18.     self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
  19.     #self.contents.font.name = (["标楷体"]) #防错用
  20.     self.opacity = $time_window_opacity
  21.    
  22.     #开关初始化 -- 预设防错的 不喜欢再用事件初始化
  23.     $game_switches[$time_date_running] = true #时间功能开启
  24.     $game_switches[$time_date_tone] = true    #色调功能开启
  25.     $game_switches[$hide_window] = false      #隐藏功能关闭
  26.     $game_switches[$real_time_format] = true  #真实时间12小时制
  27.     $game_switches[$time_date_weather] = true #天气功能开启
  28.     $game_switches[$time_map_region] = true   #区域功能开启
  29.    
  30.     #变数归零
  31.     $weather_hour = nil
  32.     $weather_type_rand = 0
  33.     $hour_count = 0
  34.     $weather_hour = 0
  35.     $game_variables[$week] = 1
  36.     @id = $game_map.map_id
  37.     for i in [$min, $hour, $day, $month, $year]
  38.       if $game_variables[i] == 0
  39.         $game_variables[i] = 1
  40.         i+=1
  41.       end # end if
  42.     end # end for
  43.     #刷新窗口
  44.     refresh
  45.   end # end def initialize
  46.   #----------------------#
  47.   #*刷新                 #
  48.   #----------------------#
  49.   def refresh
  50.     self.contents.clear
  51.     self.contents.font.size = $time_window_font_size
  52.     self.contents.font.color = game_date
  53.    
  54.     #计算时间
  55.     if $game_switches[$time_date_running] == true
  56.       @total_sec = Graphics.frame_count
  57.       if @total_sec % $min_rate ==0
  58.         $game_variables[$min] += 1
  59.       end
  60.       if $game_variables[$min] >= $hour_rate + 1
  61.         $game_variables[$min] = 1
  62.         $game_variables[$hour] += 1
  63.         $hour_count += 1
  64.       end
  65.       if $game_variables[$hour] >= $day_rate + 1
  66.         $game_variables[$hour] = 1
  67.         $game_variables[$day] += 1
  68.         $game_variables[$week] += 1
  69.         if $game_variables[$week] == 8
  70.           $game_variables[$week] = 1
  71.         end
  72.       end
  73.       if $game_variables[$day] >= $month_rate + 1
  74.         $game_variables[$day] = 1
  75.         $game_variables[$month] += 1
  76.       end
  77.       if $game_variables[$month] >= $year_rate + 1
  78.         $game_variables[$month] = 1
  79.         $game_variables[$year] += 1
  80.       end
  81.     end
  82.    
  83.    
  84.     #判断是否在室内
  85.     newid = $game_map.map_id                        #获取地图ID
  86.     if newid != @id
  87.         @id = newid
  88.     end
  89.     $mapnames = load_data("Data/MapInfos.rxdata")   #读取地图名称
  90.     map_name = $mapnames[@id].name
  91.     if map_name.include?("内") or map_name.include?(",IN")
  92.     #如果地图名称包含"内"或",IN"
  93.       $game_switches[$time_date_weather] = false    #则不显示天气
  94.       $weather_hour = 0
  95.       $weather_type = 99                            #99是让窗口不会显示天气
  96.                                                     #应该不会有人定义99种天气吧
  97.       $game_variables[$time_map_region] = 98
  98.     end
  99.     time_date_window_update                         #窗口文字坐标调整
  100.     print_date                                      #显示文字
  101.     get_season_weather                              #计算季节天气机率
  102.     show_festival                                   #显示节日
  103.     get_region_weather                              #计算区域天气机率
  104.                                              
  105.    
  106.     if $game_switches[$time_date_weather] == true  #天气功能开关为ON时
  107.       #如果天气需要归零
  108.       if $hour_count >= $weather_hour or $weather_hour == 0
  109.         $hour_count = 0                             #天气持续时间归零
  110.         $weather_type_rand = rand(100) + 1          #随机数生成天气类型
  111.         $weather_power =     rand(9) + 1            #随机数生成天气强度
  112.         $weather_hour = rand($weather_hour_max) + 1 #随机数出现天气时间
  113.         $weather_dur = 50
  114.       else
  115.         $weather_1_min = 1                                #天气一最低机率
  116.         $weather_1_max = $weather_1_rate                  #天气一最高机率
  117.         $weather_2_min = $weather_1_max + 1               #天气二最低机率
  118.         $weather_2_max = $weather_2_min + $weather_2_rate #天气二最高机率
  119.         $weather_3_min = $weather_2_max + 1               #天气三最低机率
  120.         $weather_3_max = $weather_3_min + $weather_3_rate #天气三最高机率
  121.         $weather_4_min = $weather_3_max + 1               #天气四最低机率
  122.         $weather_4_max = $weather_4_min + $weather_4_rate #天气四最高机率
  123.         
  124.         if $weather_1_rate != 0
  125.           if $weather_type_rand >= $weather_1_min and $weather_type_rand <=$weather_1_max
  126.             $weather_type = 0 #无
  127.           end
  128.         end
  129.         if $weather_2_rate != 0
  130.           if $weather_type_rand >= $weather_2_min and $weather_type_rand <=$weather_2_max
  131.             $weather_type = 1 #雨
  132.           end
  133.         end
  134.         if $weather_3_rate != 0
  135.           if $weather_type_rand >= $weather_3_min and $weather_type_rand <=$weather_3_max
  136.             $weather_type = 2 #风
  137.           end
  138.         end
  139.         if $weather_4_rate != 0
  140.           if $weather_type_rand >= $weather_4_min and $weather_type_rand <=$weather_4_max
  141.             $weather_type = 3 #雪
  142.           end
  143.         end
  144.         
  145.         #播放天气BGS
  146.         #Audio.bgs_play("文件名",音量,节奏速度)
  147.         case $weather_type #当天气
  148.         when 0
  149.           Audio.bgs_stop
  150.         when 1             #是雨的情况下
  151.           Audio.bgs_play("Audio/BGS/005-Rain01", 60)
  152.          
  153.         when 2             #是风的情况下
  154.           Audio.bgs_play("Audio/BGS/001-Wind01", 70)
  155.          
  156.         when 3             #是雪的情况下
  157.           Audio.bgs_play("Audio/BGS/003-Wind03", 80)
  158.          
  159.         end# end case
  160.       end # end if
  161.       $weather_dur = 50
  162.     else                                            #如果天气开关为off
  163.       $weather_type, $weather_power, $weather_dur = [0,0,0]#将天气回复为无
  164.     end # end if
  165.    
  166.     $game_screen.weather($weather_type, $weather_power, $weather_dur)   #显示天气
  167.    
  168.     if $game_switches[$time_date_tone] == true      #如果色调开关为on
  169.       get_tone                                    #显示色调
  170.       $game_screen.start_tone_change(Tone.new($tone_R, $tone_G, $tone_B, $tone_K), 50)
  171.     else                                            #如果为off
  172.                                                     #色调回复正常
  173.       $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
  174.     end # end if
  175.    
  176.     #当人物走到窗口坐标时移动时间窗口
  177.     if $game_player.screen_x >= ($time_date_X - 16) && $game_player.screen_x <= ($time_date_X + $time_date_W + 16)
  178.       if $game_player.screen_y >= ($time_date_Y - 16) && $game_player.screen_y <= ($time_date_Y + $time_date_H + 16)
  179.                                             # +/- 16 像素是调整手感
  180.         self.x = $time_date_XM
  181.         self.y = $time_date_YM
  182.         time_date_screen_moved = true               #避免与自动隐藏功能互相冲突
  183.         
  184.         case $hide_direction                        #将隐藏方向改为相反的方向
  185.         when 2
  186.           $hide_direction = 8
  187.         when 4
  188.           $hide_direction = 6
  189.         when 6
  190.           $hide_direction = 4
  191.         when 8
  192.           $hide_direction = 2
  193.         end # end case
  194.         
  195.       else                                          #窗口回到原位
  196.         self.x = $time_date_X
  197.         self.y = $time_date_Y
  198.         time_date_screen_moved = false              #避免与自动隐藏功能互相冲突
  199.       end # end if
  200.     else                                            #窗口回到原位
  201.       self.x = $time_date_X
  202.       self.y = $time_date_Y
  203.       time_date_screen_moved = false                #避免与自动隐藏功能互相冲突
  204.     end # end if

  205.     mouse_x, mouse_y = [-1, -1]                     #没使用鼠标脚本时防错
  206.     #如果使用鼠标脚本的话就取消注释
  207.     #如果不使用鼠标脚本的话就注释掉,否则会报错
  208.     mouse_x, mouse_y = Mouse.get_mouse_pos         #获得鼠标位置
  209.    
  210.     #当按住A键时
  211.       #显示现实时间
  212.     if Input.press?(Input::A)
  213.       show_real_time      
  214.     end # end if
  215.    
  216.     #当鼠标移动到窗口时位置 或是按下Z键时
  217.       #显示已自动隐藏的时间窗口
  218.     if $game_switches[$hide_window] == true
  219.       case $hide_direction                          #调整隐藏方向
  220.       when 2
  221.         self.y = $time_date_Y + $time_date_H - $hide_window_width
  222.       when 4
  223.         self.x = -($time_date_W) + $hide_window_width
  224.       when 6
  225.         self.x = $time_date_X + $time_date_W - $hide_window_width
  226.       when 8
  227.         self.y = -($time_date_H) + $hide_window_width
  228.       end # end case
  229.       if Input.press?(Input::Z) or (mouse_x >= $time_date_X && mouse_x <= ($time_date_X + $time_date_W)) && (mouse_y >= $time_date_Y and mouse_y <= ($time_date_Y + $time_date_H))
  230.         if time_date_screen_moved == false          #避免与自动移动功能互相冲突
  231.           self.x = $time_date_X
  232.           self.y = $time_date_Y
  233.         else
  234.           self.x = $time_date_XM
  235.           self.y = $time_date_YM
  236.         end
  237.       end # end if
  238.     else
  239.       if time_date_screen_moved == false            #避免与自动移动功能互相冲突
  240.         self.x = $time_date_X
  241.         self.y = $time_date_Y
  242.       end
  243.     end # end if
  244.    
  245.     #更新窗口坐标等
  246.     if $game_variables[$time_window_pattern] != @pattern_now
  247.       time_date_window_update
  248.       self.x = $time_date_X
  249.       self.y = $time_date_Y
  250.       self.z = $time_window_z
  251.       self.width = $time_date_W
  252.       self.height = $time_date_H
  253.       self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
  254.       @pattern_now = $game_variables[$time_window_pattern]
  255.     end

  256.   end # end def refresh

  257.   #----------------------#
  258.   #*刷新画面             #
  259.   #----------------------#
  260.   def update
  261.     super
  262.     refresh
  263.   end # end def update
  264. end# end class Window_time

  265. #================================================================================#
  266. #****Scene_Map                                                                   #
  267. #--------------------------------------------------------------------------------#
  268. #    处理地图画面的类别。                                                        #
  269. #================================================================================#
  270. class Scene_Map
  271.   #--------------------------------------------------------------------------
  272.   # ● 主处理
  273.   #--------------------------------------------------------------------------
  274.   alias timedate_main main
  275.   def main
  276.     # 产生活动区块
  277.     @spriteset = Spriteset_Map.new
  278.     # 产生讯息窗口
  279.     @message_window = Window_Message.new
  280.     # 产生时间窗口
  281.     @time_window = Window_Time.new
  282.     if $game_switches[$time_date_running] == false
  283.       @time_window.visible = false
  284.     end # end if
  285.     # 执行过渡
  286.     Graphics.transition
  287.     # 主循环
  288.     loop do
  289.       # 更新游戏画面
  290.       Graphics.update
  291.       # 更新输入讯息
  292.       Input.update
  293.       # 更新画面
  294.       update
  295.       # 如果画面切换的话就中断循环
  296.       if $scene != self
  297.         break
  298.       end # end if
  299.     end # end loop
  300.     # 准备过渡
  301.     Graphics.freeze
  302.     # 释放活动区块
  303.     @spriteset.dispose
  304.     # 释放讯息窗口
  305.     @message_window.dispose
  306.     # 释放时间窗口
  307.     @time_window.dispose
  308.     # 标题画面切换中的情况下
  309.     if $scene.is_a?(Scene_Title)
  310.       # 淡入淡出画面
  311.       Graphics.transition
  312.       Graphics.freeze
  313.     end # end if
  314.   end # end def main
  315.   
  316.   alias timedate_update update
  317.   def update
  318.    
  319.     #如果时间日期功能开关为OFF则不显示时间窗口
  320.     if $game_switches[$time_date_running] == false
  321.       @time_window.visible = false
  322.     else
  323.       @time_window.visible = true
  324.     end # end if

  325.     @time_window.refresh
  326.     timedate_update
  327.   end # end def update
  328. end #end class Scene_Map

  329. #================================================================================#
  330. #****Window_Time                                                                 #
  331. #--------------------------------------------------------------------------------#
  332. #    显示时间的窗口类                                                            #
  333. #================================================================================#
  334. class Window_Time < Window_Base
  335.   
  336.   def show_real_time
  337.     @time = Time.now
  338.     @time_hour = @time.hour  # 用来计算十二小时制的 注意 . 和 _ 的差别
  339.    
  340.     #text = sprintf("%02d年%02d月%02d日 [   ] %02d:%002d ", @time.year, @time.month, @time.day, @time_hour, @time.min)
  341.     self.contents.clear
  342.     self.contents.font.color = real_date
  343.     self.contents.font.size = 22
  344.    
  345.     if $game_switches[$real_time_format] == true
  346.       if @time_hour >= 12
  347.         @time_hour -= 12
  348.         text = "PM"
  349.       else
  350.         text = "AM"
  351.       end # end if
  352.     else
  353.       text = ""
  354.     end # end if
  355.    
  356.     self.contents.draw_text($APM_x, $APM_y, 128, 32, text)
  357.     self.contents.draw_text($year_x, $year_y, 128, $year_font_size + 14, @time.year.to_s + "年")
  358.     self.contents.draw_text($month_x, $month_y, 128, $month_font_size + 14, @time.month.to_s + "月")
  359.     self.contents.draw_text($day_x, $day_y, 128, $day_font_size + 14, @time.day.to_s + "日")
  360.     self.contents.draw_text($hour_x , $hour_y, 128, $hour_font_size + 14, @time_hour.to_s)
  361.     self.contents.draw_text($hour_x + 26, $hour_y - 3, 128, $hour_font_size + 14, ":")
  362.     @time_min = sprintf("%02d", @time.min.to_s)
  363.     self.contents.draw_text($min_x - 3, $min_y, 128, $min_font_size + 14, @time_min)
  364.       
  365.     #!!!!注意!!!!
  366.     #这里是真实时间的星期名称,
  367.     #若是要改变游戏时间的星期名称,请到第二部分282行
  368.     case @time.wday
  369.     when 0
  370.       weektxt = "周日"
  371.     when 1
  372.       weektxt = "周一"
  373.     when 2
  374.       weektxt = "周二"
  375.     when 3
  376.       weektxt = "周三"
  377.     when 4
  378.       weektxt = "周四"
  379.     when 5
  380.       weektxt = "周五"
  381.     when 6
  382.       weektxt = "周六"
  383.     end # end case
  384.     self.contents.draw_text($week_x, $week_y, 128, $week_font_size + 14, weektxt)
  385.   end# end def show_real_time
  386.   
  387.   def get_season_weather
  388.     # 用季节区分天气类型出现机率

  389.     # 春天
  390.     case $game_variables[$season]
  391.     when 1
  392.       $weather_1_rate = $spring_none
  393.       $weather_2_rate = $spring_rain
  394.       $weather_3_rate = $spring_wind
  395.       $weather_4_rate = $spring_snow
  396.       
  397.     # 夏天
  398.     when 2
  399.       $weather_1_rate = $summer_none
  400.       $weather_2_rate = $summer_rain
  401.       $weather_3_rate = $summer_wind
  402.       $weather_4_rate = $summer_snow

  403.     # 秋天
  404.     when 3
  405.       $weather_1_rate = $autumn_none
  406.       $weather_2_rate = $autumn_rain
  407.       $weather_3_rate = $autumn_wind
  408.       $weather_4_rate = $autumn_snow

  409.     # 冬天
  410.     when 4
  411.       $weather_1_rate = $winter_none
  412.       $weather_2_rate = $winter_rain
  413.       $weather_3_rate = $winter_wind
  414.       $weather_4_rate = $winter_snow
  415.       
  416.     end # end case
  417.   end #end definition
  418.   
  419. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2026-6-19 02:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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