Ejemplo n.º 1
0
        void itemSelector_OnItemSelected(object sender, ItemSelectorEvent e)
        {
            if (QuestPartRow != null && e.Object != null)
            {
                switch (Convert.ToChar(e.Param))
                {
                    //trigger
                    case Const.CODE_I:
                    case Const.CODE_K:
                        {
                            DataRow[] rows = DB.TriggerTable.Select(DB.COL_QUESTPARTTRIGGER_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0][Const.CodeToColumn(e.Param)] = Convert.ToString(e.Object);
                            }
                            break;
                        }

                    //Requirement
                    case Const.CODE_N:
                    case Const.CODE_V:
                        {
                            DataRow[] rows = DB.RequirementTable.Select(DB.COL_QUESTPARTREQUIREMENT_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0][Const.CodeToColumn(e.Param)] = Convert.ToString(e.Object);
                            }
                            break;
                        }
                    case Const.CODE_COMPARATOR:
                        {
                            DataRow[] rows = DB.RequirementTable.Select(DB.COL_QUESTPARTREQUIREMENT_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0][Const.CodeToColumn(e.Param)] = e.Object;
                            }
                            break;
                        }

                    //Actions
                    case Const.CODE_P:
                    case Const.CODE_Q:
                        {
                            DataRow[] rows = DB.ActionTable.Select(DB.COL_QUESTPARTACTION_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0][Const.CodeToColumn(e.Param)] = Convert.ToString(e.Object);
                            }
                            break;
                        }
                }
            }
        }
Ejemplo n.º 2
0
        void selector_OnItemDeleting(object sender, ItemSelectorEvent e)
        {
            if (QuestPartRow != null)
            {
                switch (Convert.ToChar(e.Param))
                {
                    case Const.CODE_I:
                    case Const.CODE_K:
                        {
                            DataRow[] rows = DB.TriggerTable.Select(DB.COL_QUESTPARTTRIGGER_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0].Delete();
                            }

                            break;
                        }
                    case Const.CODE_N:
                    case Const.CODE_V:
                    case Const.CODE_COMPARATOR:
                        {
                            DataRow[] rows = DB.RequirementTable.Select(DB.COL_QUESTPARTREQUIREMENT_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0].Delete();
                            }
                            break;
                        }
                    case Const.CODE_P:
                    case Const.CODE_Q:
                        {
                            DataRow[] rows = DB.ActionTable.Select(DB.COL_QUESTPARTACTION_ID+"=" + e.ItemID);
                            if (rows.Length > 0)
                            {
                                rows[0].Delete();
                            }
                            break;
                        }
                }
            }
        }