Beispiel #1
0
        public Window1()
        {
            InitializeComponent();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();

            SpawnNewBlock();
            SpawnNewEnemyBlock();
            StartBlocksMovement();
            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "towerblocks.database.windows.net";
                builder.UserID         = "towerblocks";
                builder.Password       = "******";
                builder.InitialCatalog = "test";
                connection             = new SqlConnection(builder.ConnectionString);

                Console.WriteLine("\nQuery data example:");
                Console.WriteLine("=========================================\n");

                connection.Open();

                try
                {
                    using (var command = connection.CreateCommand())
                    {
                        command.CommandText = "CREATE TABLE blocks (id INTEGER PRIMARY KEY , x INTEGER, username VARCHAR(50));";
                        command.ExecuteNonQuery();
                        Console.WriteLine("Finished creating table");
                    }
                }catch (SqlException e)
                {
                }
                System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
                timer.Tick    += ReadEnemyData;
                timer.Interval = new TimeSpan(0, 0, 0, 1, 0);
                timer.Start();
                Console.WriteLine(connection.State);
            }
            catch (SqlException e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.ReadLine();
            Proxy proxy = new DatabaseProxy();

            EnemyXCoordinate = proxy.getDatabaseResponse(connection, 1);

            //BlockUi = new BlockUi();
        }
        public Window1()
        {
            InitializeComponent();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();

            SpawnNewBlock();

            StartBlocksMovement();
            //BlockUi = new BlockUi();
        }
Beispiel #3
0
 /// <summary>
 /// Decorator pattern.
 /// </summary>
 /// <param name="blockCount"></param>
 public int changeSkin_forTest(int blockCount, TowerConroller t)
 {
     if (blockCount == 0)
     {
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.draw();
     }
     else if (t.getPerfectDrop())
     {
         Settings.BlockWidth    = blockFactory.getBlock("SQUARE");
         Settings.block.Stretch = Stretch.Fill;
         Skin doublePoints = new DoublePointsDecorator(new DoublePointsSkin());
         doublePoints.draw();
     }
     else
     {
         Settings.BlockWidth    = blockFactory.getBlock("RECTANGLE");
         Settings.block.Stretch = Stretch.Fill;
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.draw();
     }
     return(Settings.points);
 }
Beispiel #4
0
        public Window1()
        {
            InitializeComponent();
            b = new Block();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();
            v = new Caretaker();
            health.Content     = Settings.healths;
            scoreLabel.Content = Settings.totalPoints;

            SpawnNewBlock();

            AbstractExpression query  = new Select("*", new From("users"));
            Context            ctx    = new Context();
            List <string>      result = query.Interpret(ctx);

            Console.WriteLine(result[0]);
            //SpawnNewEnemyBlock();
            StartBlocksMovement();
            //try
            //{

            //    SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
            //    builder.DataSource = "towerblocks.database.windows.net";
            //    builder.UserID = "towerblocks";
            //    builder.Password = "******";
            //    builder.InitialCatalog = "test";
            //    connection = new SqlConnection(builder.ConnectionString);

            //    Console.WriteLine("\nQuery data example:");
            //    Console.WriteLine("=========================================\n");

            //    connection.Open();

            //    try
            //    {
            //        using (var command = connection.CreateCommand())
            //        {
            //            command.CommandText = "CREATE TABLE blocks (id INTEGER PRIMARY KEY , x INTEGER, username VARCHAR(50));";
            //            command.ExecuteNonQuery();
            //            Console.WriteLine("Finished creating table");
            //        }
            //    }catch(SqlException e)
            //    {

            //    }
            //    System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
            //    timer.Tick += ReadEnemyData;
            //    timer.Interval = new TimeSpan(0, 0, 0, 1, 0);
            //    timer.Start();
            //    Console.WriteLine(connection.State);

            //}
            //catch (SqlException e)
            //{
            //    Console.WriteLine(e.ToString());
            //}
            Console.ReadLine();

            //BlockUi = new BlockUi();
        }