static void SelectOpponent() { Console.WriteLine(); foreach (string item in players.Keys) { if (item != selectedPlayer.Name) { Console.WriteLine(item); } } string sel = RPSValidator.GetInput("Select your Opponent", true); PlayerReal temp = (PlayerReal)players.GetValueOrDefault(sel); selectedOpponent = new PlayerAI(temp.Name, temp.Wins); Console.WriteLine($"Existing Player: {selectedOpponent.Name} | {selectedOpponent.Wins}"); }
static void UserLogin() { string user = RPSValidator.GetInput("Welcome, please enter your name: ", true); if (players.ContainsKey(user)) { selectedPlayer = (PlayerReal)players.GetValueOrDefault(user); Console.WriteLine($"Existing Player: {selectedPlayer.Name} | {selectedPlayer.Wins}"); } else { Console.WriteLine("New Player"); players.Add(user, new PlayerReal(user)); selectedPlayer = (PlayerReal)players.GetValueOrDefault(user); SaveData(); } }
public override void generateRoshambo() { Console.WriteLine(); try { int sel = (RPSValidator.ParseIntFromString($"1) Rock\n2) Paper\n3) Scissors")) - 1; if (sel > 2 || sel < 0) { Console.WriteLine("you did not select a move, try again"); generateRoshambo(); } else { Choice = (Roshambo)sel; } } catch { Console.WriteLine("input not recognized"); generateRoshambo(); } }