Class: Mikunyan::AssetBundle
- Inherits:
-
Object
- Object
- Mikunyan::AssetBundle
- Defined in:
- lib/mikunyan/asset_bundle.rb
Overview
Class for representing Unity AssetBundle
Defined Under Namespace
Classes: AssetEntry
Instance Attribute Summary collapse
-
#assets ⇒ Array<Mikunyan::Asset>
readonly
contained Assets.
-
#blobs ⇒ Object
readonly
Returns the value of attribute blobs.
-
#format ⇒ Integer
readonly
file format number.
-
#generator_version ⇒ String
readonly
version string of generator.
-
#guid ⇒ String
readonly
unique identifier (can be zero).
-
#signature ⇒ String
readonly
file signature (UnityRaw or UnityFS).
-
#unity_version ⇒ String
readonly
version string of Unity for this AssetBundle.
Class Method Summary collapse
-
.file(file) ⇒ Mikunyan::AssetBundle
Loads AssetBundle from file.
-
.load(bin) ⇒ Mikunyan::AssetBundle
Loads AssetBundle from binary string.
Instance Method Summary collapse
- #[](index) ⇒ Mikunyan::Asset?
-
#each_asset(&block) ⇒ Enumerator<Mikunyan::Asset>, Array<Mikunyan::Asset>
Same as assets.each.
Instance Attribute Details
#assets ⇒ Array<Mikunyan::Asset> (readonly)
contained Assets
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def assets @assets end |
#blobs ⇒ Object (readonly)
Returns the value of attribute blobs.
17 18 19 |
# File 'lib/mikunyan/asset_bundle.rb', line 17 def blobs @blobs end |
#format ⇒ Integer (readonly)
file format number
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def format @format end |
#generator_version ⇒ String (readonly)
version string of generator
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def generator_version @generator_version end |
#guid ⇒ String (readonly)
unique identifier (can be zero)
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def guid @guid end |
#signature ⇒ String (readonly)
file signature (UnityRaw or UnityFS)
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def signature @signature end |
#unity_version ⇒ String (readonly)
version string of Unity for this AssetBundle
16 17 18 |
# File 'lib/mikunyan/asset_bundle.rb', line 16 def unity_version @unity_version end |
Class Method Details
.file(file) ⇒ Mikunyan::AssetBundle
Loads AssetBundle from file
45 46 47 48 49 |
# File 'lib/mikunyan/asset_bundle.rb', line 45 def self.file(file) File.open(file, 'rb') do |io| AssetBundle.load(io) end end |
.load(bin) ⇒ Mikunyan::AssetBundle
Loads AssetBundle from binary string
36 37 38 39 40 |
# File 'lib/mikunyan/asset_bundle.rb', line 36 def self.load(bin) r = AssetBundle.new r.send(:load, bin) r end |
Instance Method Details
#[](index) ⇒ Mikunyan::Asset?
23 24 25 |
# File 'lib/mikunyan/asset_bundle.rb', line 23 def [](index) index.is_a?(String) ? @assets.find {|e| e.name == index} : @assets[index] end |
#each_asset(&block) ⇒ Enumerator<Mikunyan::Asset>, Array<Mikunyan::Asset>
Same as assets.each
29 30 31 |
# File 'lib/mikunyan/asset_bundle.rb', line 29 def each_asset(&block) @assets.each(&block) end |