using System; using System.Collections.Generic; using Robust.Client.Graphics; using Robust.Shared.Animations; using Robust.Shared.GameObjects; using Robust.Shared.Maths; using Robust.Shared.Utility; namespace Robust.Client.GameObjects { public interface ISpriteComponent : IComponent, IAnimationProperties { void FrameUpdate(float delta); bool Visible { get; set; } /// /// Z-index for drawing. /// int DrawDepth { get; set; } /// /// A scale applied to all layers. /// [Animatable] Vector2 Scale { get; set; } /// /// A rotation applied to all layers. /// [Animatable] Angle Rotation { get; set; } /// /// Offset applied to all layers. /// [Animatable] Vector2 Offset { get; set; } /// /// Color to multiply all layers with. /// [Animatable] Color Color { get; set; } /// /// All sprite rotation is locked, and will always be drawn upright on /// the screen, regardless of world or view orientation. /// bool NoRotation {get; set; } /// /// Enables overriding the calculated directional RSI state for this sprite. /// The state to use is defined in . /// bool EnableDirectionOverride { get; set; } /// /// The directional RSI state that will always be displayed, regardless of orientation. /// Direction DirectionOverride { get; set; } // NOTE: The below are ALL designed to NOT throw exceptions ever, // instead making a bunch of noisy error logs. /// /// The RSI that is currently used as "base". /// Layers will fall back to this RSI if they do not have their own RSI set. /// RSI? BaseRSI { get; set; } ShaderInstance? PostShader { get; set; } uint RenderOrder { get; set; } bool IsInert { get; } Matrix3 GetLocalMatrix(); /// /// Sets a layer key to the layer map, creating it if it does not exist. /// /// The key for this entry. /// The layer this entry points to. /// /// Thrown if does not exist. /// /// /// Thrown if is null. /// void LayerMapSet(object key, int layer); /// /// Removes an entry from the layer map. /// /// The key to remove. /// /// Thrown if is null. /// void LayerMapRemove(object key); /// /// Gets the index of a layer specified in the layer map. /// /// The key for the entry to look up. /// /// Thrown if is null. /// int LayerMapGet(object key); /// /// Thrown if is null. /// bool LayerMapTryGet(object key, out int layer); /// /// Create a new blank layer and add it to the layer map, /// only if the key does not already exist on the layer map. /// /// /// This is useful to allow layer map configs to be defined in prototypes, /// while still allowing code to create configs if they're absent. /// void LayerMapReserveBlank(object key); /// /// Adds a layer without texture (thus falling back to the error texture). /// The layer defaults to invisible. /// /// If not null, the index of this new layer. /// Index of the new layer. int AddBlankLayer(int? newIndex = null); int AddLayer(Texture texture, int? newIndex = null); int AddLayer(string texturePath, int? newIndex = null); int AddLayer(ResourcePath texturePath, int? newIndex = null); int AddLayer(RSI.StateId stateId, int? newIndex = null); int AddLayerState(string stateId, int? newIndex = null); int AddLayer(RSI.StateId stateId, RSI rsi, int? newIndex = null); int AddLayerState(string stateId, RSI rsi, int? newIndex = null); int AddLayer(RSI.StateId stateId, string rsiPath, int? newIndex = null); int AddLayerState(string stateId, string rsiPath, int? newIndex = null); int AddLayer(RSI.StateId stateId, ResourcePath rsiPath, int? newIndex = null); int AddLayerState(string stateId, ResourcePath rsiPath, int? newIndex = null); int AddLayer(SpriteSpecifier specifier, int? newIndex = null); void RemoveLayer(int layer); void RemoveLayer(object layerKey); void LayerSetShader(int layer, ShaderInstance shader); void LayerSetShader(object layerKey, ShaderInstance shader); void LayerSetShader(int layer, string shaderName); void LayerSetShader(object layerKey, string shaderName); void LayerSetSprite(int layer, SpriteSpecifier specifier); void LayerSetSprite(object layerKey, SpriteSpecifier specifier); void LayerSetTexture(int layer, Texture texture); void LayerSetTexture(object layerKey, Texture texture); void LayerSetTexture(int layer, string texturePath); void LayerSetTexture(object layerKey, string texturePath); void LayerSetTexture(int layer, ResourcePath texturePath); void LayerSetTexture(object layerKey, ResourcePath texturePath); void LayerSetState(int layer, RSI.StateId stateId); void LayerSetState(object layerKey, RSI.StateId stateId); void LayerSetState(int layer, RSI.StateId stateId, RSI rsi); void LayerSetState(object layerKey, RSI.StateId stateId, RSI rsi); void LayerSetState(int layer, RSI.StateId stateId, string rsiPath); void LayerSetState(object layerKey, RSI.StateId stateId, string rsiPath); void LayerSetState(int layer, RSI.StateId stateId, ResourcePath rsiPath); void LayerSetState(object layerKey, RSI.StateId stateId, ResourcePath rsiPath); void LayerSetRSI(int layer, RSI rsi); void LayerSetRSI(object layerKey, RSI rsi); void LayerSetRSI(int layer, string rsiPath); void LayerSetRSI(object layerKey, string rsiPath); void LayerSetRSI(int layer, ResourcePath rsiPath); void LayerSetRSI(object layerKey, ResourcePath rsiPath); void LayerSetScale(int layer, Vector2 scale); void LayerSetScale(object layerKey, Vector2 scale); void LayerSetRotation(int layer, Angle rotation); void LayerSetRotation(object layerKey, Angle rotation); void LayerSetVisible(int layer, bool visible); void LayerSetVisible(object layerKey, bool visible); void LayerSetColor(int layer, Color color); void LayerSetColor(object layerKey, Color color); // Yes, I realize how silly it is to reference an enum in the concrete implementation. // I don't care. void LayerSetDirOffset(int layer, SpriteComponent.DirectionOffset offset); void LayerSetDirOffset(object layerKey, SpriteComponent.DirectionOffset offset); void LayerSetAnimationTime(int layer, float animationTime); void LayerSetAnimationTime(object layerKey, float animationTime); void LayerSetAutoAnimated(int layer, bool autoAnimated); void LayerSetAutoAnimated(object layerKey, bool autoAnimated); RSI.StateId LayerGetState(int layer); /// /// Get the RSI used by a layer. /// RSI? LayerGetActualRSI(int layer); /// /// Get the RSI used by a layer. /// RSI? LayerGetActualRSI(object layerKey); ISpriteLayer this[int layer] { get; } ISpriteLayer this[Index layer] { get; } ISpriteLayer this[object layerKey] { get; } IEnumerable AllLayers { get; } int GetLayerDirectionCount(ISpriteLayer layer); /// /// Calculate sprite bounding box in world-space coordinates. /// Box2 CalculateBoundingBox(Vector2 worldPos); } }