赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 4194 |
最后登录 | 2016-9-12 |
在线时间 | 89 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 89 小时
- 注册时间
- 2011-5-15
- 帖子
- 16
|
3楼
楼主 |
发表于 2012-5-23 00:06:26
|
只看该作者
- #==============================================================================
- # □ Window_EnemyGuideStatus
- #------------------------------------------------------------------------------
- # 在怪物图件上、表示简介的窗口。
- #==============================================================================
- class Window_EnemyGuideStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 公开实例变量
- #--------------------------------------------------------------------------
- attr_reader :enemy # 表示敌人
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(240, 0, Graphics.width - 240, Graphics.height)
- self.enemy = nil
- self.z = 100
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- self.opacity = 0
- end
- @show_sprite = false
- @enemy_sprite = Sprite.new
- @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @enemy_sprite.x = 0
- @enemy_sprite.y = 0
- @enemy_sprite.z = self.z + 100
- @enemy_sprite.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- @enemy_sprite.bitmap.dispose
- @enemy_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 物件页是否显示
- #--------------------------------------------------------------------------
- def item_page_show?
- return true if KGC::EnemyGuide::SHOW_DROP_ITEM
- return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 取得页数
- #--------------------------------------------------------------------------
- def pages
- return (item_page_show? ? 2 : 1)
- end
- #--------------------------------------------------------------------------
- # ○ 表示敌人设定
- #--------------------------------------------------------------------------
- def enemy=(enemy)
- @enemy = enemy
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 更改显示的信息
- # shamt : 移动页
- #--------------------------------------------------------------------------
- def shift_info_type(shamt)
- n = self.ox + (width - 32) * shamt
- self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
- end
- #--------------------------------------------------------------------------
- # ○ sprite的表示切换
- #--------------------------------------------------------------------------
- def switch_sprite
- @show_sprite = !@show_sprite
- @enemy_sprite.visible = @show_sprite
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def refresh
- original_width = self.width
- self.width = original_width * pages - (32 * (pages - 1))
- create_contents
- self.width = original_width
- draw_enemy_sprite
- return if enemy == nil
- self.contents.font.color = normal_color
- # 没有遭遇
- unless KGC::Commands.enemy_encountered?(enemy.id)
- self.contents.font.color.alpha = 128
- dy = (height - 32) / 2
- dy -= dy % WLH
- self.contents.draw_text(0, dy, width - 32, WLH,
- KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
- self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
- return
- end
- draw_status
- end
- #--------------------------------------------------------------------------
- # ○ 简介的描绘
- #--------------------------------------------------------------------------
- def draw_status
- # Page 1
- dy = draw_basic_info(0, 0)
- draw_description(0, dy)
- # Page 2 (如果你只看到相关的项目)
- if item_page_show?
- dx = width - 32
- dy = draw_basic_info(dx, 0)
- max_rows = (self.height - dy - 32) / WLH
- rows = (max_rows + 1) / (pages - 1)
- dy = draw_drop_item(dx, dy, rows)
- draw_steal_object(dx, dy, max_rows - rows)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 基本请报页
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_basic_info(dx, dy)
- draw_graphic(dx, dy)
- draw_parameter1(dx + 112, dy)
- return dy + 96
- end
- #--------------------------------------------------------------------------
- # ○ 图解的描绘
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_graphic(dx, dy)
- buf = Bitmap.new(108, 96)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
- rect.x = (108 - rect.width) / 2
- rect.y = (96 - rect.height) / 2
- buf.stretch_blt(rect, bitmap, bitmap.rect)
- self.contents.blt(dx, dy, buf, buf.rect)
- buf.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 敌人精灵的描画
- #--------------------------------------------------------------------------
- def draw_enemy_sprite
- return if @enemy_sprite == nil
- @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
- Color.new(0, 0, 0, 160))
- return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- dx = (Graphics.width - bitmap.width) / 2
- dy = (Graphics.height - bitmap.height) / 2
- @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
- end
- #--------------------------------------------------------------------------
- # ○ 参数的描画 - 1
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_parameter1(dx, dy)
- # 名前, HP, MP
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:maxhp] = enemy.maxhp
- else
- param[:maxhp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.hp)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx + 88, dy + WLH, 64, WLH, param[:maxhp], 2)
- end
- #--------------------------------------------------------------------------
- # ○ ICON目录的描画
- # dx, dy : 描画处 X, Y
- # rows, cols : 行列数
- # item_list : 描画对象的目录
- # cond_proc : 描画条件 Proc
- # index_proc : ICON index 取得用 Proc
- #--------------------------------------------------------------------------
- def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
- nc = 0 # 现在的列数
- nr = 0 # 先在的行数
- item_list.each { |item|
- next if item == nil
- next unless cond_proc.call(item)
- icon_index = index_proc.call(item)
- next if icon_index == nil || icon_index == 0
- draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
- nc += 1
- if nc == cols
- # 次の行へ
- nc = 0
- nr += 1
- break if nr == rows # 行制限オーバー
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 战利品的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_drop_item(dx, dy, rows)
- return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- drop_items = [enemy.drop_item1, enemy.drop_item2]
- if $imported["ExtraDropItem"]
- drop_items += enemy.extra_drop_items
- end
- dy += WLH
- count = 0
- drop_items.each_with_index { |item, i|
- # 物品名
- case item.kind
- when 0
- next
- when 1
- drop_item = $data_items[item.item_id]
- when 2
- drop_item = $data_weapons[item.weapon_id]
- when 3
- drop_item = $data_armors[item.armor_id]
- end
- if KGC::Commands.enemy_item_dropped?(enemy.id, i)
- draw_item_name(drop_item, dx, dy)
- else
- draw_masked_item_name(drop_item, dx, dy)
- end
- dy += WLH
- count += 1
- break if count == rows
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 物品名为遮挡的描画
- # item : 物品 (机能、武器、防具都可以)
- # x : 描画处 X 坐标
- # y : 描画出 Y 坐标
- # enabled : 有効标志。false 的时候半透明的描画
- #--------------------------------------------------------------------------
- def draw_masked_item_name(item, x, y, enabled = true)
- return if item == nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string(item.name, mask)
- self.contents.draw_text(x + 24, y, 172, WLH, text)
- end
- #--------------------------------------------------------------------------
- # ○ 偷盗名为遮挡的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_steal_object(dx, dy, rows)
- return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
- self.contents.draw_text(dx + dw, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- steal_objects = enemy.steal_objects.clone
- if steal_objects.size >= rows
- steal_objects = steal_objects[0...(rows - 1)]
- end
- dy += WLH
- steal_objects.each_with_index { |obj, i|
- if obj.kind == 4
- # Gold
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- text = sprintf("%d%s", obj.gold, Vocab.gold)
- else
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string("aaa", mask)
- end
- self.contents.draw_text(dx + 24, dy, dw, WLH, text)
- else
- # Item
- case obj.kind
- when 1
- item = $data_items[obj.item_id]
- when 2
- item = $data_weapons[obj.weapon_id]
- when 3
- item = $data_armors[obj.armor_id]
- end
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- draw_item_name(item, dx, dy)
- else
- draw_masked_item_name(item, dx, dy)
- end
- end
- # 成功率
- if obj.success_prob > 0
- text = sprintf("%d%%", obj.success_prob)
- else
- text = "1/#{obj.denominator}"
- end
- self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
- dy += WLH
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 说明文字描画
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_description(dx, dy)
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- dx += 4
- enemy.enemy_guide_description.each_line { |line|
- self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
- dy += WLH
- }
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 实行画面的切换
- #--------------------------------------------------------------------------
- alias update_scene_change_KGC_EnemyGuide update_scene_change
- def update_scene_change
- return if $game_player.moving? # 玩家的移动中?
- if $game_temp.next_scene == :enemy_guide
- call_enemy_guide
- return
- end
- update_scene_change_KGC_EnemyGuide
- end
- #--------------------------------------------------------------------------
- # ○ 切换到怪物图鉴
- #--------------------------------------------------------------------------
- def call_enemy_guide
- $game_temp.next_scene = nil
- $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_Base
- if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
- #--------------------------------------------------------------------------
- # ● 作成指令窗口
- #--------------------------------------------------------------------------
- alias create_command_window_KGC_EnemyGuide create_command_window
- def create_command_window
- create_command_window_KGC_EnemyGuide
- return if $imported["CustomMenuCommand"]
- @__command_enemy_guide_index =
- @command_window.add_command(Vocab.enemy_guide)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- @command_window.index = @menu_index
- end
- end
- #--------------------------------------------------------------------------
- # ● 指令选择的更新
- #--------------------------------------------------------------------------
- alias update_command_selection_KGC_EnemyGuide update_command_selection
- def update_command_selection
- current_menu_index = @__command_enemy_guide_index
- call_enemy_guide_flag = false
- if Input.trigger?(Input::C)
- case @command_window.index
- when @__command_enemy_guide_index # 怪物图鉴
- call_enemy_guide_flag = true
- end
- end
- # 移动到怪物图鉴
- if call_enemy_guide_flag
- Sound.play_decision
- $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
- Scene_EnemyGuide::HOST_MENU)
- return
- end
- update_command_selection_KGC_EnemyGuide
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Scene_EnemyGuide
- #------------------------------------------------------------------------------
- # 进行怪物图鉴画面的处理的目录。
- #==============================================================================
- class Scene_EnemyGuide < Scene_Base
- HOST_MENU = 0
- HOST_MAP = 1
- #--------------------------------------------------------------------------
- # ● 对象初始化
- # menu_index : 指令光标初期位置
- # host_scene : 呼出原处 (0..菜单 1..地图)
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0, host_scene = HOST_MENU)
- @menu_index = menu_index
- @host_scene = host_scene
- end
- #--------------------------------------------------------------------------
- # ● 开始的处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- @back_sprite = Sprite.new
- begin
- @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
- rescue
- @back_sprite.bitmap = Bitmap.new(32, 32)
- end
- end
- @top_window = Window_EnemyGuideTop.new
- @enemy_window = Window_EnemyGuideList.new
- @status_window = Window_EnemyGuideStatus.new
- @status_window.enemy = @enemy_window.item
- end
- #--------------------------------------------------------------------------
- # ● 退出场景
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- if @back_sprite != nil
- @back_sprite.bitmap.dispose
- @back_sprite.dispose
- end
- @top_window.dispose
- @enemy_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 返回原菜单画面
- #--------------------------------------------------------------------------
- def return_scene
- case @host_scene
- when HOST_MENU
- $scene = Scene_Menu.new(@menu_index)
- when HOST_MAP
- $scene = Scene_Map.new
- end
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @top_window.update
- @enemy_window.update
- @status_window.update
- if @enemy_window.active
- update_enemy_selection
- end
- end
- #--------------------------------------------------------------------------
- # ○ 敌人选择的更新
- #--------------------------------------------------------------------------
- def update_enemy_selection
- if @last_index != @enemy_window.index
- @status_window.enemy = @enemy_window.item
- @last_index = @enemy_window.index
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
- # sprte的表示切换
- Sound.play_decision
- @status_window.switch_sprite
- elsif Input.trigger?(Input::LEFT)
- # 参数表示
- Sound.play_cursor
- @status_window.shift_info_type(-1)
- elsif Input.trigger?(Input::RIGHT)
- # 说明表示
- Sound.play_cursor
- @status_window.shift_info_type(1)
- end
- end
- end
复制代码
‘‘──可可夏天于2012-5-23 00:06补充以下内容
- #==============================================================================
- # □ Window_EnemyGuideStatus
- #------------------------------------------------------------------------------
- # 在怪物图件上、表示简介的窗口。
- #==============================================================================
- class Window_EnemyGuideStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 公开实例变量
- #--------------------------------------------------------------------------
- attr_reader :enemy # 表示敌人
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(240, 0, Graphics.width - 240, Graphics.height)
- self.enemy = nil
- self.z = 100
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- self.opacity = 0
- end
- @show_sprite = false
- @enemy_sprite = Sprite.new
- @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @enemy_sprite.x = 0
- @enemy_sprite.y = 0
- @enemy_sprite.z = self.z + 100
- @enemy_sprite.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- @enemy_sprite.bitmap.dispose
- @enemy_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 物件页是否显示
- #--------------------------------------------------------------------------
- def item_page_show?
- return true if KGC::EnemyGuide::SHOW_DROP_ITEM
- return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 取得页数
- #--------------------------------------------------------------------------
- def pages
- return (item_page_show? ? 2 : 1)
- end
- #--------------------------------------------------------------------------
- # ○ 表示敌人设定
- #--------------------------------------------------------------------------
- def enemy=(enemy)
- @enemy = enemy
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 更改显示的信息
- # shamt : 移动页
- #--------------------------------------------------------------------------
- def shift_info_type(shamt)
- n = self.ox + (width - 32) * shamt
- self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
- end
- #--------------------------------------------------------------------------
- # ○ sprite的表示切换
- #--------------------------------------------------------------------------
- def switch_sprite
- @show_sprite = !@show_sprite
- @enemy_sprite.visible = @show_sprite
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def refresh
- original_width = self.width
- self.width = original_width * pages - (32 * (pages - 1))
- create_contents
- self.width = original_width
- draw_enemy_sprite
- return if enemy == nil
- self.contents.font.color = normal_color
- # 没有遭遇
- unless KGC::Commands.enemy_encountered?(enemy.id)
- self.contents.font.color.alpha = 128
- dy = (height - 32) / 2
- dy -= dy % WLH
- self.contents.draw_text(0, dy, width - 32, WLH,
- KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
- self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
- return
- end
- draw_status
- end
- #--------------------------------------------------------------------------
- # ○ 简介的描绘
- #--------------------------------------------------------------------------
- def draw_status
- # Page 1
- dy = draw_basic_info(0, 0)
- draw_description(0, dy)
- # Page 2 (如果你只看到相关的项目)
- if item_page_show?
- dx = width - 32
- dy = draw_basic_info(dx, 0)
- max_rows = (self.height - dy - 32) / WLH
- rows = (max_rows + 1) / (pages - 1)
- dy = draw_drop_item(dx, dy, rows)
- draw_steal_object(dx, dy, max_rows - rows)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 基本请报页
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_basic_info(dx, dy)
- draw_graphic(dx, dy)
- draw_parameter1(dx + 112, dy)
- return dy + 96
- end
- #--------------------------------------------------------------------------
- # ○ 图解的描绘
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_graphic(dx, dy)
- buf = Bitmap.new(108, 96)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
- rect.x = (108 - rect.width) / 2
- rect.y = (96 - rect.height) / 2
- buf.stretch_blt(rect, bitmap, bitmap.rect)
- self.contents.blt(dx, dy, buf, buf.rect)
- buf.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 敌人精灵的描画
- #--------------------------------------------------------------------------
- def draw_enemy_sprite
- return if @enemy_sprite == nil
- @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
- Color.new(0, 0, 0, 160))
- return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- dx = (Graphics.width - bitmap.width) / 2
- dy = (Graphics.height - bitmap.height) / 2
- @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
- end
- #--------------------------------------------------------------------------
- # ○ 参数的描画 - 1
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_parameter1(dx, dy)
- # 名前, HP, MP
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:maxhp] = enemy.maxhp
- else
- param[:maxhp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.hp)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx + 88, dy + WLH, 64, WLH, param[:maxhp], 2)
- end
- #--------------------------------------------------------------------------
- # ○ ICON目录的描画
- # dx, dy : 描画处 X, Y
- # rows, cols : 行列数
- # item_list : 描画对象的目录
- # cond_proc : 描画条件 Proc
- # index_proc : ICON index 取得用 Proc
- #--------------------------------------------------------------------------
- def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
- nc = 0 # 现在的列数
- nr = 0 # 先在的行数
- item_list.each { |item|
- next if item == nil
- next unless cond_proc.call(item)
- icon_index = index_proc.call(item)
- next if icon_index == nil || icon_index == 0
- draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
- nc += 1
- if nc == cols
- # 次の行へ
- nc = 0
- nr += 1
- break if nr == rows # 行制限オーバー
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 战利品的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_drop_item(dx, dy, rows)
- return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- drop_items = [enemy.drop_item1, enemy.drop_item2]
- if $imported["ExtraDropItem"]
- drop_items += enemy.extra_drop_items
- end
- dy += WLH
- count = 0
- drop_items.each_with_index { |item, i|
- # 物品名
- case item.kind
- when 0
- next
- when 1
- drop_item = $data_items[item.item_id]
- when 2
- drop_item = $data_weapons[item.weapon_id]
- when 3
- drop_item = $data_armors[item.armor_id]
- end
- if KGC::Commands.enemy_item_dropped?(enemy.id, i)
- draw_item_name(drop_item, dx, dy)
- else
- draw_masked_item_name(drop_item, dx, dy)
- end
- dy += WLH
- count += 1
- break if count == rows
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 物品名为遮挡的描画
- # item : 物品 (机能、武器、防具都可以)
- # x : 描画处 X 坐标
- # y : 描画出 Y 坐标
- # enabled : 有効标志。false 的时候半透明的描画
- #--------------------------------------------------------------------------
- def draw_masked_item_name(item, x, y, enabled = true)
- return if item == nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string(item.name, mask)
- self.contents.draw_text(x + 24, y, 172, WLH, text)
- end
- #--------------------------------------------------------------------------
- # ○ 偷盗名为遮挡的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_steal_object(dx, dy, rows)
- return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
- self.contents.draw_text(dx + dw, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- steal_objects = enemy.steal_objects.clone
- if steal_objects.size >= rows
- steal_objects = steal_objects[0...(rows - 1)]
- end
- dy += WLH
- steal_objects.each_with_index { |obj, i|
- if obj.kind == 4
- # Gold
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- text = sprintf("%d%s", obj.gold, Vocab.gold)
- else
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string("aaa", mask)
- end
- self.contents.draw_text(dx + 24, dy, dw, WLH, text)
- else
- # Item
- case obj.kind
- when 1
- item = $data_items[obj.item_id]
- when 2
- item = $data_weapons[obj.weapon_id]
- when 3
- item = $data_armors[obj.armor_id]
- end
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- draw_item_name(item, dx, dy)
- else
- draw_masked_item_name(item, dx, dy)
- end
- end
- # 成功率
- if obj.success_prob > 0
- text = sprintf("%d%%", obj.success_prob)
- else
- text = "1/#{obj.denominator}"
- end
- self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
- dy += WLH
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 说明文字描画
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_description(dx, dy)
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- dx += 4
- enemy.enemy_guide_description.each_line { |line|
- self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
- dy += WLH
- }
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 实行画面的切换
- #--------------------------------------------------------------------------
- alias update_scene_change_KGC_EnemyGuide update_scene_change
- def update_scene_change
- return if $game_player.moving? # 玩家的移动中?
- if $game_temp.next_scene == :enemy_guide
- call_enemy_guide
- return
- end
- update_scene_change_KGC_EnemyGuide
- end
- #--------------------------------------------------------------------------
- # ○ 切换到怪物图鉴
- #--------------------------------------------------------------------------
- def call_enemy_guide
- $game_temp.next_scene = nil
- $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_Base
- if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
- #--------------------------------------------------------------------------
- # ● 作成指令窗口
- #--------------------------------------------------------------------------
- alias create_command_window_KGC_EnemyGuide create_command_window
- def create_command_window
- create_command_window_KGC_EnemyGuide
- return if $imported["CustomMenuCommand"]
- @__command_enemy_guide_index =
- @command_window.add_command(Vocab.enemy_guide)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- @command_window.index = @menu_index
- end
- end
- #--------------------------------------------------------------------------
- # ● 指令选择的更新
- #--------------------------------------------------------------------------
- alias update_command_selection_KGC_EnemyGuide update_command_selection
- def update_command_selection
- current_menu_index = @__command_enemy_guide_index
- call_enemy_guide_flag = false
- if Input.trigger?(Input::C)
- case @command_window.index
- when @__command_enemy_guide_index # 怪物图鉴
- call_enemy_guide_flag = true
- end
- end
- # 移动到怪物图鉴
- if call_enemy_guide_flag
- Sound.play_decision
- $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
- Scene_EnemyGuide::HOST_MENU)
- return
- end
- update_command_selection_KGC_EnemyGuide
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Scene_EnemyGuide
- #------------------------------------------------------------------------------
- # 进行怪物图鉴画面的处理的目录。
- #==============================================================================
- class Scene_EnemyGuide < Scene_Base
- HOST_MENU = 0
- HOST_MAP = 1
- #--------------------------------------------------------------------------
- # ● 对象初始化
- # menu_index : 指令光标初期位置
- # host_scene : 呼出原处 (0..菜单 1..地图)
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0, host_scene = HOST_MENU)
- @menu_index = menu_index
- @host_scene = host_scene
- end
- #--------------------------------------------------------------------------
- # ● 开始的处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- @back_sprite = Sprite.new
- begin
- @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
- rescue
- @back_sprite.bitmap = Bitmap.new(32, 32)
- end
- end
- @top_window = Window_EnemyGuideTop.new
- @enemy_window = Window_EnemyGuideList.new
- @status_window = Window_EnemyGuideStatus.new
- @status_window.enemy = @enemy_window.item
- end
- #--------------------------------------------------------------------------
- # ● 退出场景
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- if @back_sprite != nil
- @back_sprite.bitmap.dispose
- @back_sprite.dispose
- end
- @top_window.dispose
- @enemy_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 返回原菜单画面
- #--------------------------------------------------------------------------
- def return_scene
- case @host_scene
- when HOST_MENU
- $scene = Scene_Menu.new(@menu_index)
- when HOST_MAP
- $scene = Scene_Map.new
- end
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @top_window.update
- @enemy_window.update
- @status_window.update
- if @enemy_window.active
- update_enemy_selection
- end
- end
- #--------------------------------------------------------------------------
- # ○ 敌人选择的更新
- #--------------------------------------------------------------------------
- def update_enemy_selection
- if @last_index != @enemy_window.index
- @status_window.enemy = @enemy_window.item
- @last_index = @enemy_window.index
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
- # sprte的表示切换
- Sound.play_decision
- @status_window.switch_sprite
- elsif Input.trigger?(Input::LEFT)
- # 参数表示
- Sound.play_cursor
- @status_window.shift_info_type(-1)
- elsif Input.trigger?(Input::RIGHT)
- # 说明表示
- Sound.play_cursor
- @status_window.shift_info_type(1)
- end
- end
- end
复制代码
’’
‘‘──可可夏天于2012-5-23 00:07补充以下内容
@Raiku 拜托了
’’
‘‘──可可夏天于2012-5-23 22:37补充以下内容
这不是完整的吗= =
’’ |
|