Example #1
0
 /**********************************************************************
  *********************************************************************/
 async void B_Send_Clicked(object sender, EventArgs e)
 {
     b_Restart.IsEnabled = true;
     if (strategy == "Selective Repeat")
     {
         int a1 = OldPipelineProtocolsScene.nextSeqnum;
         if (a1 == 29)
         {
             await DisplayAlert("Alert", "You are done!", "OK");
         }
         else
         {
             OldPipelineProtocolsScene.InvokeSender();
         }
     }
     else
     {
         int a1 = OldPipelineProtocolsScene2.nextSeqnum;
         if (a1 == 29)
         {
             await DisplayAlert("Alert", "You are done!", "OK");
         }
         else
         {
             OldPipelineProtocolsScene2.InvokeSender();
         }
     }
 }
Example #2
0
        /**********************************************************************
         ***************************************************hghjgkh******************/
        private bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (touch.Location.X > touchEvent.CurrentTarget.PositionX && touch.Location.X < (touchEvent.CurrentTarget.Position.X + 40.0f) && //40 because it's the width of the packages spriteframe
                touch.Location.Y > touchEvent.CurrentTarget.PositionY && touch.Location.Y < (touchEvent.CurrentTarget.PositionY + 50.0f)
                )
            {
                switch (touchCount)
                {
                case 0: Corrupt(); break;

                case 1: SlowDown();
                    if (OldPipelineProtocols.strategy == "Selective Repeat")
                    {
                        OldPipelineProtocolsScene.SlowDownAck(this, ((int)touch.Location.X - 20));
                    }
                    else
                    {
                        OldPipelineProtocolsScene2.SlowDownAck(this, ((int)touch.Location.X - 20));
                    }
                    break;

                case 2: SlowCorrupt(); break;

                case 3: Lost(); break;

                default: break;
                }
            }
            return(true);
        }
Example #3
0
        /**********************************************************************
         *********************************************************************/
        private void Process(float seconds)
        {
            //stop code from running in the background
            if (stopEverything)
            {
                this.Dispose(); return;
            }

            //if Pack arrives (MinX + 319 = position of the rectangles on the right)
            if (this.PositionX + 40 >= VisibleBoundsWorldspace.MinX + 319)
            {
                if (this.ignore)
                {
                }
                else if (this.corrupt)
                {
                    if (OldPipelineProtocols.strategy == "Selective Repeat")
                    {
                        OldPipelineProtocolsScene.PackCorrupt(this);
                    }
                    else
                    {
                        OldPipelineProtocolsScene2.PackCorrupt(this);
                    }
                }
                else if (this.lost)
                {
                    //OldPipelineProtocolsScene.PackLost(this);
                    //OldPipelineProtocolsScene2.PackLost(this);
                }
                //arrived without corruption and didn't get lost on the way
                else
                {
                    ;
                    if (OldPipelineProtocols.strategy == "Selective Repeat")
                    {
                        OldPipelineProtocolsScene.PackArrived(this);
                    }
                    else
                    {
                        OldPipelineProtocolsScene2.PackArrived(this);
                    }
                }
                this.RemoveChild(this.sprite);
            }
        }
Example #4
0
        /**********************************************************************
         *********************************************************************/
        private void Process(float seconds)
        {
            if (stopEverything)
            {
                this.Dispose(); return;
            }

            //if ACK arrives (MinX + 81 = position of the rectangles on the left)
            if (this.PositionX <= VisibleBoundsWorldspace.MinX + 81)
            {
                if (this.ignore)
                {
                }
                else if (this.corrupt)
                {
                    //OldPipelineProtocolsScene.AckCorrupt(this);
                    //OldPipelineProtocolsScene2.AckCorrupt(this);
                }
                else if (this.lost)
                {
                    //OldPipelineProtocolsScene.AckLost(this);
                    //OldPipelineProtocolsScene2.AckLost(this);
                }
                //arrived without corruption and didn't get lost on the way
                else
                {
                    if (OldPipelineProtocols.strategy == "Selective Repeat")
                    {
                        OldPipelineProtocolsScene.AckArrived(this);
                    }
                    else
                    {
                        OldPipelineProtocolsScene2.AckArrived(this);
                    }
                }
                this.RemoveChild(this.sprite);
            }
        }
Example #5
0
        /**********************************************************************
         *********************************************************************/
        //sets up the scene
        void HandleViewCreated(object sender, EventArgs e)
        {
            cc_gameView = sender as CCGameView;
            if (cc_gameView != null)
            {
                //###############################################################

                //choose gamescene for GoBackN or Selective Repeat
                if (strategy == "Selective Repeat")
                {
                    gameScene = new OldPipelineProtocolsScene(cc_gameView);
                    // Starts CocosSharp:
                    cc_gameView.RunWithScene(gameScene);
                }
                else
                {
                    gameScene2 = new OldPipelineProtocolsScene2(cc_gameView);
                    //gameScene2.PositionY = -1100; //reagiert nicht mehr auf touch

                    // Starts CocosSharp:
                    cc_gameView.RunWithScene(gameScene2);
                }
            }
        }