public IDialog GetDialog(string id, float x = 0f, float y = 0f, IObject graphics = null, bool showWhileOptionsAreRunning = false, params IDialogOption[] options) { TypedParameter showParam = new TypedParameter(typeof(bool), showWhileOptionsAreRunning); if (graphics == null) { graphics = _object.GetObject(id); graphics.Tint = Colors.Black; graphics.Pivot = new PointF(); graphics.IgnoreViewport = true; graphics.IgnoreScalingArea = true; _gameState.UI.Add(graphics); } TypedParameter graphicsParam = new TypedParameter(typeof(IObject), graphics); TypedParameter playerParam = new TypedParameter(typeof(ICharacter), _gameState.Player); IDialogActions dialogActions = _resolver.Container.Resolve <IDialogActions>(playerParam); TypedParameter dialogActionsParam = new TypedParameter(typeof(IDialogActions), dialogActions); IDialog dialog = _resolver.Container.Resolve <IDialog>(showParam, graphicsParam, dialogActionsParam); foreach (IDialogOption option in options) { dialog.Options.Add(option); } return(dialog); }
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 AGSDialog(IDialogLayout layout, IDialogActions startupActions, IObject graphics, bool showWhileOptionsAreRunning = false) { _dialogLayout = layout; StartupActions = startupActions; Graphics = graphics; ShowWhileOptionsAreRunning = showWhileOptionsAreRunning; Options = new List <IDialogOption> (5); foreach (var option in Options) { option.Label.TreeNode.SetParent(Graphics.TreeNode); } Graphics.Visible = false; }
public AGSDialog(IDialogLayout layout, IDialogActions startupActions, IObject graphics, bool showWhileOptionsAreRunning = false) { _dialogLayout = layout; StartupActions = startupActions; Graphics = graphics; ShowWhileOptionsAreRunning = showWhileOptionsAreRunning; Options = new List<IDialogOption> (5); foreach (var option in Options) { option.Label.TreeNode.SetParent(Graphics.TreeNode); } Graphics.Visible = false; }
//Parameter names for speakOption and showOnce are used in the factory, changing the names requires factory code change as well public AGSDialogOption(IDialogActions actions, ICharacter player, ILabel label, bool exitDialogOnFinish = false, bool speakOption = true, bool showOnce = false, ITextConfig hoverConfig = null, ITextConfig hasBeenChosenConfig = null) { _actions = actions; _player = player; Label = label; _normalConfig = label.TextConfig; HoverConfig = hoverConfig; HasBeenChosenConfig = hasBeenChosenConfig; ExitDialogWhenFinished = exitDialogOnFinish; SpeakOption = speakOption; ShowOnce = showOnce; label.MouseEnter.Subscribe(onMouseEnter); label.MouseLeave.Subscribe(onMouseLeave); }
//Parameter names for speakOption and showOnce are used in the factory, changing the names requires factory code change as well public AGSDialogOption(IDialogActions actions, ICharacter player, ILabel label, bool exitDialogOnFinish = false, bool speakOption = true, bool showOnce = false, ITextConfig hoverConfig = null, ITextConfig hasBeenChosenConfig = null) { _actions = actions; _player = player; Label = label; _normalConfig = label.TextConfig; HoverConfig = hoverConfig; HasBeenChosenConfig = hasBeenChosenConfig; ExitDialogWhenFinished = exitDialogOnFinish; SpeakOption = speakOption; ShowOnce = showOnce; label.MouseEnter.Subscribe(onMouseEnter); label.MouseLeave.Subscribe(onMouseLeave); }
public void SetCallbacks(IDialogActions instance) { if (m_Wrapper.m_DialogActionsCallbackInterface != null) { @Continue.started -= m_Wrapper.m_DialogActionsCallbackInterface.OnContinue; @Continue.performed -= m_Wrapper.m_DialogActionsCallbackInterface.OnContinue; @Continue.canceled -= m_Wrapper.m_DialogActionsCallbackInterface.OnContinue; } m_Wrapper.m_DialogActionsCallbackInterface = instance; if (instance != null) { @Continue.started += instance.OnContinue; @Continue.performed += instance.OnContinue; @Continue.canceled += instance.OnContinue; } }
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); }