示例#1
0
 public SpriteSheet(ITrackedTexture trackedTexture, int spriteWidth, int spriteHeight)
 {
     this.TrackedTexture = trackedTexture;
     this._spriteWidth   = spriteWidth;
     this._spriteHeight  = spriteHeight;
     this._widthInTiles  = trackedTexture.CurrentTexture.Width / this._spriteWidth;
 }
示例#2
0
        protected SlimeManager(ICoreApi coreApi, string slimeName)
        {
            this.CoreApi           = coreApi;
            this.SlimeName         = slimeName;
            this.SlimeLocation     = new AssetLocation($@"Characters\Monsters\{this.SlimeName}", ContentSource.GameContent);
            this.OverriddenTexture = coreApi.Drawing.GetTrackedTexture(this.SlimeLocation);

            this.OverriddenTexture.Drawing += (sender, info) => this.OverrideDraw(info);
        }
示例#3
0
        public ISpriteSheet CreateSimpleSpriteSheet(ITrackedTexture trackedTexture, int spriteWidth, int spriteHeight)
        {
            string preferredProperty = trackedTexture.CurrentTexture.Match <Texture2D, string>()
                                       .When(this.ObjectSpriteSheet.TrackedTexture.CurrentTexture, nameof(DrawingApi.ObjectSpriteSheet))
                                       .When(this.CraftableSpriteSheet.TrackedTexture.CurrentTexture, nameof(DrawingApi.CraftableSpriteSheet))
                                       .Else((string)null);

            if (preferredProperty != null)
            {
                this._coreApiHelper.Owner.Monitor.Log($"A new sprite sheet was created for a texture which already has a sprite sheet provided. {nameof(IDrawingInfo)}.{preferredProperty} should be used instead.", LogLevel.Warn);
            }

            return(new SpriteSheet(trackedTexture, spriteWidth, spriteHeight));
        }
 public HatSpriteSheet(ITrackedTexture trackedTexture) : base(trackedTexture, 20, 20)
 {
 }