Exemplo 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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the test dialog.
        /// </summary>
        /// <returns>The test dialog.</returns>
        // ReSharper disable UnusedMember.Local
        static EditorNPCChatDialog CreateTestDialog() // ReSharper restore UnusedMember.Local
        {
            var dialog = new EditorNPCChatDialog();

            var haveYouDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(0), "Have you done this quest?");

            haveYouDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(1), "False"),
                                             new EditorNPCChatResponse(new NPCChatDialogItemID(2), "True"));

            var hasNotDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(1), "Think you can help me out?");

            hasNotDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(3), "Yes"),
                                            new EditorNPCChatResponse(new NPCChatDialogItemID(4), "No"));

            var acceptHelp = new EditorNPCChatDialogItem(new NPCChatDialogItemID(3), "Sweet, thanks!");

            var declineHelp = new EditorNPCChatDialogItem(new NPCChatDialogItemID(4), "Fine. Screw you too, you selfish jerk!");

            var hasDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(2),
                                                               "Sorry dude, you already did this quest!");

            hasDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(1), "So? Just let me do it!"),
                                         new EditorNPCChatResponse("Ok, fine, whatever. Dick."));

            dialog.Add(new EditorNPCChatDialogItem[]
                       { haveYouDoneThisQuest, hasNotDoneThisQuest, acceptHelp, declineHelp, hasDoneThisQuest });

            return(dialog);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds an <see cref="EditorNPCChatDialog"/>.
        /// </summary>
        /// <param name="dialog">The EditorNPCChatDialog to add.</param>
        public static void AddDialog(EditorNPCChatDialog dialog)
        {
            // Just always reorganize, since I'm not very trusting that things are always done right
            _instance.Reorganize();

            // Add the new dialog
            _instance[dialog.ID] = dialog;
        }
Exemplo n.º 4
0
        public static void DeleteDialog(EditorNPCChatDialog dialog)
        {
            _instance.Reorganize();

            if (GetDialog(dialog.ID) != dialog)
                return;

            _instance[dialog.ID] = null;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates the test dialog.
        /// </summary>
        /// <returns>The test dialog.</returns>
        // ReSharper disable UnusedMember.Local
        static EditorNPCChatDialog CreateTestDialog() // ReSharper restore UnusedMember.Local
        {
            var dialog = new EditorNPCChatDialog();

            var haveYouDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(0), "Have you done this quest?");
            haveYouDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(1), "False"),
                new EditorNPCChatResponse(new NPCChatDialogItemID(2), "True"));

            var hasNotDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(1), "Think you can help me out?");
            hasNotDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(3), "Yes"),
                new EditorNPCChatResponse(new NPCChatDialogItemID(4), "No"));

            var acceptHelp = new EditorNPCChatDialogItem(new NPCChatDialogItemID(3), "Sweet, thanks!");

            var declineHelp = new EditorNPCChatDialogItem(new NPCChatDialogItemID(4), "Fine. Screw you too, you selfish jerk!");

            var hasDoneThisQuest = new EditorNPCChatDialogItem(new NPCChatDialogItemID(2),
                "Sorry dude, you already did this quest!");
            hasDoneThisQuest.AddResponse(new EditorNPCChatResponse(new NPCChatDialogItemID(1), "So? Just let me do it!"),
                new EditorNPCChatResponse("Ok, fine, whatever. Dick."));

            dialog.Add(new EditorNPCChatDialogItem[]
            { haveYouDoneThisQuest, hasNotDoneThisQuest, acceptHelp, declineHelp, hasDoneThisQuest });

            return dialog;
        }