Class: R3EXS::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/R3EXS/RGSS3_R3EXS.rb

Overview

地图数据类

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(map) ⇒ R3EXS::Map

用 RPG::Map 初始化

Parameters:

  • map (RPG::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_nameString

地图显示名

Returns:



469
470
471
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 469

def display_name
  @display_name
end

#eventsHash{Integer => R3EXS::Event}

地图事件

Returns:



479
480
481
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 479

def events
  @events
end

#noteString

备注

Returns:



474
475
476
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 474

def note
  @note
end

Instance Method Details

#ex_stringsArray<String>

提取所有的字符串

Returns:



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.

将所有的字符串替换为指定的字符串

Parameters:



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 对象

Parameters:

  • map (RPG::Map)

    待注入的 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