Пример #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Warp w = new Warp();
            w.WarpMap = int.Parse(txtWarpMap.Text);
            w.WarpX = int.Parse(txtWarpX.Text);
            w.WarpY = int.Parse(txtWarpY.Text);
            _toAdd.Add(w);

            _forRefresh.RefreshTreeView();

            Close();
        }
Пример #2
0
        public void LoadEvent(Game obj, List<Event> toAdd)
        {
            int type = br.ReadInt32();
            int count;

            switch (type)
            {
                case 0:
                    break;

                case 1:
                    break;

                case 2:
                    Warp w = new Warp();
                    w.WarpMap = br.ReadInt32();
                    w.WarpX = br.ReadInt32();
                    w.WarpY = br.ReadInt32();
                    w.Position = br.ReadInt32();

                    toAdd.Add(w);
                    break;

                case 3:
                    ConditionerLoc cl = new ConditionerLoc();
                    cl.ReqMap = br.ReadInt32();
                    cl.ReqX = br.ReadInt32();
                    cl.ReqY = br.ReadInt32();
                    cl.Position = br.ReadInt32();

                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cl.If);
                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cl.Else);

                    toAdd.Add(cl);
                    break;
                case 4:
                    ConditionerVariable cv = new ConditionerVariable();
                    cv.ReqVariable = br.ReadInt32();
                    cv.ReqValue = br.ReadInt32();

                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cv.If);
                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cv.Else);

                    toAdd.Add(cv);
                    break;
                case 5:
                    ConditionerSwitch cs = new ConditionerSwitch();
                    cs.ReqSwitch = br.ReadInt32();
                    cs.ReqValue = br.ReadBoolean();

                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cs.If);
                    count = br.ReadInt32();
                    for (int i = 0; i < count; i++)
                        LoadEvent(obj, cs.Else);

                    toAdd.Add(cs);
                    break;

                case 6:
                    SetSwitch ss = new SetSwitch();
                    ss.Switch = br.ReadInt32();
                    ss.Value = br.ReadBoolean();
                    ss.ChangeType = br.ReadInt32();

                    toAdd.Add(ss);
                    break;

                case 7:
                    SetVariable sv = new SetVariable();
                    sv.Variable = br.ReadInt32();
                    sv.Value = br.ReadInt32();
                    sv.ChangeType = br.ReadInt32();

                    toAdd.Add(sv);
                    break;
            }
        }