public LogParser(IUserInput userInput, IFileReader fileReader, IFileWriter fileWriter) { this._userInput = userInput; this._fileReader = fileReader; this._fileWriter = fileWriter; this._lastLogIdFromOldCSVFile = fileReader.GetLastLogIdFromOldCSVFile(); }
public Application(IGroceryKiosk groceryKiosk, IUserInput userInput, IFormatOutput output, ILog logger) { _groceryKiosk = groceryKiosk; _userInput = userInput; _output = output; _logger = logger; }
/// <summary> /// Game 생성자. 사용자 인터페이스 연결. player들 생성. nowTurnIdx 초기화. JokerCard 없는 ground 생성. playerNum이 4명 초과 시 예외 throw. /// </summary> /// <param name="playerNum">Player의 수</param> /// <param name="userInput">사용자 입력을 받는 인터페이스</param> public Game(int playerNum, IUserInput userInput) { players = new List <Player>(); ground = new List <Card>(); //Player의 수가 4명 초과면 예외 throw if (playerNum > 4) { throw new Exception("Too Many Players"); } //userInput 초기화 this.userInput = userInput; //players 초기화 for (int i = 0; i < playerNum; i++) { players.Add(new Player(this)); players[i].Eliminated += RemovePlayer; } //nowTurnIdx 초기화 nowTurnIdx = 0; //ground 초기화 for (int i = 0; i < 24; i++) //0 ~ 11까지 Black, White NumCard 총 24개 생성 { ground.Add(new NumCard(i)); } }
private void UpdateUserInput() { Command input = Command.InvalidInput; input = this.input.GetInput(); this.ProcessInput(input); }
public GameOptions() { this.players = new Player[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { this.players[i] = new Player(i); } this.players[0].InGame = true; this.consolePlayer = 0; this.episode = 1; this.map = 1; this.skill = GameSkill.Medium; this.netGame = false; this.deathmatch = 0; this.fastMonsters = false; this.respawnMonsters = false; this.noMonsters = false; this.intermissionInfo = new IntermissionInfo(); this.renderer = null; this.sound = NullSound.GetInstance(); this.music = NullMusic.GetInstance(); this.userInput = NullUserInput.GetInstance(); }
private void Awake() { rigid = GetComponent <Rigidbody>(); anim = model.GetComponent <Animator>(); pi = GetComponent <IUserInput>(); Capsule = GetComponent <CapsuleCollider>(); }
public PayRollProgram(IUserInput userInput, IFileReader fileReader, IAlternateFactoryPaySlip paySlipFactory, IFactoryStaff staffFactory) { _fileReader = fileReader; _paySlipfactory = paySlipFactory; _userInput = userInput; _staffFactory = staffFactory; }
/// <summary> /// This method handles the main LogIn functions, using the given input device /// </summary> /// <param name="input">The input reader to be used for this method.</param> public void LogInStart(IUserInput input, BaB_DbContext db) { //print statement welcoming user Console.WriteLine("Welcome!"); //Re-initialize the logged in customer's ID to -1, in case of returning to this method! loggedInCustomer = null; //start method logic do { //Ask if they would like to "Sign in" or "Create an account" Console.WriteLine("Please enter \"Log in\" to log in to an existing account, \"Sign up\" to create a new account, or \"Exit\" to exit the application."); //temporary variable to hold the user input userInput = input.GetInput(); if ((userInput.ToLower() == "log in") || (userInput.ToLower() == "login")) //Log in existing user { LogInExistingUser(input, db); } else if (userInput.ToLower() == "sign up" || (userInput.ToLower() == "signup")) //Create new customer { CreateNewCustomer(input, db); } else if (userInput.ToLower() == "exit") //Close out of application { Environment.Exit(0); } else //invalid input { Console.WriteLine("Invalid command; Please verify your input, and try again."); } } while (LoggedInCustomer == null); //Loop while there is no logged in customer }
public Spawner SetCommand(IUserInput input) { m_Command = input.CharacterShoot; m_Command .Subscribe(Shoot); return(this); }
// Use this for initialization void Start() { cameraHandle = transform.parent.gameObject; playerHandle = cameraHandle.transform.parent.gameObject; model = playerHandle.GetComponent <ActorController>().model; IUserInput[] inputs = playerHandle.GetComponents <IUserInput>(); foreach (var input in inputs) { if (input.enabled == true) { pi = input; break; } } if (!isAI) { camera = Camera.main.gameObject; lockDot.enabled = false; Cursor.lockState = CursorLockMode.Locked; } lockState = false; }
public void Init() { _userInput = Substitute.For <IUserInput>(); _userOutput = Substitute.For <IUserOutput>(); _consolePasswordReader = new ConsolePasswordReader(_userOutput, _userInput); }
private PlayerMove GetMoveFromPlayer(IUserInput input, IUserResponse userResponse, Player player, PieceColor currentColor) { bool isValidSelection = false; var move = player.MakeMove(input); while (!isValidSelection) { if (ChessBoard.IsLegalBoardPosition(move.PieceSelectionXCoordinate, move.PieceSelectionYCoordinate) && ChessBoard.IsPieceAt(move.PieceSelectionXCoordinate, move.PieceSelectionYCoordinate)) { if (ChessBoard.PieceAt(move.PieceSelectionXCoordinate, move.PieceSelectionYCoordinate).PieceColor == currentColor) { isValidSelection = true; } else { userResponse.BadPieceSelection("You must select your own piece to move."); move = WhitePlayer.MakeMove(input); } } else { userResponse.BadPieceSelection("You must select a piece at a valid location."); move = WhitePlayer.MakeMove(input); } } return(move); }
void Start() { keyboardInput = new UserKeyboardInput(); inputStrategy = keyboardInput; musicLevel.SetActive(false); sfxLevel.SetActive(false); }
void Start() { animator = GetComponent <Animator>(); animatorState = animator.GetCurrentAnimatorStateInfo(0); userInput = GetComponent <IUserInput>(); inputSkills = GetComponent <IInputSkills>(); inputSkills.OnShepsRun += Run; inputSkills.OnFire += () => { StartCoroutine(Fire()); }; inputSkills.OnJump += () => { if (animatorState.IsTag("Rest")) { StartCoroutine(Jump()); } }; inputSkills.OnRitual += () => { if (animatorState.IsTag("Rest")) { StartCoroutine(Ritual()); } }; ShepsLiving.OnShepsDying += Dying; }
static public void swapNumbers(IUserInput input) { int num1 = input.GetInt(); int num2 = input.GetInt(); Console.WriteLine($"{num2}, {num1}"); }
private void Start() { fireballCounter = shepsSetting.FireballAmount; userInput = GetComponent <IUserInput>(); userInput.OnFireToggle += () => { StartCoroutine(FireBall()); }; }
/// <summary> /// Constructor. /// </summary> /// <param name="action">See <see cref="Action"/>.</param> /// <param name="object">See <see cref="Object"/>.</param> /// <param name="subject">See <see cref="Subject"/>.</param> public Input(string action, string @object, string subject, IUserInput userInput) { this.Action = action; this.Object = @object; this.Subject = subject; this._userInput = userInput; }
public AssetTrackerCommandBase(IConsoleOutput output, IUserInput inputHandle, IAssetRepository assetRepo, IOfficeRepository officeRepo) { Assets = assetRepo; Offices = officeRepo; OutputHandle = output; InputHandle = inputHandle; }
public ActorController Init() { var inputs = transform.GetComponents <IUserInput>(); foreach (var item in inputs) { if (item.enabled) { pi = item; break; } } if (!Model) { Model = transform.Find("Character")?.gameObject; } if (!Camcon) { Camcon = transform.Find("CameraHandle")?.GetComponent <CameraController>(); } anim = Model.GetComponent <Animator>(); rigi = transform.GetComponent <Rigidbody>(); capCol = transform.GetComponent <CapsuleCollider>(); //attackLayer = anim.GetLayerIndex("attack"); return(this); }
public ICommand Parse(IUserInput userInput) { _logger.Instance.Information($"[{nameof(CommandParser)}.{nameof(CommandParser.Parse)}] called with the following parameter: {{@UserInput}}", userInput); var parserResult = Parser.Default.ParseArguments( userInput.Arguments, _registeredVerbs.KnownVerbs); // Cache the HelpText on this parser result for future formatting. _outputFormatter.HelpText = HelpText.AutoBuild(parserResult, null, null); if (parserResult.Tag == ParserResultType.NotParsed) { _logger.Instance.Error($"[{nameof(CommandParser)}.{nameof(CommandParser.Parse)}] was unable to parse provided command: {{@UserInput}}", userInput); return(null); } if (!((parserResult as Parsed <object>)?.Value is ICommand command)) { throw new SculptorParserException($"[{nameof(CommandParser)}.{nameof(CommandParser.Parse)}] could not find a valid implementation of {nameof(ICommand)} matching {{@UserInput}}", userInput); } _logger.Instance.Information($"[{nameof(CommandParser)}.{nameof(CommandParser.Parse)}] succesfully parsed: {{@UserInput}}", userInput); return(command); }
/// <summary> /// Действие сцены /// </summary> public void Scene(IUserInput userInput, IStatusReporter statusReporter) { BattleActionHistory = new List <DoBattleAction>(); BattleActions = new Dictionary <UserCommand, DoBattleAction>() { { UserCommand.Attack, Attack }, { UserCommand.GiveUp, GiveUp }, { UserCommand.GetStat, GetStat }, { UserCommand.NoCommand, Boo } }; for ( ; ;) { foreach (var castle in Castles) { UserCommand userCommand = UserCommand.Attack; if (!IsAction) { return; } do { statusReporter.WriteLine($"ход героев замка {castle} ({Utils.EnumValueToString<CastleOwner>(castle.Owner)})"); if (castle.Owner == CastleOwner.User) { userCommand = userInput.GetUserCommand(statusReporter); statusReporter.Clear(); } /*пользователь будет делать ходы, пока функция не вернёт false*/ }while(BattleActions[userCommand](Units, Units, statusReporter)); } } }
public GameOptions() { gameVersion = GameVersion.Version109; gameMode = GameMode.Commercial; missionPack = MissionPack.Doom2; players = new Player[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { players[i] = new Player(i); } players[0].InGame = true; consolePlayer = 0; episode = 1; map = 1; skill = GameSkill.Medium; demoPlayback = false; netGame = false; deathmatch = 0; fastMonsters = false; respawnMonsters = false; noMonsters = false; intermissionInfo = new IntermissionInfo(); random = new DoomRandom(); video = NullVideo.GetInstance(); sound = NullSound.GetInstance(); music = NullMusic.GetInstance(); userInput = NullUserInput.GetInstance(); }
private void Construct(IBubbleCannon cannon, IUserInput input, IGridWrapper gridWrapper) { this.cannon = cannon; this.input = input; this.grid = gridWrapper; steps = new Vector3[3]; }
public RobotController(IRobot robot, IUserInput input, IUserOutput output, ICommandParser commandParser) { _robot = robot; _input = input; _output = output; _commandParser = commandParser; }
/// <summary> /// Creates a new customer and adds them to the database. /// </summary> /// <param name="input">User input.</param> /// <param name="db">Database reference.</param> void CreateNewCustomer(IUserInput input, BaB_DbContext db) { //create variables to hold user input during creation String newFirstName; String newLastName; String newUsername; String newPassword; //Thank the user Console.WriteLine("Thank you for signing up!"); //Collect and store first and last names (okay to be duplicated) Console.Write("Please enter your first name: "); newFirstName = input.GetInput(); Console.Write("Please enter your last name: "); newLastName = input.GetInput(); do //Username loop -- repeat until available name { Console.Write("Please enter your desired username: "******"go back") || (newUsername.ToLower() == "goback") || String.IsNullOrWhiteSpace(newUsername)) //Username cannot be "Go back" or empty { Console.WriteLine("We're sorry, that cannot be used for your username. Please try a different username. "); } else //valid username input { //query database for matching usernames var usernameAvailabilityCheck = (from check in db.CustomersDB where (check.CustUsername == newUsername) select check); if (usernameAvailabilityCheck.Count() == 0) //if the username does not exist yet { //inform user name is available Console.Write("Username available! "); //request desired password Console.Write("Please enter your desired password: "******"We're sorry, that username is unavailable. Please select a different name."); } } } while (true); //create a new customer object using the input information Customer newCustomer = new Customer(newFirstName, newLastName, newUsername, newPassword); db.Add(newCustomer); db.SaveChanges(); //query database for newly created Customer's customerID loggedInCustomer = newCustomer; }
public CustomRegistry() { Board = new CustomBoard(10, 10); Initializer = new BoardInitializer(); ActionManager = new BoardActionManager(Board, (BoardInitializer)Initializer); Notifier = new BoardNotifier(Board); ProccessUserInput = new NotifyingInput(Notifier); }
public static void SetUserInput(IUserInput input) { if (input is null) { throw new ArgumentNullException(nameof(input)); } userInput = input; }
public Engine(IRenderer renderer, IUserInput userInterface) { this.renderer = renderer; this.userInterface = userInterface; this.allObjects = new List <GameObject>(); this.movingObjects = new List <MovingObject>(); this.staticObjects = new List <GameObject>(); }
// Start is called before the first frame update void Awake() { pi = GetComponent <IUserInput>(); anim = model.GetComponent <Animator>(); rigid = GetComponent <Rigidbody>(); col = GetComponent <CapsuleCollider>(); camcon.player = player; }
//private MyTimer timer = new MyTimer(); // Use this for initialization void Awake() { faceWheel.SetActive(false); pi = GetComponent <IUserInput>(); anim = model.GetComponent <Animator>(); rigid2D = GetComponent <Rigidbody2D>(); col = GetComponent <CapsuleCollider2D>(); }
/// <summary> /// Used for initialization. The Start method is called just /// before any of the Update methods is called the first time. /// </summary> public Avatar(IAvatarBehaviour avatarBehaviour, IUserInput userInput) { this.Track = 2; this.MoveSpeed = 15; userInput.Initialize(); this.AvatarBehaviour = avatarBehaviour; this.UserInput = userInput; StateManager.Instance.PauseOrUnpause(); }
//constructor public Engine(IRenderer renderer, IUserInput userInput) { this.renderer = renderer; this.userInput = userInput; this.robotShips = new List<Ship>(); this.playerShips = new List<Ship>(); this.playerGifts = new List<Gift>(); this.robotGifts = new List<Gift>(); this.seas = new List<Sea>(); this.playerFleet = 0; this.robotFleet = 0; this.iBoot = new IntelligentBot(); }
public void Start() { Player1 = new HumanPlayer(true); Player2 = new HumanPlayer(false); CurrentPlayer = Player1; CreateCheckers(false); CreateCheckers(true); // TEST SITUATION #1 //CheckersSet.Add(new Checker(true, true, 2, 3)); // CHECKER WE TEST //CheckersSet.Add(new Checker(false, true, 0, 1)); //CheckersSet.Add(new Checker(false, true, 1, 2)); //CheckersSet.Add(new Checker(false, true, 1, 4)); //CheckersSet.Add(new Checker(false, true, 0, 5)); //CheckersSet.Add(new Checker(true, true, 7, 0)); // TEST SITUATION #2 //CheckersSet.Add(new Checker(true, false, 2, 3)); // CHECKER WE TEST //CheckersSet.Add(new Checker(true, false, 7, 0)); //CheckersSet.Add(new Checker(false, false, new Coordinate(4, 3))); //CheckersSet.Add(new Checker(true, false,new Coordinate(5, 2))); // TEST SITUATION #3 - white cheker is surrounded with reds //CheckersSet.Add(new Checker(true, false, 3, 4)); // CHECKER WE TEST //CheckersSet.Add(new Checker(false, false, 2, 3)); //CheckersSet.Add(new Checker(false, false, 2, 5)); //CheckersSet.Add(new Checker(false, false, 4, 3)); //CheckersSet.Add(new Checker(false, false, 4, 5)); // TEST SITUATION #4 - compound move //CheckersSet.Add(new Checker(true, false, 4, 3)); // CHECKER WE TEST //CheckersSet.Add(new Checker(false, false, 3, 4)); //CheckersSet.Add(new Checker(false, false, 1, 4)); //CheckersSet.Add(new Checker(false, false, 1, 2)); //CheckersSet.Add(new Checker(false, false, 3, 2)); // TEST SITUATION #5 - the only white checker is blocked //CheckersSet.Add(new Checker(true, false, 4, 3)); // CHECKER WE TEST //CheckersSet.Add(new Checker(false, false, 3, 4)); //CheckersSet.Add(new Checker(false, false, 2, 5)); //CheckersSet.Add(new Checker(false, false, 3, 2)); //CheckersSet.Add(new Checker(false, false, 2, 1)); Board = new Board(); Board.Draw(CheckersSet); }
public IUserInput SwitchPlayer() { return CurrentPlayer = (CurrentPlayer == Player1) ? Player2 : Player1; }
public UserInputEventArgs(IUserInput inputChannel) { this.inputChannel = inputChannel; }
public List<Checker> GetOwnCheckers(IUserInput currentPlayer) { return new List<Checker>(checkers.Where(checker => currentPlayer.PlaysWhites == checker.IsWhite)); }
public ApplicationController(INotifier notifier, IUserInput userInput, Calculator calculator) { _notifier = notifier; _userInput = userInput; _calculator = calculator; }
public static void DisplayCurrentPlayerMessage(IUserInput currentPlayer) { Console.SetCursorPosition(50, 1); Console.Write(" "); Console.SetCursorPosition(50, 1); Console.Write("{0} move!", currentPlayer.PlaysWhites ? "White" : "Black"); Console.SetCursorPosition(50, 3); }
public void Start() { player1 = new HumanPlayer(true); player2 = new HumanPlayer(false); CurrentPlayer = player1; checkers.Create(false); checkers.Create(true); // TEST SITUATION #1 //checkers.Set.Add(new Checker(true, true, new Coordinate(2, 3))); // CHECKER WE TEST //checkers.Set.Add(new Checker(true, true, new Coordinate(7, 0))); //checkers.Set.Add(new Checker(false, true, new Coordinate(0, 1))); //checkers.Set.Add(new Checker(false, true, new Coordinate(1, 2))); //checkers.Set.Add(new Checker(false, true, new Coordinate(1, 4))); //checkers.Set.Add(new Checker(false, true, new Coordinate(0, 5))); // TEST SITUATION #2 //checkers.Set.Add(new Checker(true, false, new Coordinate(2, 3))); // CHECKER WE TEST //checkers.Set.Add(new Checker(true, false, new Coordinate(7, 0))); //checkers.Set.Add(new Checker(false, false, new Coordinate(6, 1))); //checkers.Set.Add(new Checker(false, false, new Coordinate(5, 2))); // TEST SITUATION #3 - white cheker is surrounded with reds //checkers.Set.Add(new Checker(true, false, new Coordinate(3, 4))); // CHECKER WE TEST //checkers.Set.Add(new Checker(false, false, new Coordinate(2, 3))); //checkers.Set.Add(new Checker(false, false, new Coordinate(2, 5))); //checkers.Set.Add(new Checker(false, false, new Coordinate(4, 3))); //checkers.Set.Add(new Checker(false, false, new Coordinate(4, 5))); // TEST SITUATION #4 - compound move //checkers.Set.Add(new Checker(true, false, new Coordinate(4, 3))); // CHECKER WE TEST //checkers.Set.Add(new Checker(false, false, new Coordinate(3, 4))); //checkers.Set.Add(new Checker(false, false, new Coordinate(1, 4))); //checkers.Set.Add(new Checker(false, false, new Coordinate(1, 2))); //checkers.Set.Add(new Checker(false, false, new Coordinate(3, 2))); // TEST SITUATION #5 - the only white checker is blocked //checkers.Set.Add(new Checker(true, false, new Coordinate(4, 3))); // CHECKER WE TEST //checkers.Set.Add(new Checker(false, false, new Coordinate(3, 4))); //checkers.Set.Add(new Checker(false, false, new Coordinate(2, 5))); //checkers.Set.Add(new Checker(false, false, new Coordinate(3, 2))); //checkers.Set.Add(new Checker(false, false, new Coordinate(2, 1))); // TEST SITUATION #6 - for Take tests //checkers.Set.Add(new Checker(true, false, new Coordinate(2, 1))); //checkers.Set.Add(new Checker(false, false, new Coordinate(1, 2))); Board = new Board(); Screen.SetGraphicParameters(); Board.Draw(checkers); while (!IsGameOver()) { FindCheckersWithTakes(); SetMove(); SwitchPlayer(); } Screen.GameOverMessage(); }