public virtual IEnumerator <ITask> ChangeControllerHandler(ChangeController changeController) { Controller newController = changeController.Body; if (newController.FindInstance()) { _state.Controller.Dispose(); _state.Controller = newController; changeController.ResponsePort.Post(DefaultUpdateResponseType.Instance); SendNotification <ChangeController>(_subMgr, _state.Controller); } else { changeController.ResponsePort.Post(Fault.FromCodeSubcodeReason( W3C.Soap.FaultCodes.Receiver, DsspFaultCodes.OperationFailed, Resources.ControllerNotFound ) ); } yield break; }
protected override void ResolveEffect() { var hasWon = FlipACoin(Controller); if (hasWon) { return; } if (Source.OwningCard.Zone != Zone.Battlefield) { return; } if (Source.OwningCard.Controller == _opponent) { return; } var sourceModifier = new ChangeController(_opponent); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; Source.OwningCard.AddModifier(sourceModifier, p); }
public ChangesViewModel() { Changes = new ObservableCollection <ChangeDescriptionViewModel>(); Changes.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Changes_CollectionChanged); ChangeController = new ChangeController(); ChangeController.UserName = WindowsIdentity.GetCurrent().Name; ChangeController.ProjectName = "NoProjectName"; }
private void GeneratePath() { _algorithm?.Cleanup(); // cleanup algorithm's edits to node grid _runtime = 0f; _algorithm = new AStar(_grid); _path = _algorithm.FindPath(_start, _end); _state = _algorithm.ChangeController; }
public async Task <IActionResult> Euro() { ChangeController change = new ChangeController(_context); var quotation = await change.SetQuotation("EUR", 1); ViewData["moneda"] = quotation.Value.moneda; ViewData["precio"] = quotation.Value.precio; ViewData["url"] = "https://localhost:" + Request.Host.Port + "/cotizacion/euro"; return(View(quotation)); }
private void Apply() { foreach (var v in SelectedChanges.Where(var => var.IsApplied == false)) { v.IsApplied = ChangeController.ApplySingleChange(Plants, Wells, v.changeDescription); } if (ChangesApplied != null) { ChangesApplied(this, null); } }
public MainWindow() { InitializeComponent(); _localizationProvider = (ObjectDataProvider)Resources["language"]; _localizator = (Localizator)_localizationProvider.Data; _changeController = new ChangeController(); _changeController.Refreshed += (sender, args) => refreshFileButtonsAndTitle(); _viewModelFactory = new ViewModelFactory(); _commandsFactory = new CommandsFactory(); }
private void GainControl(Card enchantment) { var sourceModifier = new ChangeController(Controller); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; enchantment.AddModifier(sourceModifier, p); }
private void GainControl(Card enchantment) { var sourceModifier = new ChangeController(Controller); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; enchantment.AddModifier(sourceModifier, p); }
private void Save() { Microsoft.Win32.SaveFileDialog savedialog = new Microsoft.Win32.SaveFileDialog(); savedialog.Filter = "(*.xml)|*.xml"; if (savedialog.ShowDialog().Value) { ChangeController.SaveToFile(SelectedChanges.Select(var => var.changeDescription), savedialog.FileName); foreach (var v in SelectedChanges) { v.IsDirty = false; } } }
public void Initialize( IInventorApplication application, ChangeController changeController, ViewModels.IViewModelFactory viewModelFactory, Commands.ICommandsFactory commandsFactory) { _application = application; _changeController = changeController; _viewModelFactory = viewModelFactory; _commandsFactory = commandsFactory; _owner = application.MainForm as Window; Reload(); }
protected override void ResolveEffect() { var targetModifier = new ChangeController(Controller); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; Target.Card().AddModifier(targetModifier, p); var sourceModifier = new ChangeController(Controller.Opponent); Source.OwningCard.AddModifier(sourceModifier, p); }
protected override void ResolveEffect() { var targetModifier = new ChangeController(Controller); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; Target.Card().AddModifier(targetModifier, p); var sourceModifier = new ChangeController(Controller.Opponent); Source.OwningCard.AddModifier(sourceModifier, p); }
private void Load() { Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.Filter = "Known file types (*.xml)|*.xml"; openFileDialog.Title = "Select an XML file with changes in JupiterPlus format"; if (openFileDialog.ShowDialog().Value) { foreach (var c in ChangeController.LoadFromFile(openFileDialog.FileName)) { var cdv = new ChangeDescriptionViewModel(c); cdv.IsDirty = false; Changes.Add(cdv); } CheckChanges(); } }
protected override void ResolveEffect() { if (Source.OwningCard.Zone != Zone.Battlefield) return; if (Source.OwningCard.Controller == _opponent) return; var sourceModifier = new ChangeController(_opponent); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; Source.OwningCard.AddModifier(sourceModifier, p); }
public void ChangeWithCorrectValues() { //Arrange Mock <IBillRepository> mockBill = new Mock <IBillRepository>(); Mock <ICoinRepository> mockCoin = new Mock <ICoinRepository>(); Mock <ITransactionRepository> mockTransaction = new Mock <ITransactionRepository>(); Mock <ITransactionXBillRepository> mockTransactionBill = new Mock <ITransactionXBillRepository>(); Mock <ITransactionXCoinRepository> mockTransactionCoin = new Mock <ITransactionXCoinRepository>(); CheckoutCashier checkoutCashier = new CheckoutCashier(mockBill.Object, mockCoin.Object, mockTransactionBill.Object, mockTransactionCoin.Object, mockTransaction.Object); ChangeController changeController = new ChangeController(checkoutCashier); Payments payments = new Payments(mockBill.Object, mockCoin.Object, mockTransactionBill.Object, mockTransactionCoin.Object); Transaction transaction = new Transaction(); transaction.Date = DateTime.Now; transaction.TotalAmount = 20; transaction.TotalPaid = 30; List <Bill> bills = new List <Bill>(); List <Coin> coins = new List <Coin>(); mockBill.Setup(t => t.GetAllBills()).Returns(bills); mockCoin.Setup(t => t.GetAllCoins()).Returns(coins); checkoutCashier.Checkout(20, 30); payments.ChangeBill(10, transaction); payments.ChangeCoin(0, transaction); //Act var response = changeController.Change(20, 30); //Assert Assert.IsType <OkObjectResult>(response); }
protected override void ResolveEffect() { var permanents = Players.Permanents() .Where(x => _filter(x, this)) .ToList(); foreach (var permanent in permanents) { if (permanent.Controller != Controller) { var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; var modifier = new ChangeController(Controller); permanent.AddModifier(modifier, p); } } }
protected override void ResolveEffect() { var permanents = Players.Permanents() .Where(x => _filter(x, this)) .ToList(); foreach (var permanent in permanents) { if (permanent.Controller != Controller) { var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; var modifier = new ChangeController(Controller); permanent.AddModifier(modifier, p); } } }
protected override void ResolveEffect() { var creatures = Players.SelectMany(x => x.Graveyard).Where(x => x.Is().Creature).ToList(); foreach (var card in creatures) { if (card.Owner != Controller) { var modifier = new ChangeController(Controller); var p = new ModifierParameters { SourceEffect = this, SourceCard = Source.OwningCard, X = X }; card.AddModifier(modifier, p); } Controller.PutCardToBattlefield(card); } }
public void ChangeWithZeroValues() { //Arrange Mock <IBillRepository> mockBill = new Mock <IBillRepository>(); Mock <ICoinRepository> mockCoin = new Mock <ICoinRepository>(); Mock <ITransactionRepository> mockTransaction = new Mock <ITransactionRepository>(); Mock <ITransactionXBillRepository> mockTransactionBill = new Mock <ITransactionXBillRepository>(); Mock <ITransactionXCoinRepository> mockTransactionCoin = new Mock <ITransactionXCoinRepository>(); CheckoutCashier checkoutCashier = new CheckoutCashier(mockBill.Object, mockCoin.Object, mockTransactionBill.Object, mockTransactionCoin.Object, mockTransaction.Object); ChangeController changeController = new ChangeController(checkoutCashier); //Act var response = changeController.Change(0, 0); //Assert Assert.IsType <BadRequestObjectResult>(response); }
public ChangeDescription RemoveIntakeFromPlant(PumpingIntake Intake, Plant plant) { return(ChangeController.RemoveIntakeFromPlant(Intake, plant)); }
void Start() { data = GameObject.FindGameObjectWithTag("Player").GetComponent <ChangeController>(); }
public Stack <Node> FindPath(Vector2Int start, Vector2Int end) { this.Start = start; this.End = end; ChangeController.AddChange(new Change(start.x, start.y, GridNodeType.Start, GridNodeType.Empty)); ChangeController.AddChange(new Change(end.x, end.y, GridNodeType.End, GridNodeType.Empty)); Node startNode = NodeGrid.Grid[start.x, start.y]; Node endNode = NodeGrid.Grid[end.x, end.y]; _path = new Stack <Node>(); _openList = new List <Node>(); _closedList = new List <Node>(); Node current = startNode; // add start node to Open List startNode.State = NodeState.Open; _openList.Add(startNode); while (_openList.Count != 0) { // take the first node out (lowest F score) current = _openList[0]; _openList.RemoveAt(0); // add it to closed list & mark current.State = NodeState.Closed; ChangeController.AddChange(new Change( current.Position.x, current.Position.y, GridNodeType.Expanded, GridNodeType.Seen)); _closedList.Add(current); // exit if this is the end node if (current.Position == endNode.Position) { break; } // look at all adjacent nodes and add them to the open list if possible Node[] adjacentNodes = this.NodeGrid.GetAdjacentNodesArray(current); for (int i = 0; i < adjacentNodes.Length; i++) { Node node = adjacentNodes[i]; if (node != null && node.State == NodeState.None && node.Walkable) { // Setup node & calculate new costs node.Parent = current; node.DistanceToTarget = NodeGrid.Manhattan(node, endNode); node.Cost = node.Weight + node.Parent.Cost; // mark as open node.State = NodeState.Open; ChangeController.AddChange(new Change(node.Position.x, node.Position.y, GridNodeType.Seen, GridNodeType.Empty)); // Insert the new node into the sorted open list in ascending order int index = _openList.BinarySearch(node); if (index < 0) { index = ~index; } _openList.Insert(index, node); } } } // construct path, if end was not closed return null if (!_closedList.Exists(node => node.Position == endNode.Position)) { return(null); } // if all good, return path Node temp = _closedList[_closedList.IndexOf(current)]; if (temp == null) { return(null); } do { _path.Push(temp); ChangeController.AddChange(new Change(temp.Position.x, temp.Position.y, GridNodeType.Path, GridNodeType.Expanded)); temp = temp.Parent; } while (temp != null && !temp.Equals(startNode)); // Fix start and end position being overriden // TODO: Look into using a proper fix for this instead of a 'patch'. ChangeController.RemovePositions(start, 1); ChangeController.RemovePositions(end, 3); return(_path); }
public AStar(NodeGrid nodeGrid) { NodeGrid = nodeGrid; ChangeController = new ChangeController(nodeGrid.RenderNodeTypes()); }
public virtual IEnumerator<ITask> ChangeControllerHandler(ChangeController changeController) { Controller newController = changeController.Body; if (newController.FindInstance()) { _state.Controller.Dispose(); _state.Controller = newController; changeController.ResponsePort.Post(DefaultUpdateResponseType.Instance); SendNotification<ChangeController>(_subMgr, _state.Controller); } else { changeController.ResponsePort.Post(Fault.FromCodeSubcodeReason( W3C.Soap.FaultCodes.Receiver, DsspFaultCodes.OperationFailed, Resources.ControllerNotFound ) ); } yield break; }