using Newtonsoft.Json; using RhythmBase.Components.RichText; namespace RhythmBase.Events { /// /// Represents an event to show a dialogue in the game. /// public class ShowDialogue : BaseEvent { private RDDialogueExchange dialogueList = []; private string text = ""; /// /// Initializes a new instance of the class. /// public ShowDialogue() { Speed = 1; Type = EventType.ShowDialogue; Tab = Tabs.Actions; } /// /// Gets or sets the text of the dialogue. /// public string Text { get => text; set { text = value; dialogueList = RDDialogueExchange.Deserialize(value); } } /// /// Gets or sets the dialogue list. When set, the Text property is updated with the serialized value of the dialogue list. /// /// The dialogue list. [JsonIgnore] public RDDialogueExchange DialogueList { get => dialogueList; set { dialogueList = value; text = dialogueList.Serialize(); } } /// /// Gets or sets the side of the panel where the dialogue will be shown. /// public Sides PanelSide { get; set; } /// /// Gets or sets the side of the portrait in the dialogue. /// public PortraitSides PortraitSide { get; set; } /// /// Gets or sets the speed of the dialogue display. /// public int Speed { get; set; } /// /// Gets or sets a value indicating whether text sounds should be played. /// public bool PlayTextSounds { get; set; } /// /// Gets the type of the event. /// public override EventType Type { get; } /// /// Gets the tab where the event is categorized. /// public override Tabs Tab { get; } /// /// Returns a string that represents the current object. /// /// A string that represents the current object. public override string ToString() => base.ToString() + string.Format(" {0}", Text); /// /// Specifies the sides where the dialogue panel can be shown. /// public enum Sides { /// /// The bottom side. /// Bottom, /// /// The top side. /// Top } /// /// Specifies the sides where the portrait can be shown. /// public enum PortraitSides { /// /// The left side. /// Left, /// /// The right side. /// Right } } }