Example #1
0
 /// <summary>
 /// Remove the instance of the <see cref="Core.Slider"/>.
 /// </summary>
 internal void remove()
 {
     touch.eventTouchBegan -= touchBegan;
     touch.eventTouchEnded -= touchMoved;
     mainLayer.RemoveChild(spriteBar);
     mainLayer.RemoveChild(spritePoint);
 }
Example #2
0
        /**********************************************************************
         *********************************************************************/
        public static void MyTimer(int seqnum, int c)
        {
            int counter = c;

            String counterText = "";
            var    ccl_LNumber = new CCLabel(counterText, "Arial", 20);

            if (!stopEverything)
            {
                //draw counter label in respective rectangle
                float a    = 28 - seqnum;
                float yPos = 15 + (a * 65);
                counterText = "" + counter;

                ccl_LNumber.Position = new CCPoint(60, yPos + 25);
                ccl_LNumber.Color    = CCColor3B.Red;
                layer.AddChild(ccl_LNumber);
            }

            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                if (stopEverything)
                {
                    layer.Dispose();
                    return(false);
                }

                // update counter label- but only if the user didn't click pause
                if (!animationIsPaused)
                {
                    counter++;
                }
                if (!stopEverything)
                {
                    counterText      = "" + counter;
                    ccl_LNumber.Text = counterText;
                }

                if (stopEverything || counter == timeouttime)
                {
                    layer.RemoveChild(ccl_LNumber);



                    //resend pending ACK after timeout if seqnum is in list
                    if (pendingAck.Any() && pendingAck.Contains(seqnum) && !stopEverything)
                    {
                        SendPackageAt(seqnum);
                        MyTimer(seqnum, 0);
                    }
                    return(false);    //False = Stop the timer
                }
                else
                {
                    return(true);
                }                         // True = Repeat again
            });
        }
Example #3
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        public static void MyTimer(int seqnum, int c)
        {
            timerRunning = true;
            counter      = c;

            //draw counter label in respective rectangle
            float  a           = 28 - seqnum;
            float  yPos        = 15 + (a * 65);
            String counterText = "" + counter;
            var    ccl_LNumber = new CCLabel(counterText, "Arial", 20);

            ccl_LNumber.Position = new CCPoint(60, yPos + 25);
            ccl_LNumber.Color    = CCColor3B.Red;
            layer.AddChild(ccl_LNumber);

            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                // update counter label- but only if the user didn't click pause
                if (!animationIsPaused)
                {
                    counter++;
                }
                counterText      = "" + counter;
                ccl_LNumber.Text = counterText;

                ///when timer runs out
                if (stopEverything || counter == timeouttime)
                {
                    layer.RemoveChild(ccl_LNumber);
                    timerRunning = false;

                    //resend packages for all pending ACK after timeout
                    if (pendingAck.Any() && !stopEverything)
                    {
                        ResendPending();
                    }
                    return(false); //False = Stop the timer
                }
                else
                {
                    if (arrivedAck.Any() && arrivedAck.Contains(seqnum) && pendingAck.Any())
                    {
                        timerRunning = false;
                        MyTimer(pendingAck.First(), 0);
                        return(false);
                    }
                    return(true);
                }                  // True = Repeat again
            });
        }
 private void DestroyLevelButtons()
 {
     for (int i = levelButtons.Count - 1; i > -1; i--)
     {
         mainLayer.RemoveChild(levelButtons [i]);
         levelButtons [i].Dispose();
     }
 }
Example #5
0
        async public void GameOver()
        {
            // unschedule and stop all actions
            UnscheduleAll();
            StopAllActions();

            // explode ball and remove it from gameplay layer
            ball.Explode();
            gameplayLayer.RemoveChild(ball);

            // wait some time and replace scene
            await Task.Delay(3000);

            GameController.GoToScene(new MenuScene(GameController.GameView));
        }
Example #6
0
 private void DestroyCoin(Coin coinToDestroy)
 {
     coins.Remove(coinToDestroy);
     gameplayLayer.RemoveChild(coinToDestroy);
     coinToDestroy.Dispose();
 }
Example #7
0
 private void DestroyMouse(Mouse mouseToDestroy)
 {
     mice.Remove(mouseToDestroy);
     gameplayLayer.RemoveChild(mouseToDestroy);
     mouseToDestroy.Dispose();
 }