Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="EditorNPCChatDialog"/> and adds it to this collection.
        /// </summary>
        /// <returns>The new <see cref="EditorNPCChatDialog"/>.</returns>
        public static EditorNPCChatDialog CreateNewDialog()
        {
            _instance.Reorganize();

            // Find the first free index
            var i = 0;
            while (_instance.DialogExists((NPCChatDialogID)i))
            {
                ++i;
            }

            // Create the new instance
            var dialog = new EditorNPCChatDialog();
            dialog.SetID(new NPCChatDialogID(i));

            // Create the initial dialog item
            var dialogItem = new EditorNPCChatDialogItem(dialog.GetFreeDialogItemID(), "New dialog");
            dialogItem.SetText("<Enter the initial text to display>");
            dialog.Add(dialogItem);

            // Add to the collection
            AddDialog(dialog);

            return dialog;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="EditorNPCChatDialog"/> and adds it to this collection.
        /// </summary>
        /// <returns>The new <see cref="EditorNPCChatDialog"/>.</returns>
        public static EditorNPCChatDialog CreateNewDialog()
        {
            _instance.Reorganize();

            // Find the first free index
            var i = 0;

            while (_instance.DialogExists((NPCChatDialogID)i))
            {
                ++i;
            }

            // Create the new instance
            var dialog = new EditorNPCChatDialog();

            dialog.SetID(new NPCChatDialogID(i));

            // Create the initial dialog item
            var dialogItem = new EditorNPCChatDialogItem(dialog.GetFreeDialogItemID(), "New dialog");

            dialogItem.SetText("<Enter the initial text to display>");
            dialog.Add(dialogItem);

            // Add to the collection
            AddDialog(dialog);

            return(dialog);
        }