private void btnOK_Click(object sender, EventArgs e) { Jackie_s_RPGLIB.Database.Functional.SetVariable sv = new Jackie_s_RPGLIB.Database.Functional.SetVariable(); sv.Variable = lstVariable.SelectedIndex; sv.Value = int.Parse(txtValue.Text); if (rdbSet.Checked == true) sv.ChangeType = 0; else if (rdbAdd.Checked == true) sv.ChangeType = 1; else if (rdbSub.Checked == true) sv.ChangeType = 2; else if (rdbMul.Checked == true) sv.ChangeType = 3; else if (rdbDiv.Checked == true) sv.ChangeType = 4; else if (rdbRem.Checked == true) sv.ChangeType = 5; _toAdd.Add(sv); _forRefresh.RefreshTreeView(); }
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; } }