public void AssignGrid(SHQuest quest) { if (quest == null) { return; } m_Grid.Tag = quest; m_Grid.Redim(1, COLUMN_COUNT); int nRowCount = 1; if (quest.Objectives != null) { nRowCount = quest.Objectives.dataList.Count + 1; } m_Grid.Redim(nRowCount, COLUMN_COUNT); if (quest.Objectives == null) { return; } for (int r = 0; r < quest.Objectives.dataList.Count; r++) { SHQuestObjective obj = (SHQuestObjective)quest.Objectives.dataList[r]; AssignNewGrid(r + 1, obj); } }
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(); }
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); SHQuestObjective obj = (SHQuestObjective)(grid.Rows[selectedRow].Tag); if (sender.Position.Column == 0) { obj.id = (int)sender.Value; } else if (sender.Position.Column == 1) { obj.desc = (string)sender.Value; } else if (sender.Position.Column == 2) { obj.type = (SHQuestType)sender.Value; } m_GridController.RefreshPropertyGrid(selectedRow); Global._VelixianForms.FindForm("QUEST").Touch(); }
public void AssignGridRow(SourceGrid.GridRow gridRow, SHQuestObjective obj) { if (gridRow == null || obj == null) { return; } (gridRow.Grid.GetCell(gridRow.Index, 0) as SourceGrid.Cells.Cell).Value = obj.id; (gridRow.Grid.GetCell(gridRow.Index, 1) as SourceGrid.Cells.Cell).Value = obj.desc; (gridRow.Grid.GetCell(gridRow.Index, 2) as SourceGrid.Cells.Cell).Value = obj.type; }
private void AssignNewGrid(int nRowIndex, SHQuestObjective obj) { m_Grid.Rows[nRowIndex].Tag = obj; m_Grid[nRowIndex, 0] = new SourceGrid.Cells.Cell(obj.id, typeof(int)); m_Grid[nRowIndex, 1] = new SourceGrid.Cells.Cell(obj.desc, typeof(string)); m_Grid[nRowIndex, 2] = new SourceGrid.Cells.Cell(obj.type, typeof(SHQuestType)); //m_Grid[r + 1, 0].Editor.EnableEdit = false; m_Grid[nRowIndex, 0].AddController(new ObjectiveValueChangedEvent(this)); m_Grid[nRowIndex, 1].AddController(new ObjectiveValueChangedEvent(this)); m_Grid[nRowIndex, 2].AddController(new ObjectiveValueChangedEvent(this)); }
public void AddObjective() { SHQuestObjective newObj = new SHQuestObjective(); newObj.id = 1; newObj.desc = String.Empty; newObj.type = SHQuestType.DESTROY; newObj.public_progress = "self"; newObj.param1 = "0"; if (m_Grid.Tag != null && m_Grid.Tag.GetType() == typeof(SHQuest)) { SHQuest quest = (SHQuest)m_Grid.Tag; quest.Objectives.dataList.Add(newObj); AssignGrid(quest); Global._VelixianForms.FindForm("QUEST").Touch(); } }
public void DelObjective() { 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; SHQuestObjective obj = (SHQuestObjective)m_Grid.Rows[selectedRow].Tag; if (quest != null && obj != null) { quest.Objectives.dataList.Remove(obj); AssignGrid(quest); Global._VelixianForms.FindForm("QUEST").Touch(); } } }