Пример #1
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval move      = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0));
            CCActionInterval move_back = (CCActionInterval)move.reverse();

            CCActionInterval move_ease_in      = CCEaseIn.actionWithAction(move.copy() as CCActionInterval, 3);
            CCActionInterval move_ease_in_back = move_ease_in.reverse() as CCActionInterval;

            CCActionInterval move_ease_out      = CCEaseOut.actionWithAction(move.copy() as CCActionInterval, 3);
            CCActionInterval move_ease_out_back = move_ease_out.reverse() as CCActionInterval;

            CCFiniteTimeAction seq1 = CCSequence.actions(move, move_back);

            CCFiniteTimeAction seq2 = CCSequence.actions(move_ease_in, move_ease_in_back);
            CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_out, move_ease_out_back);

            CCAction a2 = m_grossini.runAction(CCRepeatForever.actionWithAction(seq1 as CCActionInterval));

            a2.tag = 1;

            CCAction a1 = m_tamara.runAction(CCRepeatForever.actionWithAction(seq2 as CCActionInterval));

            a1.tag = 1;
            CCAction a = m_kathia.runAction(CCRepeatForever.actionWithAction(seq3 as CCActionInterval));

            a.tag = 1;

            schedule(new SEL_SCHEDULE(testStopAction), 6.0f);
        }
Пример #2
0
        void AddBalloon()
        {
            string   previousBestTime = GetDefault(PREVIOUS_BEST_TIME_KEY);
            string   currentTime      = ((CCLabel)stopwatchSprite.GetChildByTag(1)).Text;
            TimeSpan currentTimeSpan  = new TimeSpan(int.Parse(currentTime.Split(':')[0]), int.Parse(currentTime.Split(':')[1]), int.Parse(currentTime.Split(':')[2]));

            previousTimeSpan = (String.IsNullOrWhiteSpace(previousBestTime) ? new TimeSpan(0, 0, 0) : new TimeSpan(int.Parse(previousBestTime.Split(':')[0]),
                                                                                                                   int.Parse(previousBestTime.Split(':')[1]),
                                                                                                                   int.Parse(previousBestTime.Split(':')[2])));

            GetRandomBalloonColor();

            balloonSprite           = new CCSprite("Balloon:" + balloonColor);
            balloonSprite.Name      = "Balloon:" + balloonColor;
            balloonSprite.PositionX = layerWidth / 2 + 3;
            balloonSprite.PositionY = 0;
            balloonSprite.Opacity   = 200;

            balloonMoved        = false;
            balloonLaunched     = false;
            balloonXVelocity    = 0;
            balloonYVelocity    = 0;
            newBalloonYVelocity = 0;
            lastPlayTime        = DateTime.Now;

            if ((currentTimeSpan.TotalSeconds - previousTimeSpan.TotalSeconds) > 0)
            {
                CCEaseIn   shakeIn;
                CCEaseOut  shakeOut;
                CCEaseIn   shakeBackIn;
                CCEaseOut  shakeBackOut;
                CCCallFunc resetFunction;
                CCCallFunc bestTimeAlertFunction;
                CCSequence motionSequence;

                shakeIn               = new CCEaseIn(new CCMoveBy(0.05f, new CCPoint(15, 0)), 1f);
                shakeOut              = new CCEaseOut(new CCMoveBy(0.05f, new CCPoint(-30, 0)), 1f);
                resetFunction         = new CCCallFunc(() => ((CCLabel)previousBestTimeSprite.GetChildByTag(1)).Text = currentTime);
                shakeBackIn           = new CCEaseIn(new CCMoveBy(0.1f, new CCPoint(30, 0)), 1f);
                shakeBackOut          = new CCEaseOut(new CCMoveBy(0.1f, new CCPoint(-15, 0)), 1f);
                bestTimeAlertFunction = new CCCallFunc(() => ShowBestTimeAlert());
                motionSequence        = new CCSequence(shakeIn, shakeOut, resetFunction, shakeBackIn, shakeBackOut, bestTimeAlertFunction);
                previousTimeSpan      = currentTimeSpan;

                previousBestTimeSprite.RunAction(motionSequence);
                SetDefault(((CCLabel)stopwatchSprite.GetChildByTag(1)).Text, PREVIOUS_BEST_TIME_KEY);
            }
            else
            {
                ControlMenu("Show");
            }

            AddChild(balloonSprite);
            balloonSprite.RunActions(new CCScaleTo(0.10f, 1.5f), new CCScaleTo(0.10f, 1f));
        }
Пример #3
0
        void OnActivatedBonus(object sender, Tuple <int, int> cell)
        {
            var gem       = gems.Find(item => item.Col == cell.Item1 && item.Row == cell.Item2);
            var actionIn  = new CCEaseIn(new CCScaleTo(0.3f, 1.1f), 4);
            var actionOut = new CCEaseOut(new CCScaleTo(0.3f, 1f), 4);

            var sequence     = new CCSequence(actionIn, actionOut);
            var repeatAction = new CCRepeat(sequence, 10000);

            gem.AddAction(repeatAction);
        }
Пример #4
0
        void ResetStopwatch()
        {
            if (((CCLabel)stopwatchSprite.GetChildByTag(1)).Text != "00:00:00")
            {
                CCEaseIn   shakeIn;
                CCEaseOut  shakeOut;
                CCEaseIn   shakeBackIn;
                CCEaseOut  shakeBackOut;
                CCCallFunc resetFunction;
                CCSequence motionSequence;

                shakeIn        = new CCEaseIn(new CCMoveBy(0.05f, new CCPoint(15, 0)), 1f);
                shakeOut       = new CCEaseOut(new CCMoveBy(0.05f, new CCPoint(-30, 0)), 1f);
                resetFunction  = new CCCallFunc(() => ((CCLabel)stopwatchSprite.GetChildByTag(1)).Text = "00:00:00");
                shakeBackIn    = new CCEaseIn(new CCMoveBy(0.1f, new CCPoint(30, 0)), 1f);
                shakeBackOut   = new CCEaseOut(new CCMoveBy(0.1f, new CCPoint(-15, 0)), 1f);
                motionSequence = new CCSequence(shakeIn, shakeOut, resetFunction, shakeBackIn, shakeBackOut);

                stopwatchSprite.RunAction(motionSequence);
            }
        }
Пример #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = Layer.VisibleBoundsWorldspace.Size;

            var move      = new CCMoveBy(3, new CCPoint(size.Width - 130, 0));
            var move_back = (CCFiniteTimeAction)move.Reverse();

            var move_ease_in      = new CCEaseIn(move, 2.5f);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out      = new CCEaseOut(move, 2.5f);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime(0.25f);

            var seq1 = new CCSequence(move, delay, move_back, delay)
            {
                Tag = 1
            };
            var seq2 = new CCSequence(move_ease_in, delay, move_ease_in_back, delay)
            {
                Tag = 1
            };
            var seq3 = new CCSequence(move_ease_out, delay, move_ease_out_back, delay)
            {
                Tag = 1
            };

            m_grossini.RepeatForever(seq1);

            m_tamara.RepeatForever(seq2);

            m_kathia.RepeatForever(seq3);

            Schedule(testStopAction, 6.25f);
        }
Пример #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = CCDirector.SharedDirector.WinSize;

            var move      = new CCMoveBy(3, new CCPoint(size.Width - 130, 0));
            var move_back = (CCActionInterval)move.Reverse();

            var move_ease_in      = new CCEaseIn((CCActionInterval)move.Copy(), 2.5f);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out      = new CCEaseOut((CCActionInterval)move.Copy(), 2.5f);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime(0.25f);

            var seq1 = CCSequence.FromActions(move, delay, move_back, (CCFiniteTimeAction)delay.Copy());
            var seq2 = CCSequence.FromActions(move_ease_in, (CCFiniteTimeAction)delay.Copy(), move_ease_in_back, (CCFiniteTimeAction)delay.Copy());
            var seq3 = CCSequence.FromActions(move_ease_out, (CCFiniteTimeAction)delay.Copy(), move_ease_out_back,
                                              (CCFiniteTimeAction)delay.Copy());

            var a2 = m_grossini.RunAction(new CCRepeatForever((CCActionInterval)seq1));

            a2.Tag = 1;

            var a1 = m_tamara.RunAction(new CCRepeatForever((CCActionInterval)seq2));

            a1.Tag = 1;

            var a = m_kathia.RunAction(new CCRepeatForever((CCActionInterval)seq3));

            a.Tag = 1;

            Schedule(testStopAction, 6.25f);
        }