using System;
using Cthangover.Core.UI;
using Cthangover.Mods.Interface.Base.Lists;
using Cthangover.Core.UI.Dialog;
using Cthangover.Core.UI.Event;
using Cthangover.Core.UI.Executable;
using Cthangover.Core.Scenarios;
using Cthangover.Core.Scenes;
using Cthangover.Core.Interactive;
namespace Cthangover.Mods.Dialog.Action.Impls
{
///
/// Data model for a dialog choice option: display Text and a GoTo target
/// action ID. The static Point property returns a fresh GUID for runtime
/// goto targets. The New factory provides concise C# construction without
/// object-initializer syntax.
///
public class SelectVariant
{
/// The text displayed on the choice button. Supports runtime variable substitution.
public string Text { get; set; }
/// Target action ID to jump to via when this variant is selected.
public string GoTo { get; set; }
///
/// Condition of the shared condition language (option "…" if=… -> :label); the
/// option is shown only while it holds. Null = always shown. Evaluated each time the
/// choice appears, so a stat, a flag or an item gained a moment ago counts.
///
public string Condition { get; set; }
/// Whether the option is offered now.
public bool IsShown() => string.IsNullOrWhiteSpace(Condition) || ScenarioCondition.Evaluate(Condition);
/// Generates a new unique action ID for use as a GoTo target (e.g. with ).
public static string Point => Guid.NewGuid().ToString();
/// Factory for concise C# construction without object-initializer syntax.
public static SelectVariant New(string text, string goTo)
{
return new SelectVariant { Text = text, GoTo = goTo };
}
}
}