赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 175 |
最后登录 | 2012-4-20 |
在线时间 | 3 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 3 小时
- 注册时间
- 2012-4-15
- 帖子
- 5
|
本帖最后由 iisnow 于 2012-4-16 15:49 编辑
@冰舞蝶恋好的,谢谢- #==============================================================================
- #==============================================================================
- # Game_System
- #------------------------------------------------------------------------------
- # 添加内容
- #==============================================================================
- class Game_System
- attr_accessor :mission #现在执行的任务
- attr_accessor :partmission
- alias carol3_ini initialize
- def initialize
- carol3_ini
- @mission = ""
- @partmission = []
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
- class Scene_Title
- alias carol3_title1 main
- def main
- $map_infos = load_data("Data/MapInfos.rxdata")
- for key in $map_infos.keys
- $map_infos[key] = $map_infos[key].name
- end
- $任务 = ""
- $支线 = nil
- $支线完成 = nil
- carol3_title1
- end
- end
- class Scene_Map
- alias carol3_update update
- def update
- carol3_update
- if $支线 != nil
- for i in 0...$game_system.partmission.size
- if $game_system.partmission[i] == $支线
- $支线 = nil
- break
- end
- end
- if $支线 != nil
- $game_system.partmission.push($支线)
- $支线 = nil
- end
- end
- if $支线完成 != nil
- for i in 0...$game_system.partmission.size
- if $game_system.partmission[i] == $支线完成
- $game_system.partmission.delete($game_system.partmission[i])
- break
- end
- end
- $支线完成 = nil
- end
- end
- end
- #==============================================================================
- # Window_MenuStatus
- #------------------------------------------------------------------------------
- # 显示菜单画面和同伴状态的窗口。
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化目标
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 480, 384)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.active = false
- self.index = -1
- @position = 0
- @count = 0
- @oldposition = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 64
- y = i * 90
- actor = $game_party.actors[i]
- self.contents.font.size = 18
- draw_actor_active_graphic(actor, x - 40, y + 50)
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 144, y)
- draw_actor_level(actor, x, y + 25)
- draw_actor_state(actor, x + 90, y + 25)
- draw_actor_exp(actor, x, y + 50)
- draw_actor_hp(actor, x + 236, y + 25)
- draw_actor_sp(actor, x + 236, y + 50)
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制行走图
- #--------------------------------------------------------------------------
- def draw_actor_active_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- p = @position * cw
- src_rect = Rect.new(p, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index *90-5, self.width - 32, 90)
- end
- end
- def update
- super
- @count += 1
- @count %= 15
- if @count == 0
- @position = (@position + 1) % 4
- end
- if @position != @oldposition
- @oldposition = @position
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 处理地图的类。包含卷动以及可以通行的判断功能。
- # 本类的实例请参考 $game_map 。
- #==============================================================================
- class Game_Map
- def name
- return $map_infos[@map_id]
- end
- end
- #==============================================================================
- # Window_RecordBook
- #------------------------------------------------------------------------------
- # 菜单界面表示信息的窗口
- #==============================================================================
- class Window_RecordBook < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(160, 384, 480, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- if $任务 == ""
- $任务 = $game_system.mission
- else
- $game_system.mission = $任务
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.size = 20
- cx = self.contents.text_size("现在地点").width + 24
- self.contents.draw_text(4, 0, cx, 24, "现在地点")
- self.contents.font.color = normal_color
- self.contents.draw_text(4 + cx, 0, 444 - cx, 24, $game_map.name.to_s)
- self.contents.font.color = system_color
- cx = self.contents.text_size("主线任务").width + 24
- self.contents.draw_text(4, 32, cx, 24, "主线任务")
- self.contents.font.color = Color.new(240,250,75,255)
- self.contents.draw_text(4 + cx, 32, 444 - cx, 24, $game_system.mission.to_s)
- self.contents.font.color = system_color
- cx = self.contents.text_size("支线任务").width + 24
- self.contents.draw_text(4, 96, cx, 24, "支线任务")
- self.contents.font.color = normal_color
- for i in 0...$game_system.partmission.size
- self.contents.draw_text(4 + cx, 96 + i * 32, 444 - cx, 24, $game_system.partmission[i].to_s)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # menu_index : 命令光标的初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- @切换状态暂停 = ""
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成命令窗口
- s1 = " 使用物品"#$data_system.words.item
- s2 = " 使用技能"#$data_system.words.skill
- s3 = " 更改装备"#$data_system.words.equip
- s4 = " 查看状态"
- s5 = " 储存游戏"
- s6 = " 结束游戏"
- s7 = " 查看任务"
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 物品、特技、装备、状态无效化
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 存档无效
- @command_window.disable_item(4)
- end
- # 生成游戏时间窗口
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 256
- # 生成金钱窗口
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- # 生成状态窗口
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- #—— 生成天书窗口
- @recordbook_window = Window_RecordBook.new
- @recordbook_window.z = 1000
- #—— 生成外边框窗口
- @outside_window = Window_Outside.new
- @outside_window.visible = true
- @outside_window.z = 1001
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @playtime_window.dispose
- @gold_window.dispose
- @status_window.dispose
- @outside_window.dispose
- @recordbook_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @playtime_window.update
- @gold_window.update
- @status_window.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @status_window.active
- update_status
- return
- end
- if @outside_window.visible == false
- update_recordbook
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (命令窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 同伴人数为 0、存档、游戏结束以外的场合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 命令窗口的光标位置分支
- case @command_window.index
- when 0 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
- when 1 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4 # 存档
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Save.new
- when 5 # 游戏结束
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到游戏结束画面
- $scene = Scene_End.new
- when 6 # 查看任务
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @outside_window.visible = false
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (查看天书的情况下)
- #--------------------------------------------------------------------------
- def update_recordbook
- if @切换状态暂停 == "天书消失"
- if @recordbook_window.y < 384
- @recordbook_window.y +=64
- @status_window.y -= 16
- return
- else
- @切换状态暂停 = ""
- @outside_window.visible = true
- @command_window.active = true
- end
- else
- if @recordbook_window.y >0
- @recordbook_window.y -= 32
- @status_window.y += 8
- return
- else
- @status_window.visible = false
- if Input.trigger?(Input::B)
- @切换状态暂停 = "天书消失"
- $game_system.se_play($data_system.cancel_se)
- @status_window.visible = true
- return
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 1 # 特技
- # 本角色的行动限制在 2 以上的情况下
- if $game_party.actors[@status_window.index].restriction >= 2
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到特技画面
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- #==============================================================================
- # Window_Outside
- #------------------------------------------------------------------------------
- # 外边框窗口
- #==============================================================================
- class Window_Outside < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(160, 384, 480, 96)
- self.back_opacity = 0
- end
- end
- #==============================================================================
- # ■ Window_PlayTime
- #------------------------------------------------------------------------------
- # 菜单画面的系统时间表示
- #==============================================================================
- class Window_PlayTime < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 128)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.size = 18
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.color = text_color(6)
- time = Time.now
- text = time.strftime("%x %X")
- self.contents.draw_text(-2, 32, 130, 32, text, 2)
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 160, 32, "日期与游戏时间")
- self.contents.draw_text(-2, 64, 130, 32, text, 2)
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
-
- #==============================================================================
复制代码 |
|