Class: Color

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

Overview

RPG Maker VX Ace Color 类

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



5
6
7
# File 'lib/R3EXS/RGSS3.rb', line 5

def alpha
  @alpha
end

#blueObject

Returns the value of attribute blue.



5
6
7
# File 'lib/R3EXS/RGSS3.rb', line 5

def blue
  @blue
end

#greenObject

Returns the value of attribute green.



5
6
7
# File 'lib/R3EXS/RGSS3.rb', line 5

def green
  @green
end

#redObject

Returns the value of attribute red.



5
6
7
# File 'lib/R3EXS/RGSS3.rb', line 5

def red
  @red
end

Class Method Details

._load(obj) ⇒ Color

反序列化 Color 对象

Parameters:

  • obj (String)

    序列化后的字符串

Returns:



22
23
24
25
26
27
28
29
30
# File 'lib/R3EXS/RGSS3.rb', line 22

def self._load(obj)
  r, g, b, a = obj.unpack('D4')
  instance = Color.allocate
  instance.red = r
  instance.green = g
  instance.blue = b
  instance.alpha = a
  instance
end

Instance Method Details

#_dump(_level) ⇒ String

序列化 Color 对象

Returns:



13
14
15
# File 'lib/R3EXS/RGSS3.rb', line 13

def _dump(_level)
  [@red, @green, @blue, @alpha].pack('D4')
end