class RPG::Animation

Public Class Methods

new(hash) click to toggle source
# File lib/rmxp_extractor/classnames.rb, line 728
def initialize(hash)
  @id = hash["id"]
  @name = hash["name"]
  @animation_name = hash["animation_name"]
  @animation_hue = hash["animation_hue"]
  @position = hash["position"]
  @frame_max = hash["frame_max"]
  @frames = []
  @timings = []
  hash["frames"].each_with_index do |value|
    @frames << RPG::Animation::Frame.new(value)
  end
  hash["timings"].each_with_index do |value|
    @timings << RPG::Animation::Timing.new(value)
  end
end

Public Instance Methods

hash() click to toggle source
# File lib/rmxp_extractor/classnames.rb, line 745
def hash
  dump = {
    id: @id,
    name: @name,
    animation_name: @animation_name,
    animation_hue: @animation_hue,
    position: @position,
    frame_max: @frame_max,
    frames: [],
    timings: [],
  }
  @frames.each_with_index do |value|
    dump[:frames] << value.hash
  end
  @timings.each_with_index do |value|
    dump[:timings] << value.hash
  end
  dump
end