赞 | 1 |
VIP | 0 |
好人卡 | 11 |
积分 | 0 |
经验 | 26243 |
最后登录 | 2014-8-4 |
在线时间 | 841 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 48
- 在线时间
- 841 小时
- 注册时间
- 2010-8-11
- 帖子
- 1135
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 945127391 于 2012-5-25 21:10 编辑
大家好,我数字君又回来了>_<
这次给大家带来的还是任务系统……(PIA!)
没错,就是那无聊的任务系统的VA移植版……
好了先发图:
这个东东比VX版的要多一些功能,
但是也比VX版的少一点点东西……
平衡嘛平衡……
BUG:
字体的高度可能会有问题,因为我一开始写的时候忘记了VA的字号比VX大……
而我制作的游戏的字号是20,所以……
但是由于附件过大,所以发不了范例了……
好吧,直接发脚本:- #==============================================================================
- # ** 任务系统VA版 V1.0
- #------------------------------------------------------------------------------
- # 此系统中包含的脚本:
- # System(module)
- # Vocab(module)
- # Game_Task
- # Game_Map
- # Game_Party
- # Window_Base
- # Window_TaskList
- # Window_TaskData
- # Window_YON
- # Scene_Task
- # Scene_Map
- #------------------------------------------------------------------------------
- # 使用说明
- # 一.召唤任务清单场景
- # SceneManager.call(Scene_Task)
- # 二.接受任务
- # $game_party.accept_task(任务id)
- # 三.完成任务
- # $game_party.complete_task(任务id)
- # 四.任务失败(不删除)
- # $game_party.fail_task(任务id)
- # 五.放弃(删除)任务
- # $game_party.abandonment_task(任务id)
- # 还有个更直接的就是:
- # $game_party.delete_task(任务id)
- # 默认的效果都一样,但是$game_party.abandonment_task有判定是否接受了要放
- # 弃的任务,而$game_party.delete_task没有,所以为了安全起见,请使用$game_party
- # .abandonment_task.
- # 六.改变任务状态
- # $game_party.change_task_status(任务id, 状态id)
- # 此方法只会改变任务的status变数,并不会造成该任务其他改变.
- # 状态id对应表
- # 0-未接受 1-已接受 2-完成 3-放弃 4-失败
- # 七.获取当前任务状态
- # $game_party.task[任务id].status
- # 返回的数字的含义:
- # 0-未接受 1-已接受 2-完成 3-放弃 4-失败
- # 八.判断是否接受任务
- # $game_party.accepted_task?(任务id)
- # 已接受返回true,未接受返回false.
- # 九.显示任务提示栏
- # $game_map.show_task_tip(任务id, 提示类型)
- # 提示类型对应表:
- # 0 - 接受任务时的提示
- # 1 - 完成任务时的提示
- # 2 - 放弃任务时的提示
- # 3 - 任务失败时的提示
- #------------------------------------------------------------------------------
- module System
- #==============================================================================
- #--------------------------------任务设置--------------------------------------
- #==============================================================================
- #--数量------------------------------------------------------------------------
- # 描绘任务资料时,线条的宽度
- Task_Filament_Width = 2
- # 任务进度槽的高度
- Task_Gauge_Height = 10
- # 任务进度槽边框的宽度
- Task_Gauge_Out_Edge_Width = 1
- # 文字高度
- WLH = 28.8
- # 提示窗口显示时间(帧)
- Show_Tip_Time = 50
- #--按键------------------------------------------------------------------------
- # 放弃任务按钮
- Task_Abandonment_Task_Input = Input::C
- # 左翻页按键
- Task_Left_Change_Page = Input::LEFT
- # 右翻页按键
- Task_Right_Change_Page = Input::RIGHT
- #--颜色------------------------------------------------------------------------
- # 描绘任务资料时,线条的颜色
- Task_Filament_Color = Color.new(255, 255, 255, 127)
- # 绘制确定放弃任务时疑问的文字色
- Task_Query_Word_Color = Color.new(255, 255, 0)
- # 没有接受的任务名字的颜色
- No_Accept_Task_Color = Color.new(255, 255, 255, 127)
- # 普通的任务名字的颜色
- Task_Color = Color.new(255, 255, 255)
- # 已经完成的任务名字的颜色
- Task_Complete_Color = Color.new(255, 255, 255)
- # 已经放弃的任务名字的颜色
- Task_Abandonment_Color = Color.new(255, 255, 255, 127)
- # 已经失败的任务名字的颜色
- Task_Fail_Color = Color.new(255, 255, 255, 127)
- # 提示没有任务时,显示的文字的颜色
- Task_Nil_Color = Color.new(255, 255, 255, 127)
- # 任务进度槽两边的颜色
- Task_Gauge_Edge_Color = Color.new(0, 0, 255)
- # 任务进度槽中间的颜色
- Task_Gauge_Central_Color = Color.new(255, 255, 255)
- # 任务进度槽外边框的颜色
- Task_Gauge_Out_Edge_Color = Color.new(255, 255, 255)
- # 任务进度槽阴影的颜色
- Task_Gauge_Shadow_Color = Color.new(0, 0, 0, 127)
- #--图标------------------------------------------------------------------------
- # 金钱的图标id
- Task_Gold_Icon = 205
- # 在没接受的任务名字前描绘图标(若不想描绘请写0)
- No_Accept_Task_Icon = 98
- # 在普通的任务名字前描绘图标(若不想描绘请写0)
- Task_Icon = 102
- # 在完成的任务名字前描绘图标(若不想描绘请写0)
- Task_Complete_Icon = 101
- # 在放弃的任务名字前描绘图标(若不想描绘请写0)
- Task_Abandonment_Icon = 103
- # 在失败的任务名字前描绘图标(若不想描绘请写0)
- Task_Fail_Icon = 99
- #--文件名----------------------------------------------------------------------
- # 在任务资料窗口下面的提示栏的图片文件名
- Page_Tip = "Graphics/System/PageTip"
- #--任务资料--------------------------------------------------------------------
- Task = []
- Task[0] = { # 任务id
- "Icon" => 406, # 图标id
- "Name" => "遗失的手风琴",# 任务名称
- "Title Help" => "委托人:音乐家", # 任务简短说明
- "Caption" => " 村庄里有一个伟大的音乐家,应邀去参加一个音乐会,但是他的手风琴不见了,你能帮他找找吗?",
- "Reward" => {"Item" => [[1, 1]], # 完成任务后奖励的物品
- "Weapon" => [[1, 1], [2, 1]], # 完成任务后奖励的武器
- "Armor" => [[1, 1], [2,1]], # 完成任务后奖励的防具
- "Gold" => 0, # 完成任务后奖励的金钱
- "Level_Plus" => [[0,5],[1,5]], # 完成任务后奖励的等级
- "Exp_Plus" => [[0, 5], [2, 5]] # 完成任务后奖励的经验
- },
- "Can Abandonment?" => true, # 可否放弃此任务
- "Level" => 3, # 任务等级
- "Max Complete Value" => 10, # 任务最大完成度
- }
- #--方法------------------------------------------------------------------------
- #----------------------------------------------------------------------------
- # * 判断是否描绘任务图标
- #----------------------------------------------------------------------------
- def self.draw_task_icon?
- if Task_Icon == 0 and Task_Complete_Icon == 0 and Task_Abandonment_Icon == 0 and Task_Fail_Icon == 0
- return false
- else return true
- end
- end
- end
- module Vocab
- #============================================================================
- #---------------------------任务用语设置-------------------------------------
- #============================================================================
- #--提示语句------------------------------------------------------------------
- Task_Accept = "接受了任务:"
- Task_Complete = "完成任务:"
- Task_Abandonment = "放弃任务:"
- Task_Fail = "任务失败:"
- Task_Nil = "暂时没有任务"
- #--警告语句------------------------------------------------------------------
- Task_Can_Not_Abandonment = "无法放弃任务[%s]"
- Task_No_Accept = "你还没接受任务[%s]!"
- #--询问语句------------------------------------------------------------------
- Task_Adandonment_Query = "你确定要放弃[%s]这个任务吗?"
- #--词语----------------------------------------------------------------------
- Task_Difficulty = "任务难度:"
- Task_Level_Word = ["简单", "容易", "中等", "困难"]
- Task_Can_Abandonment_Word = ["可放弃", "不可放弃"]
- Task_Status_Word = ["未接受", "已接受", "完成", "放弃", "失败"]
- Task_Value = "进度"
- end
- #==============================================================================
- # ** Game_Task
- #------------------------------------------------------------------------------
- # 处理任务资料的类。
- #==============================================================================
- class Game_Task
- #----------------------------------------------------------------------------
- # * 定义实例变量
- #----------------------------------------------------------------------------
- attr_reader :id
- attr_reader :task
- attr_reader :icon
- attr_reader :name
- attr_reader :title_help
- attr_reader :caption
- attr_reader :level
- attr_reader :max_complete_value
- attr_reader :status
- attr_reader :complete_value
- #----------------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------------
- def initialize(id)
- @id = id
- @task = System::Task[@id]
- @icon = @task["Icon"]
- @name = @task["Name"]
- @title_help = @task["Title Help"]
- @caption = @task["Caption"]
- @level = @task["Level"]
- @reward = @task["Reward"]
- @max_complete_value = @task["Max Complete Value"]
- @status = 0
- @complete_value = 0
- end
- #----------------------------------------------------------------------------
- # * 获取任务奖励
- #----------------------------------------------------------------------------
- def reward(type, index)
- case type
- when -1 # 所有
- return_reward = @reward
- when 0 # 物品
- return_reward = @reward["Item"][index]
- when 1 # 武器
- return_reward = @reward["Weapon"][index]
- when 2 # 防具
- return_reward = @reward["Armor"][index]
- when 3 # 金钱
- return_reward = @reward["Gold"]
- when 4 # 经验
- return_reward = @reward["Exp_Plus"][index]
- when 5 # 等级
- return_reward = @reward["Level_Plus"][index]
- end
- return return_reward
- end
- #----------------------------------------------------------------------------
- # * 获取任务等级描述语
- #----------------------------------------------------------------------------
- def level_word
- return Vocab::Task_Level_Word[@level]
- end
- #----------------------------------------------------------------------------
- # * 获取任务状态描述语
- #----------------------------------------------------------------------------
- def status_word
- return Vocab::Task_Status_Word[@status]
- end
- #----------------------------------------------------------------------------
- # * 判断该任务能否放弃
- #----------------------------------------------------------------------------
- def can_abandonment?
- return @task["Can Abandonment?"]
- end
- #----------------------------------------------------------------------------
- # * 获取任务能否放弃的语句
- #----------------------------------------------------------------------------
- def abandonment_word
- if can_abandonment?
- return Vocab::Task_Can_Abandonment_Word[0]
- else return Vocab::Task_Can_Abandonment_Word[1]
- end
- end
- #---------------------------------------------------------------------------
- # * 改变任务状态
- #---------------------------------------------------------------------------
- def status=(new_s)
- @status = new_s
- @status = 3 if @status > 3
- @status = 0 if @status < 0
- end
- #---------------------------------------------------------------------------
- # * 改变任务完成度
- #---------------------------------------------------------------------------
- def complete_value=(new_v)
- @complete_value = new_v
- @complete_value = @max_complete_value if @complete_value > @max_complete_value
- @complete_value = 0 if @complete_value < 0
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # 管理地图的类。拥有卷动地图以及判断通行度的功能。
- # 本类的实例请参考 $game_map 。
- #==============================================================================
- class Game_Map
- #----------------------------------------------------------------------------
- # * 定义实例变量
- #----------------------------------------------------------------------------
- attr_reader :tip_visible
- attr_reader :tip_task_id
- attr_reader :tip_type
- #----------------------------------------------------------------------------
- # * 重命名方法
- #----------------------------------------------------------------------------
- alias task_tip_ini initialize
- #----------------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------------
- def initialize
- task_tip_ini
- @tip_visible = false
- @tip_task_id = 0
- @tip_type = 0
- end
- #----------------------------------------------------------------------------
- # * 显示提示栏
- #----------------------------------------------------------------------------
- def show_task_tip(tip_task_id, tip_type)
- change_tip_visible
- @tip_task_id = tip_task_id
- @tip_type = tip_type
- end
- #----------------------------------------------------------------------------
- # * 改变tip_visible(逆向)
- #----------------------------------------------------------------------------
- def change_tip_visible
- if @tip_visible
- @tip_visible = false
- else @tip_visible = true
- end
- end
- #----------------------------------------------------------------------------
- # * 获取提示栏文字
- #----------------------------------------------------------------------------
- def tip_task_word(tip_type=nil)
- if tip_type == nil
- tip_type = @tip_type
- end
- case tip_type
- when 0
- word = Vocab::Task_Accept
- when 1
- word = Vocab::Task_Complete
- when 2
- word = Vocab::Task_Abandonment
- when 3
- word = Vocab::Task_Fail
- end
- return word
- end
- end
- #==============================================================================
- # ** Game_Party
- #------------------------------------------------------------------------------
- # 管理队伍的类。保存有金钱及物品的信息。本类的实例请参考 $game_party 。
- #==============================================================================
- class Game_Party < Game_Unit
- #----------------------------------------------------------------------------
- # * 定义实例变量
- #----------------------------------------------------------------------------
- attr_reader :task
- #----------------------------------------------------------------------------
- # * 重命名方法
- #----------------------------------------------------------------------------
- alias task_ini initialize
- #----------------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------------
- def initialize
- task_ini
- @task = []
- end
- #----------------------------------------------------------------------------
- # * 判断是否已有该任务
- #----------------------------------------------------------------------------
- def accepted_task?(task_id)
- if @task[task_id] != nil
- return true
- else return false
- end
- end
- #----------------------------------------------------------------------------
- # * 改变任务状态
- #----------------------------------------------------------------------------
- def change_task_status(task_id, new_status)
- @task[task_id].status = new_status
- end
- #----------------------------------------------------------------------------
- # * 接受任务
- #----------------------------------------------------------------------------
- def accept_task(task_id)
- return false if accepted_task?(task_id) == true
- @task[task_id] = Game_Task.new(task_id)
- change_task_status(task_id, 1)
- end
- #----------------------------------------------------------------------------
- # * 删除任务
- #----------------------------------------------------------------------------
- def delete_task(task_id)
- @task.delete_at(task_id)
- end
- #----------------------------------------------------------------------------
- # * 放弃任务
- #----------------------------------------------------------------------------
- def abandonment_task(task_id)
- return false if accepted_task?(task_id) == false
- delete_task(task_id)
- end
- #----------------------------------------------------------------------------
- # * 任务失败
- #----------------------------------------------------------------------------
- def fail_task(task_id)
- return false if accepted_task?(task_id) == false
- change_task_status(task_id, 4)
- end
- #----------------------------------------------------------------------------
- # * 任务完成
- #----------------------------------------------------------------------------
- def complete_task(task_id)
- return false if accepted_task?(task_id) == false
- task = @task[task_id]
- reward = task.reward(-1, 0)
- change_task_status(task_id, 2)
- # 奖励物品
- for i in 0...reward["Item"].size
- $game_party.gain_item($data_items[task.reward(0, i)[0]], task.reward(0, i)[1])
- end
- # 奖励武器
- for i in 0...reward["Weapon"].size
- $game_party.gain_item($data_weapons[task.reward(1, i)[0]], task.reward(1, i)[1])
- end
- # 奖励防具
- for i in 0...reward["Armor"].size
- $game_party.gain_item($data_armors[task.reward(2, i)[0]], task.reward(2, i)[1])
- end
- # 奖励金钱
- gain_gold(task.reward(3, 0))
- # 增加等级
- for i in 0...reward["Level_Plus"].size
- $game_party.members[task.reward(5, i)[0]].change_level(task.reward(5, i)[1], true)
- end
- # 增加经验
- for i in 0...reward["Exp_Plus"].size
- $game_party.members[task.reward(4, i)[0]].change_exp(task.reward(4, i)[1], true)
- end
- delete_task(task_id)
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # 游戏中所有窗口的父类
- #==============================================================================
- 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 += [System::WLH, min_y].max
- min_y = 0
- x = 0
- # 下面的文字
- next
- end
- # 自动换行处理
- if x + self.contents.text_size(c).width > self.contents.width
- y += [System::WLH, min_y].max
- min_y = 0
- x = 0
- end
- # 描绘文字
- self.contents.draw_text(4 + x, y, 40, System::WLH, c)
- # x 为要描绘文字的加法运算
- x += self.contents.text_size(c).width
- end
- end
- #----------------------------------------------------------------------------
- # * 描绘任务进度槽
- #----------------------------------------------------------------------------
- def draw_task_value_gauge(x, y, width, task)
- gh = System::Task_Gauge_Height
- goe = System::Task_Gauge_Out_Edge_Width
- w = width*task.complete_value/task.max_complete_value
- self.contents.fill_rect(x+3, y+3, w, gh+goe*2, System::Task_Gauge_Shadow_Color)
- self.contents.gradient_fill_rect(x+goe, y+goe, w, gh/2, System::Task_Gauge_Edge_Color, System::Task_Gauge_Out_Edge_Color, true)
- self.contents.gradient_fill_rect(x+goe, y+goe+gh/2, w, gh/2, System::Task_Gauge_Out_Edge_Color, System::Task_Gauge_Edge_Color, true)
- draw_straight_filament(x, y, x+width, y, goe, System::Task_Gauge_Out_Edge_Color)
- draw_straight_filament(x, y+gh, x+width, y+gh, goe, System::Task_Gauge_Out_Edge_Color)
- draw_straight_filament(x, y, x, y+gh, goe, System::Task_Gauge_Out_Edge_Color)
- draw_straight_filament(x+width, y, x+width, y+gh, goe, System::Task_Gauge_Out_Edge_Color)
- end
- end
- #==============================================================================
- # ** Window_TaskList
- #------------------------------------------------------------------------------
- # 把任务的名字、(状态)图标列出来的列表状窗口。
- #==============================================================================
- class Window_TaskList < Window_Command
- #----------------------------------------------------------------------------
- # * 定义实例变量
- #----------------------------------------------------------------------------
- attr_reader :list
- #----------------------------------------------------------------------------
- # * 初始化
- #----------------------------------------------------------------------------
- def initialize
- super(0, 0)
- end
- def window_width
- return 184
- end
- def window_height
- return 416
- end
- def refresh
- super
- contents.clear
- if $game_party.task.size == 0
- self.contents.font.color = System::Task_Nil_Color
- self.contents.draw_text(0, 0, self.contents.width, System::WLH, Vocab::Task_Nil, 1)
- else
- for i in 0...item_max
- draw_item(i)
- end
- end
- end
- def make_command_list
- @list = []
- return if $game_party.task.size == 0
- for i in 0...$game_party.task.size
- @list.push($game_party.task[i].id) if $game_party.task[i] != nil
- end
- end
- def draw_item(index)
- task = $game_party.task[@list[index]]
- return if task == nil
- if System.draw_task_icon?
- case task.status
- when 0
- self.contents.font.color = System::Task_Color
- if System::No_Accept_Task_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- draw_icon(System::No_Accept_Task_Icon, 0, index*System::WLH, enabled)
- when 1
- self.contents.font.color = System::Task_Color
- if System::Task_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- draw_icon(System::Task_Icon, 0, index*System::WLH, enabled)
- when 2
- self.contents.font.color = System::Task_Complete_Color
- if System::Task_Complete_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- draw_icon(System::Task_Complete_Icon, 0, index*System::WLH, enabled)
- when 3
- self.contents.font.color = System::Task_Fail_Color
- if System::Task_Fail_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- draw_icon(System::Task_Fail_Icon, 0, index*System::WLH, enabled)
- when 4
- self.contents.font.color = System::Task_Abandonmet_Icon
- if System::Task_Abandonmet_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- draw_icon(System::Task_Abandonment_Icon, 0, index*System::WLH, enabled)
- end
- else
- case task.status
- when 0
- self.contents.font.color = System::No_Accept_Task_Color
- if System::Task_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- when 1
- self.contents.font.color = System::Task_Color
- if System::Task_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- when 2
- self.contents.font.color = System::Task_Complete_Color
- if System::Task_Complete_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- when 3
- self.contents.font.color = System::Task_Fail_Color
- if System::Task_Fail_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- when 4
- self.contents.font.color = System::Task_Abandonmet_Icon
- if System::Task_Abandonmet_Color.alpha > 127
- enabled = true
- else enabled = false
- end
- end
- draw_icon(task.icon, 0, index*System::WLH, enabled)
- enabled = true
- end
- self.contents.draw_text(24, index*System::WLH, self.contents.width, System::WLH, task.name)
- self.contents.font.color = System::Task_Color
- end
- def current_item_enabled?
- end
- def current_symbol
- end
- def current_ext
- end
- end
- #==============================================================================
- # ** Window_TaskData
- #------------------------------------------------------------------------------
- # 显示任务详细资料的窗口。
- #==============================================================================
- class Window_TaskData < Window_Base
- #----------------------------------------------------------------------------
- # * 定义实例变量
- #----------------------------------------------------------------------------
- attr_accessor :page
- def initialize(task_id)
- super(184, 0, 360, 416)
- @page = 0
- refresh(task_id)
- end
- def refresh(task_id)
- self.contents.clear
- return if task_id == nil
- task = $game_party.task[task_id]
- w = self.contents.width
- h = self.contents.height
- fw = System::Task_Filament_Width
- fc = System::Task_Filament_Color
- vw = self.contents.text_size(Vocab::Task_Value).width
- if @page == 0
- #------------------------------------------------------------------------
- # * 描绘边框
- #------------------------------------------------------------------------
- #--横线------------------------------------------------------------------
- draw_straight_filament(0, 0, w, 0, fw, fc)
- draw_straight_filament(0, h-fw, w, h-fw, fw, fc)
- draw_straight_filament(fw, fw+System::WLH-1, w-fw, fw+System::WLH-1, fw, fc) # 第一行与第二行的分割线
- draw_straight_filament(fw, fw+System::WLH*2-2, w-fw, fw+System::WLH*2-2, fw, fc) # 第二行与第三行的分割线
- draw_straight_filament(fw, fw+System::WLH*3-3, w-fw, fw+System::WLH*3-3, fw, fc) # 第三行与第四行的分割线
- draw_straight_filament(fw, fw+System::WLH*4-4, w-fw, fw+System::WLH*4-4, fw, fc) # 第四行与说明文的分割线
- #--竖线------------------------------------------------------------------
- draw_straight_filament(0, fw, 0, h-fw, fw, fc)
- draw_straight_filament(w-fw, fw, w-fw, h-fw, fw, fc)
- draw_straight_filament(w/3, fw+System::WLH-1+fw, w/3, fw+System::WLH*2-2, fw, fc) # 第二行第一条竖线(等级-状态)
- draw_straight_filament(w/3*2, fw+System::WLH-1+fw, w/3*2, fw+System::WLH*2-2, fw, fc) # 第二行第二条分割线(状态-可否放弃)
- #------------------------------------------------------------------------
- # * 描绘基本资料
- #------------------------------------------------------------------------
- #--第一行----------------------------------------------------------------
- draw_icon(task.icon, fw+1, fw+1) # 任务图标
- self.contents.draw_text(fw+1+System::WLH, fw+1, w-System::WLH, System::WLH, task.name, 1) # 任务名
- #--第二行----------------------------------------------------------------
- self.contents.draw_text(0, fw+System::WLH+1, w/3, System::WLH, task.level_word, 1) # 任务等级
- self.contents.draw_text(w/3, fw+System::WLH+1, w/3, System::WLH, task.status_word, 1) # 任务状态
- self.contents.draw_text(w/3*2, fw+System::WLH+1, w/3, System::WLH, task.abandonment_word, 1) # 任务可否放弃
- self.contents.draw_text(0, fw*2+System::WLH*2-fw, w, System::WLH, task.title_help, 1) # 任务简短说明
- #--第三行----------------------------------------------------------------
- self.contents.draw_text(fw+1, fw*3+System::WLH*3-fw*2, w, System::WLH, Vocab::Task_Value) # 描绘进度条的名字
- #------------------------------------------------------------------------
- # * 描绘进度条
- #------------------------------------------------------------------------
- y = fw*3+System::WLH*3-3
- y += (System::WLH-1)/2-(System::Task_Gauge_Height+System::Task_Gauge_Out_Edge_Width*2)/2
- draw_task_value_gauge(vw+5, y, w*3-(vw+21+fw), task)
- draw_current_and_max_values(0, fw*3+System::WLH*3-fw*2, w-fw-1, task.complete_value, task.max_complete_value, Color.new(255, 255, 255), Color.new(255, 255, 255)) # 描绘最大值和最小值
- #------------------------------------------------------------------------
- # * 描绘说明文
- #------------------------------------------------------------------------
- chenge_special_character(task.caption.clone, 0, fw+System::WLH*4-2)
- elsif @page == 1
- #------------------------------------------------------------------------
- # * 描绘边框
- #------------------------------------------------------------------------
- #--横线------------------------------------------------------------------
- draw_straight_filament(0, 0, w, 0, fw, fc)
- draw_straight_filament(0, h-fw, w, h-fw, fw, fc)
- draw_straight_filament(fw, fw+23, w-fw, fw+23, fw, fc) # 题目
- #----头像分割线----------------------------------------------------------
- for i in 0...3
- draw_straight_filament(fw, fw+23+(h-fw-23)/4*(i+1), w/4, fw+23+(h-fw-23)/4*(i+1), fw, fc)
- draw_straight_filament(fw+w/4, fw+23+(h-fw-23)/4*(i+1), w/2, fw+23+(h-fw-23)/4*(i+1), fw, fc)
- end
- for i in 0...4
- draw_straight_filament(fw+w/4, fw+23+(h-fw-23)/4*(i+1)-(h-fw-23)/8, w/2, fw+23+(h-fw-23)/4*(i+1)-(h-fw-23)/8, fw, fc)
- end
- #----奖励分割线----------------------------------------------------------
- max = (h-fw-23)/(fw+23)
- for i in 0...max-1
- draw_straight_filament(fw+w/2, fw+23+(h-fw-23)/max*(i+1), w, fw+23+(h-fw-23)/max*(i+1), fw, fc)
- end
- #--竖线------------------------------------------------------------------
- draw_straight_filament(0, fw, 0, h-fw, fw, fc)
- draw_straight_filament(w-fw, fw, w-fw, h-fw, fw, fc)
- draw_straight_filament(w/2, fw*2+23, w/2, h-fw, fw, fc) # 中线
- draw_straight_filament(w/4, fw*2+23, w/4, h-fw, fw, fc) # 头像框
- #------------------------------------------------------------------------
- # * 绘制题目
- #------------------------------------------------------------------------
- self.contents.draw_text(fw, 2, w-fw, System::WLH, "奖励表", 1)
- #------------------------------------------------------------------------
- # * 绘制头像及名字
- #------------------------------------------------------------------------
- for i in 0...$game_party.members.size
- draw_actor_face($game_party.members[i], fw, fw*2+23+(h-fw-23)/4*i)
- draw_actor_name($game_party.members[i], fw, fw*2+23+(h-fw-23)/4*i, w/4-fw)
- end
- #------------------------------------------------------------------------
- # * 绘制物质奖励
- #------------------------------------------------------------------------
- y = fw+23
- #--金钱------------------------------------------------------------------
- draw_icon(System::Task_Gold_Icon, w/2+fw, y)
- self.contents.draw_text(w/2+fw, y+2, w/2-fw*2, System::WLH, task.reward(3, 0), 1)
- #--物品------------------------------------------------------------------
- for i in 0...task.reward(-1, 0)["Item"].size
- y += fw+23+1
- draw_icon($data_items[task.reward(0, i)[0]].icon_index, w/2+fw, y+2)
- text = sprintf("%s * %s", $data_items[task.reward(0, i)[0]].name, task.reward(0, i)[1])
- self.contents.draw_text(w/2+fw+System::WLH, y+2, w/2-fw*2-System::WLH, System::WLH, text, 1)
- end
- #--武器------------------------------------------------------------------
- for i in 0...task.reward(-1, 0)["Weapon"].size
- y += fw+23+1
- draw_icon($data_weapons[task.reward(1, i)[0]].icon_index, w/2+fw, y+2)
- text = sprintf("%s * %s", $data_weapons[task.reward(1, i)[0]].name, task.reward(1, i)[1])
- self.contents.draw_text(w/2+fw+System::WLH, y+2, w/2-fw*2-System::WLH, System::WLH, text, 1)
- end
- #--防具------------------------------------------------------------------
- for i in 0...task.reward(-1, 0)["Armor"].size
- y += fw+23+1
- draw_icon($data_armors[task.reward(1, i)[0]].icon_index, w/2+fw, y+2)
- text = sprintf("%s * %s", $data_armors[task.reward(1, i)[0]].name, task.reward(1, i)[1])
- self.contents.draw_text(w/2+fw+System::WLH, y+2, w/2-fw*2-System::WLH, System::WLH, text, 1)
- end
- #------------------------------------------------------------------------
- # 绘制其他奖励
- #------------------------------------------------------------------------
- exp = [false, false, false, false]
- lv = [false, false, false, false]
- for i in 0...4
- x = w/4+fw
- y = fw+23+(h-fw-23)/4*i
- self.contents.draw_text(x, y, w/4, System::WLH, "经验值:")
- y = fw+23+(h-fw-23)/4*(i+1)-(h-fw-23)/8
- self.contents.draw_text(x, y, w/4, System::WLH, "等级:")
- end
- #--经验值----------------------------------------------------------------
- for i in 0...task.reward(-1, 0)["Exp_Plus"].size
- a = task.reward(4, i)[0]
- y = fw+47+(h-fw-23)/4*a
- self.contents.draw_text(x, y, w/4, System::WLH, task.reward(4, i)[1], 2)
- exp[a] = true
- end
- for i in 0...exp.size
- y = fw+47+(h-fw-23)/4*i
- if exp[i] == false
- self.contents.draw_text(x, y, w/4, System::WLH, 0, 2)
- end
- end
- #--等级----------------------------------------------------------------
- for i in 0...task.reward(-1, 0)["Level_Plus"].size
- a = task.reward(5, i)[0]
- y = fw+47+(h-fw-23)/4*(i+1)-(h-fw-23)/8
- self.contents.draw_text(x, y, w/4, System::WLH, task.reward(5, i)[1], 2)
- lv[a] = true
- end
- for i in 0...exp.size
- y = fw+47+(h-fw-23)/4*(i+1)-(h-fw-23)/8
- if lv[i] == false
- self.contents.draw_text(x, y, w/4, System::WLH, 0, 2)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制角色肖像图
- # enabled : 有效的标志。false 的时候使用半透明效果绘制
- #--------------------------------------------------------------------------
- def draw_face(face_name, face_index, x, y, enabled = true)
- w = self.contents.width
- h = self.contents.height
- fw = System::Task_Filament_Width
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96-(96-w/4)-fw, 96-(96-(h-fw-23)/4)-fw)
- rect.x -= (w/4-96)/2
- rect.y -= ((h-fw-23)/4-96)/2
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- end
- #==============================================================================
- # ** Window_YON
- #------------------------------------------------------------------------------
- # 用来选择“是”或“否”的选单。
- #==============================================================================
- class Window_YON < Window_Command
- def initialize(x, y)
- super(x, y)
- end
- def alignment
- return 1
- end
- def make_command_list
- add_command("确定", :ok)
- add_command("取消", :canael)
- end
- end
- #==============================================================================
- # ** Scene_Task
- #------------------------------------------------------------------------------
- # 任务系统的场景的类。
- #==============================================================================
- class Scene_Task < Scene_MenuBase
- #----------------------------------------------------------------------------
- # * 开始处理
- #----------------------------------------------------------------------------
- def start
- super
- @tasklist = Window_TaskList.new
- if $game_party.task.size != 0
- @taskdata = Window_TaskData.new($game_party.task[0].id)
- else @taskdata = Window_TaskData.new(nil)
- end
- @adandonmentquery = Window_Base.new(0, 0, 500, 48)
- @adandonmentquery.x = 544/2 - @adandonmentquery.width/2
- @adandonmentquery.y = 416/2 - @adandonmentquery.height/2 - 48
- @adandonmentquery.visible = false
- @adandonmentcommand = Window_YON.new(198, @adandonmentquery.y+48)
- @adandonmentcommand.visible = false
- @adandonmentcommand.active = false
- @adandonmentcommand.set_handler(:ok, method(:adandonment_task))
- @adandonmentcommand.set_handler(:cancel, method(:cancel_adandonment))
- @page_tip_left = Sprite.new
- @page_tip_left.bitmap = Bitmap.new(System::Page_Tip)
- @page_tip_left.src_rect.height = @page_tip_left.bitmap.height/2
- @page_tip_left.y = 416-@page_tip_left.bitmap.height/2
- @page_tip_left.z = 9999
- @page_tip_right = Sprite.new
- @page_tip_right.bitmap = Bitmap.new(System::Page_Tip)
- @page_tip_right.src_rect.y = @page_tip_left.bitmap.height/2
- @page_tip_right.src_rect.height = @page_tip_left.bitmap.height/2
- @page_tip_right.y = 416-@page_tip_left.bitmap.height/2
- @page_tip_right.z = 9999
- @page_tip_right.visible = false
- end
- #----------------------------------------------------------------------------
- # * 结束处理
- #----------------------------------------------------------------------------
- def terminate
- super
- @page_tip_left.dispose
- @page_tip_right.dispose
- end
- #----------------------------------------------------------------------------
- # * 刷新场景
- #----------------------------------------------------------------------------
- def update
- super
- @page_tip_left.update
- @page_tip_right.update
- case @taskdata.page
- when 0
- @page_tip_left.visible = true
- @page_tip_right.visible = false
- when 1
- @page_tip_left.visible = false
- @page_tip_right.visible = true
- end
- if Input.repeat?(:B)
- return_scene
- elsif Input.repeat?(:DOWN)
- @taskdata.refresh(@tasklist.list[@tasklist.index])
- elsif Input.repeat?(:UP)
- @taskdata.refresh(@tasklist.list[@tasklist.index])
- elsif Input.repeat?(System::Task_Right_Change_Page)
- @taskdata.page += 1 if @taskdata.page == 0
- @taskdata.refresh(@tasklist.list[@tasklist.index])
- elsif Input.repeat?(System::Task_Left_Change_Page)
- @taskdata.page -= 1 if @taskdata.page == 1
- @taskdata.refresh(@tasklist.list[@tasklist.index])
- elsif Input.repeat?(System::Task_Abandonment_Task_Input)
- if @tasklist.list.size != 0
- @tasklist.active = false
- @adandonmentquery.contents.clear
- text = sprintf(Vocab::Task_Adandonment_Query, $game_party.task[@tasklist.list[@tasklist.index]].name)
- @adandonmentquery.contents.draw_text(0, 0, @adandonmentquery.contents.width, System::WLH, text, 1)
- @adandonmentquery.visible = true
- @adandonmentcommand.visible = true
- @adandonmentcommand.active = true
- end
- end
- end
- #----------------------------------------------------------------------------
- # * 确定放弃
- #----------------------------------------------------------------------------
- def adandonment_task
- $game_party.delete_task($game_party.task[@tasklist.list[@tasklist.index]].id)
- @tasklist.make_command_list
- @tasklist.index -= 1 if @tasklist.index > 0
- @tasklist.refresh
- @taskdata.page = 0
- if $game_party.task.size != 0
- @taskdata.refresh($game_party.task[@tasklist.list[@tasklist.index]].id)
- else @taskdata.refresh(nil)
- end
- @tasklist.active = true
- @adandonmentquery.visible = false
- @adandonmentcommand.visible = false
- @adandonmentcommand.active = false
- end
- #----------------------------------------------------------------------------
- # * 取消放弃
- #----------------------------------------------------------------------------
- def cancel_adandonment
- @tasklist.active = true
- @adandonmentquery.visible = false
- @adandonmentcommand.visible = false
- @adandonmentcommand.active = false
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 地图画面
- #==============================================================================
- class Scene_Map < Scene_Base
- alias task_sta start
- alias task_upd update
- def start
- task_sta
- @task_tip1 = Window_Base.new(0, 0, 360, System::WLH*3+System::Task_Filament_Width+24)
- @task_tip1.x = 544/2-@task_tip1.width/2
- @task_tip1.y = 416/2-@task_tip1.height/2
- @task_tip1.visible = false
- @task_tip2 = Window_Base.new(0, 0, 360, System::WLH*2+System::Task_Filament_Width+24)
- @task_tip2.x = 544/2-@task_tip2.width/2
- @task_tip2.y = 416/2-@task_tip2.height/2
- @task_tip2.visible = false
- @tip_time = 0
- end
- def update
- task_upd
- fw = System::Task_Filament_Width
- fc = System::Task_Filament_Color
- if @task_tip1.visible == true or @task_tip2.visible == true
- if @tip_time == System::Show_Tip_Time or Input.repeat?(:C)
- if @task_tip1.visible == true
- @task_tip1.visible = false
- elsif @task_tip2.visible == true
- @task_tip2.visible = false
- end
- @tip_time = 0
- else @tip_time += 1
- end
- end
- if $game_map.tip_visible == true
- if $game_party.accepted_task?($game_map.tip_task_id)
- task = $game_party.task[$game_map.tip_task_id]
- else task = Game_Task.new($game_map.tip_task_id)
- end
- if System.draw_task_icon?
- @task_tip1.draw_icon(System::Task_Icon, 0, 0)
- x = 24
- else x = 0
- end
- if $game_map.tip_type == 0
- @task_tip1.contents.clear
- @task_tip1.draw_straight_filament(0, System::WLH*2+1, @task_tip1.width, System::WLH*2+1, fw, fc)
- @task_tip1.contents.draw_text(x, 0, @task_tip1.contents.width-x, System::WLH, $game_map.tip_task_word)
- @task_tip1.draw_icon(task.icon, 0, System::WLH)
- @task_tip1.draw_text(0, System::WLH, @task_tip1.contents.width-24, System::WLH, task.name, 1)
- @task_tip1.draw_text(0, System::WLH*2+fw, @task_tip1.contents.width-24, System::WLH, task.title_help, 1)
- @task_tip1.visible = true
- else
- @task_tip2.contents.clear
- @task_tip2.contents.draw_text(x, 0, @task_tip2.contents.width-x, System::WLH, $game_map.tip_task_word)
- @task_tip2.draw_icon(task.icon, 0, System::WLH)
- @task_tip2.draw_text(0, System::WLH, @task_tip2.contents.width-24, System::WLH, task.name, 1)
- @task_tip2.visible = true
- end
- $game_map.change_tip_visible
- end
- end
- end
复制代码 好了,有什么地方不懂的可以找我哦。
谢谢大家的捧场~~~~ |
评分
-
查看全部评分
|