591 lines
29 KiB
Ruby
591 lines
29 KiB
Ruby
#==============================================================================
|
||
# ★ RGSS3_実績メダルEX Ver1.0
|
||
#==============================================================================
|
||
=begin
|
||
|
||
作者:tomoaky
|
||
webサイト:ひきも記は閉鎖しました。 (http://hikimoki.sakura.ne.jp/)
|
||
|
||
すごい記録を達成したときにポコンッと出るあれです。
|
||
メダルをカテゴリ別に管理することができます。
|
||
|
||
準備
|
||
下にある設定項目に実績メダルの内容を設定してください。
|
||
|
||
使い方
|
||
イベントコマンド『スクリプト』を使ってメダルを獲得することができます。
|
||
例)gain_medal(0) # 0番のメダルを獲得する
|
||
|
||
イベントコマンド『条件分岐』の判定材料にメダルの獲得状況を使うことができます。
|
||
例)has_medal?(4) # 4番のメダルを獲得済みかどうかで分岐
|
||
|
||
|
||
2013.06.11 Ver1.0
|
||
公開
|
||
|
||
=end
|
||
|
||
#==============================================================================
|
||
# □ 設定項目
|
||
#==============================================================================
|
||
module TMMEDAL
|
||
# メニューコマンド名
|
||
COMMAND_MEDAL = "Achievements"
|
||
|
||
# メダルが1枚もない状態でメダルコマンドを隠すかどうか(true で隠す)
|
||
HIDE_COMMAND = false
|
||
|
||
# 未取得のメダルを隠すかどうか(true で隠す)
|
||
HIDE_UNDISCOVERED = false
|
||
|
||
# 並び順を取得日時順にするかどうか(true で取得日時順)
|
||
# HIDE_UNDISCOVERED が false の場合、この設定は無効になります
|
||
DATE_SORT = false
|
||
|
||
# 並び順を逆順にするかどうか(true で逆順)
|
||
REVERSE_SORT = false
|
||
|
||
# カテゴリウィンドウの位置(0 … 上 / 1 … 右 / 2 … 左 )
|
||
# 右か左に表示する場合は取得日時が非表示になります
|
||
CATEGORY_POS = 0
|
||
|
||
# メダル獲得時の効果音
|
||
SE_GAIN_MEDAL = RPG::SE.new("Powerup", 80, 140)
|
||
|
||
# カテゴリの設定(先頭がカテゴリID 0 になります)
|
||
CATEGORY_NAME = ["Events", "Item", "Battle"]
|
||
|
||
# メダル情報の設定
|
||
# [メダル名, アイコンID, 説明文, ヒント, 並び順ID, カテゴリID]
|
||
# 説明文やヒントは \n を挿入することで改行することができます
|
||
MEDAL_DATA = {}
|
||
MEDAL_DATA[0] = ["Escape Route Conquered!", 361, "Walked till the end with the last life ablaze.", "Conquer the escape route [Prologue]", 1, 0]
|
||
MEDAL_DATA[1] = ["Interacted with Townspeople", 361, "Exchanged stories with the people of Rasuhate.", "Talked with people [Prologue]", 2, 0]
|
||
MEDAL_DATA[2] = ["Defeated the Remnant Zanahari!", 361, "Defeated the remnant Zanahari!", "Progress the story [Prologue]", 3, 2]
|
||
MEDAL_DATA[3] = ["Interacted with Fans", 361, "Exchanged stories with GeoLouise's fans.", "Talked with fans [Prologue]", 4, 0]
|
||
MEDAL_DATA[4] = ["Connected Objects", 361, "Received something entrusted and hidden by someone.", "Inside the destroyed wall... [Chapter 1]", 5, 1]
|
||
MEDAL_DATA[5] = ["Shortcut Opened", 361, "Can now reach Tiara's prison in short time.", "Unlocked door somewhere with a key [Chapter 1]", 6, 0]
|
||
MEDAL_DATA[6] = ["Something Precious", 361, "Gained something to protect, called Tiara.", "Progress the story [Chapter 1]", 7, 0]
|
||
MEDAL_DATA[7] = ["Prison Plant Fool", 361, "Made Dr. Ruster an ally.", "Progress the story [Chapter 1]", 8, 0]
|
||
MEDAL_DATA[8] = ["Yummy ^^ by Tentacle", 361, "Fell into a trap set by a monster.", "Daringly in a suspicious bed... [Chapter 1]", 9, 0]
|
||
MEDAL_DATA[9] = ["Defeated the Vulcan Queen!", 361, "Returned the puppetized Vulcan Queen to her senses.", "Progress the story [Chapter 1]", 10, 2]
|
||
MEDAL_DATA[10] = ["Hidden Item", 361, "Found a hidden item", "Investigate some wall... [Chapter 1]", 11, 1]
|
||
|
||
MEDAL_DATA[11] = ["Defeated Scathach Clone!", 361, "Defeated a clone, though it was not the original.", "Progress the story [Chapter 2]", 12, 2]
|
||
MEDAL_DATA[12] = ["Shortcut Opened 2", 361, "With Scathach's power weakened, a path opened.", "Defeat all clones [Chapter 2]", 13, 0]
|
||
MEDAL_DATA[13] = ["Hidden Soul Formula", 361, "Discovered a room and soul formula secretly used in the birthing place.", "In the hidden room in the birthing place [Chapter 2]", 14, 1]
|
||
MEDAL_DATA[14] = ["Regrettable; by Mimic", 361, "Defeated the mimic and got the treasure!", "Lurking somewhere in the birthing place... [Chapter 2]", 15, 1]
|
||
MEDAL_DATA[15] = ["Defeated Remnant Scathach!", 361, "Defeated the remnant Scathach!", "Progress the story [Chapter 2]", 16, 2]
|
||
|
||
MEDAL_DATA[16] = ["Forgotten Soul Formula", 361, "Found a soul formula forgotten in Guene's hideout.", "Search Guene's hideout [Chapter 3]", 17, 1]
|
||
MEDAL_DATA[17] = ["Exorcism Success!", 361, "Rescued a ghost bound in the prison.", "Four wandering souls... [Chapter 3]", 18, 2]
|
||
MEDAL_DATA[18] = ["Defeated Yadorikusa!", 361, "Defeated the Yadorikusa rooted in the passage!", "Progress the story [Chapter 3]", 19, 2]
|
||
MEDAL_DATA[19] = ["Key Recreator!", 361, "Collected fragments and recreated a key!", "Collect key fragments [Chapter 3]", 20, 1]
|
||
MEDAL_DATA[20] = ["Defeated Plant Princess!", 361, "Defeated the princess turned into a monster by a curse.", "Progress the story [Chapter 3]", 21, 2]
|
||
MEDAL_DATA[21] = ["Defeated Super Beast!", 361, "Miraculously defeated the super beast!", "Absolute threat enemy [Chapter 4]", 22, 2]
|
||
MEDAL_DATA[22] = ["Prisoner Girl", 361, "Stiara became an ally.", "Progress the story [Chapter 4]", 23, 0]
|
||
MEDAL_DATA[23] = ["Easy as Pie ^^ by Sludge", 361, "Let Sludge have his way.", "Progress the story [Chapter 4]", 24, 0]
|
||
MEDAL_DATA[24] = ["Amazing Gap", 361, "The gap between GeoLouise and Stiara became evident.", "Activate a certain device [Chapter 4]", 25, 0]
|
||
MEDAL_DATA[25] = ["Holy Mage Stiara", 361, "Reconciled with a massive horde of cursed grass using holy magic.", "Progress the story [Chapter 4]", 26, 0]
|
||
MEDAL_DATA[26] = ["I'd call it a draw, but I lost.", 361, "Defeated the oddly pompous Sahagin.", "Overly self-absorbed enemy [Chapter 5]", 27, 2]
|
||
MEDAL_DATA[27] = ["Brutal Knight Ardent", 361, "Ardent regained his memories, revealing his past.", "Progress the story [Chapter 5]", 28, 0]
|
||
MEDAL_DATA[28] = ["Farewell Friend", 361, "Took the last hit from best friend Caprice.", "Defeat the enemies in the sanctuary [Chapter 5]", 29, 2]
|
||
MEDAL_DATA[29] = ["Released Legendary Knight Kudan!", 361, "Released the legendary knight standing in the sanctuary!", "Defeat the enemy standing in the sanctuary [Chapter 5]", 30, 2]
|
||
MEDAL_DATA[30] = ["Released 27 Disciples!", 361, "Released disciples who were resurrected and used by demons.", "Progress the story [Chapter 5]", 31, 2]
|
||
|
||
MEDAL_DATA[31] = ["Girl from Another World", 361, "A girl who seemed like Obrido became an ally!", "Progress the story [Chapter 6]", 32, 0]
|
||
MEDAL_DATA[32] = ["Professional Standard", 361, "Acquired a professional whip from the Opa Arts storage!", "Item that pleases the masochist [Chapter 6]", 33, 1]
|
||
MEDAL_DATA[33] = ["Shortcut Opened 3", 361, "Found a short but convenient shortcut.", "Search for hidden paths [Chapter 6]", 34, 0]
|
||
MEDAL_DATA[34] = ["Spare Pocket!", 361, "The Knight of Kara can now mix with the plant bag.", "Descend the hole [Chapter 6]", 35, 0]
|
||
MEDAL_DATA[35] = ["Defeated Warden!", 361, "Defeated and captured the warden who tormented GeoLouise and others!", "Progress the story [Chapter 6]", 36, 2]
|
||
|
||
MEDAL_DATA[36] = ["Torture Success!", 361, "Successfully tortured the warden, opening a new path.", "Progress the story [Chapter 6]", 37, 0]
|
||
MEDAL_DATA[37] = ["Defeated Queen Spider!", 361, "Defeated the queen spider ruling over the old castle!", "Progress the story [Chapter 6]", 38, 2]
|
||
MEDAL_DATA[38] = ["Someday, Somewhere", 361, "A senior who became an ally returned to the original world with a junior.", "Progress the story [Chapter 6]", 39, 0]
|
||
MEDAL_DATA[39] = ["Entrusted Wish", 361, "A king from a distant foreign land entrusted GeoLouise and others with the future.", "Defeat the cursed enemy standing in the forest [Chapter 6]", 40, 2]
|
||
MEDAL_DATA[40] = ["King's Emblem", 361, "GeoLouise inherited the king's emblem.", "Progress the story [Chapter 6]", 41, 0]
|
||
|
||
MEDAL_DATA[41] = ["Protected Treasure", 361, "Made it through a group of enemies and obtained an item!", "Breakthrough [Chapter 7]", 42, 1]
|
||
MEDAL_DATA[42] = ["Quick Soul Formula", 361, "Learned a soul formula hidden in Bohelos Castle!", "Soul formula [Chapter 7]", 43, 1]
|
||
MEDAL_DATA[43] = ["Bring on the Traps!", 361, "Avoided traps and obtained an item", "Traps [Chapter 7]", 44, 1]
|
||
MEDAL_DATA[44] = ["Ideal World Conquered", 361, "Parted ways with the phantom ideal world.", "Progress the story [Chapter 7]", 45, 0]
|
||
MEDAL_DATA[45] = ["Defeated Remnant Toadeira!", 361, "Defeated the remnant Toadeira!", "Progress the story [Chapter 7]", 46, 2]
|
||
|
||
MEDAL_DATA[46] = ["Evacuation Guidance Complete!", 361, "Rescued prisoners from the prison explosion.", "All prisoners [Chapter 8]", 47, 0]
|
||
MEDAL_DATA[47] = ["Hidden Weapon!", 361, "Found a hidden item in the middle-tier prison!", "Hidden weapon [Chapter 8]", 48, 1]
|
||
MEDAL_DATA[48] = ["Holy Mother Stiara's Followers", 361, "Formed bonds with people who overcame the ordeal together.", "With those who admire [Chapter 8]", 49, 0]
|
||
MEDAL_DATA[49] = ["Overcoming Despair!", 361, "Overcame an absolutely desperate situation!", "Progress the story [Chapter 8]", 50, 0]
|
||
MEDAL_DATA[50] = ["Leave the Rest to Me", 361, "Defeated the past GeoLouise who stood in the way.", "Progress the story [Chapter 8]", 51, 2]
|
||
|
||
MEDAL_DATA[51] = ["Defeated Apostle Zanahari!", 361, "Defeated the Apostle Zanahari!", "Progress the story [Final Chapter]", 52, 2]
|
||
MEDAL_DATA[52] = ["Defeated Apostle Scathach!", 361, "Defeated the Apostle Scathach!", "Progress the story [Final Chapter]", 53, 2]
|
||
MEDAL_DATA[53] = ["Defeated Apostle Toadeira!", 361, "Defeated the Apostle Toadeira!", "Progress the story [Final Chapter]", 54, 2]
|
||
MEDAL_DATA[54] = ["Protector", 361, "Protected GeoLouise from certain doom.", "Protect to the end [Final Chapter]", 55, 0]
|
||
MEDAL_DATA[55] = ["Victory of Humanity", 361, "Defeated all the demons and achieved victory for humanity.", "Resolve [Final Chapter]", 56, 2]
|
||
MEDAL_DATA[56] = ["What If Back Then", 361, "Defeated the Great King before the flames of Rasuhate!", "IF [Secret]", 57, 2]
|
||
MEDAL_DATA[57] = ["Future Ally", 361, "Made a liberator an ally!", "Ally [Secret]", 58, 0]
|
||
MEDAL_DATA[58] = ["Past Ally", 361, "Made Tenkaran an ally!", "Ally [Secret]", 59, 0]
|
||
MEDAL_DATA[59] = ["Phantom of the Junior", 361, "Defeated the enemy disguised as a junior!", "In the underground forest [Secret]", 60, 2]
|
||
MEDAL_DATA[60] = ["Greedy One", 361, "Made Koui Mato surrender the achievement.", "Secret room [Secret]", 61, 0]
|
||
|
||
MEDAL_DATA[61] = ["Defeated True Apostles!", 361, "Defeated apostles who released their true power in the second round!", "True formidable enemies [Secret]", 57, 2]
|
||
MEDAL_DATA[62] = ["Holy Sword", 361, "Obtained the holy sword!", "In the hidden story [Secret]", 58, 1]
|
||
MEDAL_DATA[63] = ["Defeated Liberator Xxxxxx!", 361, "Rescued the missing liberator!", "With allies in the cave [Secret]", 59, 2]
|
||
MEDAL_DATA[64] = ["Defeated Elder Brother!", 361, "Defeated the illusion of the elder brother created by the training device!", "With allies and device [Secret]", 60, 2]
|
||
MEDAL_DATA[65] = ["Defeated Demon King!", 361, "Defeated the Demon King who once ruled humanity!", "Progress the hidden story [Secret]", 61, 2]
|
||
end
|
||
#==============================================================================
|
||
# ■ Game_Party
|
||
#==============================================================================
|
||
class Game_Party
|
||
#--------------------------------------------------------------------------
|
||
# ● 公開インスタンス変数
|
||
#--------------------------------------------------------------------------
|
||
attr_reader :medals # 獲得済みメダル
|
||
attr_reader :new_medals # 新規獲得メダル
|
||
attr_accessor :medal_info_count # メダル情報表示カウント
|
||
attr_accessor :medal_info_opacity # メダル情報表示不透明度
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
alias tmmedal_game_party_initialize initialize
|
||
def initialize
|
||
tmmedal_game_party_initialize
|
||
@medals = []
|
||
@new_medals = []
|
||
@medal_info_count = 0
|
||
@medal_info_opacity = 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ メダルの獲得
|
||
#--------------------------------------------------------------------------
|
||
def gain_medal(medal_id)
|
||
return if @medals[medal_id]
|
||
t = Time.now.strftime(" (%Y/%m/%d %H:%M)")
|
||
@medals[medal_id] = t
|
||
@new_medals.push([medal_id, t])
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 獲得メダル情報の消去
|
||
#--------------------------------------------------------------------------
|
||
def delete_new_medal
|
||
@new_medals.shift
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Interpreter
|
||
#==============================================================================
|
||
class Game_Interpreter
|
||
#--------------------------------------------------------------------------
|
||
# ○ メダルの獲得
|
||
#--------------------------------------------------------------------------
|
||
def gain_medal(medal_id)
|
||
$game_party.gain_medal(medal_id)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ メダルを獲得済みかどうかを返す
|
||
#--------------------------------------------------------------------------
|
||
def has_medal?(medal_id)
|
||
$game_party.medals[medal_id]
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Window_MenuCommand
|
||
#==============================================================================
|
||
class Window_MenuCommand
|
||
#--------------------------------------------------------------------------
|
||
# ● 独自コマンドの追加用
|
||
#--------------------------------------------------------------------------
|
||
alias tmmedal_window_menucommand_add_original_commands add_original_commands
|
||
def add_original_commands
|
||
tmmedal_window_menucommand_add_original_commands
|
||
unless TMMEDAL::HIDE_COMMAND && !medal_enabled
|
||
add_command(TMMEDAL::COMMAND_MEDAL, :medal, medal_enabled)
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ メダルの有効状態を取得
|
||
#--------------------------------------------------------------------------
|
||
def medal_enabled
|
||
!$game_party.medals.empty?
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# □ Window_MedalInfo
|
||
#==============================================================================
|
||
class Window_MedalInfo < Window_Base
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
def initialize
|
||
super(Graphics.width - window_width, 0, window_width, fitting_height(1))
|
||
self.opacity = 0
|
||
self.contents_opacity = $game_party.medal_info_opacity
|
||
refresh
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウ幅の取得
|
||
#--------------------------------------------------------------------------
|
||
def window_width
|
||
return 240
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● フレーム更新
|
||
#--------------------------------------------------------------------------
|
||
def update
|
||
super
|
||
if $game_party.medal_info_count > 0
|
||
self.contents_opacity += 16
|
||
$game_party.medal_info_count -= 1
|
||
$game_party.delete_new_medal if $game_party.medal_info_count == 0
|
||
else
|
||
self.contents_opacity -= 16
|
||
if self.contents_opacity == 0
|
||
open unless $game_party.new_medals.empty?
|
||
end
|
||
end
|
||
$game_party.medal_info_opacity = self.contents_opacity
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウを開く
|
||
#--------------------------------------------------------------------------
|
||
def open
|
||
refresh
|
||
TMMEDAL::SE_GAIN_MEDAL.play
|
||
$game_party.medal_info_count = 150
|
||
self.contents_opacity = 0
|
||
self
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ リフレッシュ
|
||
#--------------------------------------------------------------------------
|
||
def refresh
|
||
contents.clear
|
||
unless $game_party.new_medals.empty?
|
||
draw_background(contents.rect)
|
||
medal = TMMEDAL::MEDAL_DATA[$game_party.new_medals[0][0]]
|
||
rect = contents.rect.clone
|
||
draw_icon(medal[1], rect.x, rect.y)
|
||
rect.x += 24
|
||
rect.width -= 24
|
||
draw_text(rect, medal[0])
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 背景の描画
|
||
#--------------------------------------------------------------------------
|
||
def draw_background(rect)
|
||
temp_rect = rect.clone
|
||
temp_rect.width /= 2
|
||
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
|
||
temp_rect.x = temp_rect.width
|
||
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 背景色 1 の取得
|
||
#--------------------------------------------------------------------------
|
||
def back_color1
|
||
Color.new(0, 0, 0, 192)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 背景色 2 の取得
|
||
#--------------------------------------------------------------------------
|
||
def back_color2
|
||
Color.new(0, 0, 0, 0)
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Window_MedalCategory
|
||
#==============================================================================
|
||
class Window_MedalCategory < Window_Command
|
||
#--------------------------------------------------------------------------
|
||
# ● 公開インスタンス変数
|
||
#--------------------------------------------------------------------------
|
||
attr_reader :item_window
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
def initialize
|
||
super(0, 0)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウ幅の取得
|
||
#--------------------------------------------------------------------------
|
||
def window_width
|
||
return 160
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 表示行数の取得
|
||
#--------------------------------------------------------------------------
|
||
def visible_line_number
|
||
TMMEDAL::CATEGORY_NAME.size
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● フレーム更新
|
||
#--------------------------------------------------------------------------
|
||
def update
|
||
super
|
||
@item_window.category = current_symbol if @item_window
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● コマンドリストの作成
|
||
#--------------------------------------------------------------------------
|
||
def make_command_list
|
||
TMMEDAL::CATEGORY_NAME.each {|category| add_command(category, category.to_sym) }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● アイテムウィンドウの設定
|
||
#--------------------------------------------------------------------------
|
||
def item_window=(item_window)
|
||
@item_window = item_window
|
||
update
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Window_MedalCategoryHorz
|
||
#==============================================================================
|
||
class Window_MedalCategoryHorz < Window_HorzCommand
|
||
#--------------------------------------------------------------------------
|
||
# ● 公開インスタンス変数
|
||
#--------------------------------------------------------------------------
|
||
attr_reader :item_window
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
def initialize
|
||
super(0, 0)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウ幅の取得
|
||
#--------------------------------------------------------------------------
|
||
def window_width
|
||
Graphics.width
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 桁数の取得
|
||
#--------------------------------------------------------------------------
|
||
def col_max
|
||
return TMMEDAL::CATEGORY_NAME.size
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● フレーム更新
|
||
#--------------------------------------------------------------------------
|
||
def update
|
||
super
|
||
@item_window.category = current_symbol if @item_window
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● コマンドリストの作成
|
||
#--------------------------------------------------------------------------
|
||
def make_command_list
|
||
TMMEDAL::CATEGORY_NAME.each {|category| add_command(category, category.to_sym) }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● アイテムウィンドウの設定
|
||
#--------------------------------------------------------------------------
|
||
def item_window=(item_window)
|
||
@item_window = item_window
|
||
update
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# □ Window_Medal
|
||
#==============================================================================
|
||
class Window_Medal < Window_Selectable
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
def initialize(x, y, width, height)
|
||
super
|
||
@category = :none
|
||
refresh
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● カテゴリの設定
|
||
#--------------------------------------------------------------------------
|
||
def category=(category)
|
||
return if @category == category
|
||
@category = category
|
||
refresh
|
||
self.oy = 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 桁数の取得
|
||
#--------------------------------------------------------------------------
|
||
def col_max
|
||
return 1
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 項目数の取得
|
||
#--------------------------------------------------------------------------
|
||
def item_max
|
||
@data ? @data.size : 1
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● アイテムの取得
|
||
#--------------------------------------------------------------------------
|
||
def item
|
||
@data && index >= 0 ? @data[index] : nil
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● アイテムリストの作成
|
||
#--------------------------------------------------------------------------
|
||
def make_item_list
|
||
@data = []
|
||
TMMEDAL::MEDAL_DATA.keys.each do |i|
|
||
item = $game_party.medals[i]
|
||
next if TMMEDAL::HIDE_UNDISCOVERED && !item
|
||
medal = TMMEDAL::MEDAL_DATA[i]
|
||
if TMMEDAL::CATEGORY_NAME[medal[5]].to_sym == @category
|
||
@data.push([i, item, medal[4]])
|
||
end
|
||
end
|
||
i = TMMEDAL::DATE_SORT && TMMEDAL::HIDE_UNDISCOVERED ? 1 : 2
|
||
@data.sort!{|a, b| a[i] <=> b[i] }
|
||
@data.reverse! if TMMEDAL::REVERSE_SORT
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 項目の描画
|
||
#--------------------------------------------------------------------------
|
||
def draw_item(index)
|
||
item = @data[index]
|
||
medal = TMMEDAL::MEDAL_DATA[item[0]]
|
||
rect = item_rect(index)
|
||
if item[1]
|
||
draw_icon(medal[1], rect.x, rect.y)
|
||
draw_text(rect, item[1], 2) if TMMEDAL::CATEGORY_POS == 0
|
||
end
|
||
rect.x += 24
|
||
rect.width -= TMMEDAL::CATEGORY_POS == 0 ? 216 : 24
|
||
draw_text(rect, item[1] ? medal[0] : "?" * medal[0].size)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ヘルプテキスト更新
|
||
#--------------------------------------------------------------------------
|
||
def update_help
|
||
if item
|
||
medal = TMMEDAL::MEDAL_DATA[item[0]]
|
||
@help_window.set_text(item[1] ? medal[2] : medal[3])
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● リフレッシュ
|
||
#--------------------------------------------------------------------------
|
||
def refresh
|
||
make_item_list
|
||
create_contents
|
||
draw_all_items
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Scene_Map
|
||
#==============================================================================
|
||
class Scene_Map
|
||
#--------------------------------------------------------------------------
|
||
# ● 全ウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
alias tmmedal_scene_map_create_all_windows create_all_windows
|
||
def create_all_windows
|
||
tmmedal_scene_map_create_all_windows
|
||
create_medal_window
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ メダルウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
def create_medal_window
|
||
@medal_window = Window_MedalInfo.new
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Scene_Menu
|
||
#==============================================================================
|
||
class Scene_Menu
|
||
#--------------------------------------------------------------------------
|
||
# ● コマンドウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
alias tmmedal_scene_menu_create_command_window create_command_window
|
||
def create_command_window
|
||
tmmedal_scene_menu_create_command_window
|
||
@command_window.set_handler(:medal, method(:command_medal))
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ コマンド[メダル]
|
||
#--------------------------------------------------------------------------
|
||
def command_medal
|
||
SceneManager.call(Scene_Medal)
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# □ Scene_Medal
|
||
#==============================================================================
|
||
class Scene_Medal < Scene_MenuBase
|
||
#--------------------------------------------------------------------------
|
||
# ● 開始処理
|
||
#--------------------------------------------------------------------------
|
||
def start
|
||
super
|
||
create_help_window
|
||
create_category_window
|
||
create_item_window
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● カテゴリウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
def create_category_window
|
||
if TMMEDAL::CATEGORY_POS == 0
|
||
@category_window = Window_MedalCategoryHorz.new
|
||
else
|
||
@category_window = Window_MedalCategory.new
|
||
end
|
||
@category_window.viewport = @viewport
|
||
@category_window.help_window = @help_window
|
||
@category_window.y = @help_window.height
|
||
@category_window.set_handler(:ok, method(:on_category_ok))
|
||
@category_window.set_handler(:cancel, method(:return_scene))
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● アイテムウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
def create_item_window
|
||
if TMMEDAL::CATEGORY_POS == 0
|
||
wx = 0
|
||
ww = Graphics.width
|
||
wy = @help_window.height + @category_window.height
|
||
else
|
||
wx = TMMEDAL::CATEGORY_POS == 1 ? @category_window.width : 0
|
||
ww = Graphics.width - @category_window.width
|
||
wy = @help_window.height
|
||
end
|
||
wh = Graphics.height - wy
|
||
@item_window = Window_Medal.new(wx, wy, ww, wh)
|
||
@item_window.viewport = @viewport
|
||
@item_window.help_window = @help_window
|
||
@item_window.set_handler(:cancel, method(:on_medal_cancel))
|
||
@category_window.item_window = @item_window
|
||
@category_window.x = @item_window.width if TMMEDAL::CATEGORY_POS == 2
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● カテゴリ[決定]
|
||
#--------------------------------------------------------------------------
|
||
def on_category_ok
|
||
@item_window.activate
|
||
@item_window.select(0)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● メダル[キャンセル]
|
||
#--------------------------------------------------------------------------
|
||
def on_medal_cancel
|
||
@item_window.unselect
|
||
@category_window.activate
|
||
end
|
||
end
|
||
|