• Require a resource from a ResourceLoader.

    If

    Res

    is used the field-name is also a property that can be overwritten/defined in the map, EDF or during initialization.

    Replaces:

    static requires = {
    props: {
    sheet1: 'string', << required!
    sheet2: ['string', 'path/to/sheet] << with default
    },
    res: props => [
    ['sheet', props.sheet1],
    ['sheet', props.sheet2],
    ]
    }

    private sheet1:SpriteSheet;
    private sheet2:SpriteSheet;

    onInit() {
    this.sheet1 = this.requireResource('sheet', 'sheet1');
    this.sheet2 = this.requireResource('sheet', 'sheet2');
    }

    With:

    @res('sheet')
    private sheet1:SpriteSheet;

    @res('sheet', 'path/to/sheet')
    private sheet2:SpriteSheet;

    Parameters

    • loaderId: string
    • Optional path: string

    Returns ((target: any, memberName: string) => void)

      • (target: any, memberName: string): void
      • Parameters

        • target: any
        • memberName: string

        Returns void

Generated using TypeDoc