error() private method

private error ( string format ) : void
format string
return void
Ejemplo n.º 1
0
        internal void render()
        {
            if (_renderers.length == 0)
            {
                Debug.error("There are no Renderers in the Scene!");
                return;
            }

            // Renderers should always have those that require a RenderTarget first. They clear themselves and set themselves as
            // the current RenderTarget when they render. If the first Renderer wants the sceneRenderTarget we set and clear it now.
            if (_renderers[0].wantsToRenderToSceneRenderTarget)
            {
                Core.graphicsDevice.setRenderTarget(_sceneRenderTarget);
                Core.graphicsDevice.Clear(clearColor);
            }


            var lastRendererHadRenderTarget = false;

            for (var i = 0; i < _renderers.length; i++)
            {
                // MonoGame follows the XNA bullshit implementation so it will clear the entire buffer if we change the render target even if null.
                // Because of that, we track when we are done with our RenderTargets and clear the scene at that time.
                if (lastRendererHadRenderTarget && _renderers.buffer[i].wantsToRenderToSceneRenderTarget)
                {
                    Core.graphicsDevice.setRenderTarget(_sceneRenderTarget);
                    Core.graphicsDevice.Clear(clearColor);

                    // force a Camera matrix update to account for the new Viewport size
                    if (_renderers.buffer[i].camera != null)
                    {
                        _renderers.buffer[i].camera.forceMatrixUpdate();
                    }
                    camera.forceMatrixUpdate();
                }

                _renderers.buffer[i].render(this);
                lastRendererHadRenderTarget = _renderers.buffer[i].renderTexture != null;
            }
        }
        void onButtonClicked(Button button)
        {
            if (_parameterType == null)
            {
                (_memberInfo as MethodInfo).Invoke(_target, new object[] { });
            }
            else
            {
                // extract the param and properly cast it
                var parameters = new object[1];

                try
                {
                    if (_parameterType == typeof(float))
                    {
                        parameters[0] = float.Parse(_textField.getText());
                    }
                    else if (_parameterType == typeof(int))
                    {
                        parameters[0] = int.Parse(_textField.getText());
                    }
                    else if (_parameterType == typeof(bool))
                    {
                        parameters[0] = bool.Parse(_textField.getText());
                    }
                    else
                    {
                        parameters[0] = _textField.getText();
                    }

                    (_memberInfo as MethodInfo).Invoke(_target, parameters);
                }
                catch (Exception e)
                {
                    Debug.error(e.ToString());
                }
            }
        }