示例#1
0
        public void AddEventToNode(TreeNode t, Event e)
        {
            TreeNode addIf = new TreeNode();
            TreeNode addElse = new TreeNode();

            string[] _operation = new string[6]{"Set", "Add", "Sub", "Mul", "Div", "Rem"};
            string[] _bool = new string[3] { "True", "False", "Revert" };

            switch (e.Type)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    Warp w = e as Warp;
                    TreeNode warp = new TreeNode("Warp: (" + w.WarpMap + ", " + w.WarpX + ", " + w.WarpY + ")");
                    t.Nodes.Add(warp);
                    warp.Tag = w;
                    break;
                case 3:
                    ConditionerLoc cl = e as ConditionerLoc;
                    TreeNode conditionerloc = new TreeNode("Conditioner (Loc): (" + cl.ReqMap + ", " + cl.ReqX + ", " + cl.ReqY + ")");
                    conditionerloc.Tag = cl;

                    TreeNode clIf = new TreeNode("If: ");
                    clIf.Name = "If";
                    clIf.Tag = cl.If;
                    foreach (Event me in cl.If)
                        AddEventToNode(clIf, me);
                    addIf = new TreeNode("Add");
                    addIf.Name = "AddIf";
                    addIf.Tag = cl;
                    clIf.Nodes.Add(addIf);
                    TreeNode clElse = new TreeNode("Else: ");
                    clElse.Name = "Else";
                    clElse.Tag = cl.Else;
                    foreach (Event me in cl.Else)
                        AddEventToNode(clElse, me);
                    addElse = new TreeNode("Add");
                    addElse.Name = "AddElse";
                    addElse.Tag = cl;
                    clElse.Nodes.Add(addElse);

                    conditionerloc.Nodes.Add(clIf);
                    conditionerloc.Nodes.Add(clElse);

                    t.Nodes.Add(conditionerloc);
                    break;

                case 4:
                    ConditionerVariable cv = e as ConditionerVariable;
                    TreeNode conditionervariable = new TreeNode("Conditioner (Variable): " + cv.ReqVariable + "-" + Editor.Instance.curGame.MyVariable[cv.ReqVariable].Name + ": " + cv.ReqValue);
                    conditionervariable.Tag = cv;

                    TreeNode cvIf = new TreeNode("If: ");
                    cvIf.Name = "If";
                    cvIf.Tag = cv.If;

                    foreach (Event me in cv.If)
                        AddEventToNode(cvIf, me);
                    addIf = new TreeNode("Add:");
                    addIf.Name = "AddIf";
                    addIf.Tag = cv;
                    cvIf.Nodes.Add(addIf);
                    TreeNode cvElse = new TreeNode("Else: ");
                    cvElse.Name = "Else";
                    cvElse.Tag = cv.Else;
                    foreach (Event me in cv.Else)
                        AddEventToNode(cvElse, me);
                    addElse = new TreeNode("Add");
                    addElse.Name = "AddElse";
                    addElse.Tag = cv;
                    cvElse.Nodes.Add(addElse);

                    conditionervariable.Nodes.Add(cvIf);
                    conditionervariable.Nodes.Add(cvElse);

                    t.Nodes.Add(conditionervariable);
                    break;

                case 5:
                    ConditionerSwitch cs = e as ConditionerSwitch;
                    TreeNode conditionerswitch = new TreeNode("Conditioner (Switch): " + cs.ReqSwitch + "-" + Editor.Instance.curGame.MySwitch[cs.ReqSwitch].Name + ": " + cs.ReqValue.ToString());
                    conditionerswitch.Tag = cs;

                    TreeNode csIf = new TreeNode("If: ");
                    csIf.Name = "If";
                    csIf.Tag = cs.If;

                    foreach (Event me in cs.If)
                        AddEventToNode(csIf, me);
                    addIf = new TreeNode("Add:");
                    addIf.Name = "AddIf";
                    addIf.Tag = cs;
                    csIf.Nodes.Add(addIf);
                    TreeNode csElse = new TreeNode("Else: ");
                    csElse.Name = "Else";
                    csElse.Tag = cs.Else;
                    foreach (Event me in cs.Else)
                        AddEventToNode(csElse, me);
                    addElse = new TreeNode("Add");
                    addElse.Name = "AddElse";
                    addElse.Tag = cs;
                    csElse.Nodes.Add(addElse);

                    conditionerswitch.Nodes.Add(csIf);
                    conditionerswitch.Nodes.Add(csElse);

                    t.Nodes.Add(conditionerswitch);
                    break;

                case 6:
                    Jackie_s_RPGLIB.Database.Functional.SetSwitch ss = e as Jackie_s_RPGLIB.Database.Functional.SetSwitch;

                    TreeNode setswitch = new TreeNode("Set Switch: " + ss.Switch + "-" + Editor.Instance.curGame.MySwitch[ss.Switch].Name + ": " + ss.Value + ", " + _bool[ss.ChangeType]);
                    t.Nodes.Add(setswitch);
                    setswitch.Tag = ss;

                    break;
                case 7:
                    Jackie_s_RPGLIB.Database.Functional.SetVariable sv = e as Jackie_s_RPGLIB.Database.Functional.SetVariable;

                    TreeNode setvariable = new TreeNode("Set Variable: " + sv.Variable + "-" + Editor.Instance.curGame.MyVariable[sv.Variable].Name + ": " + sv.Value + ", " + _operation[sv.ChangeType]);
                    t.Nodes.Add(setvariable);
                    setvariable.Tag = sv;

                    break;
            }
        }
示例#2
0
        private void trvEvent_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Event eve = new Event();
                List<Event> lsteve = new List<Event>();

                trvEvent.SelectedNode = trvEvent.GetNodeAt(e.X, e.Y);

                if (trvEvent.SelectedNode.Tag is Event)
                {
                    eve = (Event)trvEvent.SelectedNode.Tag;
                    eventContextMenuStrip1.Show(Cursor.Position);
                }
                else if (trvEvent.SelectedNode.Tag is List<Event>)
                {
                    lsteve = (List<Event>)trvEvent.SelectedNode.Tag;
                }

            }
        }
示例#3
0
        public void SaveEvent(Event e)
        {
            bw.Write(e.Type);

            switch (e.Type)
            {
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    Warp w = e as Warp;
                    bw.Write(w.WarpMap);
                    bw.Write(w.WarpX);
                    bw.Write(w.WarpY);
                    bw.Write(w.Position);
                    break;

                case 3: //Conditioner Location
                    ConditionerLoc cl = e as ConditionerLoc;
                    bw.Write(cl.ReqMap);
                    bw.Write(cl.ReqX);
                    bw.Write(cl.ReqY);
                    bw.Write(cl.Position);

                    bw.Write(cl.If.Count);
                    foreach (Event miniE in cl.If)
                        SaveEvent(miniE);

                    bw.Write(cl.Else.Count);
                    foreach (Event miniE in cl.Else)
                        SaveEvent(miniE);
                    break;

                case 4:
                    ConditionerVariable cv = e as ConditionerVariable;
                    bw.Write(cv.ReqVariable);
                    bw.Write(cv.ReqValue);

                    bw.Write(cv.If.Count);
                    foreach (Event miniE in cv.If)
                        SaveEvent(miniE);

                    bw.Write(cv.Else.Count);
                    foreach (Event miniE in cv.Else)
                        SaveEvent(miniE);

                    break;
                case 5:

                    ConditionerSwitch cs = e as ConditionerSwitch;
                    bw.Write(cs.ReqSwitch);
                    bw.Write(cs.ReqValue);

                    bw.Write(cs.If.Count);
                    foreach (Event miniE in cs.If)
                        SaveEvent(miniE);

                    bw.Write(cs.Else.Count);
                    foreach (Event miniE in cs.Else)
                        SaveEvent(miniE);

                    break;

                case 6:
                    SetSwitch ss = e as SetSwitch;
                    bw.Write(ss.Switch);
                    bw.Write(ss.Value);
                    bw.Write(ss.ChangeType);

                    break;
                case 7:
                    SetVariable sv = e as SetVariable;
                    bw.Write(sv.Variable);
                    bw.Write(sv.Value);
                    bw.Write(sv.ChangeType);

                    break;
            }
        }