Ejemplo n.º 1
0
        public Game(BluetoothMag bluetooth, GameSettings gameSettings)
        {
            InitializeComponent();
            BGStuff.game   = this;
            BGStuff.InGame = true;
            Labels.Add(txtNumOfShots);
            Labels.Add(txtStatus);
            imageShotGlass.Source = FileManager.SRCShotGlass;
            ApplyTheme();
            this.bluetooth      = bluetooth;
            this.settings       = gameSettings;
            settings.YourTurn   = false;
            settings.EnemyShots = settings.NumOfShots;
            txtNumOfShots.Text  = settings.NumOfShots.ToString();
            GameGrid grid = new GameGrid(this, MainStack, SecStack, settings);

            // check for who goes first
            if (settings.Master)
            {
                Random random = new Random();
                int    ranNum = random.Next(0, 1);
                if (ranNum == 1)
                {
                    bluetooth.SendMessage(ranNum.ToString());
                    txtStatus.Text = settings.EnemyName + "'s Goes First";
                }
                else
                {
                    settings.YourTurn = true;
                    bluetooth.SendMessage(ranNum.ToString());
                    txtStatus.Text = "You Go First";
                }
            }
        }
Ejemplo n.º 2
0
 public ReconnectionPage(BluetoothMag bluetooth)
 {
     InitializeComponent();
     BGStuff.reconnectionPage = this;
     this.bluetooth           = bluetooth;
     Labels.Add(txtTrying);
     Buttons.Add(btnCancel);
     ApplyTheme();
 }
Ejemplo n.º 3
0
 public MainPage()
 {
     InitializeComponent();
     BGStuff.mainPage = this;
     Buttons.Add(btnKnownDevices);
     Buttons.Add(btnDiscoverable);
     Buttons.Add(btnStartScan);
     LoadingImage = loadingImage;
     ApplyTheme();
     bluetoothMag = new BluetoothMag();
     bluetoothMag.SetupBt();
     DeviceNames = new List <string>();
 }
 public SetupGame2(BluetoothMag bluetoothMag, GameSettings gameSettings)
 {
     InitializeComponent();
     Labels.Add(txtTitle);
     Labels.Add(txtShotsLabel);
     Labels.Add(txtNumOfShotsLeft);
     Labels.Add(txtEnReadyLabel);
     ApplyTheme();
     bluetooth              = bluetoothMag;
     this.gameSettings      = gameSettings;
     BGStuff.setUpGame2     = this;
     BGStuff.settingUpGame2 = true;
     btnContinue.IsEnabled  = false;
     txtEnReady.Text        = "Not Ready";
     txtEnReady.TextColor   = Color.Red;
     Master = bluetooth.GetMaster();
     bluetooth.ReadMessage();
     ShotsLeft = gameSettings.NumOfShots;
     txtNumOfShotsLeft.Text = ShotsLeft.ToString();
     SetupGameGrid setupGameGrid = new SetupGameGrid(this, MainLayout, gameSettings);
 }
 public SetupGame(BluetoothMag bluetoothMag)
 {
     InitializeComponent();
     bluetooth = bluetoothMag;
     Setup();
 }