public void LogoutCommand() { IRegion mainRegion = RegionManager.Regions["MainRegion"]; User usermodel = new User(); Container.RegisterInstance(usermodel); TileCommand.RaiseCanExecuteChanged(); SetCommand.RaiseCanExecuteChanged(); mainRegion.RemoveAll(); RegionManager.RequestNavigate("MainRegion", "HomeTilesView"); }
public void WhenCommandIsExecutedThenNotificationIsSended() { var tilePosition = new TilePosition(1, 2); var inputMessenger = new MessengerFake(); var tileCommand = new TileCommand(inputMessenger, tilePosition); tileCommand.Execute(null); Assert.IsNotNull(inputMessenger.SendedMessage); Assert.AreEqual(tilePosition, inputMessenger.SendedMessage.First()); }
internal bool IsCommandVisible(TileCommand command) { bool value; switch (command) { case TileCommand.Typing: value = LastTile is HeadWordItem; break; case TileCommand.Code: value = true; break; default: value = false; break; } return(value); }
internal void ExecuteCommand(TileCommand command) { switch (command) { default: throw new NotImplementedException(); case TileCommand.Typing: { var source = new CaseWordVocabularySource(Model, this, (HeadWordItem)LastTile); source.SetSuggestionsView(); } break; case TileCommand.Code: { var source = new CodeVocabularySource(this); source.SetSuggestionsView(); } break; } }
void SetCurrentTile(TileCommand cmd) { SetCurrentTile(cmd, FindObjectOfType<Player>()); }
void CheckTileClick() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Input.GetMouseButtonUp(0) && Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer("Grid"))) { var coord = Grid.PositionToCoord(hit.transform.position); if (_currentTile == null) { if ((_currentTile = Guess(coord)) == null) { return; } } if (_currentTile.CanApply(coord)) { _currentTile.Apply(coord); } _playerPromise.Fulfill(); _currentTile = null; } }
void SetCurrentTile(TileCommand cmd, Agent src) { _currentTile = cmd; _currentTile.SetSource(src); if (cmd.Range == 0) { _acceptAny = true; } else { var tiles = Level.CurrentLevel.Get(src.Position, cmd.Range); _possibleTiles = tiles.Where(tile => cmd.CanApply(tile.Coordinate)).ToArray(); foreach (var tile in _possibleTiles) { Vector3 topCenter = Level.CurrentLevel.Grid.CoordSurfacePosition(tile.Coordinate); Vector3 dir = Camera.main.transform.position - topCenter; Ray r = new Ray(topCenter, dir); foreach (var hit in Physics.RaycastAll(r)) { if (hit.transform.gameObject.GetComponent<TileWorks>() == null) { continue; } Debug.Log(string.Format("Tile at {0} blocks movement to {1}", Grid.PositionToCoord(hit.transform.position), tile.Coordinate)); hit.transform.gameObject.GetComponent<TileWorks>().FadeOut(); } } } cmd.CommandComplete += CmdOnCommandComplete; }
public void LoginCommand(User usermodel) { Container.RegisterInstance(usermodel); TileCommand.RaiseCanExecuteChanged(); SetCommand.RaiseCanExecuteChanged(); }
internal CommandItem(ITile predecessor, WordVocabularySource source, TileCommand command) : base(predecessor, source) { _command = command; }