#============================================================================== # ■ VX-RGSS2-5 用語辞典[データ] by Claimh #------------------------------------------------------------------------------ # 用語辞典のデータを構築、解析する #============================================================================== #============================================================================== # ■ DictFunc : 用語辞典用関数群 #============================================================================== module DictFunc N_FILE = 0 # 画像ではない(テキスト) C_FILE = 1 # キャラチップ(Graphics/Characters) B_FILE = 2 # バトラー(Graphics/Battler) I_FILE = 3 # アイコン(Graphics/Icons) P_FILE = 4 # ピクチャ(Graphics/Pictures) F_FILE = 5 # 顔グラフィック(Graphics/Face) #============================================================================== # ■ DictFileData:辞典用表示データクラス(描画処理の実行) #============================================================================== class DictFileData #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(type, text, file="", hue=0) @type = type @text = text @file = file @hue = hue end #-------------------------------------------------------------------------- # ● 描画タイプが文字か? #-------------------------------------------------------------------------- def text? return @type == N_FILE end #-------------------------------------------------------------------------- # ● 描画タイプがアイコンか? #-------------------------------------------------------------------------- def icon? return @type == I_FILE end #-------------------------------------------------------------------------- # ● Bitmap描画 #-------------------------------------------------------------------------- def draw_bitmap(bitmap, align, x, y) case @type when N_FILE return if @text == "" or @text.nil? bitmap.draw_text(x, y, bitmap.text_size(@text).width, Window_Base::WLH, @text, 0) when C_FILE; draw_dict_character(bitmap, align, x, y, @file, @hue) when B_FILE; draw_dict_battler(bitmap, align, x, y, @file, @hue) when I_FILE; draw_dict_icon(bitmap, align, x, y, @file, @hue) when P_FILE; draw_dict_picture(bitmap, align, x, y, @file) when F_FILE; draw_dict_face(bitmap, align, x, y, @file, @hue) end end #-------------------------------------------------------------------------- # ● 描画アライメント #-------------------------------------------------------------------------- def d_pos_x(align, x, w) case align when 1,4,7; return x when 2,5,8; return x-w/2 when 3,6,9; return x-w end end def d_pos_y(align, y, h) case align when 7,8,9; return y when 4,5,6; return y-h/2 when 1,2,3; return y-h end end #-------------------------------------------------------------------------- # ● キャラクタ描画(Graphics/Characters内の画像を表示) #-------------------------------------------------------------------------- def draw_dict_character(bitmap, align, x, y, character_name, character_index) return if character_name == nil bit = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bit.width / 3 ch = bit.height / 4 else cw = bit.width / 12 ch = bit.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) bitmap.blt( d_pos_x(align, x, src_rect.width), d_pos_y(align, y, src_rect.height), bit, src_rect) end #-------------------------------------------------------------------------- # ● バトラー描画(Graphics/Battlers内の画像を表示) #-------------------------------------------------------------------------- def draw_dict_battler(bitmap, align, x, y, file_name, hue = 0) bit = Cache.battler(file_name, hue) if bitmap.width < bit.width # 横幅を超えるものは中央表示に x = bitmap.width / 2 align = 2 end src_rect = Rect.new(0, 0, bit.width, bit.height) bitmap.blt( d_pos_x(align, x, src_rect.width), d_pos_y(align, y, src_rect.height), bit, src_rect, Dictionary::BT_OPACITY) end #-------------------------------------------------------------------------- # ● アイコン描画(Graphics/Icons内の画像を表示) #-------------------------------------------------------------------------- def draw_dict_icon(bitmap, align, x, y, filename, icon_index) bit = Cache.system(filename) src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) bitmap.blt( d_pos_x(align, x, src_rect.width), d_pos_y(align, y, src_rect.height), bit, src_rect) end #-------------------------------------------------------------------------- # ● ピクチャ描画(Graphics/Pictures内の画像を表示) #-------------------------------------------------------------------------- def draw_dict_picture(bitmap, align, x, y, file_name) bit = Cache.picture(file_name) if bitmap.width < bit.width # 横幅を超えるものは中央表示に x = bitmap.width / 2 align = 2 end src_rect = Rect.new(0, 0, bit.width, bit.height) bitmap.blt( d_pos_x(align, x, src_rect.width), d_pos_y(align, y, src_rect.height), bit, src_rect) end #-------------------------------------------------------------------------- # ● 顔グラフィック描画(Graphics/Face内の画像を表示) #-------------------------------------------------------------------------- def draw_dict_face(bitmap, align, x, y, face_name, face_index, size = 96) bit = Cache.face(face_name) src_rect = Rect.new(0, 0, 0, 0) src_rect.x = face_index % 4 * 96 + (96 - size) / 2 src_rect.y = face_index / 4 * 96 + (96 - size) / 2 src_rect.width = size src_rect.height = size bitmap.blt( d_pos_x(align, x, src_rect.width), d_pos_y(align, y, src_rect.height), bit, src_rect) end end #-------------------------------------------------------------------------- # ● マップ名取得 #-------------------------------------------------------------------------- def self.map_name(i) # マップ情報読み出し mapInfo = load_data(sprintf("Data/MapInfos.rvdata")) return mapInfo[i].name end #-------------------------------------------------------------------------- # ● ドロップアイテム取得 #-------------------------------------------------------------------------- def self.drop_item(drop) text = "( 1 / " + drop.denominator.to_s + " )" case drop.kind when 0 return "----" when 1 return $data_items[drop.item_id].name + text when 2 return $data_weapons[drop.weapon_id].name + text when 3 return $data_armor[drop.armor_id].name + text else return "----" end end #-------------------------------------------------------------------------- # ● エネミーパラメータ取得 #-------------------------------------------------------------------------- def self.enemy_param(id, type) case type when "maxhp"; return $data_enemies[id].maxhp when "maxmp"; return $data_enemies[id].maxmp when "atk"; return $data_enemies[id].atk when "def"; return $data_enemies[id].def when "spi"; return $data_enemies[id].spi when "agi"; return $data_enemies[id].agi when "hit"; return $data_enemies[id].hit when "eva"; return $data_enemies[id].eva else; p "Error:\\u[#{id}, #{type}] -> パラメータ指定エラー" end return "" end #-------------------------------------------------------------------------- # ● 構文解析[テキスト置換] #-------------------------------------------------------------------------- def self.decode(textdata) text = textdata.dup # \\n[ID]:IDで指定したアクターの名前 text.gsub!(/\\n\[([0-9]+)\]/) { $game_actors[$1.to_i].name } # \\j[ID]:IDで指定したアクターのクラス名 text.gsub!(/\\j\[([0-9]+)\]/) { $data_classes[$game_actors[$1.to_i].class_id].name } # \\J[ID]:IDで指定したクラス名 text.gsub!(/\\J\[([0-9]+)\]/) { $data_classes[$1.to_i].name } # \\e[ID]:IDで指定したエネミーの名前 text.gsub!(/\\e\[([0-9]+)\]/) { $data_enemies[$1.to_i].name } # \\u[ID,type]:IDで指定したエネミーのパラメータ(type) # 使用可能なtype: maxhp,maxmp,atk,def,spi,agi,hit,eva text.gsub!(/\\u\[([0-9]+,(.*?))\]/) { enemy_param($1.to_i, $2.to_s) } # \\g[ID]:IDで指定したエネミーのゴールド text.gsub!(/\\g\[([0-9]+)\]/) { $data_enemies[$1.to_i].gold } # \\k[ID]:IDで指定したエネミーのEXP text.gsub!(/\\k\[([0-9]+)\]/) { $data_enemies[$1.to_i].exp } # \\r[ID]:IDで指定したエネミーのドロップアイテム1 text.gsub!(/\\r\[([0-9]+)\]/) { drop_item($data_enemies[$1.to_i].drop_item1) } # \\R[ID]:IDで指定したエネミーのドロップアイテム2 text.gsub!(/\\R\[([0-9]+)\]/) { drop_item($data_enemies[$1.to_i].drop_item2) } # \\i[ID]:IDで指定したアイテムの名前 text.gsub!(/\\i\[([0-9]+)\]/) { $data_items[$1.to_i].name } # \\I[ID]:IDで指定したアイテムの価格 text.gsub!(/\\I\[([0-9]+)\]/) { $data_items[$1.to_i].price.to_s + $data_system.terms.gold } # \\w[ID]:IDで指定した武器の名前 text.gsub!(/\\w\[([0-9]+)\]/) { $data_weapons[$1.to_i].name } # \\W[ID]:IDで指定した武器の価格 text.gsub!(/\\W\[([0-9]+)\]/) { $data_weapons[$1.to_i].price.to_s + $data_system.terms.gold } # \\a[ID]:IDで指定した防具の名前 text.gsub!(/\\a\[([0-9]+)\]/) { $data_armors[$1.to_i].name } # \\A[ID]:IDで指定した防具の価格 text.gsub!(/\\A\[([0-9]+)\]/) { $data_armors[$1.to_i].price.to_s + $data_system.terms.gold } # \\s[ID]:IDで指定したスキルの名前 text.gsub!(/\\s\[([0-9]+)\]/) { $data_skills[$1.to_i].name } # \\m[ID]:IDで指定したマップ名 text.gsub!(/\\m\[([0-9]+)\]/) { map_name($1.to_i) } # ★撃破数カウンタとの併用 if defined?(DefeatCounter) # \\dID]:IDで指定したアクターがこれまでに撃破したエネミーの総数 text.gsub!(/\\d\[([0-9]+)\]/) { $game_actors.defeat(0, ($1.to_i)).to_s } # \\t[ID]:IDで指定したエネミーが撃破された総数 text.gsub!(/\\t\[([0-9]+)\]/) { $game_actors.defeat(($1.to_i), 0).to_s } end # ★クエストシステムとの併用 if defined?(Quest) # \\q[ID]:IDで指定したクエスト名 text.gsub!(/\\q\[([0-9]+)\]/) { $game_system.quest[$1.to_i].name } end return text end #-------------------------------------------------------------------------- # ● 構文解析[ファイル置換] #-------------------------------------------------------------------------- def self.type_decode(textdata) text = textdata.dup #<< ファイル置換が見つかった時点でリターンする >> # \\n[ID]:IDで指定したアクターのキャラチップ(正面) d_txt = text.gsub(/\\[Nn]\[([0-9]+)\]/) { $game_actors[$1.to_i].character_name + "\\d" + $game_actors[$1.to_i].character_index.to_s } if d_txt != textdata return DictFileData.new(C_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) end # \\b[ID]:IDで指定したアクターの顔グラフィック d_txt = text.gsub(/\\[Bb]\[([0-9]+)\]/) { $game_actors[$1.to_i].face_name + "\\d" + $game_actors[$1.to_i].face_index.to_s } if d_txt != textdata return DictFileData.new(F_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) end # \\e[ID]:IDで指定したエネミーのバトラー d_txt = text.gsub(/\\[Ee]\[([0-9]+)\]/) { $data_enemies[$1.to_i].battler_name + "\\d" + $data_enemies[$1.to_i].battler_hue.to_s } if d_txt != textdata return DictFileData.new(B_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) end # \\i[ID]:IDで指定したアイテムのアイコン d_txt = text.gsub(/\\[Ii]\[([0-9]+)\]/) { "IconSet" + "\\d" + $data_items[$1.to_i].icon_index.to_s } return DictFileData.new(I_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # \\w[ID]:IDで指定した武器のアイコン d_txt = text.gsub(/\\[Ww]\[([0-9]+)\]/) { "IconSet" + "\\d" + $data_weapons[$1.to_i].icon_index.to_s } return DictFileData.new(I_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # \\a[ID]:IDで指定した防具のアイコン d_txt = text.gsub(/\\[Aa]\[([0-9]+)\]/) { "IconSet" + "\\d" + $data_armors[$1.to_i].icon_index.to_s } return DictFileData.new(I_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # \\s[ID]:IDで指定したスキルのアイコン d_txt = text.gsub(/\\[Ss]\[([0-9]+)\]/) { "IconSet" + "\\d" + $data_skills[$1.to_i].icon_index.to_s } return DictFileData.new(I_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # \\p[File]:Graphics/Picturesに入っている画像ファイル d_txt = text.gsub(/\\[Pp]\[(.*?)\]/) { $1 } return DictFileData.new(P_FILE, textdata, d_txt) if d_txt != textdata # \\h[FILE]:Graphics/Charactersに入っている画像ファイル d_txt = text.gsub(/\\[Hh]\[(.*?),(.*?)\]/) { $1.to_s + "\\d" + $2.to_s } return DictFileData.new(C_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # \\f[FILE]:Graphics/Faceに入っている画像ファイル d_txt = text.gsub(/\\[Ff]\[(.*?),(.*?)\]/) { $1.to_s + "\\d" + $2.to_s } return DictFileData.new(F_FILE, textdata, d_txt.split(/\\d/)[0], d_txt.split(/\\d/)[1].to_i) if d_txt != textdata # テキストのみ return DictFileData.new(N_FILE, textdata) end #-------------------------------------------------------------------------- # ● 用語情報の描画 #-------------------------------------------------------------------------- def self.draw_info_text(bitmap, x, y, w, text_h, txt) txt = "" if txt.nil? text = self.decode(txt) xx = 0 line = 0 # 便宜上 text.gsub!(/\\\\/) { "\000" } # \\c[n] : 文字色変更 text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } # \\+ : ボールド表示 開始/終了 text.gsub!(/\\[+]/) { "\002" } # \\- : イタリック表示 開始/終了 text.gsub!(/\\[-]/) { "\003" } # \\x[n] : X軸方向 n の場所から描画 text.gsub!(/\\[Xx]\[([0-9]+)\]/) { "\004[#{$1}]" } # \\n : 改行 text.gsub!(/\\[Nn]/) { "\005" } # \\icon : アイコン表示 text.gsub!(/\\icon\[(.*?+)\]/) { "\006[#{$1}]" } bold = bitmap.font.bold italic = bitmap.font.italic color = bitmap.font.color.dup while ((c = text.slice!(/./m)) != nil) break if Dictionary.d_line_max <= line # \\ の場合、本来の文字に戻す c = "\\" if c == "\000" # \\c[n] : 文字色変更 if c == "\001" # 文字色を変更 text.sub!(/\[([0-9]+)\]/, "") case $1.to_i when 0; bitmap.font.color = Color.new(255, 255, 255, 255) when 1; bitmap.font.color = Color.new(128, 128, 255, 255) when 2; bitmap.font.color = Color.new(255, 128, 128, 255) when 3; bitmap.font.color = Color.new(128, 255, 128, 255) when 4; bitmap.font.color = Color.new(128, 255, 255, 255) when 5; bitmap.font.color = Color.new(255, 128, 255, 255) when 6; bitmap.font.color = Color.new(255, 255, 128, 255) when 7; bitmap.font.color = Color.new(192, 192, 192, 255) when 8; bitmap.font.color = Color.new(192, 224, 255, 255) end next # 次の文字へ end # \\+ : ボールド表示 開始/終了 if c == "\002" bitmap.font.bold = !bitmap.font.bold next # 次の文字へ end # \\- : イタリック表示 開始/終了 if c == "\003" bitmap.font.italic = !bitmap.font.italic next # 次の文字へ end if c == "\004" # 文字色を変更 text.sub!(/\[([0-9]+)\]/, "") xx = $1.to_i next # 次の文字へ end # \\n : 改行 if c == "\005" xx = 0; y += text_h; line += 1 next # 次の文字へ end # \\icon : アイコン表示 if c == "\006" text.sub!(/\[(.*?+)\]/, "") xx += self.draw_icon(bitmap, x+xx, y, text_h, $1.to_i) next # 次の文字へ end # 文字を描画 bitmap.draw_text(x+xx, y, 40, text_h, c) # x に描画した文字の幅を加算 xx += bitmap.text_size(c).width # 自動改行 if xx > w xx = 0; y += text_h; line += 1 end end # 念のため、元に戻す bitmap.font.bold = bold bitmap.font.italic = italic bitmap.font.color = color.dup end #-------------------------------------------------------------------------- # ● 用語情報の描画(Icon) \\icon用 #-------------------------------------------------------------------------- def self.draw_icon(bitmap, x, y, h, icon_index) bit = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) bitmap.blt(x, y, bit, rect) return rect.width end end module Dictionary WLH = Window_Base::WLH #-------------------------------------------------------------------------- # ● デザイン : カテゴリリスト visible(active) #-------------------------------------------------------------------------- def self.d_category_visible return (DESIGN != 1) end #-------------------------------------------------------------------------- # ● デザイン : 用語情報 visible #-------------------------------------------------------------------------- def self.d_info_visible return (DESIGN != 0) end #-------------------------------------------------------------------------- # ● デザイン : カテゴリリスト column_max #-------------------------------------------------------------------------- def self.d_category_column return (DESIGN == 3 ? CATEGORY.size : 1) end #-------------------------------------------------------------------------- # ● デザイン : カテゴリリスト column_max #-------------------------------------------------------------------------- def self.d_words_column case DESIGN when 1, 3, 4; return 1 end return 2 end #-------------------------------------------------------------------------- # ● デザイン : カテゴリリスト情報 Rect #-------------------------------------------------------------------------- def self.d_category_rect h = SHOW_COLLECT ? 360 : 416 case DESIGN when 3; return Rect.new(0, 0, 544, WLH+32) end return Rect.new(0, 0, 180, h) end #-------------------------------------------------------------------------- # ● デザイン : 用語リスト情報 Rect #-------------------------------------------------------------------------- def self.d_words_rect h = SHOW_COLLECT ? 360 : 416 case DESIGN when 1; return Rect.new(0, 0, 180, h) when 2; return Rect.new(180, 0, 364, WLH*3+32) when 3; return Rect.new(0, WLH+32, 180, h-(WLH+32)) when 4; return Rect.new(0, WLH+32, 180, h-(WLH+32)) end return Rect.new(180, 0, 364, 416) end #-------------------------------------------------------------------------- # ● デザイン : 用語情報 Rect #-------------------------------------------------------------------------- def self.d_info_rect case DESIGN when 1,4; return Rect.new(180, 0, 364, 416) when 2; return Rect.new(180, WLH*3+32, 364, 416-(WLH*3+32)) when 3; return Rect.new(180, WLH+32, 364, 416-(WLH+32)) end return Rect.new(50, 50, 444, 316) end #-------------------------------------------------------------------------- # ● デザイン : 用語カーソル Rect #-------------------------------------------------------------------------- def self.d_cursor_rect case DESIGN when 1,4; return Rect.new(520, 15, 0, 520) when 2; return Rect.new(520, 90, 0, 460) when 3; return Rect.new(520, 76, 0, 520) end return Rect.new(466, 50, 0, 410) end #-------------------------------------------------------------------------- # ● デザイン : 用語情報の最大Line数 #-------------------------------------------------------------------------- def self.d_line_max case DESIGN when 0; return 10 when 1,4; return 13 when 2; return 9 when 3; return 11 end end #-------------------------------------------------------------------------- # ● デザイン : カテゴリリスト丸める #-------------------------------------------------------------------------- def self.d_category_shorten return (DESIGN == 4) end end module Dictionary #============================================================================= # ■ DictData:用語データクラス #============================================================================= class DictData attr_reader :id # 用語ID attr_reader :type # 種類 attr_reader :sub_g # サブ画像 attr_reader :info # 説明文 attr_reader :show_flg # 表示フラグ attr_accessor :color # 表示色 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(id, data) p "DictData",id, data if data.nil? @id = id @name = data[0] @type = data[1] @sub_g = data[2] @info = data[3] @show_flg = data[4] == nil ? false : data[4] @color = data[5] == nil ? 1 : data[5] end #-------------------------------------------------------------------------- # ● 用語名[構文解析対応版] #-------------------------------------------------------------------------- def name return DictFunc.decode(@name) end #-------------------------------------------------------------------------- # ● 各パラメータの変更 #-------------------------------------------------------------------------- def name=(n) @name = n update_color end def type=(t) @type = t update_color end def sub_g=(s) @sub_g = s update_color end def info=(i) @info = i update_color end def show_flg=(f) @show_flg = f new_color end #-------------------------------------------------------------------------- # ● 色更新 #-------------------------------------------------------------------------- def new_color @color = 1 if @color != 0 end def update_color @color = 2 if @color == 0 end #-------------------------------------------------------------------------- # ● 種類描画[構文解析対応版] #-------------------------------------------------------------------------- def draw_type(bitmap, x, y) DictFunc.type_decode(@type).draw_bitmap(bitmap, 7, x, y) end def type_icon? return DictFunc.type_decode(@type).icon? end #-------------------------------------------------------------------------- # ● サブ画像描画[構文解析対応版] #-------------------------------------------------------------------------- def draw_sub_g(bitmap, x, y) return if @sub_g.nil? return if DictFunc.type_decode(@sub_g).text? DictFunc.type_decode(@sub_g).draw_bitmap(bitmap, 3, x, y) end #-------------------------------------------------------------------------- # ● ページごとの情報に配列化 #-------------------------------------------------------------------------- def page_text return info.split(/\\p/) end #-------------------------------------------------------------------------- # ● 説明文[改行点ごとに配列化] #-------------------------------------------------------------------------- def info_text(page_i) return page_text[page_i].split(/\\n/) end #-------------------------------------------------------------------------- # ● 説明文の最大ページ数 #-------------------------------------------------------------------------- def max_page return page_text.size end #-------------------------------------------------------------------------- # ● 文字色 #-------------------------------------------------------------------------- def txt_color(normal_color) case @color when 1; return NEW_COLOR when 2; return CHG_COLOR end return normal_color end end #============================================================================= # ■ DictWords :用語カテゴリデータクラス #============================================================================= class DictWords attr_reader :id # カテゴリID #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(id) @id = id reset end #-------------------------------------------------------------------------- # ● データリセット #-------------------------------------------------------------------------- def reset @list = {} end #-------------------------------------------------------------------------- # ● IDリスト取得 #-------------------------------------------------------------------------- def keys return [] if WORDS[@id].nil? # 設定おかしいけど継続 if WORDS[@id].is_a?(Hash) return WORDS[@id].keys.sort elsif defined?(DictAutoCreate) # 自動生成Plugin return DictAutoCreate.plugin_auto_ids(WORDS[@id]) end return [] # 設定おかしいけど継続 end #-------------------------------------------------------------------------- # ● データ参照 #-------------------------------------------------------------------------- def [](id) if @list[id].nil? return nil if WORDS[@id].nil? # nil返す。NoMethodErrorで落ちるはず if WORDS[@id].is_a?(Hash) @list[id] = DictData.new(id, WORDS[@id][id]) elsif defined?(DictAutoCreate) # 自動生成Plugin @list[id] = DictAutoCreate.plugin_auto_create(WORDS[@id], id) else return nil # nil返す。NoMethodErrorで落ちるはず end end return @list[id] end #-------------------------------------------------------------------------- # ● カテゴリデータ数 #-------------------------------------------------------------------------- def size return keys.size end #-------------------------------------------------------------------------- # ● カテゴリ名 #-------------------------------------------------------------------------- def name return CATEGORY[@id] end end #============================================================================= # ■ Dictionary :用語辞典データクラス #============================================================================= class Dictionary #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize reset end #-------------------------------------------------------------------------- # ● データリセット #-------------------------------------------------------------------------- def reset @list = {} end #-------------------------------------------------------------------------- # ● IDリスト取得 #-------------------------------------------------------------------------- def keys ids = [] for i in 0...CATEGORY.size ids.push(i) end return ids end #-------------------------------------------------------------------------- # ● データ参照 #-------------------------------------------------------------------------- def [](id) @list[id] = DictWords.new(id) if @list[id].nil? return @list[id] end #-------------------------------------------------------------------------- # ● カテゴリデータ数 #-------------------------------------------------------------------------- def size return CATEGORY.size end end end #============================================================================== # ■ Game_System #============================================================================== class Game_System attr_accessor :dictionary # 辞書データ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias init_dict initialize def initialize init_dict @dictionary = Dictionary::Dictionary.new end end