Exemplo n.º 1
0
 public override void OnBackPressed()
 {
     AlertDialog ad = new AlertDialog.Builder(this).Create();
     ad.SetCancelable(false); // This blocks the 'BACK' button
     ad.SetMessage("Czy chcesz wyjϾ z gry?");
     ad.SetButton("Nie", delegate { /*dialogLive = false;*/ });
     ad.SetButton2("Tak", delegate
     {
         Sockets.client.Close();
         Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
         //dialogLive = false;
     });
     //dialogLive = true;
     ad.Show();
 }
Exemplo n.º 2
0
        public void SaveCode()
        {
            int getLastID = codeDatabase.SelectAll<Code>().Count + 1;

            LinearLayout layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            EditText inputFileName = new EditText(this);
            inputFileName.Hint = "FileName";
            layout.AddView (inputFileName);

            EditText inputAuthor = new EditText(this);
            inputAuthor.Hint = "Author";
            layout.AddView (inputAuthor);

            inputAuthor.Text = GlobalSupport.LastNameInput;
            AlertDialog ad = new AlertDialog.Builder (this).Create();
            ad.SetTitle ("Enter name");
            ad.SetMessage ("Please enter a file name and your name.");
            ad.SetView (layout);
            ad.SetButton ("Save",(senderAlert, args) => {
                //Save File
                GlobalSupport.LastNameInput = inputAuthor.Text;
                Code code = new Code();
                code.CodeString = txtCodeField.Text;
                code.Author = inputAuthor.Text;
                code.FileName = inputFileName.Text;
                code.Date = DateTime.Now;
                code.LevelName = GlobalSupport.GameLevel.Substring(0,GlobalSupport.GameLevel.LastIndexOf('.'));
                code.Language = GlobalSupport.GameLanguage;

                codeDatabase.Insert(code);
            });

            ad.SetButton2 ("Cancel", (senderAlert, args) => {
                // cancels (Do nothing)
            });

            ad.Show ();
        }
Exemplo n.º 3
0
        private void ShowScorePopup(int score)
        {
            EditText input = new EditText(this);
            input.Text = GlobalSupport.LastNameInput;
            AlertDialog ad = new AlertDialog.Builder (this).Create();
            ad.SetTitle ("Enter name");
            ad.SetMessage ("You have passed the level with a score of " + score + "! Please enter your name.");
            ad.SetView (input);
            ad.SetButton ("Save",(senderAlert, args) => {
                //Save Highscore
                robot.SaveHighscore(score,input.Text);
                GlobalSupport.LastNameInput = input.Text;

            });

            ad.SetButton2 ("Cancel", (senderAlert, args) => {
                // cancels (Do nothing)
            });

            ad.Show ();
        }
Exemplo n.º 4
0
 public override void OnBackPressed()
 {
     AlertDialog ad = new AlertDialog.Builder(this).Create();
     ad.SetCancelable(false); // This blocks the 'BACK' button
     ad.SetMessage("Czy chcesz opuœciæ grê (oddasz walkowerem)?");
     ad.SetButton("Nie", delegate { dialogLive = false; });
     ad.SetButton2("Tak", delegate
     {
         byte[] buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Left), nickname));
         Sockets.client.GetStream().Write(buffer, 0, buffer.Length);
         dialogLive = false;
     });
     dialogLive = true;
     ad.Show();
 }