public IShadowItem GetShadowItem(IToolServices toolServices) { if (_shadows == null || !toolServices.Node.Equals(_currentNode)) { _shadows = toolServices.Node.Markups.FillSimpleShadowMap(toolServices.GameTree.BoardSize, SimpleMarkup); _currentNode = toolServices.Node; } char shadow = _shadows[toolServices.PointerOverPosition.X, toolServices.PointerOverPosition.Y]; if (shadow == 'r') { return(new None()); } else { switch (SimpleMarkup) { case SimpleMarkupKind.Circle: return(new Circle(toolServices.PointerOverPosition)); case SimpleMarkupKind.Cross: return(new Cross(toolServices.PointerOverPosition)); case SimpleMarkupKind.Square: return(new Square(toolServices.PointerOverPosition)); case SimpleMarkupKind.Triangle: return(new Triangle(toolServices.PointerOverPosition)); } } return(new None()); }
public void Execute(IToolServices toolService) { Position position = toolService.PointerOverPosition; MarkupInfo markups = toolService.Node.Markups; MarkupKind markupKindOnPosition = markups.RemoveMarkupOnPosition(position); if (SequenceMarkup == SequenceMarkupKind.Letter) { char letter = markups.GetSmallestUnusedLetter(); if (letter != '0' && markupKindOnPosition != MarkupKind.Label) { markups.AddMarkup <Label>(new Label(position, letter.ToString())); } } else { int number = markups.GetSmallestUnusedNumber(); if (markupKindOnPosition != MarkupKind.Label) { markups.AddMarkup <Label>(new Label(position, number.ToString())); } } _shadows = toolService.Node.Markups.FillSequenceShadowMap(toolService.GameTree.BoardSize, SequenceMarkup); }
public IShadowItem GetShadowItem(IToolServices toolService) { if (toolService.Node.Equals(toolService.GameTree.GameTreeRoot)) { int width = toolService.GameTree.BoardSize.Width; int height = toolService.GameTree.BoardSize.Height; MoveResult[,] moveResults = new MoveResult[width, height]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { moveResults[x, y] = MoveResult.Legal; } } _currentNode = toolService.Node; } else if (!toolService.Node.Equals(_currentNode) || _currentNode == null) { _moveResults = toolService.Ruleset.GetMoveResult(toolService.Node); _currentNode = toolService.Node; } MoveResult result = _moveResults[toolService.PointerOverPosition.X, toolService.PointerOverPosition.Y]; StoneColor nextPlayer = toolService.Node.Move.WhoMoves.GetOpponentColor(toolService.Node, toolService.GameTree.GameTreeRoot); if (result == MoveResult.Legal) { return(new Stone(nextPlayer, toolService.PointerOverPosition)); } else { return(new None()); } }
public void Execute(IToolServices toolService) { StoneColor previousPlayer = toolService.Node.Move.WhoMoves; StoneColor nextPlayer = StoneColor.None; //set next player if (previousPlayer == StoneColor.White) { nextPlayer = StoneColor.Black; } else if (previousPlayer == StoneColor.Black) { nextPlayer = StoneColor.White; } else { if (toolService.Node.Equals(toolService.GameTree.GameTreeRoot)) { nextPlayer = StoneColor.Black; } else { nextPlayer = StoneColor.White; } } GameTreeNode newNode = new GameTreeNode(Move.Pass(nextPlayer)); newNode.BoardState = new GameBoard(toolService.Node.BoardState); newNode.GroupState = new GroupState(toolService.Node.GroupState, toolService.Ruleset.RulesetInfo); toolService.Node.Branches.AddNode(newNode); toolService.SetNode(newNode); toolService.PlayPassSound(); }
public void Execute(IToolServices toolService) { Position position = toolService.PointerOverPosition; MarkupInfo markups = toolService.Node.Markups; MarkupKind markupKindOnPosition = markups.RemoveMarkupOnPosition(position); // If the removed markup is the same as the new one than do not add anything. if (IsMarkupEqual(SimpleMarkup, markupKindOnPosition)) { return; } if (SimpleMarkup == SimpleMarkupKind.Circle) { markups.AddMarkup <Circle>(new Circle(position)); } if (SimpleMarkup == SimpleMarkupKind.Cross) { markups.AddMarkup <Cross>(new Cross(position)); } if (SimpleMarkup == SimpleMarkupKind.Square) { markups.AddMarkup <Square>(new Square(position)); } if (SimpleMarkup == SimpleMarkupKind.Triangle) { markups.AddMarkup <Triangle>(new Triangle(position)); } }
public IShadowItem GetShadowItem(IToolServices toolService) { if (_shadows == null || !toolService.Node.Equals(_currentNode)) { _shadows = toolService.Node.Markups.FillSequenceShadowMap(toolService.GameTree.BoardSize, SequenceMarkup); _currentNode = toolService.Node; } string labelText = _shadows[toolService.PointerOverPosition.X, toolService.PointerOverPosition.Y]; if (labelText.Equals("r") || labelText.Equals("0")) { return(new None()); } else { return(new Label(toolService.PointerOverPosition, labelText)); } }
public async void Execute(IToolServices toolService) { if (!toolService.GameTree.PrimaryTimelineWithRoot.Contains(toolService.Node)) { var result = await toolService.ShowMessage(ToolMessage.BranchDeletionConfirmation); if (result == ToolConfirmationResult.Cancel) { return; } GameTreeNode parent = toolService.Node.Parent; parent.RemoveChild(toolService.Node); toolService.SetNode(parent); } else { var task = toolService.ShowMessage(ToolMessage.BranchDeletionError); } }
public void Execute(IToolServices toolService) { StoneColor nextPlayer = toolService.Node.Move.WhoMoves.GetOpponentColor(toolService.Node, toolService.GameTree.GameTreeRoot); //process move MoveProcessingResult moveResult = toolService.Ruleset.ProcessMove( toolService.Node, Move.PlaceStone(nextPlayer, toolService.PointerOverPosition)); if (moveResult.Result == MoveResult.Legal) { GameTreeNode newNode = new GameTreeNode(Move.PlaceStone(nextPlayer, toolService.PointerOverPosition)); newNode.BoardState = moveResult.NewBoard; newNode.GroupState = moveResult.NewGroupState; newNode.Move.Captures.AddRange(moveResult.Captures); toolService.Node.Branches.AddNode(newNode); toolService.SetNode(newNode); toolService.PlayStonePlacementSound(newNode.Move.Captures.Count > 0); } }
public void Set(IToolServices toolServices) { _shadows = toolServices.Node.Markups.FillSequenceShadowMap(toolServices.GameTree.BoardSize, SequenceMarkup); _currentNode = toolServices.Node; }
public void Set(IToolServices toolServices) { }
/// <summary> /// Initializes a new instance of the AnalyzeViewModel class. /// </summary> /// <param name="toolServices">tool services that will be used by the analyze mode tools</param> public AnalyzeToolsViewModel(IToolServices toolServices) { _toolServices = toolServices; }
public CheckoutRecordServices(ICheckoutRecordRepository checkoutRecordRepo, IToolServices toolservices) { _checkoutRecordRepository = checkoutRecordRepo; _toolServices = toolservices; }
public ToolsController(ILogger <ToolsController> logger, IToolServices toolServices) { _logger = logger; _toolServices = toolServices; }