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>(); config = config ?? _defaults.Idle; hoverConfig = hoverConfig ?? _defaults.Hovered; hasBeenChosenConfig = hasBeenChosenConfig ?? _defaults.Chosen; ILabel label = _ui.GetLabel($"Dialog option: {text}", text, game.Settings.VirtualResolution.Width, 20f, 0f, 0f, config: config, addToUi: false); label.RenderLayer = _defaults.RenderLayer; 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); }
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 = new AGSTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight, brush: _brushLoader.LoadSolidBrush(Colors.White), font: _fontLoader.LoadFont(null, 10f)); } if (hoverConfig == null) { hoverConfig = new AGSTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight, brush: _brushLoader.LoadSolidBrush(Colors.Yellow), font: _fontLoader.LoadFont(null, 10f)); } if (hasBeenChosenConfig == null) { hasBeenChosenConfig = new AGSTextConfig(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); }