Beispiel #1
0
 public IUIFont LoadFont(string font)
 {
     return(fontFactory.LoadFont(font));
 }
Beispiel #2
0
        public IDialogOption GetDialogOption(string text, ITextConfig config = null, ITextConfig hoverConfig = null,
                                             ITextConfig hasBeenChosenConfig = null, bool speakOption        = true, bool showOnce = false)
        {
            var game = _resolver.Container.Resolve <IGame>();

            if (config == null)
            {
                config = _fontLoader.GetTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight,
                                                   brush: _brushLoader.LoadSolidBrush(Colors.White), font: _fontLoader.LoadFont(null, 10f));
            }
            if (hoverConfig == null)
            {
                hoverConfig = _fontLoader.GetTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight,
                                                        brush: _brushLoader.LoadSolidBrush(Colors.Yellow), font: _fontLoader.LoadFont(null, 10f));
            }
            if (hasBeenChosenConfig == null)
            {
                hasBeenChosenConfig = _fontLoader.GetTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight,
                                                                brush: _brushLoader.LoadSolidBrush(Colors.Gray), font: _fontLoader.LoadFont(null, 10f));
            }
            ILabel label = _ui.GetLabel($"Dialog option: {text}", text, game.Settings.VirtualResolution.Width, 20f, 0f, 0f,
                                        config: config, addToUi: false);

            label.Enabled = true;
            TypedParameter labelParam         = new TypedParameter(typeof(ILabel), label);
            NamedParameter speakParam         = new NamedParameter("speakOption", speakOption);
            NamedParameter showOnceParam      = new NamedParameter("showOnce", showOnce);
            NamedParameter hoverParam         = new NamedParameter("hoverConfig", hoverConfig);
            NamedParameter wasChosenParam     = new NamedParameter("hasBeenChosenConfig", hasBeenChosenConfig);
            TypedParameter playerParam        = new TypedParameter(typeof(ICharacter), _gameState.Player);
            IDialogActions dialogActions      = _resolver.Container.Resolve <IDialogActions>(playerParam);
            TypedParameter dialogActionsParam = new TypedParameter(typeof(IDialogActions), dialogActions);
            IDialogOption  option             = _resolver.Container.Resolve <IDialogOption>(labelParam, speakParam, showOnceParam, hoverParam,
                                                                                            wasChosenParam, playerParam, dialogActionsParam);

            return(option);
        }