SetFrame() public method

public SetFrame ( Rectangle frame ) : void
frame Microsoft.Xna.Framework.Rectangle
return void
示例#1
0
 private void UpdateIconFrame()
 {
     _iconFrame = _locked ? _iconFrameLocked : _iconFrameUnlocked;
     if (_achievementIcon == null)
     {
         return;
     }
     _achievementIcon.SetFrame(_iconFrame);
 }
        private void sacrificeWindow_OnUpdate(UIElement affectedElement)
        {
            float num = 0.05f;
            float sacrificeAnimationProgress = GetSacrificeAnimationProgress();
            float lerpValue = Utils.GetLerpValue(1f, 0.7f, sacrificeAnimationProgress, clamped: true);
            float num2      = lerpValue * lerpValue;

            num2 *= 2f;
            float num3 = 1f + num2;

            num *= num3;
            float num4 = 1.14285719f;
            float num5 = 1f;

            OffsetRotationsForCogs(2f * num, _sacrificeCogsSmall);
            OffsetRotationsForCogs(num4 * num, _sacrificeCogsMedium);
            OffsetRotationsForCogs((0f - num5) * num, _sacrificeCogsBig);
            int frameY = 0;

            if (_sacrificeAnimationTimeLeft != 0)
            {
                float num6 = 0.1f;
                float num7 = 71f / (339f * (float)Math.PI);
                frameY = ((sacrificeAnimationProgress >= 1f - num6) ? 8 : ((sacrificeAnimationProgress >= 1f - num6 * 2f) ? 7 : ((sacrificeAnimationProgress >= 1f - num6 * 3f) ? 6 : ((sacrificeAnimationProgress >= num7 * 4f) ? 5 : ((sacrificeAnimationProgress >= num7 * 3f) ? 4 : ((sacrificeAnimationProgress >= num7 * 2f) ? 3 : ((!(sacrificeAnimationProgress >= num7)) ? 1 : 2)))))));
                if (_sacrificeAnimationTimeLeft == 56)
                {
                    SoundEngine.PlaySound(63);
                    Vector2 accelerationPerFrame = new Vector2(0f, 0.163500011f);
                    for (int i = 0; i < 15; i++)
                    {
                        Vector2 initialVelocity = Main.rand.NextVector2Circular(4f, 3f);
                        if (initialVelocity.Y > 0f)
                        {
                            initialVelocity.Y = 0f - initialVelocity.Y;
                        }
                        initialVelocity.Y -= 2f;
                        _pistonParticleSystem.AddParticle(new CreativeSacrificeParticle(_pistonParticleAsset, null, initialVelocity, Vector2.Zero)
                        {
                            AccelerationPerFrame = accelerationPerFrame,
                            ScaleOffsetPerFrame  = -0.0166666675f
                        });
                    }
                }
                if (_sacrificeAnimationTimeLeft == 40 && _researchComplete)
                {
                    _researchComplete = false;
                    SoundEngine.PlaySound(64);
                }
            }
            _sacrificePistons.SetFrame(1, 9, 0, frameY, 0, 0);
        }
示例#3
0
 private void UpdateIconFrame()
 {
     if (!_locked)
     {
         _iconFrame = _iconFrameUnlocked;
     }
     else
     {
         _iconFrame = _iconFrameLocked;
     }
     if (_achievementIcon != null)
     {
         _achievementIcon.SetFrame(_iconFrame);
     }
 }
示例#4
0
        private void UpdateVisuals(UIImageFramed button, int indexOfFilter)
        {
            bool flag            = _filterer.IsFilterActive(indexOfFilter);
            bool isMouseHovering = button.IsMouseHovering;
            int  frameX          = flag.ToInt();
            int  frameY          = flag.ToInt() * 2 + isMouseHovering.ToInt();

            button.SetFrame(2, 4, frameX, frameY, -2, -2);
            IColorable colorable = _iconsByButtons[button] as IColorable;

            if (colorable != null)
            {
                colorable.Color = (flag ? Color.White : (Color.White * 0.5f));
            }
        }
        private void UpdateVisuals(UIImageFramed button, int indexOfFilter)
        {
            bool flag            = this._filterer.IsFilterActive(indexOfFilter);
            bool isMouseHovering = button.IsMouseHovering;
            int  frameX          = flag.ToInt();
            int  frameY          = flag.ToInt() * 2 + isMouseHovering.ToInt();

            button.SetFrame(2, 4, frameX, frameY, -2, -2);
            if (!(this._iconsByButtons[button] is IColorable iconsByButton))
            {
                return;
            }
            Color color = flag ? Color.White : Color.White * 0.5f;

            iconsByButton.Color = color;
        }