Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        /**
         * 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);
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
 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');
 }
Esempio n. 9
0
 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;
 }
Esempio n. 11
0
 public MatchManager(MatchSession ms) //Continue previous match session?
 {
     this.ms = ms;
 }
Esempio n. 12
0
 public MatchManager()
 {
     ms = new MatchSession(FileManager.GenerateRandomWord(5));
 }
Esempio n. 13
0
 // Start is called before the first frame update
 private void Start()
 {
     _matchSession = MatchSession.Current;
     _heightField  = transform.Find("HeightField").GetComponent <TextMeshProUGUI>();
 }
Esempio n. 14
0
 public UnitFactory(MatchSession session)
 {
     _session = session;
 }
Esempio n. 15
0
 public void MatchDisplayProgress(MatchSession ms, string guess)
 {
     viewInterface.MatchDisplayProgress(ms, guess);
 }
Esempio n. 16
0
 public void MatchDisplayLose(MatchSession ms)
 {
     viewInterface.MatchDisplayLose(ms);
 }
Esempio n. 17
0
 public void MatchDisplayIncorrect(MatchSession ms)
 {
     viewInterface.MatchDisplayIncorrect(ms);
 }
Esempio n. 18
0
 public void MatchDisplayStart(MatchSession ms)
 {
     ViewInterface.MatchDisplayStart(ms);
 }
Esempio n. 19
0
 public void MatchDisplayLose(MatchSession ms)
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("Too bad, the answer was: " + ms.CurrentWord);
     Console.ForegroundColor = ConsoleColor.Gray;
 }