Exemplo n.º 1
0
        public void Save(List <RunningLetter> gameData)
        {
            RunningLetter newLetter = new RunningLetter();
            var           games     = LoadDatas();

            foreach (var letter in gameData)
            {
                foreach (var priviosLetter in games)
                {
                    if (letter == priviosLetter)
                    {
                        break;
                    }
                    else if (newLetter != letter)
                    {
                        newLetter = letter;
                    }
                }
                games.Add(newLetter);
            }

            using (var file = File.Open(_path, FileMode.Create))
                using (var writer = new StreamWriter(file))
                {
                    writer.Write(JsonConvert.SerializeObject(games));
                    writer.Flush();
                }
        }
Exemplo n.º 2
0
        public void CreateLetter(List <RunningLetter> _runningLetters, int targetPosX, int targetPosY, char symbol, int page)
        {
            Random        random         = new Random();
            RunningLetter _runningLetter = new RunningLetter();

            _runningLetter.Symbol          = symbol;
            _runningLetter.TargetPositionX = targetPosX;
            _runningLetter.TargetPositionY = targetPosY;
            _runningLetter.LetterPage      = page;
            Switcher = random.Next(0, 2);
            if (Switcher == 0)
            {
                var Y = random.Next(0, 2);
                _runningLetter.StartPositionX = random.Next(0, 29);
                if (Y == 0)
                {
                    _runningLetter.StartPositionY = 0;
                }
                else
                {
                    _runningLetter.StartPositionY = 29;
                }
            }
            else if (Switcher == 1)
            {
                var X = random.Next(0, 2);
                if (X == 0)
                {
                    _runningLetter.StartPositionX = 0;
                }
                else
                {
                    _runningLetter.StartPositionX = 29;
                }
                _runningLetter.StartPositionY = random.Next(0, 29);
            }
            _runningLetters.Add(_runningLetter);
        }
Exemplo n.º 3
0
 public UserInteraction(RunningLetter runningLetter, Logic logic, CheckCollision checkCollision)
 {
     _runningLetter  = runningLetter;
     _logic          = logic;
     _checkCollision = checkCollision;
 }
Exemplo n.º 4
0
 public CheckCollision(Logic logic, RunningLetter runningLetter)
 {
     _logic         = logic;
     _runningLetter = runningLetter;
 }
Exemplo n.º 5
0
 public Logic(RunningLetter runningLetter, GameDataService gameDataService)
 {
     _runningLetter   = runningLetter;
     _gameDataService = gameDataService;
 }