Class: R3EXS::Map
- Inherits:
-
Object
- Object
- R3EXS::Map
- Defined in:
- lib/R3EXS/RGSS3_R3EXS.rb
Overview
地图数据类
Instance Attribute Summary collapse
-
#display_name ⇒ String
地图显示名.
-
#events ⇒ Hash{Integer => R3EXS::Event}
地图事件.
-
#note ⇒ String
备注.
Instance Method Summary collapse
-
#ex_strings ⇒ Array<String>
提取所有的字符串.
-
#in_strings(hash) ⇒ void
将所有的字符串替换为指定的字符串.
-
#initialize(map) ⇒ R3EXS::Map
constructor
用 RPG::Map 初始化.
-
#inject_to(map) ⇒ void
注入到 RPG::Map 对象.
Constructor Details
#initialize(map) ⇒ R3EXS::Map
用 RPG::Map 初始化
486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 486 def initialize(map) @display_name = map.display_name @note = map.note @events = {} map.events.each do |key, event| next if event.nil? event_r3exs = R3EXS::Event.new(event) @events[key] = event_r3exs unless event_r3exs.empty? end end |
Instance Attribute Details
#display_name ⇒ String
地图显示名
469 470 471 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 469 def display_name @display_name end |
#events ⇒ Hash{Integer => R3EXS::Event}
地图事件
479 480 481 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 479 def events @events end |
Instance Method Details
#ex_strings ⇒ Array<String>
提取所有的字符串
512 513 514 515 516 517 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 512 def ex_strings strings = [@display_name] strings << @note @events.each_value { |event| strings.concat(event.ex_strings) } strings end |
#in_strings(hash) ⇒ void
This method returns an undefined value.
将所有的字符串替换为指定的字符串
524 525 526 527 528 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 524 def in_strings(hash) @display_name = hash.fetch(@display_name, @display_name) @note = hash.fetch(@note, @note) @events.each_value { |event| event.in_strings(hash) } end |
#inject_to(map) ⇒ void
This method returns an undefined value.
注入到 RPG::Map 对象
503 504 505 506 507 |
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 503 def inject_to(map) map.display_name = @display_name map.note = @note @events.each { |key, event| event.inject_to(map.events[key]) } end |