- 注册时间
- 2006-5-13
- 最后登录
- 2006-5-28
③业余
- 积分
- 220
|

效果: 人物介绍.
原地址:http://www.k3.dion.ne.jp/~claimh/
#==============================================================================
# ■ キャラ紹介 Ver.1.3.0 by Claimh
#------------------------------------------------------------------------------
# ・ステータス画面時に何らかのボタンを押すことで、
# 各キャラの詳細説明画面が表示できます。
# ・ボタンはHELPのInputを見て、確認してください。
# ・標準では、キャラの年齢、出身地、身長、体重、
# その他の文章説明を対応しています。
# ・これ以外に追加したい場合は、改造してください。
#==============================================================================
module Chara_Review
#----------------------------------------------------------------------------
# カスタマイズSTART
#----------------------------------------------------------------------------
# キャラ紹介に切り替えるボタン(デフォルト:C)
CHENGE_KEY = Input::C
#--------------------------------------------------------------------------
# ● 年齢(アクターIDの順に入れていってください)
#--------------------------------------------------------------------------
CHARA_AGE = {
# アクターID => "年齢"
1 => "??",
2 => "??",
3 => "??",
4 => "??",
5 => "??",
6 => "??",
7 => "??",
8 => "??"
}
#--------------------------------------------------------------------------
# ● 出身地(同上)
#--------------------------------------------------------------------------
CHARA_FROM = {
# アクターID => "出身地"
1 => "??",
2 => "??",
3 => "??",
4 => "??",
5 => "??",
6 => "??",
7 => "??",
8 => "??"
}
#--------------------------------------------------------------------------
# ● 身長(同上)
#--------------------------------------------------------------------------
CHARA_H = {
# アクターID => "身長"
1 => "??",
2 => "??",
3 => "??",
4 => "??",
5 => "??",
6 => "??",
7 => "??",
8 => "??"
}
#--------------------------------------------------------------------------
# ● 体重(同上)
#--------------------------------------------------------------------------
CHARA_W = {
# アクターID => "体重"
1 => "??",
2 => "??",
3 => "??",
4 => "??",
5 => "??",
6 => "??",
7 => "??",
8 => "??"
}
#--------------------------------------------------------------------------
# ● その他文章(\nを入れると改行します)
#--------------------------------------------------------------------------
CHARA_INFO = {
# アクターID:1
1 => "RPGツクールXPの代表的キャラクタ。\n駆け出しのファイター\n(口が開いたまま。",
# アクターID:2
2 => "槍を使う人。それ以外何も",
# アクターID:3
3 => "斧で一閃。力持ち",
# アクターID:4
4 => "短剣の両刃双刀使い。",
# アクターID:5
5 => "ロングボウの使い手",
# アクターID:6
6 => "早撃ち名人・・・なのか?",
# アクターID:7
7 => "回復魔法に長ける。",
# アクターID:8
8 => "攻撃魔法に長けているが、腕力は弱め。"
}
#----------------------------------------------------------------------------
# カスタマイズEND
#----------------------------------------------------------------------------
end
#==============================================================================
# ■ Window_Charactor
#------------------------------------------------------------------------------
# キャラ紹介画面
#==============================================================================
class Window_Charactor < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh(actor)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor)
self.contents.clear
return if actor.nil?
draw_battler_graphics(actor, 100, 200)
self.contents.font.color = system_color
self.contents.draw_text(250, 10, 80, 32, "Name:")
self.contents.draw_text(250, 50, 80, 32, "Age:")
self.contents.draw_text(250, 90, 80, 32, "From:")
self.contents.draw_text(250, 130, 80, 32, "Height:")
self.contents.draw_text(250, 170, 80, 32, "Weight:")
self.contents.font.color = normal_color
draw_actor_name(actor, 350, 10)
self.contents.draw_text(350, 50, 80, 32, Chara_Review::CHARA_AGE[actor.id])
self.contents.draw_text(350, 90, 180, 32, Chara_Review::CHARA_FROM[actor.id])
self.contents.draw_text(350, 130 , 200, 32, Chara_Review::CHARA_H[actor.id])
self.contents.draw_text(350, 170, 250, 32, Chara_Review::CHARA_W[actor.id])
draw_enter_text(50, 250, 600, 32, Chara_Review::CHARA_INFO[actor.id])
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● バトラーグラフィックの描画
#--------------------------------------------------------------------------
def draw_battler_graphics(actor, x, y)
battler = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
w = battler.width
h = battler.height
self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
end
#--------------------------------------------------------------------------
# ● 改行を認識して表示
#--------------------------------------------------------------------------
def draw_enter_text(x, y, width, height, text)
info_box = text.split(/\n/)
for i in 0...info_box.size
self.contents.draw_text( x, y+i*32, width, 32, info_box)
break if (y+i*32) > (self.height-32)
end
end
end
#==============================================================================
# ■ Scene_Charactor
#------------------------------------------------------------------------------
# キャラ紹介画面の処理を行うクラスです。
#==============================================================================
class Scene_Charactor
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_index : アクターインデックス
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# アクターを取得
@actor = $game_party.actors[@actor_index]
# ステータスウィンドウを作成
@status_window = Window_Charactor.new(@actor)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$scene = Scene_Menu.new(3)
return
end
# R ボタンが押された場合
if Input.trigger?(Input::R)
# カーソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 次のアクターへ
@actor_index += 1
@actor_index %= $game_party.actors.size
# 別のキャラ紹介画面に切り替え
@status_window.refresh($game_party.actors[@actor_index])
return
end
# L ボタンが押された場合
if Input.trigger?(Input: )
# カーソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 前のアクターへ
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 別のキャラ紹介画面に切り替え
@status_window.refresh($game_party.actors[@actor_index])
return
end
end
end
#==============================================================================
# ■ Scene_Status
#------------------------------------------------------------------------------
# 決定ボタンでキャラ紹介画面へ
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_chara update
def update
# C ボタンが押された場合
if Input.trigger?(Chara_Review::CHENGE_KEY)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# キャラ紹介画面に切り替え
$scene = Scene_Charactor.new(@actor_index)
return
end
update_chara
end
end |
|