Example #1
0
        public UIController(IUIInfo uI, IPlayer player, List <IMoveToPoint> enemies)
        {
            CanExecute = true;
            _UI        = uI;
            _player    = player;
            _enemies   = enemies;

            initialEnemiesNumber = enemies.Count;
            score = 0;
        }
Example #2
0
        private void Share(IUIInfo selDest)
        {
            var lv = new LoadingView("Retrieving image");

            SelectedDestination = selDest;

            if (selDest is ISocialSharer)
            {
                var selSocialSharer = (ISocialSharer)selDest;
                selSocialSharer.Share(this);

                return;
            }

            // this is a mess
            if (selDest is IFileSharingUploader)
            {
                var selFileSharer = (IFileSharingUploader)selDest;
                var docs          = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var myFilename    = Helpers.GetWebFileName(docs);
                selFileSharer.Upload(WebFilePath, myFilename, this);

                return;
            }

            if (selDest is IPhotoAlbumUploader)
            {
                var selPhotoSharer = (IPhotoAlbumUploader)selDest;
                lv.Show();
                var img = Helpers.GetImageFromWebPage(WebPage, lv);
                lv.Hide();
                selPhotoSharer.Upload(img, this);

                return;
            }

            if (selDest is DropboxUploader)
            {
                var selDropBox = (DropboxUploader)selDest;
                selDropBox.Upload(WebFilePath, this);

                return;
            }

            throw new ArgumentOutOfRangeException("Unsupported sharer: " + selDest.Name);
        }
Example #3
0
        public Controllers(Data data)
        {
            var pcInputHorizontal = new PCInputHorizontal();
            var pcInputVertical   = new PCInputVertical();
            var pcInputFire       = new PCFireInput();

            IPlayerFactory playerFactory = new PlayerFactory(data.Player);
            IPlayer        player        = playerFactory.CreatePlayer();

            IBulletFactory bulletFactory = new BulletFactory(data.Bullet);

            IEnemyFactory enemyFactory = new EnemyFactory();
            CompositeMove enemy        = new CompositeMove();

            int enemiesNum = 5;

            for (int i = 0; i < enemiesNum; ++i)
            {
                enemy.AddUnit(enemyFactory.CreateEnemy(data.Enemy, EnemyType.Small));
            }


            var enemiesList = enemy.GetEnemiesList();
            List <IDestructable> destructables = new List <IDestructable>();

            foreach (var _enemy in enemiesList)
            {
                destructables.Add((IDestructable)_enemy);
            }
            destructables.Add((IDestructable)player);


            IUIFactory uIFactory = new UIFactory();
            IUIInfo    uI        = uIFactory.CreateUI(data.UISettings);

            var executes = new List <IExecute>();

            executes.Add(new InputController(pcInputHorizontal, pcInputVertical, pcInputFire));
            executes.Add(new MoveController(pcInputHorizontal, pcInputVertical, player, data.Player));
            executes.Add(new EnemyMoveController(enemy, player.GetPosition()));
            executes.Add(new FireController(player, pcInputFire, data.Bullet, bulletFactory));
            executes.Add(new CollisionController(destructables));
            executes.Add(new UIController(uI, player, enemiesList));

            _executeControllers = executes.ToArray();
        }