| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 6 |
| 经验 | |
| 最后登录 | 2020-4-24 |
| 在线时间 | 63 小时 |
- 梦石
- 0
- 星屑
- 646
- 在线时间
- 63 小时
- 注册时间
- 2019-1-26
- 回帖
- 9
|
楼主 |
发表于 2019-11-27 03:15:51
|
显示全部楼层
本帖最后由 VIPArcher 于 2019-11-30 11:22 编辑
- #==============================================================================
- # ■ RGSS3 アイテム詳細説明 Ver1.03 by 星潟
- #------------------------------------------------------------------------------
- # このスクリプトを導入することで
- # アイテム画面や装備画面でアイテムにカーソルを合わせた状態で
- # 特定のキーを押した際、アイテム詳細説明ウィンドウを開く事が出来るようになります。
- # 詳細説明の記述には制御文字を使用する事が出来ます。
- # デフォルトの画面サイズであれば、詳細説明記述は13行まで
- # <Lx:あいうえお>とすることで記述できます。
- # (xの場所に通常説明後の行番号、あいうえおの場所に文字列)
- #
- # 設定例(ハンドアクスのメモ欄)
- # <L1:あいうえお>
- # <L2:かきくけこ>
- # <L3:さしすせそ>
- # <L4:\C[10]たちつてと>
- # <L6:なにぬねの>
- # <L7:はひふへほ>
- #
- # ……とした場合、ハンドアクスの詳細説明は以下のように表示されます。
- #
- # [ハンドアクスのアイコン]ハンドアクス 価格[ハンドアクスの価格][通貨単位]
- # ハンドアクスの通常のアイテム説明1行目
- # ハンドアクスの通常のアイテム説明2行目
- # あいうえお
- # かきくけこ
- # さしすせそ
- # たちつてと(赤字で表示)
- #
- # なにぬねの
- # はひふへほ
- #
- # 白の魔様のアイテム図鑑スクリプトを使用されている方は
- # 他サイト対応素材のアイテム詳細説明 白の魔様アイテム図鑑併用化の使用をお勧めします。
- #------------------------------------------------------------------------------
- # Ver1.02 軽量化&処理の改善による競合対策を行いました。
- # Ver1.03 詳細ウィンドウ表示フラグを修正しました。
- # アイテムを購入する際にも詳細ウィンドウを
- # 開くことのできる設定を追加しました。
- # スクリプトによっては相性が悪いかもしれません。
- # (ショップ処理を下敷きにした合成屋スクリプト等)
- # 必要に応じて使用して下さい。
- #==============================================================================
- module IT_DETAIL
-
- #価格を表示するか否か
- #true 表示
- #false 非表示
-
- VALUE = false
-
- #ショップでの購入画面でも詳細ウィンドウを表示するか否か
- #trueで表示する。falseで表示しない。
-
- BUY = false
-
- #詳細表示ウィンドウの背景透明度
-
- B_OPA = 225
-
- #VALUEがtrueの場合、価格を表示する場合の「価格」の部分の文字色
-
- V_C1 = 16
-
- #VALUEがtrueの場合、非売品である事を表示する場合の文字色
-
- V_C2 = 16
-
- #アイテム詳細画面を開く為のキー
- #機能重複を防ぐ為、:X、:Y、:ALT、:CTRL、:F5、:F6、:F7、:F8の何れかを推奨。
-
- KEY = :X
-
- #アイテム詳細画面を開いた際に決定用SEを鳴らすか?
- #true 鳴らす
- #false 鳴らさない
-
- SOUND = true
-
- #アイテム詳細画面の説明をアイテムのメモ欄に記載する為のキーワード
-
- WORD1 = "L"
-
- #アイテム詳細画面上で価格を表示する場合の「価格」の文字列を設定
-
- WORD2 = "价格"
-
- #アイテム詳細画面上で価格を表示する場合の「非売品」の文字列を設定
-
- WORD3 = "<非卖品>"
-
- end
- class Scene_MenuBase < Scene_Base
- #--------------------------------------------------------------------------
- # 詳細説明ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_detail_window
-
- #各種詳細説明ウィンドウ関連フラグの初期化。
-
- $game_party.item_detail_mode = false
- $game_party.selected_detail_item = nil
- $game_party.item_detail_refresh_order = false
- $game_party.item_detail_end = false
-
- #詳細説明ウィンドウの作成。
-
- @item_detail_window = Window_Item_Detail.new(0,0,Graphics.width,Graphics.height)
- @item_detail_window.z = 1000
- @item_detail_window.visible = false
- @item_detail_window.back_opacity = IT_DETAIL::B_OPA
- end
- #--------------------------------------------------------------------------
- # 更新
- #--------------------------------------------------------------------------
- alias update_detail update
- def update
-
- #本来の処理を実行。
-
- update_detail
-
- #詳細説明ウィンドウが存在しない場合は処理を終了する。
-
- return if @item_detail_window == nil
-
- #詳細説明ウィンドウの表示/非表示切り替えフラグがtrueの場合
-
- if $game_party.item_detail_mode == true
-
- #詳細説明ウィンドウが既に表示されている場合
-
- if @item_detail_window.visible == true
-
- #表示を消し、表示フラグをfalseにする。
-
- @item_detail_window.visible = false
- $game_party.item_detail_mode = false
-
- #詳細説明ウィンドウが表示されていない場合
-
- else
-
- #更新した上で表示し、表示フラグをtrueにする。
-
- @item_detail_window.refresh($game_party.selected_detail_item)
- @item_detail_window.visible = true
- $game_party.item_detail_mode = false
- end
-
- #詳細説明ウィンドウのリフレッシュフラグがtrueの場合
-
- elsif $game_party.item_detail_refresh_order == true
-
- #詳細説明ウィンドウを更新し、リフレッシュフラグをfalseにする。
-
- @item_detail_window.refresh($game_party.selected_detail_item)
- $game_party.item_detail_refresh_order = false
-
- #詳細説明終了フラグがtrueの場合
-
- elsif $game_party.item_detail_end == true
-
- #詳細説明ウィンドウを非表示にし
- #詳細説明終了フラグをfalseにする。
-
- @item_detail_window.visible = false
- $game_party.item_detail_end = false
- end
- end
- end
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # 開始
- #--------------------------------------------------------------------------
- alias start_detail_window start
- def start
-
- #本来の処理を実行。
-
- start_detail_window
-
- #詳細説明ウィンドウを作成する。
-
- create_detail_window
- end
- end
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # 開始
- #--------------------------------------------------------------------------
- alias start_detail_window start
- def start
-
- #本来の処理を実行。
-
- start_detail_window
-
- #詳細説明ウィンドウを作成する。
-
- create_detail_window
- end
- end
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # 開始
- #--------------------------------------------------------------------------
- alias start_detail_window start
- def start
-
- #本来の処理を実行。
-
- start_detail_window
-
- #詳細説明ウィンドウを作成する。
-
- create_detail_window
- end
- end
- class Window_Selectable < Window_Base
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- alias initialize_detail initialize
- def initialize(x, y, width, height)
-
- #本来の処理を実行。
-
- initialize_detail(x, y, width, height)
-
- #詳細説明ウィンドウの有効フラグをfalseにする。
-
- @detail_window_valid = false
- end
- #--------------------------------------------------------------------------
- # ハンドリング処理
- #--------------------------------------------------------------------------
- alias process_handling_detail_window process_handling
- def process_handling
-
- #本来の処理を実行。
-
- process_handling_detail_window
-
- #非戦闘時は処理しない。
-
- return if $game_party.in_battle == true
-
- #詳細説明ウィンドウが有効であり
- #詳細説明ウィンドウ用ボタンが押されている場合に限り
- #詳細説明ウィンドウを表示する。
-
- return process_detail_window if self.active && Input.trigger?(IT_DETAIL::KEY)
- end
- #--------------------------------------------------------------------------
- # 決定の場合
- #--------------------------------------------------------------------------
- alias process_ok_detail process_ok
- def process_ok
-
- #詳細説明ウィンドウ終了フラグを有効にする。
-
- $game_party.item_detail_end = true
-
- #本来の処理を実行。
-
- process_ok_detail
- end
- #--------------------------------------------------------------------------
- # キャンセルの場合
- #--------------------------------------------------------------------------
- alias process_cancel_detail process_cancel
- def process_cancel
-
- #詳細説明ウィンドウ終了フラグを有効にする。
-
- $game_party.item_detail_end = true
-
- #本来の処理を実行。
-
- process_cancel_detail
- end
- #--------------------------------------------------------------------------
- # 詳細説明ウィンドウ用の切り替え
- #--------------------------------------------------------------------------
- def process_detail_window
-
- #詳細説明ウィンドウ有効フラグがfalseの場合は処理を行わない。
-
- return unless @detail_window_valid
-
- #SEを鳴らす場合は鳴らす。
-
- Sound.play_ok if IT_DETAIL::SOUND
-
- #入力情報を更新する。
-
- Input.update
-
- #詳細ウィンドウ表示切り替えフラグを有効にする。
-
- $game_party.item_detail_mode = true
- end
- end
- class Window_Item_Detail < Window_Base
- #--------------------------------------------------------------------------
- # リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(item)
-
- #ウィンドウの内容を消去する。
-
- contents.clear
-
- #アイテムが存在しない場合は処理を中断する。
-
- return if item == nil
-
- #ウィンドウへの各種描写を実行する。
-
- draw_detail_text(item)
- end
- #--------------------------------------------------------------------------
- # テキスト描写
- #--------------------------------------------------------------------------
- def set_text(text)
-
- #既存テキストと異なる場合のみテキスト内容を更新。
-
- @text = text if text != @text
- end
- #--------------------------------------------------------------------------
- # クリア
- #--------------------------------------------------------------------------
- def clear
-
- #テキストを消去する。
-
- set_text("")
- end
- #--------------------------------------------------------------------------
- # 通常のアイテムの説明描写
- #--------------------------------------------------------------------------
- def set_item(item)
-
- #アイテムに応じて説明を描写。
-
- set_text(item ? item.description : "")
- end
- #--------------------------------------------------------------------------
- # アイテムの詳細説明描写
- #--------------------------------------------------------------------------
- def draw_detail_text(item)
-
- #アイテムが存在しない場合は処理を行わない。
-
- return if item == nil
-
- #アイテムの名前を描写する。
-
- draw_item_name(item, 4, 0, enabled = true, width = 512)
-
- #アイテムの価格を描写する場合
-
- if IT_DETAIL::VALUE == true
-
- #アイテムの値段が0より高い場合
-
- if item.price > 0
-
- #関連情報を描写する。
-
- value = item.price
- currency_unit = $data_system.currency_unit
- change_color(text_color(IT_DETAIL::V_C1))
- draw_text(68, 0, 400, line_height, IT_DETAIL::WORD2, 2)
- change_color(normal_color)
- draw_currency_value(value, currency_unit, 68, 0, 512)
-
- #アイテムの値段が0以下の場合
-
- else
-
- #売却不可の旨を描写する。
-
- change_color(text_color(IT_DETAIL::V_C2))
- draw_text(68, 0, 400, line_height, IT_DETAIL::WORD3, 2)
- change_color(normal_color)
- end
- end
-
- #通常のアイテムの説明描写を行う。
-
- set_item(item)
- draw_text_ex(4, line_height, @text)
-
- #アイテムの詳細説明が存在しない場合は処理を中断する。
-
- return if item.detail_description.empty?
-
- #アイテムの詳細説明を描写する。
-
- item.detail_description.each {|array| draw_text_ex(4, (array[0] + 2) * line_height, array[1])}
- end
- end
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- alias initialize_ild initialize
- def initialize(x, y, width, height)
-
- #本来の処理を実行。
-
- initialize_ild(x, y, width, height)
-
- #戦闘中の場合は処理を中断する。
-
- return if $game_party.in_battle == true
-
- #詳細説明有効フラグを有効にする。
-
- @detail_window_valid = true
- end
- #--------------------------------------------------------------------------
- # アイテムの取得
- #--------------------------------------------------------------------------
- alias item_ild item
- def item
-
- #詳細説明ウィンドウが有効かつアクティブかつ
- #詳細説明ウィンドウに表示すべきアイテムが異なる場合
-
- if @detail_window_valid && active && $game_party.selected_detail_item != item_ild
- $game_party.selected_detail_item = item_ild
- $game_party.item_detail_refresh_order = true
- end
-
- #本来の処理を実行。
-
- item_ild
- end
- end
- class Window_EquipSlot < Window_Selectable
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- alias initialize_esd initialize
- def initialize(x, y, width)
-
- #本来の処理を実行。
-
- initialize_esd(x, y, width)
-
- #戦闘中の場合は処理を中断する。
-
- return if $game_party.in_battle == true
-
- #詳細説明ウィンドウ有効フラグをtrueにする。
-
- @detail_window_valid = true
- end
- #--------------------------------------------------------------------------
- # アイテムの取得
- #--------------------------------------------------------------------------
- alias item_esd item
- def item
-
- #詳細説明ウィンドウが有効かつアクティブかつ
- #詳細説明ウィンドウに表示すべきアイテムが異なる場合
-
- if @detail_window_valid && active && $game_party.selected_detail_item != item_esd
- $game_party.selected_detail_item = item_esd
- $game_party.item_detail_refresh_order = true
- end
-
- #本来の処理を実行。
-
- item_esd
- end
- end
- class Window_EquipItem < Window_ItemList
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- alias initialize_eid initialize
- def initialize(x, y, width, height)
-
- #本来の処理を実行。
-
- initialize_eid(x, y, width, height)
-
- #戦闘中の場合は処理を中断する。
-
- return if $game_party.in_battle == true
-
- #詳細説明ウィンドウ有効フラグをtrueにする。
-
- @detail_window_valid = true
- end
- #--------------------------------------------------------------------------
- # アイテムの取得
- #--------------------------------------------------------------------------
- alias item_eid item
- def item
-
- #詳細説明ウィンドウが有効かつアクティブかつ
- #詳細説明ウィンドウに表示すべきアイテムが異なる場合
-
- if @detail_window_valid && active && $game_party.selected_detail_item != item_eid
- $game_party.selected_detail_item = item_eid
- $game_party.item_detail_refresh_order = true
- end
-
- #本来の処理を実行。
-
- item_eid
- end
- end
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- alias initialize_eid initialize
- def initialize(x, y, width, height)
-
- #本来の処理を実行。
-
- initialize_eid(x, y, width, height)
-
- #戦闘中の場合は処理を中断する。
-
- return if $game_party.in_battle == true
-
- #詳細説明ウィンドウ有効フラグをtrueにする。
-
- @detail_window_valid = IT_DETAIL::BUY
-
- end
- #--------------------------------------------------------------------------
- # アイテムの取得
- #--------------------------------------------------------------------------
- alias item_ild item
- def item
-
- #詳細説明ウィンドウが有効かつアクティブかつ
- #詳細説明ウィンドウに表示すべきアイテムが異なる場合
-
- if @detail_window_valid && active && $game_party.selected_detail_item != item_ild
- $game_party.selected_detail_item = item_ild
- $game_party.item_detail_refresh_order = true
- end
-
- #本来の処理を実行。
-
- item_ild
- end
- end
- class Game_Party < Game_Unit
- attr_accessor :item_detail_mode
- attr_accessor :selected_detail_item
- attr_accessor :item_detail_refresh_order
- attr_accessor :item_detail_end
- end
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # アイテムの詳細説明
- #--------------------------------------------------------------------------
- def detail_description
-
- #キャッシュが存在する場合はキャッシュを返す。
-
- return @detail_description if @detail_description != nil
-
- #詳細説明用配列を作成する。
-
- @detail_description = []
-
- #メモ欄の各行からデータを取得し、取得できた場合は詳細説明用配列にデータを入れる。
-
- self.note.each_line { |line|
- memo = line.scan(/<#{IT_DETAIL::WORD1}(\S+)[::](\S+)>/).flatten
- @detail_description.push([memo[0].to_i, memo[1].to_s]) if memo != nil && !memo.empty?
- }
-
- #詳細説明用配列を返す。
-
- @detail_description
- end
- end
复制代码 |
|