Ejemplo n.º 1
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.Rewards != null)
                {
                    nRowCount = quest.Rewards.dataList.Count + 1;
                }

                m_Grid.Redim(nRowCount, COLUMN_COUNT);

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

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

                    AssignNewGrid(r + 1, obj);
                }
            }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);

                    SHQuestReward reward = (SHQuestReward)(grid.Rows[selectedRow].Tag);

                    if (sender.Position.Column == 0)
                    {
                        reward.type = (SHQuestRewardType)sender.Value;
                    }
                    else if (sender.Position.Column == 1)
                    {
                        reward.param1 = (string)sender.Value;
                    }
                    else if (sender.Position.Column == 2)
                    {
                        reward.param2 = (string)sender.Value;
                    }

                    m_GridController.RefreshPropertyGrid(selectedRow);

                    Global._VelixianForms.FindForm("QUEST").Touch();
                }
Ejemplo n.º 4
0
            public void AssignGridRow(SourceGrid.GridRow gridRow, SHQuestReward obj)
            {
                if (gridRow == null || obj == null)
                {
                    return;
                }

                (gridRow.Grid.GetCell(gridRow.Index, 0) as SourceGrid.Cells.Cell).Value = obj.type;
                (gridRow.Grid.GetCell(gridRow.Index, 1) as SourceGrid.Cells.Cell).Value = obj.param1;
                (gridRow.Grid.GetCell(gridRow.Index, 2) as SourceGrid.Cells.Cell).Value = obj.param2;
            }
Ejemplo n.º 5
0
            private void AssignNewGrid(int nRowIndex, SHQuestReward obj)
            {
                m_Grid.Rows[nRowIndex].Tag = obj;

                m_Grid[nRowIndex, 0] = new SourceGrid.Cells.Cell(obj.type, typeof(SHQuestRewardType));
                m_Grid[nRowIndex, 1] = new SourceGrid.Cells.Cell(obj.param1, typeof(string));
                m_Grid[nRowIndex, 2] = new SourceGrid.Cells.Cell(obj.param2, typeof(string));

                //m_Grid[r + 1, 0].Editor.EnableEdit = false;
                m_Grid[nRowIndex, 0].AddController(new RewardValueChangedEvent(this));
                m_Grid[nRowIndex, 1].AddController(new RewardValueChangedEvent(this));
                m_Grid[nRowIndex, 2].AddController(new RewardValueChangedEvent(this));
            }
Ejemplo n.º 6
0
            public void AddReward()
            {
                SHQuestReward newObj = new SHQuestReward();

                newObj.type   = SHQuestRewardType.SILVER;
                newObj.param1 = "";

                if (m_Grid.Tag != null && m_Grid.Tag.GetType() == typeof(SHQuest))
                {
                    SHQuest quest = (SHQuest)m_Grid.Tag;

                    quest.Rewards.dataList.Add(newObj);

                    AssignGrid(quest);
                    Global._VelixianForms.FindForm("QUEST").Touch();
                }
            }
Ejemplo n.º 7
0
            public void DelReward()
            {
                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;
                    SHQuestReward obj   = (SHQuestReward)m_Grid.Rows[selectedRow].Tag;

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

                        AssignGrid(quest);
                        Global._VelixianForms.FindForm("QUEST").Touch();
                    }
                }
            }