Пример #1
0
        /// <summary>
        /// Returns a string with some internal engine information. Use this for debugging, especially when the game slows down.
        /// </summary>
        /// <returns>Internal engine information.</returns>
        public string GetDiagnostics()
        {
            string output = "";

            output += "Number of objects in hierarchy: " + CountSubtreeSize(this) + '\n';
            output += "OnBeforeStep delegates: " + (OnBeforeStep == null?0:OnBeforeStep.GetInvocationList().Length) + '\n';
            output += "OnAfterStep delegates: " + (OnAfterStep == null?0:OnAfterStep.GetInvocationList().Length) + '\n';
            output += "OnAfterRender delegates: " + (OnAfterRender == null?0:OnAfterRender.GetInvocationList().Length) + '\n';
            output += Texture2D.GetDiagnostics();
            output += _collisionManager.GetDiagnostics();
            output += _updateManager.GetDiagnostics();
            return(output);
        }
Пример #2
0
        private void HandleComponentRender(RenderEvent renderEvent)
        {
            if (renderEvent.DidComponentRender(ComponentId))
            {
                _logger.LogDebug(new EventId(1, nameof(HandleComponentRender)), $"Received a new render where component {ComponentId} did render.");

                RenderCount++;

                // First notify derived types, e.g. queried AngleSharp collections or elements
                // that the markup has changed and they should rerun their queries.
                HandleChangesToMarkup(renderEvent);

                // Then it is safe to tell anybody waiting on updates or changes to the rendered fragment
                // that they can redo their assertions or continue processing.
                OnAfterRender?.Invoke();
            }
        }