コード例 #1
0
 public EntryRenderer(GuiComponentDescriptor descriptor, EntryTitle titleRenderer, IComponentRenderer valueRenderer, GameObject valueGameObject)
 {
     _titleRenderer   = titleRenderer;
     _valueRenderer   = valueRenderer;
     _valueGameObject = valueGameObject;
     _descriptor      = descriptor;
 }
コード例 #2
0
        private void SetCurrentAppState(ComponentType appStateType)
        {
            Action onReady = () =>
            {
                _currentAppState = _appStates[appStateType];
                _currentAppState.StateChangeRequested += StateChangeRequestedHandler;
                _currentAppState.AppSize = _graphicsBase.ScreenBounds;

                _currentAppStateRenderer              = _appStateRenderers[appStateType];
                _currentAppStateRenderer.Component    = _currentAppState;
                _currentAppStateRenderer.GraphicsBase = _graphicsBase;

                _gestureRecognizer.CurrentAppState = _currentAppState;

                _currentAppState.OnTransitionTo();
            };

            if (_currentAppState != null)
            {
                _currentAppState.StateChangeRequested -= StateChangeRequestedHandler;
                _currentAppState.OnTransitionFrom(onReady);
            }
            else
            {
                onReady();
            }
        }
コード例 #3
0
        /// <summary>
        /// Renders the specified <see cref="MvcComponentBase" /> to the current WebForms view.
        /// </summary>
        /// <param name="helper">The HTML helper instance that this method extends.</param>
        /// <param name="component">The <see cref="MvcComponentBase" /> to render.</param>
        public static void KrystalwareWebForms(this HtmlHelper helper, MvcComponentBase component)
        {
            IComponentRenderer renderer = RendererFactory.GetRenderer(component);

            renderer.Register(component);

            using (HtmlTextWriter w = new HtmlTextWriter(helper.ViewContext.Writer))
                renderer.Render(component, w);
        }
コード例 #4
0
ファイル: Renderer.cs プロジェクト: iLogical/MonoGame
 public Renderer(IComponentRenderer componentRenderer, GraphicsDeviceManager graphicsDevice, ISpriteBatch spriteBatch)
 {
     _componentRenderer = componentRenderer;
     _spriteBatch       = spriteBatch;
     _graphicsDevice    = graphicsDevice;
     _currentScene      = new NoScene();
     _clearColor        = Color.CornflowerBlue;
     _debug             = false;
 }
コード例 #5
0
        /// <summary>
        /// Renders the specified <see cref="MvcComponentBase" /> and returns the output for a Razor view.
        /// </summary>
        /// <param name="helper">The HTML helper instance that this method extends.</param>
        /// <param name="component">The <see cref="MvcComponentBase" /> to render.</param>
        public static MvcHtmlString KrystalwareRazor(this HtmlHelper helper, MvcComponentBase component)
        {
            IComponentRenderer renderer = RendererFactory.GetRenderer(component);

            renderer.Register(component);

            using (StringWriter s = new StringWriter())
            {
                using (HtmlTextWriter w = new HtmlTextWriter(s))
                    renderer.Render(component, w);

                return(MvcHtmlString.Create(s.ToString()));
            }
        }
コード例 #6
0
        private void SetCurrentAppState(ComponentType appStateType)
        {
            Action onReady = () =>
                {
                    _currentAppState = _appStates[appStateType];
                    _currentAppState.StateChangeRequested += StateChangeRequestedHandler;
                    _currentAppState.AppSize = _graphicsBase.ScreenBounds;

                    _currentAppStateRenderer = _appStateRenderers[appStateType];
                    _currentAppStateRenderer.Component = _currentAppState;
                    _currentAppStateRenderer.GraphicsBase = _graphicsBase;

                    _gestureRecognizer.CurrentAppState = _currentAppState;

                    _currentAppState.OnTransitionTo();
                };

            if (_currentAppState != null)
            {
                _currentAppState.StateChangeRequested -= StateChangeRequestedHandler;
                _currentAppState.OnTransitionFrom(onReady);
            }
            else
                onReady();
        }
コード例 #7
0
ファイル: Renderer.cs プロジェクト: orb1t/LayItOut
 public void RegisterRenderer <TComponent>(IComponentRenderer <TRendererContext, TComponent> renderer) where TComponent : IComponent
 {
     _renderers[typeof(TComponent)] = (ctx, c) => renderer.Render(ctx, (TComponent)c, Render);
 }