Class: R3EXS::Actor

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

Overview

角色类

Instance Attribute Summary collapse

Attributes inherited from BaseItem

#description, #index, #name, #note

Instance Method Summary collapse

Constructor Details

#initialize(actor, index, with_note) ⇒ R3EXS::Actor

用 RPG::Actor 初始化

Parameters:

  • actor (RPG::Actor)

    待处理的 RPG::Actor 对象

  • index (Integer)

    在原始数组中的索引

  • with_note (Boolean)

    是否处理 note 字段



92
93
94
95
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 92

def initialize(actor, index, with_note)
    super(actor, index, with_note)
    @nickname = actor.nickname
end

Instance Attribute Details

#nicknameString

昵称

Returns:

  • (String)


134
135
136
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 134

def nickname
  @nickname
end

Instance Method Details

#empty?Boolean

判断是否为空

Returns:

  • (Boolean)


127
128
129
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 127

def empty?
    super && @nickname.to_s.empty?
end

#ex_stringsArray<String>

提取所有的字符串

Returns:

  • (Array<String>)


109
110
111
112
113
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 109

def ex_strings
    strings = super
    strings << @nickname
    strings
end

#in_strings(hash) ⇒ void

This method returns an undefined value.

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

Parameters:

  • hash (Hash<String, String>)

    字符串翻译表



119
120
121
122
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 119

def in_strings(hash)
    super(hash)
    @nickname = hash[@nickname] || @nickname
end

#inject_to(actor) ⇒ void

This method returns an undefined value.

注入到 RPG::Actor 对象

Parameters:

  • actor (RPG::Actor)

    待注入的 RPG::Actor 对象



101
102
103
104
# File 'lib/R3EXS/RGSS3_R3EXS.rb', line 101

def inject_to(actor)
    super(actor)
    actor.nickname = @nickname
end