Example #1
0
        /**********************************************************************
         *********************************************************************/
        //this method imitates the sender of a packet. It is called by the method invoke
        public static void SendPackageAt(int seqnum)
        {
            if (!stopEverything)
            {
                if (seqnum == nextSeqnum)
                {
                    DrawFillLeft(seqnum);
                }

                //pending if not already acknowledged . Add to list only once
                if (!arrivedAck.Any() && !pendingAck.Contains(seqnum) ||
                    arrivedAck.Any() && !arrivedAck.Contains(seqnum) && !pendingAck.Contains(seqnum))
                {
                    pendingAck.Add(seqnum);
                }

                //define object
                float yPos = 15 + (65 * (28 - seqnum)); //calculate where the box !starts! in the coordinate system
                var   pp   = new OldPipelineProtocolsPack(seqnum, 0);
                pp.Position = new CCPoint(80, yPos);
                layer.AddChild(pp);

                //define actions
                float timeToTake        = 5f;
                var   distance          = new CCPoint(280, yPos);             //82 to 278 = 278-82 = 196
                var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the object 196 in x-direction within 5 seconds
                var   removeAction      = new CCRemoveSelf();                 //this action removes the object

                //define sequence of actions and apply to object
                var cc_seq1 = new CCSequence(sendPackageAction, removeAction);
                pp.RunAction(cc_seq1);
            }
        }
Example #2
0
        /**********************************************************************
         *********************************************************************/
        public static void SlowDownPack(OldPipelineProtocolsPack pp, int xPos)
        {
            //stop running actions
            pp.StopAllActions();

            //define actions
            float yPos              = 15 + (65 * (28 - pp.seqnum));
            float timeToTake        = 8f;
            var   distance          = new CCPoint(280, yPos);
            var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the Object to the CCPoint
            var   removeAction      = new CCRemoveSelf();                 //this action removes the object*/

            //define sequence of actions and apply to object
            var cc_seq1 = new CCSequence(sendPackageAction, removeAction);

            pp.RunAction(cc_seq1);
        }