示例#1
0
文件: Form1.cs 项目: S-W-dev/DiceGame
        public GameMain(bool join)
        {
            InitializeComponent();

            new DatabaseConn("", "").DownloadAndSet();

            TopMost         = true;
            FormBorderStyle = FormBorderStyle.FixedSingle;
            WindowState     = FormWindowState.Maximized;
            MaximizeBox     = false;

            conn = new Thread(new ServerComponents(this).connection);
            conn.Start();
            while (!connected)
            {
                Thread.Sleep(1);
            }
            if (join)
            {
                var message = new ClientMessage.JoinMessage();
                message.room_code = Prompt.ShowDialog("Enter the room code", "Prompt");
                var message1 = JsonConvert.SerializeObject(message);
                //Console.WriteLine(message1);
                ServerComponents.SendMessage(server, message1);
            }

            //Console.WriteLine("ORIGINAL SIZE: " + Width);
        }
示例#2
0
文件: Form1.cs 项目: S-W-dev/DiceGame
        private void setImage(string image)
        {
            var message = new ClientMessage.ImageMessage();

            message.image = image;
            ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message));
        }
示例#3
0
文件: Form1.cs 项目: S-W-dev/DiceGame
        private void setName(string name)
        {
            var message = new ClientMessage.NameMessage();

            message.name = name;
            ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message));
        }
示例#4
0
文件: Form1.cs 项目: S-W-dev/DiceGame
        private void setMoney(int money)
        {
            var message = new ClientMessage.MoneyMessage();

            message.money = money;
            ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message));
        }
示例#5
0
文件: Form1.cs 项目: S-W-dev/DiceGame
        private void submit_Click(object sender, EventArgs e)
        {
            setBet = currentBet;
            setC   = currentChoice;
            var message = new ClientMessage.BetMessage();

            message.bet    = setBet >= 100 ? setBet : 100;;
            message.choice = setC;
            ServerComponents.SendMessage(server, JsonConvert.SerializeObject(message));
        }