Current section
Files
Jump to
Current section
Files
lib/structs/assets/unity_prefab_asset.ex
defmodule Manganese.SerializationKit.Structs.UnityPrefabAsset do
@moduledoc """
"""
alias Manganese.SerializationKit.Structs
alias Manganese.SerializationKit.Enumerations
@typedoc """
"""
@type t :: %Structs.UnityPrefabAsset{
path: String.t,
id: Structs.UnityAsset.id,
name: String.t,
root_game_object: String.t,
type: Enumerations.UnityAssetType.t
}
defstruct [
:path,
:id,
:name,
:root_game_object,
type: :game_object
]
# Deserialization
@doc """
"""
@spec from_map(t_external) :: t
def from_map(%{ "path" => path, "id" => id, "name" => name, "root_game_object" => root_game_object }) do
%Structs.UnityPrefabAsset{
path: path,
id: id,
name: name,
root_game_object: Structs.UnityGameObject.from_map root_game_object
}
end
# Serialization
@type t_external :: map
@doc """
"""
@spec to_map(t) :: t_external
def to_map(%Structs.UnityPrefabAsset{
path: path,
id: id,
name: name,
root_game_object: root_game_object,
type: type
}) do
%{
"path" => path,
"id" => id,
"name" => name,
"root_game_object" => Structs.UnityGameObject.to_map(root_game_object),
"type" => Enumerations.UnityAssetType.to_integer(type)
}
end
end