Esempio n. 1
0
        private void OnInviteDirectMessage(object sender, byte[] bytes)
        {
            if (bytes[0] == MessageConnect)
            {
                relay.OnDirectMessage -= OnInviteDirectMessage;
                relay.SendDirectMessage((Guid)sender, new[] { MessageConnect });

                StartGame((Guid)sender);

                relay.GetFile(matchmakingFileId, (s, file) =>
                {
                    var newEntries = file.Entries.SetItem(relay.OwnId.ToString(), "");
                    relay.UpdateFile(matchmakingFileId, newEntries);

                    OnFileRecieved(sender, file);
                });
            }
        }
Esempio n. 2
0
        private void FormGame_Load(object sender, EventArgs e)
        {
            relay.SendDirectMessage(opponentGuid, BitsUtils.IntToBytes(priority));

            buttons = new Button[tableLayoutPanelGame.ColumnCount, tableLayoutPanelGame.RowCount];

            for (byte y = 0; y < tableLayoutPanelGame.RowCount; y++)
            {
                for (byte x = 0; x < tableLayoutPanelGame.ColumnCount; x++)
                {
                    buttons[x, y] = new Button
                    {
                        Dock = DockStyle.Fill
                    };
                    buttons[x, y].Click += OnClick;

                    tableLayoutPanelGame.Controls.Add(buttons[x, y], x, y);
                }
            }
        }