赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 3278 |
最后登录 | 2016-10-9 |
在线时间 | 150 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 150 小时
- 注册时间
- 2006-4-15
- 帖子
- 84
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 lsmzzz38 于 2013-2-11 22:20 编辑
- #============================================================================
- # ** 任务系统
- # 基本:
- # $scene = Scene_Task.new(返回的场景, 游标初始index) 召唤查看任务场景
- # 说明:
- # $game_party.accept_task(id) 接受id号任务
- # $game_party.delete_task(Game_Task.new(id)) 删除(放弃)id号任务
- # $game_party.completed_task(id) 完成id号任务
- # $game_party.task_status(id) 获取任务状态,未接受返回nil;未完成返回false;
- # 已完成返回true
- # $game_party.accepted_task?(id) 判断角色是否接受了id号任务
- # $game_party.completed_task?(id) 判断角色是否完成了id号任务
- # 快捷手段:
- # visible_ts(id, kind)
- # 在地图画面上显示id号任务的状态.kind:0为接受任务时显示的信息;
- # 1为完成任务时显示的信息;2为任务失败时显示的信息;
- # 3为放弃任务时显示的信息;4为无法放弃任务时显示的信息;
- # 5为已接此任务的提示.
- # accept_task(id, enforcement)
- # 接受id号任务并在地图上显示接受任务时显示的信息,enforcement为是否
- # 强制接受,true为是,可不填,默认为false
- # complete_task(id) 删除id号任务并在地图上显示完成任务时显示的信息
- # fail_task(id) 删除id号任务并在地图上显示任务失败时显示的信息
- # abandonment_task(id) 删除id号任务并在地图上显示放弃任务时显示的信息
- #============================================================================
- module DOS
- #============================================================================
- #-------------------------------任务设置-------------------------------------
- #============================================================================
- Task_Abandonment_Task_Input = Input::Letters["E"] # 放弃任务按钮........[按键]
- Task_Left_Change_Page = Input::LEFT # 左翻页按键........................[按键]
- Task_Right_Change_Page = Input::RIGHT # 右翻页按键......................[按键]
- Task_Filament_Color = Color.new(0, 0, 0) # 描绘报酬表格时,线条的颜色....[颜色]
- # ▼ 绘制确定放弃任务时疑问的文字色.....................................[颜色]
- Task_Query_Word_Color = Color.new(255, 255, 0)
- Task_Gold_Icon_Index = 205 # 金钱的图标id...............................[数字]
- # 没有接受该任务,又调用该任务的complete_task/fail_task/abandonment_task方法时,
- # 该怎样处理.0为显示一个窗口, 1为无处理.................................[数字]
- Task_No_Accept = 0
- #--任务资料设置(此处省略分类)
- Task = []
- #--痴情的女鬼---------------------------------------------------
- Task[0] = { # 任务id
- "Icon" => 10, # 图标id
- "Name" => "痴情的女鬼",# 任务名称
- "Caption" => " 村子里有一间大屋子,里头住着一个叫高姗姗的女鬼,他一直在等他的哥哥高
- 文彦.这种痴情的确令人佩服,但她每天晚上都会发出鬼哭的声音,引得附近黑毛
- 狼咆哮,斯库拉唱歌,厄洛斯射箭,狄安娜砸盾等,严重地影响了附近村民的休息
- .你能够帮村民解决这个痴情的女鬼吗?",
- "Reward" => {"Item" => [], # 完成任务后奖励的物品
- "Weapon" => [], # 完成任务后奖励的武器
- "Armor" => [], # 完成任务后奖励的防具
- "Gold" => 0, # 完成任务后奖励的金钱
- "Level_Plus" => [], # 完成任务后奖励的等级
- "Exp_Plus" => [] # 完成任务后奖励的经验
- },
- "Can Abandonment?" => false, # 可否放弃此任务
- "Level" => 3 # 任务等级
- }
- #--遗失的手风琴-----------------------------------------------
- Task[1] = { # 任务id
- "Icon" => 100, # 图标id
- "Name" => "遗失的手风琴",# 任务名称
- "Caption" => " 村庄里有一个伟大的音乐家,应邀去参加一个音乐会,但是他的手风琴不见,
- 你能帮他找找吗?",
- "Reward" => {"Item" => [], # 完成任务后奖励的物品
- "Weapon" => [], # 完成任务后奖励的武器
- "Armor" => [], # 完成任务后奖励的防具
- "Gold" => 0, # 完成任务后奖励的金钱
- "Level_Plus" => [], # 完成任务后奖励的等级
- "Exp_Plus" => [] # 完成任务后奖励的经验
- },
- "Can Abandonment?" => true, # 可否放弃此任务
- "Level" => 3 # 任务等级
- }
- end
- module Vocab
- #============================================================================
- #---------------------------任务用语设置-------------------------------------
- #============================================================================
- Task_Accept = "接受了任务[%s]"
- Task_Complete = "任务[%s]被完成!"
- Task_Fail = "任务[%s]已失败"
- Task_Abandonment = "放弃任务[%s]"
- Task_Can_Not_Abandonment = "无法放弃任务[%s]"
- Task_Adandonment_Query = "你确定要放弃[%s]这个任务吗?"
- Task_Accepted = "已接受任务[%s]"
- Task_No_Accept = "你还没接受任务[%s]!"
- Task_Difficulty = "任务难度:"
- Task_Level_Word = ["简单", "容易", "中等", "困难"]
- Task_Can_Abandonment_Word = ["可放弃", "不可放弃"]
- Task_Change_Page = ["按下右键翻到下一页 >", "< 按下左键翻到上一页"]
- end
- #============================================================================
- # ** Game_Task
- #============================================================================
- class Game_Task
- #----------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------
- def initialize(id)
- @id = id
- @task = DOS::Task[id]
- end
- #----------------------------------------------------------------------
- # * 获取任务id
- #----------------------------------------------------------------------
- def id
- return @id
- end
- #----------------------------------------------------------------------
- # * 获取任务图标索引
- #----------------------------------------------------------------------
- def icon_index
- return @task["Icon"]
- end
- #----------------------------------------------------------------------
- # * 获取任务名
- #----------------------------------------------------------------------
- def name
- return @task["Name"]
- end
- #----------------------------------------------------------------------
- # * 获取任务说明
- #----------------------------------------------------------------------
- def caption
- return @task["Caption"]
- end
- #----------------------------------------------------------------------
- # * 获取任务奖赏资料(不包括物品/武器/防具数量)
- # kind:0为道具;1为武器;2为防具;3为金钱;4为lv;5为exp.
- #----------------------------------------------------------------------
- def reward(kind, index=0)
- case kind
- when 0
- return $data_items[@task["Reward"]["Item"][index][0]]
- when 1
- return $data_weapons[@task["Reward"]["Weapon"][index][0]]
- when 2
- return $data_armors[@task["Reward"]["Armor"][index][0]]
- when 3
- return @task["Reward"]["Gold"]
- when 4
- if @task["Reward"]["Level_Plus"][index] != nil
- return @task["Reward"]["Level_Plus"][index][1]
- else return nil
- end
- when 5
- if @task["Reward"]["Exp_Plus"][index] != nil
- return @task["Reward"]["Exp_Plus"][index][1]
- else return nil
- end
- end
- end
- #----------------------------------------------------------------------
- # * 获取任务奖赏多少种道具
- # kind:0为道具;1为武器;2为防具.
- #----------------------------------------------------------------------
- def reward_size(kind)
- case kind
- when 0
- return @task["Reward"]["Item"].size
- when 1
- return @task["Reward"]["Weapon"].size
- when 2
- return @task["Reward"]["Armor"].size
- end
- end
- #----------------------------------------------------------------------
- # * 获取任务奖赏等级/经验的受益人(le = level & exp)
- # kind:0为level;1为exp.
- #----------------------------------------------------------------------
- def reward_le_actor(kind, index)
- case kind
- when 0
- if $game_party.members[@task["Reward"]["Level_Plus"][index][0]] != nil
- return $game_party.members[@task["Reward"]["Level_Plus"][index][0]]
- else return nil
- end
- when 1
- if $game_party.members[@task["Reward"]["Exp_Plus"][index][0]] != nil
- return $game_party.members[@task["Reward"]["Exp_Plus"][index][0]]
- else return nil
- end
- end
- end
- #----------------------------------------------------------------------
- # * 获取任务奖赏等级/经验的受益人总数(le = level & exp)
- # kind:0为level;1为exp.
- #----------------------------------------------------------------------
- def reward_le_actor_size(kind)
- case kind
- when 0
- return @task["Reward"]["Level_Plus"].size
- when 1
- return @task["Reward"]["Exp_Plus"].size
- end
- end
- #----------------------------------------------------------------------
- # * 获取任务奖赏道具数量
- # kind:0为道具;1为武器;2为防具.
- #----------------------------------------------------------------------
- def reward_item_amount(kind,index)
- case kind
- when 0
- return @task["Reward"]["Item"][index][1]
- when 1
- return @task["Reward"]["Weapon"][index][1]
- when 2
- return @task["Reward"]["Armor"][index][1]
- end
- end
- #----------------------------------------------------------------------
- # * 获取任务等级
- #----------------------------------------------------------------------
- def level
- return @task["Level"]
- end
- #----------------------------------------------------------------------
- # * 获取描述任务等级用语
- #----------------------------------------------------------------------
- def level_word
- return Vocab::Task_Level_Word[@task["Level"]]
- end
- #----------------------------------------------------------------------
- # * 获取可否放弃标识
- #----------------------------------------------------------------------
- def can_abandonment?
- return @task["Can Abandonment?"]
- end
- #----------------------------------------------------------------------
- # * 获取可否放弃文字
- #----------------------------------------------------------------------
- def can_abandonment_word
- if @task["Can Abandonment?"] == true
- return Vocab::Task_Can_Abandonment_Word[0]
- else return Vocab::Task_Can_Abandonment_Word[1]
- end
- end
- end
- #==============================================================================
- # ** Game_Party
- #------------------------------------------------------------------------------
- # 這個類用來操控主角隊伍,包含了隊伍所攜資金和物品等資訊。
- # 這個類的實例被全域變數 $game_party 所引用。
- #==============================================================================
- class Game_Party < Game_Unit
- attr_reader :accepted_task
- def initialize
- super
- [url=home.php?mod=space&uid=236945]@gold[/url] = 100
- @steps = 0
- @last_item_id = 0
- @last_actor_index = 0
- @last_target_index = 0
- @actors = [] # 隊員類型 (主角編號)
- @items = {} # 所攜物品 HASH 表 (物品編號)
- @weapons = {} # 所攜武器 HASH 表 (武器編號)
- @armors = {} # 所攜護具 HASH 表 (護具編號)
- @accepted_task = []
- @task_status = []
- end
- def accept_task(id)
- @accepted_task.push(Game_Task.new(id))
- @task_status[id] = false
- end
- def delete_task(task)
- @accepted_task.delete(task)
- @task_status[id] = nil
- end
- def completed_task(id)
- delete_task(Game_Task.new(id))
- for item in 0...@accepted_task[id].reward_size(0)
- gain_item(@accepted_task[id].reward(0, item),@accepted_task[id].reward_item_amount(0,item))
- end
- for item in 0...@accepted_task[id].reward_size(1)
- gain_item(@accepted_task[id].reward(1, item),@accepted_task[id].reward_item_amount(1,item))
- end
- for item in 0...@accepted_task[id].reward_size(2)
- gain_item(@accepted_task[id].reward(2, item),@accepted_task[id].reward_item_amount(2,item))
- end
- for index in 0...@accepted_task[id].reward_le_actor_size(0)
- if @accepted_task[id].reward_le_actor(0, index) == nil
- next
- end
- @accepted_task[id].reward_le_actor(0, index).change_level(@accepted_task[id].reward(5, index), true)
- end
- for index in 0...@accepted_task[id].reward_le_actor_size(1)
- if @accepted_task[id].reward_le_actor(1, index) == nil
- next
- end
- @accepted_task[id].reward_le_actor(1, index).change_exp(@accepted_task[id].reward(4, index), true)
- end
- gain_gold(@accepted_task[id].reward(3))
- @task_status[id] = true
- end
- def task_status(id)
- return @task_status[id]
- end
- def accepted_task?(id)
- if @task_status[id] == true or @task_status[id] == false
- return true
- else return false
- end
- end
- def completed_task?(id)
- if @task_stutas[id] == true
- return true
- else return false
- end
- end
- end
- #============================================================================
- # ** Window_TaskHelp
- #============================================================================
- class Window_TaskHelp < Window_Base
- attr_accessor :paga
- def initialize(id, paga=0)
- super(160, 20, 384, 376)
- @paga = paga
- refresh(id)
- end
- def refresh(id)
- dw = self.width - 32
- dh = self.height - 32
- task = Game_Task.new(id)
- self.contents.clear
- if @paga == 0 # 描绘第一页
- draw_icon(task.icon_index, 0, 0)
- self.contents.draw_text(28, 0, dw, 24, task.name)
- self.contents.draw_text(0, 24, dw, 24, Vocab::Task_Difficulty)
- w = self.contents.text_size(Vocab::Task_Difficulty).width
- self.contents.draw_text(w, 24, dw, 24, task.level_word)
- self.contents.draw_text(28, 0, dw-28, 24, task.can_abandonment_word, 2)
- chenge_special_character(task.caption.clone, 0, 48)
- elsif @paga == 1 # 描绘第二页
- #-描绘表格-------------------------------------------------------------
- # 边框
- draw_straight_filament(0, 0, dw, 0, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, 0, 0, dh, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, 27, dw, 27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, dh-1, dw/2, dh-1, 1, DOS::Task_Filament_Color)
- draw_straight_filament(dw/2+2, dh-5, dw-1, dh-5, 1, DOS::Task_Filament_Color)
- draw_straight_filament(dw-1, 0, dw-1, dh-4, 1, DOS::Task_Filament_Color)
- # 中线
- draw_straight_filament(dw/2-1, 27, dw/2-1, dh, 1, DOS::Task_Filament_Color)
- draw_straight_filament(dw/2+1, 27, dw/2+1, dh-4, 1, DOS::Task_Filament_Color)
- # 队伍成员分割线
- h = (dh-27-1)/4
- draw_straight_filament(0, h*1+27, dw/2-1, h*1+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, h*2+27, dw/2-1, h*2+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, h*3+27, dw/2-1, h*3+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(0, h*4+27, dw/2-1, h*4+27, 1, DOS::Task_Filament_Color)
- # 头像分割线
- draw_straight_filament(79, 27, 79, dh, 1, DOS::Task_Filament_Color)
- # 描绘成员奖励分割线
- draw_straight_filament(79, (h-h/2)*1+27, dw/2-1, (h-h/2)*1+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(79, (h-h/2)+h+27, dw/2-1, (h-h/2)+h+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(79, (h-h/2)+h*2+27, dw/2-1, (h-h/2)+h*2+27, 1, DOS::Task_Filament_Color)
- draw_straight_filament(79, (h-h/2)+h*3+27, dw/2-1, (h-h/2)+h*3+27, 1, DOS::Task_Filament_Color)
- # 描绘奖励分割线
- a = (dw-28)/24
- for i in 0...a
- draw_straight_filament(dw/2+2, 24*i+27, dw-1, 24*i+27, 1, DOS::Task_Filament_Color)
- end
- #-结束描绘-------------------------------------------------------------
- #-描绘内容-------------------------------------------------------------
- # 描绘标题
- self.contents.draw_text(1, 1, dw-1, 24, "奖赏表", 1)
- # 描绘头像等
- for i in 0...$game_party.members.size
- draw_actor_face($game_party.members[i], 1, h*i+28, h-1)
- self.contents.font.size = 20
- self.contents.draw_text(1, 1+h*i+27, 96, 24, $game_party.members[i].name)
- self.contents.font.size = 18
- self.contents.draw_text(81,1+h*i+27, dw/2-81, 24,"奖励#{Vocab.level}:")
- self.contents.draw_text(81,1+h*i+27+h/2, dw/2-81, 24,"奖励经验:")
- if task.reward(4, i) != nil
- self.contents.draw_text(81,1+h*i+27+h/4, dw/2-82, 24, task.reward(4, i), 2)
- else self.contents.draw_text(81,1+h*i+27+h/4, dw/2-82, 24, "无", 2)
- end
- if task.reward(5, i) != nil
- self.contents.draw_text(81,1+h*i+27+h/4+h/2, dw/2-82, 24, task.reward(5, i), 2)
- else self.contents.draw_text(81,1+h*i+27+h/4+h/2, dw/2-82, 24, "无", 2)
- end
- end
- self.contents.font.size = 20
- x = dw/2+1
- # 描绘金钱奖励
- draw_icon(DOS::Task_Gold_Icon_Index, x, 26)
- self.contents.draw_text(x+25, 26, dw/2-1, 24,"金币:#{task.reward(3, 0)}#{Vocab.gold}")
- y = 26+24
- # 描绘道具奖励
- for i in 0...task.reward_size(0)
- draw_icon(task.reward(0, i).icon_index, x, y+i*24)
- self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(0, i).name}*#{task.reward_item_amount(0, i)}")
- end
- y = 26 + 24 + task.reward_size(0)*24
- # 描绘武器奖励
- for i in 0...task.reward_size(1)
- draw_icon(task.reward(1, i).icon_index, x, y+i*24)
- self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(1, i).name}*#{task.reward_item_amount(1, i)}")
- end
- y = 26 + 24 + task.reward_size(0)*24 + task.reward_size(1)*24
- # 描绘防具奖励
- for i in 0...task.reward_size(2)
- draw_icon(task.reward(2, i).icon_index, x, y+i*24)
- self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(2, i).name}*#{task.reward_item_amount(2, i)}")
- end
- #-结束描绘-------------------------------------------------------------
- end
- end
- end
- #=============================================================================
- # ** Scene_Task
- #=============================================================================
- class Scene_Task < Scene_Base
- #---------------------------------------------------------------------------
- # * 初始化变量
- #---------------------------------------------------------------------------
- def initialize(return_scene, index=0)
- @index = index
- @return_scene = return_scene
- end
- #---------------------------------------------------------------------------
- # * 开始处理
- #---------------------------------------------------------------------------
- def start
- create_menu_background
- @th = Window_TaskHelp.new($game_party.accepted_task[0].id)
- @paga = @th.paga
- tn = []
- for i in 0...$game_party.accepted_task.size
- tn[i] = $game_party.accepted_task[i].name
- end
- @hc = Window_Command.new(160, tn)
- @hc.y = 20
- @hc.height = 376
- @hc.index = @index
- @query = Window_Base.new(40, 152, 464, 56)
- a = sprintf(Vocab::Task_Adandonment_Query, $game_party.accepted_task[0].name)
- @query.contents.font.color = DOS::Task_Query_Word_Color
- @query.contents.draw_text(0, 0, 432, 24, a, 1)
- @query.contents.font.color = Color.new(0, 0, 0)
- @qc = Window_Command.new(160, [" 是", " 否"])
- @qc.x = 192
- @qc.y = 208
- @query.visible = false
- @qc.visible = false
- @qc.active = false
- [url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new
- @sprite.bitmap = Bitmap.new(384, 24)
- @sprite.bitmap.draw_text(0, 0, 384, 24, Vocab::Task_Change_Page[@paga], 1)
- @sprite.x = 0
- @sprite.y = 416-24
- end
- #--------------------------------------------------------------------------
- # * 结束处理
- #--------------------------------------------------------------------------
- def terminate
- dispose_menu_background
- @hc.dispose
- @th.dispose
- @query.dispose
- @qc.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * 更新帧
- #--------------------------------------------------------------------------
- def update
- @sprite.update
- @sprite.x + 10 if @sprite.x != 160
- @hc.update
- @th.update
- update_input
- if @hc.index != @index
- @th.refresh($game_party.accepted_task[@hc.index].id)
- @index = @hc.index
- end
- @query.update
- if @query.active == true
- @qc.update
- end
- if @paga != @th.paga
- @sprite.bitmap.clear
- @sprite.bitmap.draw_text(0, 0, 384, 24, Vocab::Task_Change_Page[@th.paga], 1)
- @sprite.x = 0
- @paga = @th.paga
- end
- end
- #--------------------------------------------------------------------------
- # * 刷新按键
- #--------------------------------------------------------------------------
- def update_input
- if Input.trigger?(Input::B)
- if @hc.active == true
- Sound.play_cancel
- $scene = @return_scene
- elsif @query.visible == true
- Sound.play_cancel
- @hc.active = true
- @query.visible = false
- @qc.visible = false
- @qc.active = false
- end
- elsif Input.trigger?(DOS::Task_Abandonment_Task_Input)
- if @hc.active == true
- if $game_party.accepted_task[@hc.index].can_abandonment? == true
- Sound.play_decision
- a = sprintf(Vocab::Task_Adandonment_Query, $game_party.accepted_task[@hc.index].name)
- @query.contents.clear
- @query.contents.font.color = DOS::Task_Query_Word_Color
- @query.contents.draw_text(0, 0, 432, 24, a, 1)
- @query.contents.font.color = Color.new(0, 0, 0)
- @query.visible = true
- @qc.visible = true
- @qc.active = true
- @hc.active = false
- else Sound.play_buzzer
- @query.contents.clear
- a = sprintf(Vocab::Task_Can_Not_Abandonment, $game_party.accepted_task[@hc.index].name)
- @query.contents.font.color = DOS::Task_Query_Word_Color
- @query.contents.draw_text(0, 0, 432, 24, a, 1)
- @query.contents.font.color = Color.new(0, 0, 0)
- @query.visible = true
- @hc.active = false
- end
- end
- elsif Input.trigger?(Input::C)
- if @qc.visible == true
- if @qc.index == 0
- Sound.play_decision
- @query.contents.clear
- a = sprintf(Vocab::Task_Abandonment, $game_party.accepted_task[@hc.index].name)
- @query.contents.font.color = DOS::Task_Query_Word_Color
- @query.contents.draw_text(0, 0, 432, 24, a, 1)
- @query.contents.font.color = Color.new(0, 0, 0)
- @qc.visible = false
- @query.visible = true
- $game_party.delete_task($game_party.accepted_task[@hc.index])
- Graphics.wait(40)
- $scene = Scene_Task.new(@return_scene)
- else @hc.active = true
- Sound.play_cancel
- @query.visible = false
- @qc.visible = false
- @qc.active = false
- end
- end
- elsif Input.trigger?(DOS::Task_Left_Change_Page)
- if @th.paga == 1
- @th.paga = 0
- @th.refresh($game_party.accepted_task[@hc.index].id)
- end
- elsif Input.trigger?(DOS::Task_Right_Change_Page)
- if @th.paga == 0
- @th.paga = 1
- @th.refresh($game_party.accepted_task[@hc.index].id)
- end
- end
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # 這個類用來操控地圖,包含了地圖滾動設置和通行度判定等資訊。
- # 這個類的實例被全域變數 $game_map 所引用。
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * 宣告執行個體變數
- #--------------------------------------------------------------------------
- attr_accessor :task_id
- attr_reader :ts_visible
- attr_reader :task_word
- alias old_ini initialize
- def initialize
- old_ini
- @task_word = ""
- @ts_visible = false
- @task_id = 0
- end
- def visible_task_status
- if @ts_visible == false
- @ts_visible = true
- else @ts_visible = false
- end
- end
- def set_task_word(kind)
- case kind
- when 0 # 接受了任务
- @task_word = Vocab::Task_Accept
- when 1 # 完成了任务
- @task_word = Vocab::Task_Complete
- when 2 # 任务失败了
- @task_word = Vocab::Task_Fail
- when 3 # 放弃了任务
- @task_word = Vocab::Task_Abandonment
- when 4 # 无法放弃任务
- @task_word = Vocab::Task_Can_Not_Abandonment
- when 5 # 已接受了任务
- @task_word = Vocab::Task_Accepted
- when 6 # 未接受任务
- @task_word = Vocab::Task_No_Accept
- when nil
- @task_word = nil
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # 這個類用來執行顯示地圖場景畫面的程式。
- #==============================================================================
- class Scene_Map < Scene_Base
- alias old_sta start
- alias old_upd update
- alias old_ter terminate
- def start
- old_sta
- @ts = Window_Base.new(40, 152, 464, 56)
- @ts.visible = false
- end
- def terminate
- old_ter
- @ts.dispose
- end
- def update
- old_upd
- if $game_map.ts_visible == true
- @ts.contents.clear
- tw = sprintf($game_map.task_word, Game_Task.new($game_map.task_id).name)
- @ts.contents.draw_text(28, 0, 408, 24, tw)
- @ts.draw_icon(Game_Task.new($game_map.task_id).icon_index, 0, 0)
- @ts.visible = true
- Graphics.wait(40)
- $game_map.visible_task_status
- @ts.visible = false
- end
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # 這個類是用來執行事件指令的直譯器。
- # 這個類作為 Game_Map、Game_Troop 和 Game_Event 的內部類使用。
- #==============================================================================
- class Game_Interpreter
- def accept_task(id, enforcement=false)
- if $game_party.accepted_task?(id) == false or enforcement == true
- $game_party.accept_task(id)
- visible_ts(id, 0)
- else
- visible_ts(id, 5)
- end
- end
- def complete_task(id)
- if $game_party.accepted_task?(id) == false
- $game_party.completed_task(id)
- visible_ts(id, 1)
- elsif $game_party.accepted_task?(id) == nil
- visible_ts(id, 6) if DOS::Task_No_Accept == 0
- end
- end
- def fail_task(id)
- if $game_party.accepted_task?(id) == false
- $game_party.delete_task(Game_Task.new(id))
- visible_ts(id, 2)
- elsif $game_party.accepted_task?(id) == nil
- visible_ts(id, 6) if DOS::Task_No_Accept == 0
- end
- end
- def abandonment_task(id)
- if $game_party.accepted_task?(id) == false
- $game_party.delete_task(Game_Task.new(id))
- visible_ts(id, 3)
- elsif $game_party.accepted_task?(id) == nil
- visible_ts(id, 6) if DOS::Task_No_Accept == 0
- end
- end
- def visible_ts(id, kind)
- $game_map.task_id = id
- $game_map.set_task_word(kind)
- $game_map.visible_task_status
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # * 描绘直线 by 945127391
- # begin_x : 直线开始的x坐标
- # begin_y : 直线开始的y坐标
- # end_x : 直线结束的x坐标
- # end_y : 直线结束的y坐标
- # color : 直线的颜色
- # width : 直线的宽度(厚度)
- #--------------------------------------------------------------------------
- def draw_straight_filament(begin_x, begin_y, end_x, end_y, width, color)
- if begin_x == end_x
- bitmap = Bitmap.new(width, end_y-begin_y)
- elsif begin_y == end_y
- bitmap = Bitmap.new(end_x-begin_x, width)
- else return
- end
- bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, color)
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(begin_x, begin_y, bitmap, rect)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # * 描绘自动换行文字 by 叶子
- # 修改 945127391
- #--------------------------------------------------------------------------
- def chenge_special_character(text, x=0, y=0)
- # 记录换行时y坐标最小加值
- min_y = 0
- while ((c = text.slice!(/./m)) != nil)
- # 另起一行文字的情况下
- if c == "\n"
- y += [WLH, min_y].max
- min_y = 0
- x = 0
- # 下面的文字
- next
- end
- # 自动换行处理
- if x + self.contents.text_size(c).width > self.contents.width
- y += [WLH, min_y].max
- min_y = 0
- x = 0
- end
- # 描绘文字
- self.contents.draw_text(4 + x, y, 40, WLH, c)
- # x 为要描绘文字的加法运算
- x += self.contents.text_size(c).width
- end
- end
- end
复制代码 使用不了还是使用错误?
|
|