コード例 #1
0
            /// <summary>
            /// Updates the emoticon.
            /// </summary>
            /// <param name="currentTime">The current game time.</param>
            public void Update(TickCount currentTime)
            {
                // Check for a valid state
                if (!IsValidStateToUse)
                {
                    return;
                }

                // Update the sprite
                _grh.Update(currentTime);

                // Check if the emoticon is still alive
                if (_grh.GrhData.FramesCount <= 1)
                {
                    // For stationary, check that the target amount of time has elapsed
                    if (currentTime > _initializeTime + _stationaryEmoticonLife)
                    {
                        _isAlive = false;
                    }
                }
                else
                {
                    // If animated, check if the animation is still going
                    _isAlive = (_grh.AnimType == AnimType.LoopOnce);
                }
            }
コード例 #2
0
                /// <summary>
                /// Updates the <see cref="Control"/>. This is called for every <see cref="Control"/>, even if it is disabled or
                /// not visible.
                /// </summary>
                /// <param name="currentTime">The current time in milliseconds.</param>
                protected override void UpdateControl(TickCount currentTime)
                {
                    base.UpdateControl(currentTime);

                    if (!IsVisible)
                    {
                        return;
                    }

                    // Get the current item info
                    var currItemInfo = ItemsCollection.GetItemInfo(Slot);

                    // Check if the item info has changed and, if so, re-initialize the sprite
                    if (currItemInfo != _lastItemInfo)
                    {
                        ItemsCollection.PeerTradeForm.InitializeItemInfoSprite(_sprite, currItemInfo);
                        _lastItemInfo = currItemInfo;
                    }

                    // Update the sprite
                    if (_sprite.GrhData != null)
                    {
                        _sprite.Update(currentTime);
                    }
                }
コード例 #3
0
        internal void UpdateIconImage()
        {
            if (!NeedsToUpdateImage)
            {
                return;
            }

            // Store the GrhIndex of the animation before updating it to compare if there was a change
            var current = _animationGrh.CurrentGrhData;

            if (current == null)
            {
                _image = null;
                return;
            }

            var oldGrhData = current;

            // Update the Grh
            _animationGrh.Update(TickCount.Now);

            // Check that the GrhIndex changed from the update
            if (oldGrhData != _animationGrh.CurrentGrhData)
            {
                // Change the image
                _grhImageList.GetImageAsync(current, _asyncCallback, this);
            }
        }
コード例 #4
0
ファイル: QuickBarForm.cs プロジェクト: wtfcolt/game
            /// <summary>
            /// Updates the <see cref="Control"/>. This is called for every <see cref="Control"/>, even if it is disabled or
            /// not visible.
            /// </summary>
            /// <param name="currentTime">The current time in milliseconds.</param>
            protected override void UpdateControl(TickCount currentTime)
            {
                // Make sure the quick bar item is valid
                switch (QuickBarItemType)
                {
                case QuickBarItemType.Inventory:
                    if (QuickBarForm._gps.UserInfo.Inventory[(InventorySlot)QuickBarItemValue] == null)
                    {
                        SetQuickBar(QuickBarItemType.None, 0);
                    }
                    break;

                case QuickBarItemType.Skill:
                    break;
                }

                if (_grh.GrhData != null)
                {
                    _grh.Update(currentTime);
                }

                base.UpdateControl(currentTime);
            }
コード例 #5
0
        /// <summary>
        /// When overridden in the derived class, draws the graphics to the control.
        /// </summary>
        /// <param name="currentTime">The current time.</param>
        protected override void HandleDraw(TickCount currentTime)
        {
            base.HandleDraw(currentTime);

            if (DesignMode)
            {
                return;
            }

            if (_drawingManager.RenderWindow == null)
            {
                return;
            }

            if (Grh == null)
            {
                return;
            }

            Grh.Update(currentTime);

            m.Update(currentTime);

            _drawingManager.Update(currentTime);

            var sb = _drawingManager.BeginDrawWorld(_camera);

            if (sb == null)
            {
                return;
            }

            // Change the view
            var oldView = RenderWindow.GetView();

            _drawView.Reset(new FloatRect(Camera.Min.X, Camera.Min.Y, Camera.Size.X, Camera.Size.Y));
            RenderWindow.SetView(_drawView);

            try
            {
                try
                {
                    Grh.Draw(sb, Vector2.Zero, Color.White);
                }
                catch (LoadingFailedException)
                {
                    // A LoadingFailedException is generally fine here since it probably means the graphic file was invalid
                    // or does not exist
                }

                // Draw the walls
                if (Walls != null)
                {
                    foreach (var wall in Walls)
                    {
                        var rect = wall.ToRectangle();
                        RenderRectangle.Draw(sb, rect, _autoWallColor);
                    }
                }

                m.Draw(sb, Camera);
            }
            finally
            {
                _drawingManager.EndDrawWorld();

                // Restore the view
                RenderWindow.SetView(oldView);
            }
        }
コード例 #6
0
ファイル: StatusEffectsForm.cs プロジェクト: wtfcolt/game
 public void Draw(ISpriteBatch sb, Vector2 position, TickCount currentTime)
 {
     _grh.Update(currentTime);
     _grh.Draw(sb, position);
 }