赞 | 0 |
VIP | 5 |
好人卡 | 0 |
积分 | 6 |
经验 | 5677 |
最后登录 | 2024-10-20 |
在线时间 | 156 小时 |
Lv2.观梦者 秀才
- 梦石
- 0
- 星屑
- 592
- 在线时间
- 156 小时
- 注册时间
- 2008-7-23
- 帖子
- 290
|
这是一个关于电影模式的脚本。- #==============================================================================
- # ■ Window_MSGMovie
- #------------------------------------------------------------------------------
- # 电影模式下显示文章的信息窗口。
- #==============================================================================
- # 电影模式开关 默认为 50号开关
- $movie_switches = 100
- # 电影模式下等待关闭文字 默认 50号变量
- $close_speak = 100
- class Window_MSGMovie < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化状态
- #--------------------------------------------------------------------------
- def initialize
- super(0,400,640,80)
- self.contents = Bitmap.new(width, height)
- self.windowskin = Bitmap.new(30,30)
- $game_temp.message_window_showing = false
- self.z = 199
- end
- #--------------------------------------------------------------------------
- # ● 处理信息结束
- #--------------------------------------------------------------------------
- def end_MSG
- self.active = false
- self.pause = false
- self.contents.clear
- # 呼叫信息调用
- if $game_temp.message_proc != nil
- $game_temp.message_proc.call
- end
- # 清除文章、选择项、输入数值的相关变量
- $game_temp.message_text = nil
- $game_temp.message_proc = nil
- $game_temp.choice_start = 99
- $game_temp.choice_max = 0
- $game_temp.choice_cancel_type = 0
- $game_temp.choice_proc = nil
- $game_temp.num_input_start = 99
- $game_temp.num_input_variable_id = 0
- $game_temp.num_input_digits_max = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- x = 0
- if $game_temp.message_text != nil
- temp_text = $game_temp.message_text.clone
- movie_text = $game_temp.message_text.clone
- # 模拟执行(计算文字位置)
- text = ""
- # 转换字符
- temp_text.gsub!(/\\\\/) { "\000" }
- temp_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
- temp_text.gsub!(/\\[Vv]\[([0-9]+)\]/) { "\002[#{$1}]" }
- temp_text.gsub!(/\\[Nn]\[([0-9]+)\]/) { "\003[#{$1}]" }
- while((c = temp_text.slice!(/./m)) != nil)
- if c == "\000"
- c = "\\"
- end
- if c == "\001"
- # 更改文字色
- temp_text.sub!(/\[([0-9]+)\]/, "")
- color = $1.to_i
- c = ""
- text += c
- next
- end
- if c == "\002"
- c = $game_variables[$1.to_i].to_s
- temp_text.sub!(/\[([0-9]+)\]/, "")
- text += c
- next
- end
- if c == "\003"
- temp_text.sub!(/\[([0-9]+)\]/, "")
- c = $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- text += c
- next
- end
- if c == "\n"
- c = ""
- text += c
- next
- end
- text += c
- end
- # 计算文字居中位置
- move_x = (640 - self.contents.text_size(text).width) / 2 -20
- # 执行 (显示文字)
- movie_text.gsub!(/\\\\/) { "\000" }
- movie_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
- movie_text.gsub!(/\\[Vv]\[([0-9]+)\]/) { "\002[#{$1}]" }
- movie_text.gsub!(/\\[Nn]\[([0-9]+)\]/) { "\003[#{$1}]" }
- while((m = movie_text.slice!(/./m)) != nil)
- if m == "\000"
- m = "\\"
- end
- if m == "\001"
- # 更改文字色
- movie_text.sub!(/\[([0-9]+)\]/, "")
- color = $1.to_i
- if color >= 0 and color <= 7
- self.contents.font.color = text_color(color)
- end
- # 下面的文字
- next
- end
- if m == "\002"
- m = $game_variables[$1.to_i].to_s
- movie_text.sub!(/\[([0-9]+)\]/, "")
- end
- if m == "\003"
- movie_text.sub!(/\[([0-9]+)\]/, "")
- m = $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- if m == "\n"
- m = ""
- end
- self.contents.draw_text(move_x + x,0,self.contents.text_size(m).width,32,m)
- x += self.contents.text_size(m).width
- end
- # 返回系统文字颜色
- self.contents.font.color = normal_color
- # 清理显示文字
- $game_temp.message_text = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 等待循环
- if $game_variables[$close_speak] >= 2
- $game_variables[$close_speak] -= 1
- end
- if $game_variables[$close_speak] == 1
- $game_variables[$close_speak] = 0
- end_MSG
- end
- # 当C键按下时
- if Input.trigger?(Input::C) and $game_variables[$close_speak] == 0
- end_MSG
- end
- # 显示文字
- if $game_temp.message_text != nil
- refresh
- return
- end
- end
- end
- # --重定义Scene_Map类
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成活动块
- @spriteset = Spriteset_Map.new
- # 生成信息窗口
- @message_window = Window_Message.new
- # 生成电影模式对话窗口
- @MSG_Movie_Window = Window_MSGMovie.new
- # 电影模式黑框
- @black = Sprite.new
- @black.bitmap = Bitmap.new(640,480)
- @black.bitmap.fill_rect(0,0,640,50,Color.new(25,25,25,255))
- @black.bitmap.fill_rect(0,400,640,80,Color.new(25,25,25,255))
- @black.opacity = 0
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放活动块
- @spriteset.dispose
- # 释放信息窗口
- @message_window.dispose
- # 释放信息窗口
- @MSG_Movie_Window.dispose
- # 标题画面切换中的情况下
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 循环
- loop do
- # 按照地图、实例、主角的顺序刷新
- # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
- # 的机会的重要因素)
- $game_map.update
- $game_system.map_interpreter.update
- $game_player.update
- # 系统 (计时器)、画面刷新
- $game_system.update
- $game_screen.update
- # 如果主角在场所移动中就中断循环
- unless $game_temp.player_transferring
- break
- end
- # 执行场所移动
- transfer_player
- # 处理过渡中的情况下、中断循环
- if $game_temp.transition_processing
- break
- end
- end
- # 刷新活动块
- @spriteset.update
- # 选择刷新
- if $game_switches[$movie_switches] == false
- # 刷新信息窗口
- @message_window.update
- # 电影模式的黑框
- @black.opacity = 0
- else
- # 刷新电影模式信息
- @MSG_Movie_Window.update
- # 电影模式的黑框
- @black.opacity = 250
- end
- # 游戏结束的情况下
- if $game_temp.gameover
- # 切换的游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 返回标题画面的情况下
- if $game_temp.to_title
- # 切换到标题画面
- $scene = Scene_Title.new
- return
- end
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除过渡处理中标志
- $game_temp.transition_processing = false
- # 执行过渡
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- return
- end
- # 遇敌计数为 0 且、且遇敌列表不为空的情况下
- if $game_player.encounter_count == 0 and $game_map.encounter_list != []
- # 不是在事件执行中或者禁止遇敌中
- unless $game_system.map_interpreter.running? or
- $game_system.encounter_disabled
- # 确定队伍
- n = rand($game_map.encounter_list.size)
- troop_id = $game_map.encounter_list[n]
- # 队伍有效的话
- if $data_troops[troop_id] != nil
- # 设置调用战斗标志
- $game_temp.battle_calling = true
- $game_temp.battle_troop_id = troop_id
- $game_temp.battle_can_escape = true
- $game_temp.battle_can_lose = false
- $game_temp.battle_proc = nil
- end
- end
- end
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 不是在事件执行中或菜单禁止中
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- # 设置菜单调用标志以及 SE 演奏
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- end
- end
- # 调试模式为 ON 并且按下 F9 键的情况下
- if $DEBUG and Input.press?(Input::F9)
- # 设置调用调试标志
- $game_temp.debug_calling = true
- end
- # 不在主角移动中的情况下
- unless $game_player.moving?
- # 执行各种画面的调用
- if $game_temp.battle_calling
- call_battle
- elsif $game_temp.shop_calling
- call_shop
- elsif $game_temp.name_calling
- call_name
- elsif $game_temp.menu_calling
- call_menu
- elsif $game_temp.save_calling
- call_save
- elsif $game_temp.debug_calling
- call_debug
- end
- end
- end
- end
- #=============================================================================
- # 本脚本来自66RPG,如使用请保留此信息
- #[癫狂侠客]书写脚本
- #=============================================================================
复制代码 这是个关于日期交替的脚本,当这个脚本被放到“电影”脚本上面时,日期无效,当放到下面,出现冲突。求解……- class Scene_Map
- def main
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- @time_date_window = Window_Time_Date.new
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end # end if $scene != self
- end # end loop do
- Graphics.freeze
- @spriteset.dispose
- @message_window.dispose
- @time_date_window.dispose
- if $scene.is_a?(Scene_Title)
- Graphics.transition
- Graphics.freeze
- end # end if $scene.is_a?(Scene_Title)
- end # end def main
- end # end class Scene_Map
- class Window_Time_Date < Window_Base
- def initialize
- super(0, 0, 250, 55)
- self.contents = Bitmap.new(width - 33, height - 33)
- refresh
- end # end def initialize
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.size = 19
- @total_sec = Graphics.frame_count
- if @total_sec % 9 ==0
- $game_variables[1] += 1
- end # end if @total_sec % 40 ==0
-
- if $game_variables[1] >= 60 + 0
- $game_variables[1] = 0
- $game_variables[2] += 1
- end # end if $game_variables[1] >= 60 + 0
-
- if $game_variables[2] >= 23 + 1
- $game_variables[2] = 0
- $game_variables[3] += 1
- end # end if $game_variables[2] >= 23 + 1
-
- if $game_variables[3] >= 30 + 1
- $game_variables[3] = 1
- $game_variables[4] += 1
- end # end if $game_variables[3] >= 30 + 1
-
- if $game_variables[4] >= 12 + 1
- $game_variables[4] = 1
- $game_variables[5] += 1
- end # end if $game_variables[4] >= 12 + 1
-
- text_min = ["00", "01", "02", "03", "04", "05", "06","07","08","09","10","11",
- "12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27",
- "28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43",
- "44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59",
- "60"][$game_variables[1]]
- text_hour = ["00:", "01:", "02:", "03:", "04:", "05:", "06:",
- "07:", "08:", "09:", "10:", "11:", "12:","13:","14:","15:","16:",
- "17:","18:","19:","20:","21:","22:","23:","24:"][$game_variables[2]]
- text_day = ["", "01日", "02日", "03日", "04日", "05日", "06日",
- "07日", "08日", "09日", "10日", "11日", "12日",
- "13日", "14日", "15日", "16日", "17日", "18日",
- "19日", "20日", "21日", "22日", "23日", "24日",
- "25日", "26日", "27日", "28日", "29日",
- "30日"][$game_variables[3]]
- text_month = ["", " 01月", " 02月", " 03月", " 04月", " 05月", " 06月",
- " 07月", " 08月", " 09月", " 10月", " 11月", " 12月"][$game_variables[4]]
- text_year = ["1560年", "1561年", "1562年","1563年","1564年","1565年","1566年",
- "1567年","1568年","1569年","1570年","1571年","1572年"][$game_variables[5]]
- self.contents.clear
- self.contents.draw_text(5, -5, 128, 32,text_year)
- self.contents.draw_text(60, -5, 128, 32, text_month)
- self.contents.draw_text(111, -5, 128, 32, text_day)
- self.contents.draw_text(155, -5, 128, 32, text_hour)
- self.contents.draw_text(184, -5, 128, 32, text_min)
- def update
- super
- refresh
- end
- end
- end
复制代码 |
|