Class FaceObjectProviders


  • public class FaceObjectProviders
    extends java.lang.Object
    Provider for faces of GameObjects and Archetypes. The face can be the "normal" (default) face or a filtered variant such as (semi-)transparent and/or double height.
    • Constructor Detail

      • FaceObjectProviders

        public FaceObjectProviders​(int doubleFaceOffset,
                                   @NotNull
                                   @NotNull FaceObjects faceObjects,
                                   @NotNull
                                   @NotNull ResourceIcons resourceIcons)
        Creates a new instance.
        Parameters:
        doubleFaceOffset - the offset for shifting double faces
        faceObjects - the face objects instance
        resourceIcons - the resource icons for creating icons
    • Method Detail

      • reloadAll

        public void reloadAll()
        Reloads all providers provided by this FaceObjects.
      • setNormal

        public void setNormal​(@NotNull
                              @NotNull FaceProvider normalFaceProvider)
        Sets the normal FaceProvider. The normal face provider also serves as parent for all other face providers.
        Parameters:
        normalFaceProvider - face the provider that provides normal images
      • getFace

        @NotNull
        public <G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>> @NotNull javax.swing.ImageIcon getFace​(@NotNull
                                                                                                                                                                              @NotNull BaseObject<G,​A,​R,​?> baseObject)
        Returns the face of a BaseObject as an ImageIcon.
        Parameters:
        baseObject - the base object to get the face for
        Returns:
        the face of the base object as an icon or null if no face could be found
      • getTrans

        @NotNull
        public @NotNull javax.swing.ImageIcon getTrans​(@NotNull
                                                       @NotNull GameObject<?,​?,​?> gameObject)
        Returns the transparent face for a GameObject as an ImageIcon.
        Parameters:
        gameObject - the game object
        Returns:
        the image icon
      • getDouble

        @NotNull
        public @NotNull javax.swing.ImageIcon getDouble​(@NotNull
                                                        @NotNull GameObject<?,​?,​?> gameObject)
        Returns the double face for a GameObject as an ImageIcon.
        Parameters:
        gameObject - the game object
        Returns:
        the image icon
      • getTransDouble

        @NotNull
        public @NotNull javax.swing.ImageIcon getTransDouble​(@NotNull
                                                             @NotNull GameObject<?,​?,​?> gameObject)
        Returns the transparent double face for a GameObject as an ImageIcon.
        Parameters:
        gameObject - the game object
        Returns:
        the image icon
      • getStretched

        @NotNull
        public @NotNull javax.swing.ImageIcon getStretched​(@NotNull
                                                           @NotNull GameObject<?,​?,​?> gameObject,
                                                           long stretch)
        Returns the stretched face for a GameObject as an ImageIcon.
        Parameters:
        gameObject - the game object
        Returns:
        the image icon
      • getImageIconForFacename

        @Nullable
        public @Nullable javax.swing.ImageIcon getImageIconForFacename​(@NotNull
                                                                       @NotNull java.lang.String faceObjName)
        Returns the ImageIcon for a given face object name.
        Parameters:
        faceObjName - the face object name
        Returns:
        the image icon or null if not found
      • getDisplayIcon

        @Nullable
        public @Nullable javax.swing.ImageIcon getDisplayIcon​(@NotNull
                                                              @NotNull NamedObject namedObject)
        Returns the display icon for a NamedObject.
        Parameters:
        namedObject - the named object
        Returns:
        display icon of this AbstractNamedObject