public void ContextMenuStrip_Always_AddCustomItems() { // Setup using (var treeView = new TreeViewControl()) { var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var assessmentSectionContext = new AssessmentSectionStateRootContext(assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mocks = new MockRepository(); IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(cmp => cmp.Get(assessmentSectionContext, treeView)).Return(menuBuilder); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { plugin.Gui = gui; // Call using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(assessmentSectionContext, null, treeView)) { // Assert Assert.AreEqual(10, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportAssessmentSectionIndex, "&Importeren...", "Importeer de gegevens vanuit een bestand.", CoreGuiResources.ImportIcon); } } } }
public void ContextMenuStrip_Always_CallsBuilder() { // Setup var mocks = new MockRepository(); var menuBuilder = mocks.StrictMock <IContextMenuBuilder>(); menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); IGui gui = StubFactory.CreateGuiStub(mocks); using (var treeViewControl = new TreeViewControl()) { gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); mocks.ReplayAll(); using (var p = new RiskeerPlugin()) { p.Gui = gui; TreeNodeInfo i = p.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DikeProfile)); // Call i.ContextMenuStrip(null, null, treeViewControl); } } // Assert mocks.VerifyAll(); }
public ViewParameter(Action action, IGui gui, IApplication application) { paramList = new List <object>(); paramList.Add(action); paramList.Add(gui); paramList.Add(application); }
public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllDisabled() { // Setup using (var treeView = new TreeViewControl()) { var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var context = new HydraulicLoadsStateRootContext(assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mocks = new MockRepository(); IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { plugin.Gui = gui; // Call using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(context, null, treeView)) { // Assert Assert.AreEqual(10, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem( menu, contextMenuCalculateAllIndex, "Alles be&rekenen", "Er is geen hydraulische belastingendatabase geïmporteerd.", RiskeerCommonFormsResources.CalculateAllIcon, false); } } } }
public void GivenCalculationsWithIllustrationPoints_WhenClearIllustrationPointsClickedAndContinue_ThenInquiryAndIllustrationPointsCleared( Func <IAssessmentSection, HydraulicBoundaryLocationCalculation> getHydraulicLocationCalculationFunc) { // Given var random = new Random(21); IAssessmentSection assessmentSection = GetConfiguredAssessmentSectionWithHydraulicBoundaryLocationCalculations(); HydraulicBoundaryLocationCalculation calculation = getHydraulicLocationCalculationFunc(assessmentSection); calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(random.NextDouble(), new TestGeneralResultSubMechanismIllustrationPoint()); HydraulicBoundaryLocationCalculation[] calculationsWithOutput = GetAllWaterLevelCalculationsWithOutput(assessmentSection).ToArray(); var messageBoxText = ""; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); messageBoxText = helper.Text; helper.ClickOk(); }; var context = new WaterLevelCalculationsForNormTargetProbabilitiesGroupContext(new ObservableList <HydraulicBoundaryLocation>(), assessmentSection); var mockRepository = new MockRepository(); using (var treeViewControl = new TreeViewControl()) { var calculationObserver = mockRepository.StrictMock <IObserver>(); calculationObserver.Expect(o => o.UpdateObserver()); IGui gui = StubFactory.CreateGuiStub(mockRepository); gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub <IMainWindow>()); gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mockRepository.ReplayAll(); calculation.Attach(calculationObserver); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; using (ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(context, null, treeViewControl)) { // When contextMenuAdapter.Items[contextMenuClearIllustrationPointsIndex].PerformClick(); // Then const string expectedMessage = "Weet u zeker dat u alle berekende illustratiepunten bij 'Waterstanden bij vaste doelkans' wilt wissen?"; Assert.AreEqual(expectedMessage, messageBoxText); Assert.IsTrue(calculationsWithOutput.All(calc => calc.HasOutput)); Assert.IsFalse(calculation.Output.HasGeneralResult); } } } mockRepository.VerifyAll(); }
public Controller(IGui gui) { _gui = gui; consumer = new Consumer(); Start(); }
/// <summary> /// Initializes a new instance of the <see cref="IScreen"/> class. /// </summary> /// <param name="gui">The GUI Component, if null you cant use GUI in this screen.</param> public IScreen(IGui gui = null) { this.gui = gui; IsLoaded = false; CleanUpWhenRemoved = true; CleanupAbles = new List <ICleanupAble>(); }
static void Main() { // Create a time for Tick event Timer timer = new Timer(10); // Hook up the Elapsed event for the timer. timer.Elapsed += OnTimedEvent; timer.AutoReset = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Connect GUI with the Controller and vice versa ReactionMachineForm MainForm = new ReactionMachineForm(); Contoller = new SimpleReactionController(); Gui = MainForm; Gui.Connect(Contoller); Contoller.Connect(Gui, new RandomGenerator()); //Reset the GUI Gui.Init(); // Start the timer timer.Enabled = true; Application.Run(MainForm); }
public void Write(IGui data, XElement node) { Write(new NodeUIData() { Area = data.Area }, node); }
// sets the controller to the OnState private void InitialiseToOnState(IController controller, IGui gui, IRandom rng) { gui.Connect(controller); controller.Connect(gui, rng); gui.Init(); controller.Init(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { Object[] param = e.Parameter as Object[]; if (param != null) { parameter = new ViewParameter(param); gui = parameter.GetGui(); application = parameter.GetApplication(); // Since we do not need the parameter any more, overwrite them param = parameter.GetParameter(); switch (parameter.GetAction()) { case ViewParameter.Action.ExcerciseShow: excercise = param[0] as IExcercise; categoriesList = param[1] as ObservableCollection <Category>; break; case ViewParameter.Action.ExcerciseCreate: categoriesList = param[0] as ObservableCollection <Category>; Editable = true; break; case ViewParameter.Action.ExcerciseEdit: excercise = param[0] as IExcercise; excerciseTmp = new Excercise(excercise.ID, excercise.Name, excercise.Description, excercise.Categories); categoriesList = param[1] as ObservableCollection <Category>; break; default: throw new NotImplementedException(); } } base.OnNavigatedTo(e); }
public void Test_ResultState_CoinInserted() { controller = new EnhancedReactionController(); gui = new DummyGui(); rng = new RndGenerator(); InitialiseToRunningState(controller, gui, rng); // Play 3 games for (int t = 0; t < 10; t++) { controller.Tick(); } controller.GoStopPressed(); controller.GoStopPressed(); for (int t = 0; t < RandomNumber + 15; t++) { controller.Tick(); } controller.GoStopPressed(); controller.GoStopPressed(); for (int t = 0; t < RandomNumber + 20; t++) { controller.Tick(); } controller.GoStopPressed(); controller.GoStopPressed(); // Inserting a coin in the ResultState has no effect Assert.AreEqual("Average: 0.15", displayText); controller.CoinInserted(); Assert.AreEqual("Average: 0.15", displayText); }
public void Test_GameOverState_Tick() { controller = new EnhancedReactionController(); gui = new DummyGui(); rng = new RndGenerator(); InitialiseToRunningState(controller, gui, rng); // Tick shows the reaction time and then sets the // controller to the WaitState // NOTE: This test does not test the transition // to the ResultState. That is tested in // Test_Play_Three_Games_And_Wait_Ticks for (int t = 0; t < 50; t++) { controller.Tick(); } controller.GoStopPressed(); Assert.AreEqual("0.50", displayText); for (int t = 0; t < 299; t++) { controller.Tick(); } Assert.AreEqual("0.50", displayText); controller.Tick(); Assert.AreEqual("Wait...", displayText); }
public void Test_RunningState_Tick() { controller = new EnhancedReactionController(); gui = new DummyGui(); rng = new RndGenerator(); InitialiseToRunningState(controller, gui, rng); // Ticks advance the time display in the RunningState Assert.AreEqual("0.00", displayText); controller.Tick(); Assert.AreEqual("0.01", displayText); for (int t = 0; t < 10; t++) { controller.Tick(); } Assert.AreEqual("0.11", displayText); for (int t = 0; t < 100; t++) { controller.Tick(); } Assert.AreEqual("1.11", displayText); // GoStopPressed should advance to the GameOverState // and no further update to the display controller.GoStopPressed(); Assert.AreEqual("1.11", displayText); }
public void ContextMenuStrip_WithSpecificAssessmentSectionConfiguration_CalculateAllMenuItemStateAsExpected(AssessmentSection assessmentSection, bool expectedEnabledState) { // Setup using (var treeView = new TreeViewControl()) { var context = new CalculationsStateRootContext(assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var mocks = new MockRepository(); IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { plugin.Gui = gui; // Call using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(context, null, treeView)) { // Assert Assert.AreEqual(10, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, "Alles be&rekenen", expectedEnabledState ? "Voer alle berekeningen binnen dit traject uit." : "Er zijn geen berekeningen om uit te voeren.", RiskeerCommonFormsResources.CalculateAllIcon, expectedEnabledState); } } } }
public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup var menuBuilder = mocksRepository.StrictMock <IContextMenuBuilder>(); using (mocksRepository.Ordered()) { menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); } using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mocksRepository); gui.Stub(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilder); mocksRepository.ReplayAll(); plugin.Gui = gui; // Call info.ContextMenuStrip(null, null, treeViewControl); } // Assert // Assert expectancies called in TearDown() }
public InstallLocation([NotNull] ControllerConfig config, [NotNull] IProcessRunner processRunner, [NotNull] IGui gui) { if (config == null) { throw new ArgumentNullException("config"); } if (processRunner == null) { throw new ArgumentNullException("processRunner"); } if (gui == null) { throw new ArgumentNullException("gui"); } this.config = config; this.processRunner = processRunner; this.gui = gui; string path = Path.Combine(config.LauncherBinDirFullPath, "bin"); path = Path.Combine(path, config.WurmUnlimitedMode ? "wu" : "wo"); path = Path.Combine(path, config.BuildCode); installDirPath = path; if (!Path.IsPathRooted(installDirPath)) { throw new InvalidOperationException("rootPath must be absolute"); } if (!Directory.Exists(installDirPath)) { Directory.CreateDirectory(installDirPath); } }
public void ContextMenuStrip_Always_ContextMenuItemSelectMapLayerEnabled() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); var mockRepository = new MockRepository(); var assessmentSectionStateRootContext = new AssessmentSectionStateRootContext(new AssessmentSection(AssessmentSectionComposition.Dike)); using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mockRepository); gui.Stub(g => g.Get(backgroundData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mockRepository.ReplayAll(); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(backgroundData, assessmentSectionStateRootContext, treeViewControl)) { const string expectedItemText = "&Selecteren..."; const string expectedItemTooltip = "Selecteer een achtergrondkaart."; TestHelper.AssertContextMenuStripContainsItem(contextMenu, selectContextMenuIndex, expectedItemText, expectedItemTooltip, RiskeerCommonFormsResources.MapsIcon); } } } // Assert mockRepository.VerifyAll(); }
public void CreateInstance_WithContext_SetsFailureMechanismContributionAsData() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var viewCommands = mocks.Stub <IViewCommands>(); IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(g => g.ViewCommands).Return(viewCommands); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { plugin.Gui = gui; FailureMechanismContribution failureMechanismContribution = FailureMechanismContributionTestFactory.CreateFailureMechanismContribution(); var context = new NormContext(failureMechanismContribution, assessmentSection); PropertyInfo info = GetInfo(plugin); // Call IObjectProperties objectProperties = info.CreateInstance(context); // Assert Assert.IsInstanceOf <NormProperties>(objectProperties); Assert.AreSame(failureMechanismContribution, objectProperties.Data); } mocks.VerifyAll(); }
public void ContextMenuStrip_Always_CallsBuilder() { // Setup var mocks = new MockRepository(); var menuBuilder = mocks.StrictMock <IContextMenuBuilder>(); menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); using (plugin) using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); mocks.ReplayAll(); plugin.Gui = gui; // Call info.ContextMenuStrip(null, null, treeViewControl); } // Assert mocks.VerifyAll(); }
public void Connect(IGui gui, IRandom rng) { this.gui = gui; this.random = rng; this.gui.Connect(this); Init(); }
public void ContextMenuStrip_Always_ReturnsExpectedItem() { // Setup using (var treeView = new TreeViewControl()) { var failureMechanisms = new ObservableList <SpecificFailureMechanism>(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var context = new SpecificFailureMechanismsContext(failureMechanisms, assessmentSection); var menuBuilder = mocks.StrictMock <IContextMenuBuilder>(); using (mocks.Ordered()) { menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder); menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddDeleteChildrenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); } IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); mocks.ReplayAll(); plugin.Gui = gui; // Call info.ContextMenuStrip(context, assessmentSection, treeView); // Assert // Assert expectancies are called in TearDown() } }
public void ContextMenuStrip_WaterLevelCalculationsWithoutIllustrationPoints_ContextMenuItemClearAllIllustrationPointsDisabled() { // Setup IAssessmentSection assessmentSection = GetConfiguredAssessmentSectionWithHydraulicBoundaryLocationCalculations(); var nodeData = new WaterLevelCalculationsForNormTargetProbabilitiesGroupContext(new ObservableList <HydraulicBoundaryLocation>(), assessmentSection); var mockRepository = new MockRepository(); using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mockRepository); gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub <IMainWindow>()); mockRepository.ReplayAll(); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert ToolStripItem contextMenuItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex]; Assert.IsFalse(contextMenuItem.Enabled); } } } mockRepository.VerifyAll(); // Expect no calls on arguments }
public void ContextMenuStrip_Always_AddCustomItems() { // Setup var failureMechanisms = new ObservableList <SpecificFailureMechanism>(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var context = new SpecificFailureMechanismsContext(failureMechanisms, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeView = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); mocks.ReplayAll(); plugin.Gui = gui; // Call using (ContextMenuStrip menu = info.ContextMenuStrip(context, assessmentSection, treeView)) { // Assert Assert.AreEqual(6, menu.Items.Count); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCreateFailureMechanismIndex, "Faalmechanisme toevoegen", "Voeg een nieuw faalmechanisme toe aan deze map.", RiskeerCommonFormsResources.FailureMechanismIcon); } } }
public LaunchController(IGuiHost host, ControllerConfig config, [NotNull] IDebug debug, [NotNull] UserSettings settings) { if (host == null) { throw new ArgumentNullException("host"); } this.host = host; if (config == null) { throw new ArgumentNullException("config"); } if (debug == null) { throw new ArgumentNullException("debug"); } if (settings == null) { throw new ArgumentNullException("settings"); } this.config = config; this.debug = debug; this.settings = settings; var updaterGui = new UpdaterGui(host, debug); host.SetContent(updaterGui); gui = updaterGui; }
public void CreateInstance_WithContext_SetsData() { // Setup var mocks = new MockRepository(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var viewCommands = mocks.Stub <IViewCommands>(); IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(g => g.ViewCommands).Return(viewCommands); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { plugin.Gui = gui; var context = new TestStateRootContext(assessmentSection); PropertyInfo info = GetInfo(plugin); // Call IObjectProperties objectProperties = info.CreateInstance(context); // Assert Assert.IsInstanceOf <AssessmentSectionProperties>(objectProperties); Assert.AreSame(assessmentSection, objectProperties.Data); } mocks.VerifyAll(); }
internal WeekApplicationContext() { try { Log.LogCaller(); //MonitorProcess.Run(); // Removed because of false positive virus varning _updateHandler = UpdateHandler.Instance; Settings.StartWithWindows = Settings.SettingIsValue(Resources.StartWithWindows, true.ToString()); Application.ApplicationExit += OnApplicationExit; SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged; _currentWeek = Week.Current(); _lastIconRes = WeekIcon.GetIconResolution(); Gui = new TaskbarGui(_currentWeek, _lastIconRes); Gui.UpdateRequest += GuiUpdateRequestHandler; _timer = GetTimer; AutoUpdateCheck(); } catch (Exception ex) { _timer?.Stop(); Log.LogCaller(); Message.Show(Resources.UnhandledException, ex); Application.Exit(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Object[] param = e.Parameter as Object[]; if (param != null) { parameter = new ViewParameter(param); gui = parameter.GetGui(); application = parameter.GetApplication(); // Since we do not need the parameter any more, overwrite them param = parameter.GetParameter(); switch (parameter.GetAction()) { case ViewParameter.Action.CategoryShow: category = param[0] as ICategory; Editable = false; break; case ViewParameter.Action.CategoryCreate: Editable = true; break; case ViewParameter.Action.CategoryEdit: category = param[0] as ICategory; categoryTmp = new Category(category.Name, category.Description); Editable = false; break; default: throw new NotImplementedException(); } } base.OnNavigatedTo(e); }
protected virtual void Dispose(bool disposing) { if (disposing) { Gui = null; } }
public void ContextMenuStrip_Always_CallsBuilder() { // Setup var mocks = new MockRepository(); var menuBuilder = mocks.StrictMock <IContextMenuBuilder>(); using (mocks.Ordered()) { menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); } using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); mocks.ReplayAll(); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; // Call info.ContextMenuStrip(null, null, treeViewControl); } } // Assert mocks.VerifyAll(); }
public LaunchController(IGuiHost host, ControllerConfig config, [NotNull] IDebug debug) { if (host == null) throw new ArgumentNullException("host"); this.host = host; if (config == null) throw new ArgumentNullException("config"); if (debug == null) throw new ArgumentNullException("debug"); this.config = config; this.debug = debug; var updaterGui = new UpdaterGui(host, debug); host.SetContent(updaterGui); gui = updaterGui; }
public TableIO(IGui gui, IRecordManager recordManager) { m_gui = gui; m_recordManager = recordManager; m_state = State.Unknown; m_listControlsEnabledOnlyOnAdd = new List<Control>(); m_listControlsEnabledOnlyOnView = new List<Control>(); m_listControlsNeverEnabled = new List<Control>(); m_dataRow = null; m_connection = null; m_sqlDataAdapter = null; m_dataSet = null; m_tableName = ""; m_suspendValueChanged = false; m_suspendGuiChanged = false; listDataBinding = new List<DataBinding>(); m_recordIsOptional = false; }
public ItemRecordManager(IGui gui, ComboBox categoryControl, ComboBox subCategoryControl, ComboBox typeControl, TextBox asset2D, TextBox asset3D, TextBox baseBaseItem, Button baseBaseItemBtn, Button baseManufacturingBtn, TextBox equipVisualEffect) { m_gui = gui; m_categoryControl = categoryControl; m_subCategoryControl = subCategoryControl; m_typeControl = typeControl; m_categoryTabPages = new Dictionary<Items.ItemCategory, TabPage[]>(); m_subCategoryTabPages = new Dictionary<Items.ItemSubCategory, TabPage[]>(); m_asset2D = asset2D; m_asset3D = asset3D; m_baseBaseItem = baseBaseItem; m_baseBaseItemBtn = baseBaseItemBtn; m_baseManufacturingBtn = baseManufacturingBtn; m_equipVisualEffect = equipVisualEffect; }
public ItemMissileRecordManager(IGui gui) { m_gui = gui; }
public ItemBeamRecordManager(IGui gui) { m_gui = gui; }
public ItemEngineRecordManager(IGui gui) { m_gui = gui; }
public ItemDeviceRecordManager(IGui gui) { m_gui = gui; }
public override void Update(GameTime gameTime) { float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; if (game.Lives <= 0) { Lost = true; finished = true; } else if (spawner.finished == true && enemyManager.enemies.Count == 0) { Won = true; finished = true; } if (!finished) { KeyboardState ks = Keyboard.GetState(); MouseState ms = Mouse.GetState(); if (ks.IsKeyDown(Keys.Space)) { Pause(); } if (ks.IsKeyDown(Keys.O)) { UnPause(); } if (!Paused) { sinceTowerChange += elapsed; if (mode == Mode.build) { if (ButtonState.Pressed == ms.LeftButton) { int x, y; x = ms.X - camera.PointPosition.X - ((ms.X - camera.PointPosition.X) % 48); y = ms.Y - camera.PointPosition.Y - ((ms.Y - camera.PointPosition.Y) % 48); int xCoord, yCoord; xCoord = x / 48; yCoord = y / 48; //Preveri ce se nahaja na mapi if (xCoord >= 0 && (xCoord) <= (map[0].Length-1) && yCoord >= 0 && (yCoord) <= (map.Length-1)) { Point mousePosition = new Point(xCoord, yCoord); if (ObjectMap[mousePosition.Y][mousePosition.X] == null && !EnemyManager.isEnemyOnIt(mousePosition) && game.money >= Building.cost) { towerManager.Build(new Vector2(x, y), Building); } } } if (sinceTowerChange > 0.1f && ks.IsKeyDown(Keys.Add)) { buildingTower++; if (buildingTower == towerManager.towerList.Count) buildingTower = 0; sinceTowerChange = 0; } } else if (mode == Mode.normal && ButtonState.Pressed == ms.LeftButton) { Rectangle mouse = new Rectangle(ms.X - 2, ms.Y - 2, 4, 4); selected = isEnemyOnLocation(mouse); if (selected == null) { foreach (Tower t in towerManager.towers) { Rectangle rec = t.DestinationRectangle; if (mouse.Intersects(rec)) { selected = t; } } } } if (ks.IsKeyDown(Keys.B)) { mode = Mode.build; } if (ks.IsKeyDown(Keys.N)) { mode = Mode.normal; } } } base.Update(gameTime); }
public ItemAmmoRecordManager(IGui gui) { m_gui = gui; }