示例#1
0
 public void Update(
     BestiaryUICollectionInfo providedInfo,
     Rectangle hitbox,
     EntryIconDrawSettings settings)
 {
     this.UpdateUnlockState(this.GetUnlockState(providedInfo));
 }
示例#2
0
        private void AdjustSpecialSpawnRulesForVisuals(EntryIconDrawSettings settings)
        {
            int num;

            if (NPCID.Sets.SpecialSpawningRules.TryGetValue(this._npcNetId, out num) && num == 0)
            {
                Point tileCoordinates = (this._npcCache.position - this._npcCache.rotation.ToRotationVector2() * -1600f).ToTileCoordinates();
                this._npcCache.ai[0] = (float)tileCoordinates.X;
                this._npcCache.ai[1] = (float)tileCoordinates.Y;
            }
            switch (this._npcNetId)
            {
            case 244:
                this._npcCache.AI_001_SetRainbowSlimeColor();
                break;

            case 299:
            case 538:
            case 539:
            case 639:
            case 640:
            case 641:
            case 642:
            case 643:
            case 644:
            case 645:
                if (!settings.IsPortrait || this._npcCache.frame.Y != 0)
                {
                    break;
                }
                this._npcCache.frame.Y = this._npcCache.frame.Height;
                break;

            case 330:
            case 372:
            case 586:
            case 587:
            case 619:
            case 620:
                this._npcCache.alpha = 0;
                break;

            case 356:
                this._npcCache.ai[2] = 1f;
                break;

            case 636:
                this._npcCache.Opacity = 1f;
                if ((double)++this._npcCache.localAI[0] < 44.0)
                {
                    break;
                }
                this._npcCache.localAI[0] = 0.0f;
                break;

            case 656:
                this._npcCache.townNpcVariationIndex = 1;
                break;
            }
        }
示例#3
0
        public void Draw(
            BestiaryUICollectionInfo providedInfo,
            SpriteBatch spriteBatch,
            EntryIconDrawSettings settings)
        {
            Rectangle iconbox = settings.iconbox;

            spriteBatch.Draw(this._textureAsset.get_Value(), iconbox.Center.ToVector2() + Vector2.One, new Rectangle?(this._sourceRectangle), Color.White, 0.0f, this._sourceRectangle.Size() / 2f, 1f, SpriteEffects.None, 0.0f);
        }
示例#4
0
        private void AdjustSpecialSpawnRulesForVisuals(EntryIconDrawSettings settings)
        {
            if (NPCID.Sets.SpecialSpawningRules.TryGetValue(_npcNetId, out var value) && value == 0)
            {
                Point point = (_npcCache.position - _npcCache.rotation.ToRotationVector2() * -1600f).ToTileCoordinates();
                _npcCache.ai[0] = point.X;
                _npcCache.ai[1] = point.Y;
            }
            switch (_npcNetId)
            {
            case 244:
                _npcCache.AI_001_SetRainbowSlimeColor();
                break;

            case 356:
                _npcCache.ai[2] = 1f;
                break;

            case 330:
            case 372:
            case 586:
            case 587:
            case 619:
            case 620:
                _npcCache.alpha = 0;
                break;

            case 299:
            case 538:
            case 539:
            case 639:
            case 640:
            case 641:
            case 642:
            case 643:
            case 644:
            case 645:
                if (settings.IsPortrait && _npcCache.frame.Y == 0)
                {
                    _npcCache.frame.Y = _npcCache.frame.Height;
                }
                break;

            case 636:
                _npcCache.Opacity = 1f;
                if ((_npcCache.localAI[0] += 1f) >= 44f)
                {
                    _npcCache.localAI[0] = 0f;
                }
                break;

            case 656:
                _npcCache.townNpcVariationIndex = 1;
                break;
            }
        }
示例#5
0
 private void UpdatePosition(EntryIconDrawSettings settings)
 {
     if (_npcCache.noGravity)
     {
         _npcCache.Center = settings.iconbox.Center.ToVector2() + _positionOffsetCache;
     }
     else
     {
         _npcCache.Bottom = settings.iconbox.TopLeft() + settings.iconbox.Size() * new Vector2(0.5f, 1f) + new Vector2(0f, -8f) + _positionOffsetCache;
     }
     _npcCache.position = _npcCache.position;
 }
示例#6
0
 private void UpdatePosition(EntryIconDrawSettings settings)
 {
     if (this._npcCache.noGravity)
     {
         this._npcCache.Center = settings.iconbox.Center.ToVector2() + this._positionOffsetCache;
     }
     else
     {
         this._npcCache.Bottom = settings.iconbox.TopLeft() + settings.iconbox.Size() * new Vector2(0.5f, 1f) + new Vector2(0.0f, -8f) + this._positionOffsetCache;
     }
     this._npcCache.position = this._npcCache.position.Floor();
 }
示例#7
0
 public void Draw(
     BestiaryUICollectionInfo providedInfo,
     SpriteBatch spriteBatch,
     EntryIconDrawSettings settings)
 {
     this.UpdatePosition(settings);
     if (this._customTexture != null)
     {
         spriteBatch.Draw(this._customTexture.get_Value(), this._npcCache.Center, new Rectangle?(), Color.White, 0.0f, this._customTexture.Size() / 2f, this._npcCache.scale, SpriteEffects.None, 0.0f);
     }
     else
     {
         ITownNPCProfile profile;
         if (this._npcCache.townNPC && TownNPCProfiles.Instance.GetProfile(this._npcCache.type, out profile))
         {
             TextureAssets.Npc[this._npcCache.type] = profile.GetTextureNPCShouldUse(this._npcCache);
         }
         Main.instance.DrawNPCDirect(spriteBatch, this._npcCache, this._npcCache.behindTiles, Vector2.Zero);
     }
 }
示例#8
0
        public void Update(BestiaryUICollectionInfo providedInfo, Rectangle hitbox, EntryIconDrawSettings settings)
        {
            Vector2           positionOffsetCache = default(Vector2);
            int?              num  = null;
            int?              num2 = null;
            int?              num3 = null;
            bool              wet  = false;
            float             num4 = 0f;
            Asset <Texture2D> val  = null;

            if (NPCID.Sets.NPCBestiaryDrawOffset.TryGetValue(_npcNetId, out var value))
            {
                _npcCache.rotation = value.Rotation;
                _npcCache.scale    = value.Scale;
                if (value.PortraitScale.HasValue && settings.IsPortrait)
                {
                    _npcCache.scale = value.PortraitScale.Value;
                }
                positionOffsetCache = value.Position;
                num  = value.Frame;
                num2 = value.Direction;
                num3 = value.SpriteDirection;
                num4 = value.Velocity;
                wet  = value.IsWet;
                if (value.PortraitPositionXOverride.HasValue && settings.IsPortrait)
                {
                    positionOffsetCache.X = value.PortraitPositionXOverride.Value;
                }
                if (value.PortraitPositionYOverride.HasValue && settings.IsPortrait)
                {
                    positionOffsetCache.Y = value.PortraitPositionYOverride.Value;
                }
                if (value.CustomTexturePath != null)
                {
                    val = Main.Assets.Request <Texture2D>(value.CustomTexturePath, Main.content, (AssetRequestMode)1);
                }
                if (val != null && val.IsLoaded)
                {
                    _customTexture = val;
                }
            }
            _positionOffsetCache = positionOffsetCache;
            UpdatePosition(settings);
            if (NPCID.Sets.TrailingMode[_npcCache.type] != -1)
            {
                for (int i = 0; i < _npcCache.oldPos.Length; i++)
                {
                    _npcCache.oldPos[i] = _npcCache.position;
                }
            }
            _npcCache.direction = (_npcCache.spriteDirection = (num2.HasValue ? num2.Value : (-1)));
            if (num3.HasValue)
            {
                _npcCache.spriteDirection = num3.Value;
            }
            _npcCache.wet = wet;
            AdjustSpecialSpawnRulesForVisuals(settings);
            SimulateFirstHover(num4);
            if (!num.HasValue && (settings.IsPortrait || settings.IsHovered))
            {
                _npcCache.velocity.X = (float)_npcCache.direction * num4;
                _npcCache.FindFrame();
            }
            else if (num.HasValue)
            {
                _npcCache.FindFrame();
                _npcCache.frame.Y = _npcCache.frame.Height * num.Value;
            }
        }
示例#9
0
 public void Draw(BestiaryUICollectionInfo providedInfo, SpriteBatch spriteBatch, EntryIconDrawSettings settings)
 {
     UpdatePosition(settings);
     if (_customTexture != null)
     {
         spriteBatch.Draw(_customTexture.Value, _npcCache.Center, null, Color.White, 0f, _customTexture.Size() / 2f, _npcCache.scale, SpriteEffects.None, 0f);
         return;
     }
     if (_npcCache.townNPC && TownNPCProfiles.Instance.GetProfile(_npcCache.type, out var profile))
     {
         TextureAssets.Npc[_npcCache.type] = profile.GetTextureNPCShouldUse(_npcCache);
     }
     Main.instance.DrawNPCDirect(spriteBatch, _npcCache, _npcCache.behindTiles, Vector2.Zero);
 }
示例#10
0
        public void Update(
            BestiaryUICollectionInfo providedInfo,
            Rectangle hitbox,
            EntryIconDrawSettings settings)
        {
            Vector2           vector2   = new Vector2();
            int?              nullable1 = new int?();
            int?              nullable2 = new int?();
            int?              nullable3 = new int?();
            bool              flag      = false;
            float             velocity  = 0.0f;
            Asset <Texture2D> asset     = (Asset <Texture2D>)null;

            NPCID.Sets.NPCBestiaryDrawModifiers bestiaryDrawModifiers;
            if (NPCID.Sets.NPCBestiaryDrawOffset.TryGetValue(this._npcNetId, out bestiaryDrawModifiers))
            {
                this._npcCache.rotation = bestiaryDrawModifiers.Rotation;
                this._npcCache.scale    = bestiaryDrawModifiers.Scale;
                if (bestiaryDrawModifiers.PortraitScale.HasValue && settings.IsPortrait)
                {
                    this._npcCache.scale = bestiaryDrawModifiers.PortraitScale.Value;
                }
                vector2   = bestiaryDrawModifiers.Position;
                nullable1 = bestiaryDrawModifiers.Frame;
                nullable2 = bestiaryDrawModifiers.Direction;
                nullable3 = bestiaryDrawModifiers.SpriteDirection;
                velocity  = bestiaryDrawModifiers.Velocity;
                flag      = bestiaryDrawModifiers.IsWet;
                if (bestiaryDrawModifiers.PortraitPositionXOverride.HasValue && settings.IsPortrait)
                {
                    vector2.X = bestiaryDrawModifiers.PortraitPositionXOverride.Value;
                }
                if (bestiaryDrawModifiers.PortraitPositionYOverride.HasValue && settings.IsPortrait)
                {
                    vector2.Y = bestiaryDrawModifiers.PortraitPositionYOverride.Value;
                }
                if (bestiaryDrawModifiers.CustomTexturePath != null)
                {
                    asset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>(bestiaryDrawModifiers.CustomTexturePath, (AssetRequestMode)1);
                }
                if (asset != null && asset.get_IsLoaded())
                {
                    this._customTexture = asset;
                }
            }
            this._positionOffsetCache = vector2;
            this.UpdatePosition(settings);
            if (NPCID.Sets.TrailingMode[this._npcCache.type] != -1)
            {
                for (int index = 0; index < this._npcCache.oldPos.Length; ++index)
                {
                    this._npcCache.oldPos[index] = this._npcCache.position;
                }
            }
            this._npcCache.direction = this._npcCache.spriteDirection = nullable2.HasValue ? nullable2.Value : -1;
            if (nullable3.HasValue)
            {
                this._npcCache.spriteDirection = nullable3.Value;
            }
            this._npcCache.wet = flag;
            this.AdjustSpecialSpawnRulesForVisuals(settings);
            this.SimulateFirstHover(velocity);
            if (!nullable1.HasValue && (settings.IsPortrait || settings.IsHovered))
            {
                this._npcCache.velocity.X = (float)this._npcCache.direction * velocity;
                this._npcCache.FindFrame();
            }
            else
            {
                if (!nullable1.HasValue)
                {
                    return;
                }
                this._npcCache.FindFrame();
                this._npcCache.frame.Y = this._npcCache.frame.Height * nullable1.Value;
            }
        }