public void Render(IWords Iworld, IForms IfieldForm) //мир и формы должны через интерфейсную ссылку передаваться { this.Iworld = Iworld; //или перегружать класс будем(хуже) if (IfieldForm is FieldForm1) { fieldForm = IfieldForm as FieldForm1; } //РАЗВИЛКА!!!!!! if (Iworld is World_1) { world = Iworld as World_1; verwolfHeight = world.verwolfHeight; verwolfWight = world.verwolfWight; subjectPanelGame = world.subjectsPanel; hero = world.hero; fieldForm.renderer = this; //ПОДПИСКИ НА СОБЫТИЯ ФОРМЫ---> ****вервольфа нужно обобщать через интерфейс или абстрактный класс //this.fieldForm.eTruck += new FieldForm.Truck(DrawTrucks); fieldForm.eFieldMouseClick += new FieldMouseClick(DrawCaptureObjects); //ПОДПИСКА ЧЕРЕЗ АНОНИМНЫЙ МЕТОД--->снимаем управление с Hero fieldForm.eFieldMouseUp += delegate(object sender, MouseEventArgs e){ if (hero.CurrentState == stateHero.Control && Math.Abs(hero.Location.X - e.Location.X) < hero.rangeHero && Math.Abs(hero.Location.Y - e.Location.Y) < hero.rangeHero) { if (e.Button == MouseButtons.Right) { hero.CurrentState = stateHero.Stay; } } }; //ПОДПИСКА ЧЕРЕЗ ЛЯМБДА fieldForm.eFieldMouseMove += (sender, e) => { Point verwolfBeginLocation = world.verfolfBeginLocation; int rateX = verwolfBeginLocation.X + world.verwolfWight; int rateY = verwolfBeginLocation.Y + world.verwolfHeight; if (e.Location.X > verwolfBeginLocation.X && e.Location.X < rateX && e.Location.Y > verwolfBeginLocation.Y && e.Location.Y < rateY && world.verwolf.CurrentState == WolfState.Stay) { DrawTrucks(true); } else { DrawTrucks(false); } }; } InitializeImages(); hero = world.hero; }
private IForms ValidateForm(Item currentItem) { IForms form = _formrepo.GetFormData(currentItem); form.FieldGroups = form.FieldGroups.Where(i => i != null).Select(ConstructFormFieldGroup).ToList(); if (form.FieldGroups.Any(b => b.ApplyValidation == true)) { form.FormInvalid = true; } return(form); }
//強制刪除記錄 main / detail / log / kind of form data / public bool DeleteRecordForce(IForms form, string signDocID) { var mainpulationConditions = new List <MultiConditions>(); mainpulationConditions.Add(form.DeleteData(signDocID)); mainpulationConditions.Add(new MultiConditions() { { "Delete From signform_detail Where SignDocID_FK = @SignDocID_FK", new Conditions() { { "@SignDocID_FK", signDocID } } } }); mainpulationConditions.Add(new MultiConditions() { { "Delete From signform_main Where SignDocID = @SignDocID", new Conditions() { { "@SignDocID", signDocID } } } }); return(_dc.ExecuteMultAndCheck(mainpulationConditions)); }
////ИСХОДНАЯ ТОЧКА, ОТКУДА ЗАПУСКАЕТСЯ МИР И ВИЗУАЛИЗАТОР private void ResetSimulator() { framesRun = 0; renderer = new Renderer(); GameOver pipec = new GameOver(YouLost); hero = new Hero(); //герой общий для всех миров hero.eExchangeWorld += new ExchangeWorld(CurrentExit); timer1.Enabled = true; timer2.Enabled = true; Iworld1 = new World_1(fillPanel, pipec, subjectsPanel, hero); World_1 w1 = Iworld1 as World_1; exchangePortal.Add(Iworld1.Exit, w1.hive); //т.к. у нас пчелы в улье создаются, а сначала мы мир открываем, то вот такие пляски currentWorld = Iworld1; hero.GetCurrentWorld(Iworld1); //герой узнает о мире Iworld1.renderer = renderer; IForm1 = new FieldForm1(); StartWorld(Iworld1); }
private IForms ConstructForm(Item currentItem) { IForms form = _formrepo.GetFormData(currentItem); return(form); }