Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            while (game == null)
            {
                Thread.Sleep(1);
            }
            //UpdatePlayerDisplay();

            tableTable.ColumnStyles[2].Width = 700f / 1592f * MainPanel.Width;
            tableTable.RowStyles[2].Height   = 350f / 850f * MainPanel.Height;

            //Console.WriteLine(Table.Location);

            //Console.WriteLine("LOG 1: " + MainPanel.Width);

            setChoice(1);

            setName(DatabaseConn.getUsername());
            setMoney(DatabaseConn.getMoney());
            setImage(DatabaseConn.getImage());

            UpdatePlayers();
        }
Exemple #2
0
 public Start()
 {
     InitializeComponent();
     playerBox1.setName(DatabaseConn.getUsername());
     playerBox1.setMoney(DatabaseConn.getMoney());
     playerBox1.setImage(DatabaseConn.getImage());
     playerBox1.setClickForName(delegate {
         DatabaseConn.setUsername(Prompt.ShowDialog("Enter a new username: "******"Enter a new username"));
         playerBox1.setName(DatabaseConn.getUsername());
     });
     try {
         new DatabaseConn("", "").DownloadAndSet();
     } catch (Exception) { }
 }
Exemple #3
0
        public static async Task <LoginData> ShowDialog(string text, string caption)
        {
            Form login = new Form()
            {
                Width           = 500,
                Height          = 170,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                Text            = caption,
                StartPosition   = FormStartPosition.CenterScreen
            };
            Label textLabel = new Label()
            {
                Width = 400, Left = 50, Top = 20, Text = text
            };
            TextBox username = new TextBox()
            {
                Text = DatabaseConn.getUsername() == "Player" ? "" : DatabaseConn.getUsername(), Left = 50, Top = 50, Width = 400
            };
            TextBox password = new TextBox()
            {
                Left = 50, Top = 70, Width = 400
            };
            Button confirmation = new Button()
            {
                Text = "Login", Left = 350, Width = 100, Top = 90, DialogResult = DialogResult.OK
            };

            confirmation.Click += (sender, e) => { login.Close(); };
            login.Controls.Add(username);
            login.Controls.Add(password);
            login.Controls.Add(confirmation);
            login.Controls.Add(textLabel);
            login.AcceptButton = confirmation;

            LoginData data = new LoginData();

            if (login.ShowDialog() == DialogResult.OK)
            {
                var x = new DatabaseConn(username.Text, password.Text);
                var y = await x.Download();

                return(y);
            }
            else
            {
                return(data);
            }
        }