private void btnOK_Click(object sender, EventArgs e)
        {
            switch (chkConditionerType.SelectedIndex)
            {
                case 0:
                    ConditionerLoc cl = new ConditionerLoc();
                    cl.ReqMap = int.Parse(txtReqMap.Text);
                    cl.ReqX = int.Parse(txtReqX.Text);
                    cl.ReqY = int.Parse(txtReqY.Text);

                    _toAdd.Add(cl);
                    _forRefresh.RefreshTreeView();
                    break;
                case 1:
                    ConditionerVariable cv = new ConditionerVariable();
                    cv.ReqVariable = lstVariable.SelectedIndex;
                    cv.ReqValue = int.Parse(txtReqVarValue.Text);

                    _toAdd.Add(cv);
                    _forRefresh.RefreshTreeView();
                    break;

                case 2:
                    ConditionerSwitch cs = new ConditionerSwitch();
                    cs.ReqSwitch = lstSwitch.SelectedIndex;
                    cs.ReqValue = (cmbSwitchValue.SelectedIndex == 0) ? true : false;

                    _toAdd.Add(cs);
                    _forRefresh.RefreshTreeView();
                    break;
            }

            Close();
        }
Example #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;
            }
        }