Пример #1
0
        private void sendMessage(int progress)
        {
            NetworkIt.Message m = new NetworkIt.Message("progress");
            m.DeliverToSelf = false;
            m.AddField("progress", "" + progress);
            //m.AddField("count", "" + messageCount++);

            client.SendMessage(m);
        }
Пример #2
0
        private void Client_MessageReceived(object sender, NetworkItMessageEventArgs e)
        {
            int random = RandomInt(1, 2);

            Debug.WriteLine(e.ReceivedMessage.ToString());
            NetworkIt.Message m = e.ReceivedMessage;
            if (m.Subject.Equals("force"))
            {
                int power = 0;

                int.TryParse(m.GetField("message"), out power);
                Debug.WriteLine("power" + power);
                if (power >= 1 && power <= 2)
                {
                    Debug.WriteLine("light squeeze");
                    if (random == 1)
                    {
                        soundtoPlay = new SoundPlayer("audio\\whyhellothere.wav");
                        soundtoPlay.Play();
                    }
                    else
                    {
                        soundtoPlay = new SoundPlayer("audio\\caliente.wav");
                        soundtoPlay.Play();
                    }
                }
                else if (power == 3)
                {
                    random = RandomInt(1, 3);
                    Debug.WriteLine("medium squeeze");
                    if (random == 1)
                    {
                        soundtoPlay = new SoundPlayer("audio\\letsgo.wav");
                        soundtoPlay.Play();
                    }
                    else if (random == 2)
                    {
                        soundtoPlay = new SoundPlayer("audio\\onestepatatime.wav");
                        soundtoPlay.Play();
                    }
                    else if (random == 3)
                    {
                        soundtoPlay = new SoundPlayer("audio\\imsoalive.wav");
                        soundtoPlay.Play();
                    }
                }
                else if (power == 4)
                {
                    random = RandomInt(1, 4);
                    Debug.WriteLine("big squeeze");
                    if (random == 1)
                    {
                        soundtoPlay = new SoundPlayer("audio\\ow_easy.wav");
                        soundtoPlay.Play();
                    }
                    else if (random == 2)
                    {
                        soundtoPlay = new SoundPlayer("audio\\whatstheproblem.wav");
                        soundtoPlay.Play();
                    }
                    else if (random == 3)
                    {
                        soundtoPlay = new SoundPlayer("audio\\cryout.wav");
                        soundtoPlay.Play();
                    }
                    else if (random == 4)
                    {
                        soundtoPlay = new SoundPlayer("audio\\youok.wav");
                        soundtoPlay.Play();
                    }
                }
            }
        }