private void pgDialogElement_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            TreeNode node = tvDialogDetail.SelectedNode;

            if (node.Tag.GetType() == typeof(SHDialog))
            {
                SHDialog dlg = (SHDialog)node.Tag;
                node.Text = xmlCore.GetSafeString(dlg.text);

                if (e.ChangedItem.Label == "(아이디)" && dlg.id != (int)e.OldValue)
                {
                    m_ListViewController.SortListView(dlg);
                }
            }
            else if (node.Tag.GetType() == typeof(SHDialogSay))
            {
                SHDialogSay say = (SHDialogSay)node.Tag;
                node.Text = xmlCore.GetSafeString(say.text);
            }
            else if (node.Tag.GetType() == typeof(SHDialogSelect))
            {
                SHDialogSelect sel = (SHDialogSelect)node.Tag;
                SetTreeNodeFromSel(node, sel.text, sel.exit, sel.exitSpecified);
            }
            else if (node.Tag.GetType() == typeof(SHItemAdd) || node.Tag.GetType() == typeof(SHItemRemove) || node.Tag.GetType() == typeof(SHItemFill))
            {
                SHItemAddRemoveBase itemBase = (SHItemAddRemoveBase)node.Tag;
                SetTreeNodeFromItem(node, itemBase);
            }

            Refresh_WhenPropertyValueChanged(node);
        }
        private void AddSelect_Item(SHItemAddRemoveType nItemAddRemoveType)
        {
            if (tvDialogDetail.SelectedNode == null || tvDialogDetail.SelectedNode.Tag == null)
            {
                return;
            }

            Type nodeType = tvDialogDetail.SelectedNode.Tag.GetType();

            if (nodeType == typeof(SHDialogSelect))
            {
                SHDialogSelect      dialogSelect = (SHDialogSelect)tvDialogDetail.SelectedNode.Tag;
                SHItemAddRemoveBase newItem      = SHItemAddRemove.NewItem(nItemAddRemoveType);

                newItem.id     = 0;
                newItem.amount = 0;

                if (dialogSelect.Item == null)
                {
                    dialogSelect.Item = new SHItemAddRemove();
                }
                dialogSelect.Item.dataList.Add(newItem);

                TreeNode newNode = ProcessItem(tvDialogDetail.SelectedNode, newItem);

                tvDialogDetail.SelectedNode = newNode;
            }

            Global._VelixianForms.FindForm("DIALOG").Touch();
        }
        private void SetTreeNodeFromItem(TreeNode node, SHItemAddRemoveBase itemBase)
        {
            if (itemBase.GetType() == typeof(SHItemAdd))
            {
                node.Text = "[ITEM-ADD]";
            }
            else if (itemBase.GetType() == typeof(SHItemRemove))
            {
                node.Text = "[ITEM-REMOVE]";
            }
            else if (itemBase.GetType() == typeof(SHItemFill))
            {
                node.Text = "[ITEM-FILL]";
            }
            else
            {
                return;
            }

            node.Text = node.Text + " (ID: " + itemBase.id.ToString() + ") , (Amount: " + itemBase.amount.ToString() + ")";

            node.ImageIndex         = 0;
            node.SelectedImageIndex = 0;
            node.Tag       = itemBase;
            node.ForeColor = Color.DeepSkyBlue;
        }
Beispiel #4
0
        private void QuestElement_ValueChanged(SourceGrid.GridRow gridRow)
        {
            if (gridRow != null)
            {
                if (gridRow.Tag.GetType() == typeof(SHQuestObjective))
                {
                    SHQuestObjective obj = (SHQuestObjective)gridRow.Tag;

                    m_ObjectiveGridController.AssignGridRow(gridRow, obj);
                }
                else if (gridRow.Tag.GetType() == typeof(SHQuestReward))
                {
                    SHQuestReward reward = (SHQuestReward)gridRow.Tag;

                    m_RewardGridController.AssignGridRow(gridRow, reward);
                }
                else if (gridRow.Tag.GetType() == typeof(SHItemAddRemove))
                {
                    SHItemAddRemoveBase item = (SHItemAddRemoveBase)gridRow.Tag;

                    m_ItemGridController.AssignGridRow(gridRow, item);
                }
            }

            Global._VelixianForms.FindForm("QUEST").Touch();
        }
Beispiel #5
0
            public void AssignGrid(SHQuest quest)
            {
                if (quest == null)
                {
                    return;
                }

                m_Grid.Tag = quest;

                m_Grid.Redim(1, COLUMN_COUNT);

                int nRowCount = 1;

                if (quest.Items != null)
                {
                    nRowCount = quest.Items.dataList.Count + 1;
                }

                m_Grid.Redim(nRowCount, COLUMN_COUNT);

                if (quest.Items == null)
                {
                    return;
                }

                for (int r = 0; r < quest.Items.dataList.Count; r++)
                {
                    SHItemAddRemoveBase obj = (SHItemAddRemoveBase)quest.Items.dataList[r];

                    AssignNewGrid(r + 1, obj);
                }
            }
        private TreeNode ProcessItem(TreeNode nodeParent, SHItemAddRemoveBase selectNode)
        {
            TreeNode nodeNew = new TreeNode();

            SetTreeNodeFromItem(nodeNew, selectNode);

            nodeParent.Nodes.Add(nodeNew);

            return(nodeNew);
        }
Beispiel #7
0
            public void AssignGridRow(SourceGrid.GridRow gridRow, SHItemAddRemoveBase item)
            {
                if (gridRow == null || item == null)
                {
                    return;
                }

                (gridRow.Grid.GetCell(gridRow.Index, 0) as SourceGrid.Cells.Cell).Value = item.GetItemType();
                (gridRow.Grid.GetCell(gridRow.Index, 1) as SourceGrid.Cells.Cell).Value = item.id;
                (gridRow.Grid.GetCell(gridRow.Index, 2) as SourceGrid.Cells.Cell).Value = item.amount;
            }
Beispiel #8
0
            private void AssignNewGrid(int nRowIndex, SHItemAddRemoveBase item)
            {
                m_Grid.Rows[nRowIndex].Tag = item;

                m_Grid[nRowIndex, 0] = new SourceGrid.Cells.Cell(item.GetItemType(), typeof(SHItemAddRemoveType));
                m_Grid[nRowIndex, 1] = new SourceGrid.Cells.Cell(item.id, typeof(int));
                m_Grid[nRowIndex, 2] = new SourceGrid.Cells.Cell(item.amount, typeof(int));

                //m_Grid[r + 1, 0].Editor.EnableEdit = false;
                m_Grid[nRowIndex, 0].AddController(new ItemValueChangedEvent(this));
                m_Grid[nRowIndex, 1].AddController(new ItemValueChangedEvent(this));
                m_Grid[nRowIndex, 2].AddController(new ItemValueChangedEvent(this));
            }
Beispiel #9
0
                public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
                {
                    base.OnValueChanged(sender, e);

                    SHQuest quest = (SHQuest)sender.Grid.Tag;

                    if (quest == null)
                    {
                        return;
                    }

                    int selectedRow = sender.Position.Row;

                    SourceGrid.Grid grid = (sender.Grid as SourceGrid.Grid);

                    SHItemAddRemoveBase item = (SHItemAddRemoveBase)(grid.Rows[selectedRow].Tag);

                    if (sender.Position.Column == 0)
                    {
                        SHItemAddRemoveBase newItem = SHItemAddRemove.NewItem((SHItemAddRemoveType)sender.Value);
                        newItem.id     = item.id;
                        newItem.amount = item.amount;

                        quest.Items.dataList[selectedRow - 1] = newItem;
                    }
                    else if (sender.Position.Column == 1)
                    {
                        item.id = (int)sender.Value;
                    }
                    else if (sender.Position.Column == 2)
                    {
                        item.amount = (int)sender.Value;
                    }

                    m_GridController.RefreshPropertyGrid(selectedRow);

                    Global._VelixianForms.FindForm("QUEST").Touch();
                }
Beispiel #10
0
            public void DelItem()
            {
                if (MessageBox.Show("Are you sure you want to delete?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    int selectedRow = -1;
                    selectedRow = m_Grid.Selection.ActivePosition.Row;

                    if (selectedRow < 0)
                    {
                        return;
                    }

                    SHQuest             quest = (SHQuest)m_Grid.Tag;
                    SHItemAddRemoveBase obj   = (SHItemAddRemoveBase)m_Grid.Rows[selectedRow].Tag;

                    if (quest != null && obj != null)
                    {
                        quest.Items.dataList.Remove(obj);

                        AssignGrid(quest);
                        Global._VelixianForms.FindForm("QUEST").Touch();
                    }
                }
            }
        private void subDialogDetailDel_Click(object sender, EventArgs e)
        {
            if (tvDialogDetail.SelectedNode == null || tvDialogDetail.SelectedNode.Tag == null)
            {
                return;
            }

            SHDialog dlg      = (SHDialog)tvDialogDetail.TopNode.Tag;
            Type     nodeType = tvDialogDetail.SelectedNode.Tag.GetType();

            if (nodeType == typeof(SHDialog))
            {
                MessageBox.Show("For safety you can not delete the conversation.", Application.ProductName);
                return;
            }

            if (nodeType == typeof(SHDialogSay))
            {
                SHDialogSay say = (SHDialogSay)tvDialogDetail.SelectedNode.Tag;

                if ((say.dataList.Count > 0 && MessageBox.Show("All subnodes will be deleted, Are you sure you want to delete?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No) ||
                    (say.dataList.Count == 0 && MessageBox.Show("Are you 100% sure?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No))
                {
                    return;
                }

                if (tvDialogDetail.SelectedNode.Parent.Tag.GetType() == typeof(SHDialog))
                {
                    dlg.Say  = null;
                    dlg.exit = 1;

                    TreeNode pNode = ProcessDialog(dlg);
                    tvDialogDetail.SelectedNode = pNode;
                }
                else if (tvDialogDetail.SelectedNode.Parent.Tag.GetType() == typeof(SHDialogSelect))
                {
                    SHDialogSelect sel = (SHDialogSelect)tvDialogDetail.SelectedNode.Parent.Tag;

                    sel.Say  = null;
                    sel.exit = 1;

                    SetTreeNodeFromSel(tvDialogDetail.SelectedNode.Parent, sel.text, sel.exit, sel.exitSpecified);
                    tvDialogDetail.Nodes.Remove(tvDialogDetail.SelectedNode);

                    tvDialogDetail.SelectedNode = tvDialogDetail.SelectedNode.Parent;
                }
            }
            else if (nodeType == typeof(SHDialogSelect))
            {
                SHDialogSelect sel = (SHDialogSelect)tvDialogDetail.SelectedNode.Tag;

                if (tvDialogDetail.SelectedNode.Parent == null || tvDialogDetail.SelectedNode.Parent.Tag.GetType() != typeof(SHDialogSay))
                {
                    return;
                }

                // Parent
                SHDialogSay say = (SHDialogSay)tvDialogDetail.SelectedNode.Parent.Tag;

                if ((sel.Say != null && MessageBox.Show("이 작업으로 하위 노드까지 전부 삭제됩니다. 계속하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No) ||
                    (say.dataList.Count < 2 && sel.Say == null && MessageBox.Show("대화문은 DIALOG 또는 SELECT로 반드시 종료되어야 합니다.\n이 작업으로 인하여 논리적 오류가 존재하는 대화문이 생성될 수 있습니다. 계속하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No) ||
                    (say.dataList.Count >= 2 && sel.Say == null && MessageBox.Show("정말 삭제하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No))
                {
                    return;
                }

                tvDialogDetail.Nodes.Remove(tvDialogDetail.SelectedNode);
                say.dataList.Remove(sel);
            }
            else if (nodeType == typeof(SHItemAdd) || nodeType == typeof(SHItemRemove) || nodeType == typeof(SHItemFill))
            {
                SHItemAddRemoveBase itemAdd = (SHItemAddRemoveBase)tvDialogDetail.SelectedNode.Tag;

                if (MessageBox.Show("정말 삭제하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }

                if (tvDialogDetail.SelectedNode.Parent.Tag.GetType() == typeof(SHDialogSelect))
                {
                    SHDialogSelect sel = (SHDialogSelect)tvDialogDetail.SelectedNode.Parent.Tag;

                    for (int i = 0; i < sel.Item.dataList.Count; i++)
                    {
                        if (sel.Item.dataList[i] == tvDialogDetail.SelectedNode.Tag)
                        {
                            sel.Item.dataList.Remove(tvDialogDetail.SelectedNode.Tag);
                            break;
                        }
                    }

                    if (sel.Item.dataList.Count == 0)
                    {
                        sel.Item = null;
                    }

                    tvDialogDetail.Nodes.Remove(tvDialogDetail.SelectedNode);
                    tvDialogDetail.SelectedNode = tvDialogDetail.SelectedNode.Parent;
                }
            }

            // Update
            m_ListViewController.SetListText(lvDialogs.SelectedItems[0], dlg);

            Global._VelixianForms.FindForm("DIALOG").Touch();
        }