Class: R3EXS::Troop::Page

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

Overview

战斗事件(页)的数据类

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, index) ⇒ R3EXS::Troop::Page

用 RPG::Troop::Page 初始化

Parameters:

  • page (RPG::Troop::Page)

    待处理的 RPG::Troop::Page 对象

  • index (Integer)

    在原始数组中的索引



1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1514

def initialize(page, index)
  @index = index
  @list = []
  page.list.each_with_index do |eventcommand, eventcommand_index|
    next if eventcommand.nil?

    eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
    @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
  end
end

Instance Attribute Details

#indexInteger

在原始数组中的索引

Returns:

  • (Integer)


1501
1502
1503
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1501

def index
  @index
end

#listArray<R3EXS::EventCommand>

执行内容

Returns:



1506
1507
1508
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1506

def list
  @list
end

Instance Method Details

#empty?Boolean

判断是否为空

Returns:

  • (Boolean)


1555
1556
1557
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1555

def empty?
  @list.empty?
end

#ex_stringsArray<String>

提取所有的字符串

Returns:



1537
1538
1539
1540
1541
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1537

def ex_strings
  strings = []
  @list.each { |eventcommand| strings.concat(eventcommand.ex_strings) }
  strings
end

#in_strings(hash) ⇒ void

This method returns an undefined value.

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

Parameters:



1548
1549
1550
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1548

def in_strings(hash)
  @list.each { |eventcommand| eventcommand.in_strings(hash) }
end

#inject_to(page) ⇒ void

This method returns an undefined value.

注入到 RPG::Troop::Page 对象

Parameters:



1530
1531
1532
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 1530

def inject_to(page)
  @list.each { |eventcommand| eventcommand.inject_to(page.list[eventcommand.index]) }
end