赞 | 11 |
VIP | 107 |
好人卡 | 119 |
积分 | 149 |
经验 | 180043 |
最后登录 | 2024-9-8 |
在线时间 | 3303 小时 |
Lv4.逐梦者 送快递的水表员
- 梦石
- 10
- 星屑
- 4857
- 在线时间
- 3303 小时
- 注册时间
- 2012-6-27
- 帖子
- 7160
|
本帖最后由 Password 于 2016-5-28 18:59 编辑
用这个脚本完全替换原 Scene_Map 即可。然后就可以愉快地+1s了
默认1号开关控制显示与否。如果需要游戏开始就显示的话请在游戏刚开始就打开1号开关。【我先默认显示左下角好了
范例:
测试工程.rar
(241.78 KB, 下载次数: 125)
脚本:- #==============================================================================
- # ■ Window_Time
- #------------------------------------------------------------------------------
- # 显示时间的窗口。
- #==============================================================================
- class Window_Time < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标 w : 窗口宽度,默认160
- # y : 窗口 Y 座标 h : 窗口高度,默认是2行文字宽度
- #--------------------------------------------------------------------------
- def initialize(x, y, w=160, h=WLH*2+32)
- super(x, y, w, h)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- draw_playtime
- end
- #--------------------------------------------------------------------------
- # ● 描绘游戏时间
- #--------------------------------------------------------------------------
- def draw_playtime
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- time_string = sprintf("%02d时%02d分%02d秒", hour, min, sec)
-
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width, WLH, "游戏时间:")
- self.contents.draw_text(0, WLH, 160, WLH, time_string)
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_map.refresh
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- @time_window = Window_Time.new(0, 360-24) #修改
- end
- #--------------------------------------------------------------------------
- # ● 执行渐变
- #--------------------------------------------------------------------------
- def perform_transition
- if Graphics.brightness == 0 # 战斗後或载入後等
- fadein(30)
- else # 从菜单中回来等
- Graphics.transition(15)
- end
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
- @spriteset.dispose_characters # 隐藏角色来生成战斗背景
- end
- snapshot_for_background
- @spriteset.dispose
- @message_window.dispose
- if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
- perform_battle_transition # 执行战斗渐变
- end
- @time_window.dispose #修改
- end
- #--------------------------------------------------------------------------
- # ● 基本更新处理
- #--------------------------------------------------------------------------
- def update_basic
- Graphics.update # 更新游戏画面
- Input.update # 更新输入信息
- $game_map.update # 更新地图
- @spriteset.update # 更新活动块组
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- $game_map.interpreter.update # 更新解释器
- $game_map.update # 更新地图
- $game_player.update # 更新主角
- $game_system.update # 更新计时器
- @spriteset.update # 更新活动块组
- @message_window.update # 更新信息窗口
- unless $game_message.visible # 信息窗口显示中除外
- update_transfer_player
- update_encounter
- update_call_menu
- update_call_debug
- update_scene_change
- end
- @time_window.refresh #修改
- if $game_switches[1] == false # 在这里可以修改控制开关ID
- @time_window.opacity = 0
- @time_window.contents_opacity = 0
- else
- @time_window.opacity = 255
- @time_window.contents_opacity = 255
- end
- end
- #--------------------------------------------------------------------------
- # ● 淡入画面
- # duration : 时间
- # 如果直接使用 Graphics.fadeout 的话会出现一些状况,如天候效果和远景
- # 滚动都会被强迫停止,所以用动态的 fade-in 效果会好些。
- #--------------------------------------------------------------------------
- def fadein(duration)
- Graphics.transition(0)
- for i in 0..duration-1
- Graphics.brightness = 255 * i / duration
- update_basic
- end
- Graphics.brightness = 255
- end
- #--------------------------------------------------------------------------
- # ● 淡出画面
- # duration : 时间
- # 与上面的 fadein 一样,不是直接调用 Graphics.fadein。
- #--------------------------------------------------------------------------
- def fadeout(duration)
- Graphics.transition(0)
- for i in 0..duration-1
- Graphics.brightness = 255 - 255 * i / duration
- update_basic
- end
- Graphics.brightness = 0
- end
- #--------------------------------------------------------------------------
- # ● 场所移动处理
- #--------------------------------------------------------------------------
- def update_transfer_player
- return unless $game_player.transfer?
- fade = (Graphics.brightness > 0)
- fadeout(30) if fade
- @spriteset.dispose # 释放活动块组
- $game_player.perform_transfer # 执行场所移动
- $game_map.autoplay # 自动更改 BGM 和 BGS
- $game_map.update
- Graphics.wait(15)
- @spriteset = Spriteset_Map.new # 重新生成活动块组
- fadein(30) if fade
- Input.update
- end
- #--------------------------------------------------------------------------
- # ● 遇敌处理
- #--------------------------------------------------------------------------
- def update_encounter
- return if $game_player.encounter_count > 0 # 检查步数
- return if $game_map.interpreter.running? # 判断是否有事件正在执行
- return if $game_system.encounter_disabled # 判断是否禁止遇敌
- troop_id = $game_player.make_encounter_troop_id # 判断敌人队伍
- return if $data_troops[troop_id] == nil # 判断队伍是否无效
- $game_troop.setup(troop_id)
- $game_troop.can_escape = true
- $game_temp.battle_proc = nil
- $game_temp.next_scene = "battle"
- preemptive_or_surprise
- end
- #--------------------------------------------------------------------------
- # ● 判断先下手或被偷袭
- #--------------------------------------------------------------------------
- def preemptive_or_surprise
- actors_agi = $game_party.average_agi
- enemies_agi = $game_troop.average_agi
- if actors_agi >= enemies_agi
- percent_preemptive = 5
- percent_surprise = 3
- else
- percent_preemptive = 3
- percent_surprise = 5
- end
- if rand(100) < percent_preemptive
- $game_troop.preemptive = true
- elsif rand(100) < percent_surprise
- $game_troop.surprise = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断是否呼叫菜单(按下B键)
- #--------------------------------------------------------------------------
- def update_call_menu
- if Input.trigger?(Input::B)
- return if $game_map.interpreter.running? # 判断是否有事件正在执行
- return if $game_system.menu_disabled # 判断是否禁止菜单呼叫
- $game_temp.menu_beep = true # 设置音效标志
- $game_temp.next_scene = "menu"
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断是否呼叫DEBUG场景(按下F9键)
- #--------------------------------------------------------------------------
- def update_call_debug
- if $TEST and Input.press?(Input::F9) # 游戏测试并按下F9
- $game_temp.next_scene = "debug"
- end
- end
- #--------------------------------------------------------------------------
- # ● 执行场景交替
- #--------------------------------------------------------------------------
- def update_scene_change
- return if $game_player.moving? # 判断主角是否移动中
- case $game_temp.next_scene
- when "battle"
- call_battle
- when "shop"
- call_shop
- when "name"
- call_name
- when "menu"
- call_menu
- when "save"
- call_save
- when "debug"
- call_debug
- when "gameover"
- call_gameover
- when "title"
- call_title
- else
- $game_temp.next_scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 切换至战斗画面
- #--------------------------------------------------------------------------
- def call_battle
- @spriteset.update
- Graphics.update
- $game_player.make_encounter_count
- $game_player.straighten
- $game_temp.map_bgm = RPG::BGM.last
- $game_temp.map_bgs = RPG::BGS.last
- RPG::BGM.stop
- RPG::BGS.stop
- Sound.play_battle_start
- $game_system.battle_bgm.play
- $game_temp.next_scene = nil
- $scene = Scene_Battle.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至商店画面
- #--------------------------------------------------------------------------
- def call_shop
- $game_temp.next_scene = nil
- $scene = Scene_Shop.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至名称输入画面
- #--------------------------------------------------------------------------
- def call_name
- $game_temp.next_scene = nil
- $scene = Scene_Name.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至菜单画面
- #--------------------------------------------------------------------------
- def call_menu
- if $game_temp.menu_beep
- Sound.play_decision
- $game_temp.menu_beep = false
- end
- $game_temp.next_scene = nil
- $scene = Scene_Menu.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至存档画面
- #--------------------------------------------------------------------------
- def call_save
- $game_temp.next_scene = nil
- $scene = Scene_File.new(true, false, true)
- end
- #--------------------------------------------------------------------------
- # ● 切换至DEBUG画面
- #--------------------------------------------------------------------------
- def call_debug
- Sound.play_decision
- $game_temp.next_scene = nil
- $scene = Scene_Debug.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至游戏结束画面
- #--------------------------------------------------------------------------
- def call_gameover
- $game_temp.next_scene = nil
- $scene = Scene_Gameover.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至标题画面
- #--------------------------------------------------------------------------
- def call_title
- $game_temp.next_scene = nil
- $scene = Scene_Title.new
- fadeout(60)
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗渐变
- #--------------------------------------------------------------------------
- def perform_battle_transition
- Graphics.transition(80, "Graphics/System/BattleStart", 80)
- Graphics.freeze
- end
- end
复制代码 |
|