Пример #1
0
        void OnDeleteBackward(object sender, CCIMEKeybardEventArgs e)
        {
            var focusedTextField = sender as CCTextField;

            if (focusedTextField == null || string.IsNullOrEmpty(focusedTextField.Text))
            {
                e.Cancel = true;
                return;
            }

            // Just cancel this if we would backspace over the PlaceHolderText as it would just be
            // replaced anyway and the Action below should not be executed.
            var delText = focusedTextField.Text;

            if (delText == focusedTextField.PlaceHolderText)
            {
                e.Cancel = true;
                return;
            }

            delText = delText.Substring(delText.Length - 1);

            // create a delete text sprite and do some action
            var label = new CCLabel(delText, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE + 3, CCLabelFormat.SpriteFont);

            this.AddChild(label);

            // move the sprite to fly out
            CCPoint beginPos      = focusedTextField.Position;
            CCSize  textfieldSize = focusedTextField.ContentSize;
            CCSize  labelSize     = label.ContentSize;

            beginPos.X += (textfieldSize.Width - labelSize.Width) / 2.0f;

            var nextRandom = (float)CCRandom.Next(RANDOM_MAX);

            CCSize  winSize = VisibleBoundsWorldspace.Size;
            CCPoint endPos  = new CCPoint(-winSize.Width / 4.0f, winSize.Height * (0.5f + nextRandom / (2.0f * RANDOM_MAX)));

            float duration       = 1;
            float rotateDuration = 0.2f;
            int   repeatTime     = 5;

            label.Position = beginPos;

            var delAction = new CCSpawn(new CCMoveTo(duration, endPos),
                                        new CCRepeat(
                                            new CCRotateBy(rotateDuration, (CCRandom.Next() % 2 > 0) ? 360 : -360),
                                            (uint)repeatTime),
                                        new CCFadeOut(duration)
                                        );

            label.RunActionsAsync(delAction, new CCRemoveSelf(true));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCActionInterval inA, outA;

            m_pInScene.Visible = false;

            float inDeltaZ, inAngleZ;
            float outDeltaZ, outAngleZ;

            if (m_eOrientation == CCTransitionOrientation.UpOver)
            {
                inDeltaZ  = 90;
                inAngleZ  = 270;
                outDeltaZ = 90;
                outAngleZ = 0;
            }
            else
            {
                inDeltaZ  = -90;
                inAngleZ  = 90;
                outDeltaZ = -90;
                outAngleZ = 0;
            }

            inA = CCSequence.FromActions
                  (
                new CCDelayTime(m_fDuration / 2),
                CCSpawn.FromActions
                (
                    new CCOrbitCamera(m_fDuration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
                    new CCScaleTo(m_fDuration / 2, 1),
                    new CCShow()
                ),
                new CCCallFunc(Finish)
                  );

            outA = CCSequence.FromActions
                   (
                CCSpawn.FromActions
                (
                    new CCOrbitCamera(m_fDuration / 2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
                    new CCScaleTo(m_fDuration / 2, 0.5f)
                ),
                new CCHide(),
                new CCDelayTime(m_fDuration / 2)
                   );

            m_pInScene.Scale = 0.5f;
            m_pInScene.RunAction(inA);
            m_pOutScene.RunAction(outA);
        }
Пример #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(1);

            var action = CCSpawn.FromActions(
                new CCJumpBy(2, new CCPoint(300, 0), 50, 4),
                new CCRotateBy(2, 720));

            m_grossini.RunAction(action);
        }
Пример #4
0
        public override void onEnter()
        {
            base.onEnter();

            alignSpritesLeft(1);

            CCAction action = CCSpawn.actions(
                CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4),
                CCRotateBy.actionWithDuration(2, 720));

            m_grossini.runAction(action);
        }
Пример #5
0
    public static CCSpawn Create(params CCAction[] actions)
    {
        var spawn = new CCSpawn();

        spawn._actionList = new List <CCAction>(actions.Length);
        spawn._actionList.AddRange(actions);
        spawn._duration = 0f;
        for (int i = 0; i < actions.Length; i++)
        {
            spawn._duration = Math.Max(spawn._duration, actions[i].Duration);
        }
        return(spawn);
    }
Пример #6
0
        //	int redColorIncrement = 10;


        public GameLayer()
            : base(CCColor4B.Blue, CCColor4B.White)
        {
            // Set the layer gradient direction
            this.Vector = new CCPoint(0f, 0.5f);

            // Create and add sprites

            initSprites();
            scaleSprites();
            addChildNodes();


            //	AddChild (monkeySprite1, 1);

            monkeySprite2 = new CCSprite("monkey");
            //	AddChild (monkeySprite2, 1);

            // Define actions
            var moveUp   = new CCMoveBy(1.0f, new CCPoint(0.0f, 100.0f));
            var moveDown = moveUp.Reverse();


            //	var moveForward = new CCTransitionMoveInR (0.1f,this);

            // A CCSequence action runs the list of actions in ... sequence!
            //CCFiniteTimeAction cfa = new CCEaseIn (moveUp);

            CCSequence moveSeq = new CCSequence(new CCEaseBackIn(moveUp), new CCEaseBackInOut(moveUp));

            repeatedAction = new CCRepeatForever(moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 4, 4));

            //	CCAction moveR = new Action

            // Schedule for method to be called every 0.1s
            Schedule(UpdateLayerGradient, 0.1f);
        }
Пример #7
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            // rotate and jump
            var jump1 = new CCJumpBy(4, new CCPoint(-s.Width + 80, 0), 100, 4);
            var jump2 = jump1.Reverse();
            var rot1  = new CCRotateBy(4, 360 * 2);
            var rot2  = rot1.Reverse();

            var seq3_1 = new CCSequence(jump2, jump1);
            var seq3_2 = new CCSequence(rot1, rot2);
            var spawn  = new CCSpawn(seq3_1, seq3_2);

            speedAction1 = new CCSpeed(new CCRepeatForever(spawn), 1.0f);
            speedAction2 = new CCSpeed(new CCRepeatForever(spawn), 2.0f);
            speedAction3 = new CCSpeed(new CCRepeatForever(spawn), 0.5f);

            m_grossini.RunAction(speedAction1);
            m_tamara.RunAction(speedAction2);
            m_kathia.RunAction(speedAction3);
        }