赞 | 1 |
VIP | 17 |
好人卡 | 3 |
积分 | 1 |
经验 | 49919 |
最后登录 | 2020-2-6 |
在线时间 | 898 小时 |
Lv1.梦旅人 矿工
- 梦石
- 0
- 星屑
- 134
- 在线时间
- 898 小时
- 注册时间
- 2012-10-5
- 帖子
- 1535
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 876加几 于 2013-10-4 16:45 编辑
脚本:- #==============================================================================
- # ■ Window_Task
- #------------------------------------------------------------------------------
- # 显示任务的选择行窗口。
- #==============================================================================
- class Window_Task < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 480 - 64)
- @name = nil
- @task_help = nil
- [url=home.php?mod=space&uid=236945]@gold[/url] = nil
- @items = nil
- @weapons = nil
- @armors = nil
- @item = nil
- [url=home.php?mod=space&uid=36793]@weapon[/url] = nil
- @armor = nil
- if @name == nil
- @item_max = 1
- else
- @item_max = @name.size
- end
- difficulty = nil
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- self.index = -1
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @name == nil
- @item_max = 1
- else
- @item_max = @name.size
- end
- end
- #--------------------------------------------------------------------------
- # ● 报偿设置
- # item_id/weapon_id/armor_id : 报偿物品在数据库中的位置,nil等于没报偿
- #--------------------------------------------------------------------------
- def reward_items(item_id = nil)
- @item[@item.size] = item_id
- end
- def reward_weapons(weapon_id = nil)
- @weapon[@weapon.size] = weapon_id
- end
- def reward_armor(armor_id = nil)
- @armor[@armor.size] = armor_id
- end
- #--------------------------------------------------------------------------
- # ● 新建任务
- # new_name : 新任务的名称
- # task_help : 新任务的简介
- # difficulty : 新任务的难度
- # gold : 金钱报偿,0等于没报偿
- #--------------------------------------------------------------------------
- def new_task(new_name, task_help, difficulty = 1, gold = 0)
- @name_size = @name.size
- @task_help_size = @task_help.size
- difficulty_size = difficulty.size
- @gold_size = @gold.size
- @items_size = @items.size
- @weapons_size = @weapons.size
- @armors_size = @armors.size
- @name[@name_size] = new_name
- @name2[@name_size] = new_name
- @task_help[@task_help_size] = task_help
- @difficulty[difficulty_size] = difficulty
- @gold[@gold_size] = gold
- @items[@items_size] = @item
- @weapons[@weapons_size] = @weapon
- @armors[@armors_size] = @armor
- end
- #--------------------------------------------------------------------------
- # ● 完成任务
- # bbb : 任务ID
- #--------------------------------------------------------------------------
- def final_task(bbb)
- [url=home.php?mod=space&uid=110690]@BBB[/url] = bbb - 1
- unless @name[@bbb].include?("(已失败)")
- @name[@bbb] = @name[@bbb] + "(已完成)"
- @task_help[@bbb] = @task_help[@bbb] + "(已完成)"
- $game_party.gain_gold(@gold[bbb])
- for i in [email protected]
- if @item != nil
- $game_party.gain_item(@item[i], 1)
- end
- end
- for i in [email protected]
- if [url=home.php?mod=space&uid=36793]@weapon[/url] != nil
- $game_party.gain_weapon(@weapon[i], 1)
- end
- end
- for i in [email protected]
- if @armor != nil
- $game_party.gain_armor(@armor[i], 1)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 任务失败
- # ccc : 任务ID
- #--------------------------------------------------------------------------
- def lose_task(ccc)
- [url=home.php?mod=space&uid=9267]@CCC[/url] = ccc - 1
- unless @name[@bbb].include?("(已完成)")
- @name[@ccc] = @name[@ccc] + "(已失败)"
- @task_help[@ccc] = @task_help[@ccc] + "(已失败)"
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index,color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, 640 / 2 - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @name[index])
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 56, 320 - 8, 32)
- end
- end
- #--------------------------------------------------------------------------
- # ● 拆分数组并显示内容
- #--------------------------------------------------------------------------
- def update
- for i in 0...@item_max
- x = 320 + 16
- if self.index == i and $t == true
- refresh
- self.contents.font.color = system_color
- self.contents.draw_text(x, 0, 100, 32, "任务名:")
- self.contents.draw_text(x, 64, 100, 32, "难度:")
- self.contents.draw_text(x, 112, 100, 32, "说明:")
- if @gold[index] != 0
- self.contents.draw_text(x, 176, 100, 32, "奖励金钱:")
- y = 240
- else
- y = 208
- end
- if @items[index] != nil
- self.contents.draw_text(x, y, 100, 32, "奖励物品:")
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(x, 32, 320 - 32, 32, @name2[index])
- self.contents.draw_text(x, 144, 280, 32, @task_help[index])
- if @gold[index] != 0
- self.contents.draw_text(x, 208, 100, 32, @gold[index])
- end
- if @items[index] != nil and @item != nil
- for j in [email protected]
- @y = y + @item[j] * 32
- end
- for g in [email protected]
- draw_item_name($data_items[@item[g]], x, @y)
- end
- for g in [email protected]
- draw_item_name($data_weapons[@weapon[g]], x, @y + @item.size * 32)
- end
- for g in [email protected]
- draw_item_name($data_armors[@armor[g]], x, @y + @item.size * 32 + @weapon.size * 32)
- end
- end
- #Moon = difficulty[index] / DIFFICULTY::System
- #Star = difficulty[index] % DIFFICULTY::System
- #Sun = Moon / DIFFICULTY::System
- #Moon %= DIFFICULTY::System
- #Space = DIFFICULTY::Space
- #rect = Rect.new(0, 0, DIFFICULTY::Size, DIFFICULTY::Size)
- #while Sun>0
- # self.contents.blt(x + Space, 96, Sun, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Sun -= 1
- #end
- #while Moon>0
- # self.contents.blt(x + Space, 97, Moon, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Moon -= 1
- #end
- #while Star>0
- # self.contents.blt(x + Space, 98, Star, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Star -= 1
- #end
- text1 = "★" * difficulty[index]
- text2 = "☆" * (5 - difficulty[index])
- text = text1 + text2
- self.contents.draw_text(x + 60, 64, 280, 32, text)
- end
- end
- end
- end
复制代码 先不说NoMethodError,居然连光标都不显示了,处于有光标活动的类连光标都不见了,这是怎么回事? 光标的声音也是在Scene类手动添加的。
Scene类代码:- #===============================================================================
- # ● Scene_Task
- #-------------------------------------------------------------------------------
- # 处理任务画面的类。
- #===============================================================================
- class Scene_Task
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成任务活动窗口
- @task_window = Window_Task.new
- @task_window.y = 64
- if @task_window.active == false
- @task_window.active = true
- end
- # 生成任务辅助窗口
- @taskassist_window = Window_TaskAssist.new
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放各个窗口
- @task_window.dispose
- @taskassist_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新各个窗口
- @task_window.update
- @taskassist_window.update
- # 当按下 C 键后可查看任务信息
- if Input.trigger?(Input::C)
- $t = true #让T变为true
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- end
- # 解除任务信息
- if $t == true
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- $t = false
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- end
- if Input.trigger?(Input::UP)
- $t = false
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- end
- if Input.trigger?(Input::DOWN)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- end
- end
- # 演奏光标 SE
- if Input.trigger?(Input::UP)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- end
- if Input.trigger?(Input::DOWN)
- $t = false
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- end
- # 没显示任务时按下 B 键的情况下
- if $t == false and Input.trigger?(Input::B)
- # 切换到菜单界面
- $scene = Scene_Menu.new(5)
- end
- end
- end
复制代码 |
|