示例#1
0
        /// <summary>
        /// Handles the Click event of the btnAddRedirect control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void btnAddRedirect_Click(object sender, EventArgs e)
        {
            if (_doNotUpdateObj)
            {
                return;
            }

            if (EditingObjAsResponse == null)
            {
                return;
            }

            // Make sure there isn't already a dialog characterID
            if (EditingObjAsResponse.Page != NPCChatResponseBase.EndConversationPage)
            {
                MessageBox.Show("This response already has a dialog characterID.");
                return;
            }

            // Set the redirection
            EditingObjAsResponse.SetPage(new NPCChatDialogItemID(0));

            // TODO: Properly update the tree
            btnRefresh_Click(null, null);

            // TODO: Select the new dialog characterID in the tree
        }
示例#2
0
        /// <summary>
        /// Handles the Click event of the btnAddDialog control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void btnAddDialog_Click(object sender, EventArgs e)
        {
            if (_doNotUpdateObj)
            {
                return;
            }

            if (EditingObjAsResponse == null)
            {
                return;
            }

            // Make sure there isn't already a dialog characterID
            if (EditingObjAsResponse.Page != NPCChatResponseBase.EndConversationPage)
            {
                MessageBox.Show("This response already has a dialog characterID.");
                return;
            }

            // Create the new dialog characterID
            var id            = CurrentDialog.GetFreeDialogItemID();
            var newDialogItem = new EditorNPCChatDialogItem(id, "New dialog characterID");

            CurrentDialog.Add(newDialogItem);

            // Hook it to the response
            EditingObjAsResponse.SetPage(id);

            // Update the tree
            npcChatDialogView.UpdateTree();

            // TODO: Select the new dialog characterID in the tree
        }
示例#3
0
        /// <summary>
        /// Handles the TextChanged event of the txtTitle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void txtTitle_TextChanged(object sender, EventArgs e)
        {
            if (_doNotUpdateObj)
            {
                return;
            }

            if (EditingObjAsDialogItem != null)
            {
                EditingObjAsDialogItem.SetTitle(txtTitle.Text);
            }
            else if (EditingObjAsResponse != null)
            {
                EditingObjAsResponse.SetText(txtTitle.Text);
            }
        }
示例#4
0
        /// <summary>
        /// Sets the NPC chat object being edited.
        /// </summary>
        /// <param name="obj">The NPC chat object.</param>
        void SetEditingObject(object obj)
        {
            if (_editingObj == obj)
            {
                return;
            }

            _doNotUpdateObj = true;
            _editingObj     = obj;

            SetConditionalsEnabled(false);

            if (obj is EditorNPCChatDialogItem)
            {
                DisableAllTabsExcept(tcChatDialogItem, tpDialog);
                txtTitle.Enabled = true;

                txtTitle.Text       = EditingObjAsDialogItem.Title;
                txtDialogText.Text  = EditingObjAsDialogItem.Text;
                txtDialogPage.Text  = EditingObjAsDialogItem.ID.ToString();
                chkIsBranch.Checked = EditingObjAsDialogItem.IsBranch;

                if (EditingObjAsDialogItem.IsBranch)
                {
                    SetConditionalsEnabled(true);
                    lstConditionals.SetConditionalCollection(EditingObjAsDialogItem.Conditionals);
                    EditingObjAsDialogItem.SetConditionals(lstConditionals.ConditionalCollection);
                }
            }
            else if (obj is EditorNPCChatResponse)
            {
                DisableAllTabsExcept(tcChatDialogItem, tpResponse);
                txtTitle.Enabled = true;

                txtTitle.Text         = EditingObjAsResponse.Text;
                txtDialogText.Text    = EditingObjAsResponse.Text;
                txtResponseIndex.Text = EditingObjAsResponse.Page.ToString();
                txtResponseValue.Text = EditingObjAsResponse.Value.ToString();

                SetConditionalsEnabled(true);
                lstConditionals.SetConditionalCollection(EditingObjAsResponse.Conditionals);
                EditingObjAsResponse.SetConditionals(lstConditionals.ConditionalCollection);

                lstActions.Items.Clear();
                lstActions.Items.AddRange(EditingObjAsResponse.Actions.ToArray());
            }
            else if (obj is TreeNode)
            {
                DisableAllTabsExcept(tcChatDialogItem, tpRedirect);
                txtTitle.Enabled = false;

                var redirectTo = (EditorNPCChatDialogItem)EditingObjAsTreeNode.Tag;
                txtTitle.Text      = redirectTo.Text;
                txtRedirectID.Text = redirectTo.ID.ToString();
            }
            else
            {
                SetAllChildrenEnabled(tcChatDialogItem.Controls, false);
            }

            _doNotUpdateObj = false;
        }