コード例 #1
0
ファイル: Form1.cs プロジェクト: solson/DSAE
        private void clicks_MessagesReceived(IStringChannel channel)
        {
            string click;
            while ((click = channel.DequeueMessage(0)) != null)
            {
                Console.WriteLine("Click received: " + click);

                string[] parts = click.Split(new char[] {' '}, 3);
                string button = parts[0];
                string type = parts[1];
                string player = parts[2];
                int clickingPlayerID = int.Parse(player);

                if (clickingPlayerID == playerID)
                    return;

                if (type == "down")
                {
                    if (button == "right")
                    {
                        if (playerID == 0)
                            user2RightDown = true;
                        else if (playerID == 1)
                            user1RightDown = true;
                    }
                    //else
                    //{
                    //    int otherPlayerID = (playerID == 0) ? 1 : 0;
                    //    toggleWordBoxUnderCursorNumberDragging(otherPlayerID + 1);
                    //}
                }
                else if (type == "up")
                {
                    if (button == "right")
                    {
                        if (playerID == 0)
                            user2RightDown = false;
                        if (playerID == 1)
                            user1RightDown = false;
                    }
                    //else
                    //{
                    //    if (playerID == 1 && boxBeingDraggedByUser1 != null)
                    //    {
                    //        boxBeingDraggedByUser1.dropped();
                    //        boxBeingDraggedByUser1 = null;
                    //    }
                    //    if (playerID == 0 && boxBeingDraggedByUser2 != null)
                    //    {
                    //        boxBeingDraggedByUser2.dropped();
                    //        boxBeingDraggedByUser2 = null;
                    //    }
                    //}
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: solson/DSAE
 private void control_MessagesReceived(IStringChannel channel)
 {
     string cmd;
     while ((cmd = channel.DequeueMessage(0)) != null)
     {
         Console.WriteLine("Command received: " + cmd);
         doCommand(cmd);
     }
 }
コード例 #3
0
ファイル: StressTests.cs プロジェクト: briandealwis/gt
        private void client_ReceivedStringMessage(IStringChannel channel)
        {
            string message;
            while ((message = channel.DequeueMessage(0)) != null)
            {
                if (!StandardObjects.StringMessage.Equals(message))
                {
                    Console.WriteLine("Invalid strings message: {0}",
                        message);
                    errorOccurred = true;
                }

                if (random.Next(0, 100) < 10)
                {
                    stringChannel.Send(message);
                }
            }
        }