赞 | 0 |
VIP | 12 |
好人卡 | 0 |
积分 | 1 |
经验 | 3626 |
最后登录 | 2020-5-5 |
在线时间 | 1 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 1 小时
- 注册时间
- 2008-5-31
- 帖子
- 237
|
- #==============================================================================
- # ■ Scene_Task
- #------------------------------------------------------------------------------
- # 处理商店画面的类。
- #==============================================================================
- class Scene_Task < Scene_Base
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- #=============开始================
- def start
- super
- #名称
- create_menu_background
- create_command_window
- @name_window = Window_Base.new( 0, 0, 128, 56)
- @name_window.contents = Bitmap.new( 96, 24)
- @name_window.contents.draw_text( 0, 0, 96, 24, "当前任务", 1)
- # 参数1 即居中 2 右对齐 默认左对齐
- @name_window.active = false
- # 生成主线任务窗口
- @main_window = Window_MainTask.new(0,56)
- @main_window.active = false
- @main_window.visible = false
- # 生成支线任务窗口
- @branch_window = Window_BranchTask.new(0,56)
- @branch_window.active = false
- @branch_window.visible = false
- # 生成信息窗口
- @info_window = Window_TaskInfo.new(128,56)
- end
- #======结束====================
- def terminate
- super
- dispose_menu_background
- dispose_command_window
- @name_window.dispose
- @main_window.dispose
- @branch_window.dispose
- @info_window.dispose
- end
- #===========更新=================
- def update
- super
- update_menu_background
- @command_window.update
- @main_window.update
- @branch_window.update
- @info_window.update
- if @command_window.active
- update_command_selection
- elsif @main_window.active
- update_main_selection
- elsif @branch_window.active
- update_branch_selection
- end
- end
-
- #=========指令窗口=============
- def create_command_window
- s1 = Vocab::MainTask
- s2 = Vocab::BranchTask
- s3 = Vocab::TaskCancel
- @command_window = Window_Command.new(512, [s1, s2, s3], 3)
- @command_window.x = 128
- @command_window.y = 0
- end
-
- #======释放===============
- def dispose_command_window
- @command_window.dispose
- end
- #=====指令更新=====================
-
- #-------命令-------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Menu.new
- elsif Input.trigger?(Input::C)
-
- case @command_window.index
- when 0 # 主线
- Sound.play_decision
- @command_window.active = false
- @main_window.active = true
- @main_window.visible = true
- @main_window.refresh
- # @status_window.visible = true
- when 1 # 支线
- Sound.play_decision
- @command_window.active = false
- @branch_window.active = true
- @branch_window.visible = true
- @branch_window.refresh
- when 2 # 取消
- Sound.play_decision
- $scene = Scene_Menu.new
- end
- end
- end
- #---------------主线-------------------------
- def update_main_selection
- @info_window.item = @main_window.item
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @main_window.active = false
- @main_window.visible = false
- # @status_window.visible = false
- @info_window.item = nil
- return
- end
- end
- #-----------------支线------------------------
- def update_branch_selection
- @info_window.item = @branch_window.item
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @branch_window.active = false
- @branch_window.visible = false
- # @status_window.visible = false
- @info_window.item = nil
- return
- end
- end
- end
- #==============================================================================
- # ■ Window_BranchTask
- #------------------------------------------------------------------------------
- # 商店画面、浏览显示可以购买的商品的窗口。
- #==============================================================================
- class Window_BranchTask < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # shop_goods : 商品
- #--------------------------------------------------------------------------
- def initialize(x,y)
- super( x, y, 128, 424)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for i in 1...6
- if $game_variables[i]!=0
- @data.push($task_blist[$game_variables[i] - 1])
- end
- end
-
- # 如果项目数不是 0 就生成位图、描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 24)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- rect.width -= 4
- #很重要#
- self.contents.draw_text(rect,item[1], 0)
- end
- end
- #==============================================================================
- # ■ Window_MainTask
- #------------------------------------------------------------------------------
- # 显示主任务名的窗口。
- #==============================================================================
- class Window_MainTask < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # shop_goods : 商品
- #--------------------------------------------------------------------------
- def initialize(x,y)
- super( x, y, 128, 424)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- # 7号为主线计数
-
- for i in 0...( $game_variables[7] + 1)/2
- @data.push($task_mlist[i])
- end
-
- # 如果项目数不是 0 就生成位图、描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 24)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- rect.width -= 4
- #输出任务名称
- self.contents.draw_text(rect,$task_mlist[index][1], 0)
- end
- end
- #==============================================================================
- # ■ Window_TaskInfo
- #------------------------------------------------------------------------------
- # 显示任务信息的窗口。
- #==============================================================================
- class Window_TaskInfo < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize(x,y)
- super( x, y, 512, 424)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- # 字体颜色见window.png 的右下角颜色修改
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- self.contents.font.color = text_color(12)
- self.contents.draw_text( 14, 4, 172, 24, "任务名称")
- self.contents.draw_text( 14, 60, 172, 24, "任务内容")
- self.contents.draw_text( 14, 200, 172, 24, "委托人&地点")
- self.contents.draw_text( 14, 300, 172, 24, "任务奖励")
-
- self.contents.font.color = text_color(0)
- # 任务名称
- self.contents.draw_text( 256, 30, 252, 24, @item[1], 1)
- # 描述一行约46字符,第一行空4字符
- # 任务内容
- self.contents.draw_text( 80, 100, 400, 24, @item[2])
- self.contents.draw_text( 40, 130, 440, 24, @item[3])
- self.contents.draw_text( 40, 160, 440, 24, @item[4])
- # 地点&委托人
- self.contents.draw_text( 256, 230, 242, 24, @item[5])
- #奖励物
- case @item[6]
- when 0
- draw_currency_value(@item[7], 14, 350, 416)
- when 1
- item = $data_items[@item[7]]
- draw_icon(item.icon_index, 364, 350, true)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = 255
- self.contents.draw_text( 388, 350, 128, 24, item.name)
- when 2
- item = $data_weapons[@item[7]]
- draw_icon(item.icon_index, 364, 350, true)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = 255
- self.contents.draw_text( 388, 350, 128, 24, item.name)
- when 3
- item = $data_armors[@item[7]]
- draw_icon(item.icon_index, 364, 350, true)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = 255
- self.contents.draw_text( 388, 350, 128, 24, item.name)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 新的物品
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
复制代码- #------------------------------------------------------------------------------
- # 任务
- #------------------------------------------------------------------------------
- #----------------------------------------------------------------------
- # 格式: $task_mlist 主线 $task_blist 支线
- # 0 表示主线 1 表示支线
- # 任务名称“”
- # 任务描述一共三行 描述一行约44字符,第一行空4字符 40个
- # 任务奖励内容 0,1,2,3(金钱,物品,武器,防具)
- # 物品id/ 金钱数
- # 0-3(未接,ing,ed,要用到计数变量的的) 这行先排除吧。。。
- #----------------------------------------------------------------------
- $task_mlist = []
- info_temp = [0,"no m1","no1 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",0,100]
- $task_mlist.push(info_temp)
- info_temp = [0,"no m2"," no2 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",1,1]
- $task_mlist.push(info_temp)
- info_temp = [0,"no m3"," no3 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",2,01]
- $task_mlist.push(info_temp)
- info_temp = [0,"no m4"," no4 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",3,01]
- $task_blist = []
- info_temp = [1,"no b1"," no1 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",0,010000000]
- $task_blist.push(info_temp)
- info_temp = [1,"no b2"," no2 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",1,01]
- $task_blist.push(info_temp)
- info_temp = [1,"no b3"," no3 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",2,01]
- $task_blist.push(info_temp)
- info_temp = [1,"no b4"," no4 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",3,01]
- $task_blist.push(info_temp)
- info_temp = [1,"no b5"," no5 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",3,06]
- $task_blist.push(info_temp)
- info_temp = [1,"no b6"," no6 bangrenmaidongxi","L2","l3","亡命酒馆:拉斯",3,02]
- $task_blist.push(info_temp)
复制代码
之前改shop得的一个任务图鉴,拿来做人物的也ok。就是排版&内容改改
之后使用的数据也奉上。。。 |
|