| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2017-5-6 |
| 在线时间 | 35 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 35 小时
- 注册时间
- 2011-3-2
- 回帖
- 4
|
楼主 |
发表于 2015-12-6 17:08:54
|
显示全部楼层
本帖最后由 RyanBern 于 2015-12-6 19:47 编辑
附:所用到的脚本
CG背景脚本
- #==============================================================================
- # ■ Window_CGBookBG
- #------------------------------------------------------------------------------
- # 窗口式CG图鉴系统,尝试使用CG书则打开图鉴(Programed By 狸猫阿白)
- #==============================================================================
- class Window_Cgbookbg < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- # 调整大小以免显示出多余的箭头
- super(-32, -32, 706, 544)
- self.opacity = 0
- # 设定初始页页数
- $page = 0
- #刷新
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(674, 512)
- # 根据当前页数显示背景图片
- background = RPG::Cache.picture("cgbookbg" + "#{$page + 1}")
- # 调整位置以使图片显示在画面正中间*(注意 32 和 16)
- self.contents.blt(16, 16, background, Rect.new(0, 0, 640, 480), 255)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 必须在背景窗口和选项窗口都设置如果按下 L/R ,否则机器卡的话容易出现
- # 画面残留现象。
- # R 键被按下的情况下
- if Input.trigger?(Input::R)
- # 如果在第3页
- if $page == 2
- #演奏冻结SE
- $game_system.se_play($data_system.buzzer_se)
- # 否则向右翻页
- else
- # 演奏翻页SE
- Audio.se_play("Audio/SE/046-Book01", 100, 100)
- # 向右翻页
- $page += 1
- end
- end
- # L键被按下的情况下
- if Input.trigger?(Input::L)
- # 如果在第1页
- if $page == 0
- # 演奏冻结SE
- $game_system.se_play($data_system.buzzer_se)
- # 否则向左翻页
- else
- # 演奏翻页SE
- Audio.se_play("Audio/SE/046-Book01", 100, 100)
- # 向左翻页
- $page -= 1
- end
- end
- # 刷新画面
- refresh
- end
- end
复制代码
CG未扩大的小图脚本
- #==============================================================================
- # ■ Window_CGBook
- #------------------------------------------------------------------------------
- # 窗口式CF图鉴系统,使用CG书则打开图鉴(Programed By 狸猫阿白)
- # 所用窗口外观图形名称:001-Blue1514
- # 获得CG脚本:需在事件中运行脚本:
- # 示例:在事件中添加下列脚本则获得第1张CG
- # file = File.open("save/cg/cg1.rxdata", "wb")
- # file.close
- #==============================================================================
- class Window_Cgbook < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :index # 光标位置
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 480)
- # 设置每行显示CG小图标的数量
- @column_max = 3
- # 设置CG书窗口使用的皮肤文件
- self.windowskin = RPG::Cache.windowskin("CG对话框")
- self.opacity = 0
- # 使用图片作为光标
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @cg = []
- # 根据当前页数计算该页显示CG图的物品ID
- page_first = $page * 9 + 1
- page_last = [$page * 9 + 9, 23].min
- # 添加CG图片的小图标
- for i in page_first..page_last
- if FileTest.exist?("save/cg/cg" + "#{i}" + ".rxdata" )
- if $page == 0
- case i
- when 1
- @cg.push(RPG::Cache.picture("CG小-踏上旅途的少年"))
- when 2
- @cg.push(RPG::Cache.picture("CG小-新一&兰"))
- when 3
- @cg.push(RPG::Cache.picture("CG小-三段式大笑"))
- when 4
- @cg.push(RPG::Cache.picture("CG小-错乱僧"))
- when 5
- @cg.push(RPG::Cache.picture("CG小-乱&雷易"))
- when 6
- @cg.push(RPG::Cache.picture("CG小-圭子"))
- when 7
- @cg.push(RPG::Cache.picture("CG小-这都是爱啊"))
- when 8
- @cg.push(RPG::Cache.picture("CG小-神木"))
- when 9
- @cg.push(RPG::Cache.picture("CG小-下水道中"))
- end
- end
- if $page == 1
- case i
- when 10
- @cg.push(RPG::Cache.picture("CG小-好人花太郎"))
- when 11
- @cg.push(RPG::Cache.picture("CG小-桂&伊丽莎白"))
- when 12
- @cg.push(RPG::Cache.picture("CG小-人造人十九号"))
- when 13
- @cg.push(RPG::Cache.picture("CG小-欣喜的山本总队长"))
- when 14
- @cg.push(RPG::Cache.picture("CG小-凌波的微笑"))
- when 15
- @cg.push(RPG::Cache.picture("CG小-初号机的报复"))
- when 16
- @cg.push(RPG::Cache.picture("CG小-罗迪王子"))
- when 17
- @cg.push(RPG::Cache.picture("CG小-仙太郎的婚礼"))
- when 18
- @cg.push(RPG::Cache.picture("CG小-结局-白菜之爱版"))
- end
- end
- if $page == 2
- case i
- when 19
- @cg.push(RPG::Cache.picture("CG小-结局-妄想版"))
- when 20
- @cg.push(RPG::Cache.picture("CG小-结局-王子之爱版"))
- when 21
- @cg.push(RPG::Cache.picture("CG小-结局-护卫队版"))
- when 22
- @cg.push(RPG::Cache.picture("CG小-结局-返回现实版"))
- when 23
- @cg.push(RPG::Cache.picture("CG小-结局-穿越版"))
- end
- end
- else # for [if FileTest.exist?("save/cg/cg" + "#{i}" + ".rxdata" )]
- @cg.push(RPG::Cache.picture("cgsmallempty"))
- end
- end
- # 生成位图、重新描绘全部项目
- @item_max = @cg.size
- self.contents = Bitmap.new(width - 32, 448)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目(CG小图标)
- # index : CG的物品编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- cg = @cg[index]
- # 每张小图的位置左上角坐标
- if index % 3 == 2
- x = 74 + index % 3 * 176
- else
- x = 75 + index % 3 * 176
- end
- if index / 3 == 0
- y = 52 + index / 3 * 121
- else
- y = 53 + index / 3 * 121
- end
-
- # 描绘选框光标
- #rect = Rect.new(x + 12, y, 140, 110)
- # 描绘CG小图
- self.contents.blt(x, y, cg, Rect.new(0, 0, 120, 90), 255)
- end
- #--------------------------------------------------------------------------
- # ● 定义选择框光标
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 矩形光标选框左上角坐标与CG小图统一
- if index % 3 == 2
- x = 74 + index % 3 * 176
- else
- x = 75 + index % 3 * 176
- end
- if index / 3 == 0
- y = 52 + index / 3 * 121
- else
- y = 53 + index / 3 * 121
- end
- # 更新光标矩形
- self.cursor_rect.set(x - 12, y - 12, 144, 114)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 必须在背景窗口和选项窗口都设置如果按下 L/R ,否则机器卡的话容易出现
- # 画面残留现象。
- # 可以移动光标的情况下
- if self.active and @item_max > 0 and @index >= 0
- # R 键被按下的情况下
- if Input.trigger?(Input::R)
- # 如果翻到最后一页且光标超出最后一张图,则把光标指向最后一张图
- if $page == 2 and @index > 4
- @index = 4
- end
- end
- # L 键被按下的情况下
- if Input.trigger?(Input::L)
- # 如果翻到最后一页且光标超出最后一张图,则把光标指向最后一张图
- if $page == 2 and @index > 4
- @index = 4
- end
- end
- end
- # 刷新画面
- refresh
- update_cursor_rect
- end
- end
复制代码
显示CG的脚本
- #==============================================================================
- # ■ Window_Cg
- #------------------------------------------------------------------------------
- # CG书卡CG观赏窗口(预留按方向键则直接切换到下1张CG的功能,所以设了refresh)
- #==============================================================================
- class Window_Cg < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize(cg_id)
- # 调整大小以免显示出多余的箭头
- super(-32, -32, 706, 544)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- # 刷新
- refresh(cg_id)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh(cg_id)
- self.contents.clear
- # CG图片名称中的编号与该CG图在CG书上的index统一
- cg_now = cg_id + 1 + $page * 9
- # 获取CG图片的物品ID
- # 如果已经获得该图则描绘CG
- if FileTest.exist?("save/cg/cg" + "#{cg_now}" + ".rxdata" )
- case cg_now
- when 1
- cg = "CG-踏上旅途的少年"
- when 2
- cg = "CG-新一&兰"
- when 3
- cg = "CG-三段式大笑"
- when 4
- cg = "CG-错乱僧"
- when 5
- cg = "CG-乱&雷易"
- when 6
- cg = "CG-圭子"
- when 7
- cg = "CG-这都是爱啊"
- when 8
- cg = "CG-神木"
- when 9
- cg = "CG-下水道中"
- when 10
- cg = "CG-好人花太郎"
- when 11
- cg = "CG-桂&伊丽莎白"
- when 12
- cg = "CG-人造人十九号"
- when 13
- cg = "CG-欣喜的山本总队长"
- when 14
- cg = "CG-凌波的微笑"
- when 15
- cg = "CG-初号机的报复"
- when 16
- cg = "CG-罗迪王子"
- when 17
- cg = "CG-仙太郎的婚礼"
- when 18
- cg = "CG-结局-白菜之爱版"
- when 19
- cg = "CG-结局-妄想版"
- when 20
- cg = "CG-结局-王子之爱版"
- when 21
- cg = "CG-结局-护卫队版"
- when 22
- cg = "CG-结局-返回现实版"
- when 23
- cg = "CG-结局-穿越版"
- end
- # 描绘图片
- bitmap = RPG::Cache.picture("#{cg}")
- self.contents.blt(16, 16, bitmap, Rect.new(0, 0, 640, 480), 255)
- end
- end
- end
复制代码
窗口选项脚本- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- # ■ 功能加强 BY 狸猫阿白 ■
- # ■ 修改了原来在物品窗口不活动时,仍然显示光标的bug
- # ■ 新增教训数显示窗口
- # ■ 新增卡片书功能
- # ■ 新增相册(CG)功能
- # ■ 太极图平时使用时消耗 SP
- #==============================================================================
- #==============================================================================
- # ■ Harts_Window_ItemTitle
- #------------------------------------------------------------------------------
- # アイテム画面で、タイトルを表示するウィンドウ。
- #==============================================================================
- class Harts_Window_ItemTitle < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
- end
- end
- #==============================================================================
- # ■ Harts_Window_ItemCommand
- #------------------------------------------------------------------------------
- # アイテムの種別選択を行うウィンドウです。
- #==============================================================================
- class Harts_Window_ItemCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 160, 288)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_max = 8
- @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- y = index * 32
- self.contents.draw_text(4, y, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- case self.index
- when 0
- @text = "目前可以使用的物品。"
- when 1
- @text = "只能在战斗中使用的物品。"
- when 2
- @text = "未装备的武器。"
- when 3
- @text = "未装备的副手防具。"
- when 4
- @text = "未装备的头部防具。"
- when 5
- @text = "未装备的身体防具。"
- when 6
- @text = "未装备的装饰品。"
- when 7
- @text = "无法直接使用的剧情道具,只要持有就会在需要时自行用到。"
- end
- @help_window.set_text(@text)
- end
- end
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Harts_Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(160, 0, 480, 416)
- refresh
- # ■■■ 物品显示窗口初始光标在-1位置,使玩家看不到光标 ■■■
- self.index = -1
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- # ● アイテム一覧設定
- # command : 選択中のコマンド
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- case command
- when 0
- for i in 1...$data_items.size
- if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- when 1
- for i in 1...$data_items.size
- if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
- @data.push($data_items[i])
- end
- end
- when 2
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- when 3
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 4
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 5
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 6
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 7
- for i in 1...191
- if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- end
- # 項目数が 0 でなければビットマップを作成し、全項目を描画
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 種類別アイテム数の取得
- #--------------------------------------------------------------------------
- def item_number
- return @item_max
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Harts_Scene_Item
- #------------------------------------------------------------------------------
- # アイテム画面の処理を行うクラスです。再定義
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # タイトルウィンドウを作成
- @itemtitle_window = Harts_Window_ItemTitle.new
- #コマンドウィンドウを作成
- @itemcommand_window = Harts_Window_ItemCommand.new
- @command_index = @itemcommand_window.index
- #アイテムウィンドウを作成
- @itemlist_window = Harts_Window_ItemList.new
- @itemlist_window.active = false
- #ヘルプウィンドウを作成
- @help_window = Window_Help.new
- @help_window.x = 0
- @help_window.y = 416
- # ヘルプウィンドウを関連付け
- @itemcommand_window.help_window = @help_window
- @itemlist_window.help_window = @help_window
- # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- # アイテムウィンドウ内容表示
- @itemlist_window.set_item(@command_index)
- # ■生成教训窗口
- @lesson_window = Window_Lesson.new
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @itemtitle_window.dispose
- @itemcommand_window.dispose
- @itemlist_window.dispose
- @help_window.dispose
- @target_window.dispose
- # ■ 释放教训窗口
- @lesson_window.dispose
- # ■(防出错)如果CG书相关窗口和卡片书相关窗口存在,则释放它们
- if @cgbookbg_window != nil
- @cgbookbg_window.dispose
- end
- if @cgbook_window != nil
- @cgbook_window.dispose
- end
- if @cg_window != nil
- @cg_window.dispose
- end
- if @cardbookbg_window != nil
- @cardbookbg_window.dispose
- end
- if @cardbook_window != nil
- @cardbook_window.dispose
- end
- if @card_window != nil
- @card_window.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @itemtitle_window.update
- @itemcommand_window.update
- @itemlist_window.update
- @help_window.update
- @target_window.update
- if @command_index != @itemcommand_window.index
- @command_index = @itemcommand_window.index
- @itemlist_window.set_item(@command_index)
- end
- # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
- if @itemcommand_window.active
- update_itemcommand
- return
- end
- # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
- if @itemlist_window.active
- update_itemlist
- return
- end
-
- # ■CG书窗口被激活的情况下: 调用 update_cgbook
- if @cgbook_window != nil and @cgbook_window.active and @cgbookbg_window != nil and @cgbook_window.active
- update_cgbook
- return
- end
- # ■CG欣赏窗口被激活的情况下: 调用 update_cg
- if @cg_window != nil and @cg_window.active
- update_cg
- return
- end
- # ■卡片书窗口被激活的情况下:
- if @cardbook_window != nil and @cardbook_window.active
- # 如果卡片观赏窗口被激活:调用 update_card
- if @card_window != nil and @card_window.active
- update_card
- # 此外的情况下:调用 update_cardbook
- else
- update_cardbook
- end
- return
- end
- # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_itemcommand
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(0)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 選択中のコマンドのアイテムがない場合
- if @itemlist_window.item_number == 0
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # アイテムウィンドウをアクティブにする
- @itemcommand_window.active = false
- @itemlist_window.active = true
- @itemlist_window.index = 0
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_itemlist
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # アイテムウィンドウをアクティブにする
- @itemcommand_window.active = true
- @itemlist_window.active = false
- # ■■■ 物品显示窗口光标位置回到0,使玩家看到该类物品列表的最开始 ■■■
- @itemlist_window.index = 0
- # ■■■ 物品显示窗口光标位置回到-1,使光标消失 ■■■
- @itemlist_window.index = -1
- @itemcommand_window.index = @command_index
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムウィンドウで現在選択されているデータを取得
- @item = @itemlist_window.item
- # 使用アイテムではない場合
- unless @item.is_a?(RPG::Item)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 使用できない場合
- unless $game_party.item_can_use?(@item.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # ■所使用物品是CG书的情况下
- if @item == $data_items[2]
- # 演奏打开书的SE
- Audio.se_play("Audio/SE/打开书", 100, 100)
- # 窗口状态转向CG书模式(过渡)
- Graphics.freeze
- @help_window.active = false
- @help_window.visible = false
- @itemlist_window.active = false
- @itemlist_window.visible = false
- @itemtitle_window.visible = false
- @itemcommand_window.visible = false
- @lesson_window.visible = false
- # ■ 生成CG书背景窗口和CG书窗口,先生成的会被后生成的挡住。
- @cgbookbg_window = Window_Cgbookbg.new
- @cgbook_window = Window_Cgbook.new
- # 设置打开CG图片时的渐变图,不设则自动淡入淡出,下同
- Graphics.transition(20, "Graphics/Transitions/data 000091")
- return
- end
- # ■所使用物品是集卡书的情况下
- if @item == $data_items[5]
- # 演奏打开书的SE
- Audio.se_play("Audio/SE/打开书", 100, 100)
- # 窗口状态转向卡片书模式(过渡)
- Graphics.freeze
- @help_window.active = false
- @help_window.visible = false
- @itemlist_window.active = false
- @itemlist_window.visible = false
- @itemtitle_window.visible = false
- @itemcommand_window.visible = false
- @lesson_window.visible = false
- @cardbookbg_window = Window_Cardbookbg.new
- @cardbook_window = Window_Cardbook.new
- Graphics.transition(20, "Graphics/Transitions/data 000091")
- return
- end
- # 効果範囲が味方の場合
- if @item.scope >= 3
- # ターゲットウィンドウをアクティブ化
- @itemlist_window.active = false
- @target_window.x = 304
- @target_window.visible = true
- @target_window.active = true
- # 効果範囲 (単体/全体) に応じてカーソル位置を設定
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- # 効果範囲が味方以外の場合
- else
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @itemlist_window.draw_item(@itemlist_window.index)
- end
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ■■■刷新画面 (CG书窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_cgbook
- @cgbookbg_window.update
- @cgbook_window.update
- if Input.trigger?(Input::B)
- # 演奏合上书的SE
- Audio.se_play("Audio/SE/合上书", 100, 100)
- # 窗口状态转向初期模式(过渡)
- Graphics.freeze
- @help_window.active = true
- @help_window.visible = true
- @itemlist_window.active = true
- @itemlist_window.visible = true
- @itemtitle_window.visible = true
- @itemcommand_window.visible = true
- @lesson_window.visible = true
- # 释放CG书背景窗口
- @cgbookbg_window.dispose
- # 为避免出错,将CG书背景窗口设为nil
- @cgbookbg_window = nil
- # 释放CG书窗口
- @cgbook_window.dispose
- # 将CG书窗口设为nil,否则在 update 方法中会与
- # if @cgbook_window != nil and @cgbook_window.active 这类的判断出错
- # (会判断该类窗口已经dispose而报错,强退游戏),下同。
- @cgbook_window = nil
- Graphics.transition(20, "Graphics/Transitions/data 00314")
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- if FileTest.exist?("save/cg/cg" + "#{@cgbook_window.index + $page * 9 + 1}" + ".rxdata")
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 打开CG观赏窗口(过渡)
- Graphics.freeze
- @cgbookbg_window.visible = false
- @cgbook_window.active = false
- @cgbook_window.visible = false
- @cg_window = Window_Cg.new(@cgbook_window.index)
- # 如果是第 20 号 CG,则做套图第 1 张标记
- if @cgbook_window.index + $page * 9 + 1 == 20
- @cg_i = 1
- end
- Graphics.transition(10)
- else
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # ■■■刷新画面 (CG欣赏窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_cg
- # 如果按下 取消 键,或按下 确定 键时没有套图第1张标记
- if Input.trigger?(Input::B) or (@cg_i != 1 and Input.trigger?(Input::C))
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 释放CG欣赏窗口(过渡)
- Graphics.freeze
- @cg_window.dispose
- # 将CG欣赏窗口设为nil
- @cg_window = nil
- @cg_i = nil
- # 窗口状态转向CG书模式
- @cgbookbg_window.visible = true
- @cgbook_window.active = true
- @cgbook_window.visible = true
- # 设置关闭CG图片时的渐变图,不设则自动淡入淡出
- Graphics.transition(10)
- return
- end
- # 如果按下 确定 键时有套图第 1 张标记
- if Input.trigger?(Input::C) and @cg_i == 1
- # 演奏翻页 SE
- Audio.se_play("Audio/SE/046-Book01", 100, 100)
- # 准备过渡
- Graphics.freeze
- @cg_window.contents.clear
- bitmap = RPG::Cache.picture("CG-结局-王子之爱版2")
- @cg_window.contents.blt(16, 16, bitmap, Rect.new(0, 0, 640, 480), 255)
- # 套图标记更新为第 2 张
- @cg_i += 1
- Graphics.transition(10)
- end
- end
- #--------------------------------------------------------------------------
- # ■■■刷新画面 (仅卡片书窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_cardbook
- @cardbookbg_window.update
- @cardbook_window.update
- if Input.trigger?(Input::B)
- # 演奏合上书的SE
- Audio.se_play("Audio/SE/合上书", 100, 100)
- # 窗口状态转向初期模式(过渡)
- Graphics.freeze
- @help_window.active = true
- @help_window.visible = true
- @itemlist_window.active = true
- @itemlist_window.visible = true
- @itemtitle_window.visible = true
- @itemcommand_window.visible = true
- @lesson_window.visible = true
- # 释放卡片书背景窗口
- @cardbookbg_window.dispose
- # 将卡片书背景窗口设为nil
- @cardbookbg_window = nil
- # 释放卡片书窗口
- @cardbook_window.dispose
- # 将卡片书窗口设为nil
- @cardbook_window = nil
- Graphics.transition(20, "Graphics/Transitions/data 00314")
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 窗口状态转向卡片书与卡片欣赏共存模式(过渡)
- Graphics.freeze
- @card_window = Window_Card.new(@cardbook_window.index + $page * 12)
- @card_window.x = (@cardbook_window.index / 2 + 1 ) % 2 * 294 + 10
- Graphics.transition(5)
- end
- end
- #--------------------------------------------------------------------------
- # ■■■刷新画面 (卡片书窗口与卡片欣赏窗口同时被激活的情况下)
- #--------------------------------------------------------------------------
- def update_card
- @cardbookbg_window.update
- @cardbook_window.update
- @card_window.x = (@cardbook_window.index / 2 + 1 ) % 2 * 294 + 10
- @card_window.refresh(@cardbook_window.index + $page * 12)
- # 按下 B 键 & C 键的情况下
- if Input.trigger?(Input::B) or Input.trigger?(Input::C)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 释放卡片欣赏窗口(过渡)
- Graphics.freeze
- @card_window.dispose
- # 将卡片欣赏窗口设为nil
- @card_window = nil
- Graphics.transition(5)
- return
- end
- if Input.trigger?(Input::R) or Input.trigger?(Input::L)
- # 释放卡片欣赏窗口(不过渡)
- @card_window.dispose
- # 将卡片欣赏窗口设为nil
- @card_window = nil
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # アイテム切れなどで使用できなくなった場合
- unless $game_party.item_can_use?(@item.id)
- # アイテムウィンドウの内容を再作成
- @itemlist_window.refresh
- end
- # ターゲットウィンドウを消去
- @itemlist_window.active = true
- @target_window.visible = false
- @target_window.active = false
- @itemlist_window.set_item(@command_index)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムを使い切った場合
- if $game_party.item_number(@item.id) == 0
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にアイテムの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにアイテムの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # アイテムを使った場合
- if used
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @itemlist_window.draw_item(@itemlist_window.index)
- @itemlist_window.set_item(@command_index)
- end
- # ■■■■■■■ 如果使用的是[太极图] ■■■■■■■
- if @item.id == 39
- for actor in $game_party.actors
- if actor.sp >= 200
- actor.sp -= 200
- break
- end
- end
- end
- # ■■■■■■■■■■■ END ■■■■■■■■■■
- # ターゲットウィンドウの内容を再作成
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # アイテムを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
复制代码 |
|