Class: Table
- Inherits:
-
Object
- Object
- Table
- Defined in:
- lib/R3EXS/RGSS3.rb
Overview
RPG Maker VX Ace Table 类
Table 是一个多维数组,每个元素都是带符号的两字节整数(int16_t), 也就是 -32,768~32,767 之间的整数
Ruby Array 类在处理大量信息时效率很差,因此使用了此类。
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#dim ⇒ Object
Returns the value of attribute dim.
-
#xsize ⇒ Object
Returns the value of attribute xsize.
-
#ysize ⇒ Object
Returns the value of attribute ysize.
-
#zsize ⇒ Object
Returns the value of attribute zsize.
Class Method Summary collapse
-
._load(obj) ⇒ Table
反序列化 Table 对象.
Instance Method Summary collapse
-
#_dump(_level) ⇒ String
序列化 Table 对象.
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
84 85 86 |
# File 'lib/R3EXS/RGSS3.rb', line 84 def data @data end |
#dim ⇒ Object
Returns the value of attribute dim.
84 85 86 |
# File 'lib/R3EXS/RGSS3.rb', line 84 def dim @dim end |
#xsize ⇒ Object
Returns the value of attribute xsize.
84 85 86 |
# File 'lib/R3EXS/RGSS3.rb', line 84 def xsize @xsize end |
#ysize ⇒ Object
Returns the value of attribute ysize.
84 85 86 |
# File 'lib/R3EXS/RGSS3.rb', line 84 def ysize @ysize end |
#zsize ⇒ Object
Returns the value of attribute zsize.
84 85 86 |
# File 'lib/R3EXS/RGSS3.rb', line 84 def zsize @zsize end |
Class Method Details
._load(obj) ⇒ Table
反序列化 Table 对象
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/R3EXS/RGSS3.rb', line 103 def self._load(obj) dim, xsize, ysize, zsize, total_size, *data = obj.unpack('L5s*') instance = allocate instance.dim = dim instance.xsize = xsize instance.ysize = ysize instance.zsize = zsize instance.data = data.first(total_size) instance end |
Instance Method Details
#_dump(_level) ⇒ String
序列化 Table 对象
93 94 95 96 |
# File 'lib/R3EXS/RGSS3.rb', line 93 def _dump(_level) total = @xsize * @ysize * @zsize [@dim, @xsize, @ysize, @zsize, total].pack('L5') + @data.pack('s*') end |