Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.m_actexp == null || this.m_actexp.ReturnType == null || this.m_actexp.ReturnType.DBID == FixedValueProvider.TYPE_NIL_ID)
            {
                MessageBox.Show("先输入条件表达式", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //选中填充API默认值
            ActionExp expa = ExpManager.CreateNewActionExp(new GameAPIDefine(FixedValueProvider.COMPARE_API_ID));

            expa.API.ArgValues[0] = m_Vexp;                                                      //左值为可变类型
            expa.API.ArgValues[1] = ExpManager.CreateUnknownExp();                               //右值为空类型
            m_Vexp.ReturnType     = expa.API.ArgValues[1].ReturnType = this.m_actexp.ReturnType; //让自动填充的左右两个表达式,类型和上面一致


            ExpForm expform = new ExpForm(expa, this.m_gameEvent, true, expa.ReturnType, m_Vexp);

            expform.StartPosition = FormStartPosition.CenterParent;
            if (expform.ShowDialog() == DialogResult.OK)
            {
                this.listBox1.Items.Add(expform.RusultExp);
                this.m_bChanged = true;
            }
        }
Ejemplo n.º 2
0
        public override bool EditData(System.Collections.Hashtable table)
        {
            BindDelegate();
            Trace.Assert(table != null);
            Trace.Assert(table.ContainsKey("data"));
            Trace.Assert(table.ContainsKey("event_data"));
            Trace.Assert(table.ContainsKey("prev_data"));
            Trace.Assert(table.ContainsKey("next_data"));
            Trace.Assert(table.ContainsKey("flowchart_name"));
            Trace.Assert(table.ContainsKey("map_name"));

            LuaManager.GetLuaManager().InitOther("flowchart_name", table["flowchart_name"].ToString());
            LuaManager.GetLuaManager().InitOther("map_name", table["map_name"].ToString());
            LuaManager.GetLuaManager().InitOther("client_dir", table["client_dir"].ToString());

            //初始化历史表
            CacheManager.GetCacheManager().Global_Args_Table = table["globe_args"] as Hashtable;

            Exp        exp;
            List <Exp> elist;

            if (table["data"] == null)
            {
                exp   = ExpManager.CreateUnknownExp();
                elist = new List <Exp>();
            }
            else
            {
                ConditionData cd    = table["data"] as ConditionData;
                object[]      olist = cd.datalist;
                exp   = olist[0] as Exp;
                elist = olist[1] as List <Exp>;
            }

            ConditionForm expform = new ConditionForm(exp, table["event_data"] as GameEvent, elist);

            //conForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            //ExpForm expform = new ExpForm(exp, table["event_data"] as GameEvent, true, null);
            expform.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            if (expform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //清空连接线
                Hashtable outlineList = (table["next_data"] as Hashtable);
                foreach (DataElement de in outlineList.Values)
                {
                    if (!elist.Contains(de.Data as Exp))
                    {
                        de.Data        = null;
                        de.Text        = "";
                        de.TooltipText = "";
                    }
                }

                ConditionData cd = new ConditionData();
                cd.datalist = new object[] { expform.ResultExp, expform.LineExpList };
                this.data   = cd;
                this.text   = expform.ResultExp.ToString();
                if (this.text.Length > 15)
                {
                    this.text = this.text.Substring(0, 13) + "...";
                }
                if (expform.ResultExp is ActionExp)
                {
                    this.TooltipText = (expform.ResultExp as ActionExp).strFullText;
                }
                ScanConst(table);
                return(true);
            }
            return(false);
        }