public void MatchDisplayIncorrect(MatchSession ms) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid guess, lose turn!"); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Try #" + (ms.Attempts.Count + 1)); }
private void Start() { // TODO - decide how we will set up the capture zones on each map // and how to easily find them _zones = FindObjectsOfType <CaptureZone>(); _matchSession = MatchSession.Current; }
public async Task <IActionResult> Edit(Guid id, [Bind("MatchSessionId,ConnectedUserId,DateTime,Lat,Lng")] MatchSession matchSession) { if (id != matchSession.MatchSessionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(matchSession); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MatchSessionExists(matchSession.MatchSessionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ConnectedUserId"] = new SelectList(_context.ConnectedUsers, "ConnectedUserId", "ConnectedUserId", matchSession.ConnectedUserId); return(View(matchSession)); }
public void MatchDisplayProgress(MatchSession ms, string guess) { for (int i = 0; i < ms.CurrentWord.Length; i++) { if (ms.Progression[i] == '+') { Console.ForegroundColor = ConsoleColor.Green; Console.Write(guess[i]); } else if (ms.Progression[i] == '-') { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write(guess[i]); } else // Assume '.' { Console.ForegroundColor = ConsoleColor.Red; Console.Write(guess[i]); } System.Threading.Thread.Sleep(100); } Console.ForegroundColor = ConsoleColor.Gray; Console.Write('\n'); Console.WriteLine("Try #" + (ms.Attempts.Count + 1)); }
private void Start() { _minimapSize = gameObject.GetComponent <RectTransform>().rect.width; _offsetFromRightSide = (-1) * (transform.parent.GetComponent <RectTransform>().rect.width / 2 + transform.parent.GetComponent <RectTransform>().anchoredPosition.x); _targetedScreenSize = transform.parent.parent.GetComponent <RectTransform>().rect.width; _matchSession = MatchSession.Current; TerrainMap map = _matchSession.TerrainMap; if (map == null) { // Hack: When loading a map, the camera is moved to the loading scene, // where the terrain map is not yet loaded. Don't throw errors in that case. return; } //_terrainSize = _terrain.terrainData.bounds.size; _terrainSize = map.MapMax - map.MapMin; _terrainPos = map.MapMin; _miniMapCamera.orthographicSize = _terrainSize.x / 2f; //convert camera to a texture RenderTexture.active = _miniMapCamera.targetTexture; _miniMapCamera.Render(); Texture2D image = new Texture2D(_miniMapCamera.targetTexture.width, _miniMapCamera.targetTexture.height); image.ReadPixels(new Rect(0, 0, _miniMapCamera.targetTexture.width, _miniMapCamera.targetTexture.height), 0, 0); image.Apply(); _miniMapImage.texture = image; _miniMapCamera.enabled = false; }
/** * A match is a single guessing game * Returns the result (WIN, LOSE or DRAW) */ public MatchResultType PlayMatch() { //Create view //MatchView display = new MatchView(MatchView.ViewTypes.VIEW_CONSOLE); MatchResultType retVal = MatchResultType.DRAW; ms.maxAttempts = 5; //Host/server should make this, transmit to client(s) char[] clearCondition = new char[ms.CurrentWord.Length]; for (int i = 0; i < ms.CurrentWord.Length; i++) { clearCondition[i] = '+'; } //Console.WriteLine("Answer: {0}", ms.CurrentWord); while (ms.Progression != new string(clearCondition) && ms.Attempts.Count < ms.maxAttempts) { //Prompt guess string guess = "temp"; if (guess == "I quit") { return(MatchResultType.LOSE); } else if (guess == "I give up") { //display.MatchDispayAnswer(ms.CurrentWord); return(MatchResultType.LOSE); } else { guess = guess.ToLower(); } if (guess.Length == ms.CurrentWord.Length && FileManager.WordsListContains(guess)) { ms.Progression = MatchSession.MatchGuess(guess, ms.CurrentWord); //display.MatchDisplayProgress(ms, guess); } else { //display.MatchDisplayIncorrect(ms); } ms.Attempts.Add(new KeyValuePair <string, string>(guess, ms.Progression)); } if (ms.Progression == new string(clearCondition)) { retVal = MatchResultType.WIN; //display.MatchDisplayWin(); } else { retVal = MatchResultType.WIN; //I want to move the display function up to GameProcedure, //but it should still be able to access the information of the session //display.MatchDisplayLose(ms); } return(retVal); }
public async Task <IActionResult> Create([Bind("MatchSessionId,ConnectedUserId,DateTime,Lat,Lng")] MatchSession matchSession) { if (ModelState.IsValid) { _context.Add(matchSession); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ConnectedUserId"] = new SelectList(_context.ConnectedUsers, "ConnectedUserId", "ConnectedUserId", matchSession.ConnectedUserId); return(View(matchSession)); }
public void MatchDisplayStart(MatchSession ms) { Console.WriteLine("Starting a match of lingo \n Good luck"); Console.WriteLine("Try #1"); for (int i = 0; i < ms.CurrentWord.Length; i++) { if (ms.Progression[i] == '+') { Console.Write(ms.CurrentWord[i]); } else { Console.Write('.'); } } Console.Write('\n'); }
public void StartSession(IGameServices services, int line, int collumn, Vector2 boardSize) { session = new MatchSession(services, line, collumn, boardSize); }
// Start is called before the first frame update private void Start() { _matchSession = MatchSession.Current; }
public MatchManager(MatchSession ms) //Continue previous match session? { this.ms = ms; }
public MatchManager() { ms = new MatchSession(FileManager.GenerateRandomWord(5)); }
// Start is called before the first frame update private void Start() { _matchSession = MatchSession.Current; _heightField = transform.Find("HeightField").GetComponent <TextMeshProUGUI>(); }
public UnitFactory(MatchSession session) { _session = session; }
public void MatchDisplayProgress(MatchSession ms, string guess) { viewInterface.MatchDisplayProgress(ms, guess); }
public void MatchDisplayLose(MatchSession ms) { viewInterface.MatchDisplayLose(ms); }
public void MatchDisplayIncorrect(MatchSession ms) { viewInterface.MatchDisplayIncorrect(ms); }
public void MatchDisplayStart(MatchSession ms) { ViewInterface.MatchDisplayStart(ms); }
public void MatchDisplayLose(MatchSession ms) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Too bad, the answer was: " + ms.CurrentWord); Console.ForegroundColor = ConsoleColor.Gray; }