[][src]Trait amethyst_assets::PrefabData

pub trait PrefabData<'a> {
    type SystemData: SystemData<'a>;
    type Result;
    fn add_to_entity(
        &self,
        entity: Entity,
        system_data: &mut Self::SystemData,
        entities: &[Entity],
        children: &[Entity]
    ) -> Result<Self::Result, Error>; fn load_sub_assets(
        &mut self,
        _progress: &mut ProgressCounter,
        _system_data: &mut Self::SystemData
    ) -> Result<bool, Error> { ... } }

Trait for loading a prefabs data for a single entity

Associated Types

type SystemData: SystemData<'a>

SystemData needed to perform the load

type Result

The result type returned by the load operation

Loading content...

Required methods

fn add_to_entity(
    &self,
    entity: Entity,
    system_data: &mut Self::SystemData,
    entities: &[Entity],
    children: &[Entity]
) -> Result<Self::Result, Error>

Add the data for this prefab onto the given Entity

This can also be used to load resources, the recommended way of doing so is to put the resources on the main Entity of the Prefab

Parameters:

  • entity: Entity to load components on, or the root Entity for the resource scenario
  • system_data: SystemData needed to do the loading
  • entities: Some components need access to the entities that was created as part of the full prefab, for linking purposes, so this contains all those Entitys.
  • children: Entities that need access to the Hierarchy in this function won't be able to access it yet, since it is only updated after this function runs. As a work- around, this slice includes all hierarchical children of the entity being passed.
Loading content...

Provided methods

fn load_sub_assets(
    &mut self,
    _progress: &mut ProgressCounter,
    _system_data: &mut Self::SystemData
) -> Result<bool, Error>

Trigger asset loading for any sub assets.

Parameters:

  • progress: Progress structure that needs to be used for tracking progress of sub loads
  • system_data: SystemData for the prefab

Returns

  • Err(error) - if an Error occurs
  • Ok(false) - if no sub assets need loading
  • Ok(true) - if sub assets need loading, in this case the sub asset load must be added to the given progress tracker

Type parameters:

  • P: Progress tracker
Loading content...

Implementations on Foreign Types

impl<'a, T> PrefabData<'a> for Option<T> where
    T: PrefabData<'a>, 
[src]

type SystemData = <T as PrefabData<'a>>::SystemData

type Result = Option<<T as PrefabData<'a>>::Result>

impl<'a> PrefabData<'a> for Transform[src]

type SystemData = WriteStorage<'a, Transform>

type Result = ()

impl<'a> PrefabData<'a> for Named[src]

type SystemData = (WriteStorage<'a, Named>,)

type Result = ()

impl<'a> PrefabData<'a> for ()[src]

type SystemData = ()

type Result = ()

impl<'a, A> PrefabData<'a> for (A,) where
    A: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData,)

type Result = ()

impl<'a, A, B> PrefabData<'a> for (A, B) where
    A: PrefabData<'a>,
    B: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData)

type Result = ()

impl<'a, A, B, C> PrefabData<'a> for (A, B, C) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData)

type Result = ()

impl<'a, A, B, C, D> PrefabData<'a> for (A, B, C, D) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData)

type Result = ()

impl<'a, A, B, C, D, E> PrefabData<'a> for (A, B, C, D, E) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F> PrefabData<'a> for (A, B, C, D, E, F) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G> PrefabData<'a> for (A, B, C, D, E, F, G) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H> PrefabData<'a> for (A, B, C, D, E, F, G, H) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I> PrefabData<'a> for (A, B, C, D, E, F, G, H, I) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>,
    Q: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData, Q::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>,
    Q: PrefabData<'a>,
    R: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData, Q::SystemData, R::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>,
    Q: PrefabData<'a>,
    R: PrefabData<'a>,
    S: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData, Q::SystemData, R::SystemData, S::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>,
    Q: PrefabData<'a>,
    R: PrefabData<'a>,
    S: PrefabData<'a>,
    T: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData, Q::SystemData, R::SystemData, S::SystemData, T::SystemData)

type Result = ()

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> PrefabData<'a> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) where
    A: PrefabData<'a>,
    B: PrefabData<'a>,
    C: PrefabData<'a>,
    D: PrefabData<'a>,
    E: PrefabData<'a>,
    F: PrefabData<'a>,
    G: PrefabData<'a>,
    H: PrefabData<'a>,
    I: PrefabData<'a>,
    J: PrefabData<'a>,
    K: PrefabData<'a>,
    L: PrefabData<'a>,
    M: PrefabData<'a>,
    N: PrefabData<'a>,
    O: PrefabData<'a>,
    P: PrefabData<'a>,
    Q: PrefabData<'a>,
    R: PrefabData<'a>,
    S: PrefabData<'a>,
    T: PrefabData<'a>,
    U: PrefabData<'a>, 
[src]

type SystemData = (A::SystemData, B::SystemData, C::SystemData, D::SystemData, E::SystemData, F::SystemData, G::SystemData, H::SystemData, I::SystemData, J::SystemData, K::SystemData, L::SystemData, M::SystemData, N::SystemData, O::SystemData, P::SystemData, Q::SystemData, R::SystemData, S::SystemData, T::SystemData, U::SystemData)

type Result = ()

Loading content...

Implementors

impl<'a, A, F> PrefabData<'a> for AssetPrefab<A, F> where
    A: Asset,
    F: Format<A::Data>, 
[src]

type SystemData = (ReadExpect<'a, Loader>, WriteStorage<'a, Handle<A>>, Read<'a, AssetStorage<A>>)

type Result = Handle<A>

Loading content...