Exemplo n.º 1
0
        public override CCObject copyWithZone(CCZone zone)
        {
            CCZone tmpZone = zone;
            CCSpawn ret = null;

            if (tmpZone != null && tmpZone.m_pCopyObject != null)
            {
                ret = tmpZone.m_pCopyObject as CCSpawn;
                if (ret == null)
                {
                    return null;
                }
            }
            else
            {
                ret = new CCSpawn();
                tmpZone = new CCZone(ret);
            }

            base.copyWithZone(tmpZone);

            CCFiniteTimeAction param1 = m_pOne.copy() as CCFiniteTimeAction;
            CCFiniteTimeAction param2 = m_pTwo.copy() as CCFiniteTimeAction;
            if (param1 == null || param2 == null)
            {
                return null;
            }

            ret.initOneTwo(param1, param2);

            return ret;
        }
Exemplo n.º 2
0
        /** creates the Spawn action */
        public static CCSpawn actionOneTwo(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
        {
            CCSpawn spawn = new CCSpawn();
            spawn.initOneTwo(action1, action2);

            return spawn;
        }
Exemplo n.º 3
0
        protected CCSpawn(CCSpawn spawn)
            : base(spawn)
        {
            var param1 = spawn.m_pOne.Copy() as CCFiniteTimeAction;
            var param2 = spawn.m_pTwo.Copy() as CCFiniteTimeAction;

            InitOneTwo(param1, param2);
        }
Exemplo n.º 4
0
        public static CCSpawn FromActions(params CCFiniteTimeAction[] actions)
        {
            CCFiniteTimeAction prev = actions[0];

            for (int i = 1; i < actions.Length; i++)
            {
                prev = new CCSpawn (prev, actions[i]);
            }

            return (CCSpawn) prev;
        }
Exemplo n.º 5
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval inA, outA;

            m_pInScene.Visible = false;

            float inDeltaZ, inAngleZ;
            float outDeltaZ, outAngleZ;

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

            inA = (CCActionInterval)CCSequence.actions
                  (
                CCDelayTime.actionWithDuration(m_fDuration / 2),
                CCSpawn.actions
                (
                    new CCOrbitCamera(m_fDuration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
                    CCScaleTo.actionWithDuration(m_fDuration / 2, 1),
                    CCShow.action()
                ),
                CCCallFunc.actionWithTarget(this, base.finish)
                  );

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

            m_pInScene.Scale = 0.5f;
            m_pInScene.RunAction(inA);
            m_pOutScene.RunAction(outA);
        }
Exemplo n.º 6
0
        public virtual bool onTextFieldInsertText(CCTextFieldTTF pSender, string text, int nLen)
        {
            // if insert enter, treat as default to detach with ime
            if ("\n" == text)
            {
                return(false);
            }

            // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore.
            if (pSender.CharCount >= m_nCharLimit)
            {
                return(true);
            }

            // create a insert text sprite and do some action
            CCLabelTTF label = CCLabelTTF.labelWithString(text, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE);

            this.addChild(label);
            ccColor3B color = new ccColor3B {
                r = 226, g = 121, b = 7
            };

            label.Color = color;

            // move the sprite from top to position
            CCPoint endPos = pSender.position;

            if (pSender.CharCount > 0)
            {
                endPos.x += pSender.contentSize.width / 2;
            }
            CCSize  inputTextSize = label.contentSize;
            CCPoint beginPos      = new CCPoint(endPos.x, CCDirector.sharedDirector().getWinSize().height - inputTextSize.height * 2);

            float duration = 0.5f;

            label.position = beginPos;
            label.scale    = 8;

            CCAction seq = CCSequence.actions(
                CCSpawn.actions(
                    CCMoveTo.actionWithDuration(duration, endPos),
                    CCScaleTo.actionWithDuration(duration, 1),
                    CCFadeOut.actionWithDuration(duration)),
                CCCallFuncN.actionWithTarget(this, callbackRemoveNodeWhenDidAction));

            label.runAction(seq);
            return(false);
        }
Exemplo n.º 7
0
        public override void onEnter()
        {
            base.onEnter();
            this.m_pInScene.scale        = 0.001f;
            this.m_pOutScene.scale       = 1f;
            this.m_pInScene.anchorPoint  = new CCPoint(0.5f, 0.5f);
            this.m_pOutScene.anchorPoint = new CCPoint(0.5f, 0.5f);
            CCFiniteTimeAction[] cCFiniteTimeActionArray  = new CCFiniteTimeAction[2];
            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { CCScaleBy.actionWithDuration(this.m_fDuration / 2f, 0.001f), CCRotateBy.actionWithDuration(this.m_fDuration / 2f, 720f) };
            cCFiniteTimeActionArray[0] = CCSpawn.actions(cCFiniteTimeActionArray1);
            cCFiniteTimeActionArray[1] = CCDelayTime.actionWithDuration(this.m_fDuration / 2f);
            CCActionInterval cCActionInterval = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            this.m_pOutScene.runAction(cCActionInterval);
            CCScene mPInScene = this.m_pInScene;

            CCFiniteTimeAction[] cCFiniteTimeActionArray2 = new CCFiniteTimeAction[] { cCActionInterval.reverse(), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            mPInScene.runAction(CCSequence.actions(cCFiniteTimeActionArray2));
        }
Exemplo n.º 8
0
        public override void onEnter()
        {
            float single;
            float single1;
            float single2;
            float single3;

            base.onEnter();
            this.m_pInScene.visible = false;
            if (this.m_eOrientation != tOrientation.kOrientationRightOver)
            {
                single  = -90f;
                single1 = 90f;
                single2 = -90f;
                single3 = 0f;
            }
            else
            {
                single  = 90f;
                single1 = 270f;
                single2 = 90f;
                single3 = 0f;
            }
            CCFiniteTimeAction[] cCFiniteTimeActionArray  = new CCFiniteTimeAction[] { CCDelayTime.actionWithDuration(this.m_fDuration / 2f), null, null, null };
            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single1, single, -45f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 1f), CCShow.action() };
            cCFiniteTimeActionArray[1] = CCSpawn.actions(cCFiniteTimeActionArray1);
            cCFiniteTimeActionArray[2] = CCShow.action();
            cCFiniteTimeActionArray[3] = CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish));
            CCActionInterval cCActionInterval = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            CCFiniteTimeAction[] cCFiniteTimeActionArray2 = new CCFiniteTimeAction[3];
            CCFiniteTimeAction[] cCFiniteTimeActionArray3 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single3, single2, 45f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 0.5f) };
            cCFiniteTimeActionArray2[0] = CCSpawn.actions(cCFiniteTimeActionArray3);
            cCFiniteTimeActionArray2[1] = CCHide.action();
            cCFiniteTimeActionArray2[2] = CCDelayTime.actionWithDuration(this.m_fDuration / 2f);
            CCActionInterval cCActionInterval1 = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray2);

            this.m_pInScene.scale = 0.5f;
            this.m_pInScene.runAction(cCActionInterval);
            this.m_pOutScene.runAction(cCActionInterval1);
        }
Exemplo n.º 9
0
        public virtual bool onTextFieldDeleteBackward(CCTextFieldTTF pSender, string delText, int nLen)
        {
            // create a delete text sprite and do some action
            CCLabelTTF label = CCLabelTTF.labelWithString(delText, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE);

            this.addChild(label);

            // move the sprite to fly out
            CCPoint beginPos      = pSender.position;
            CCSize  textfieldSize = pSender.contentSize;
            CCSize  labelSize     = label.contentSize;

            beginPos.x += (textfieldSize.width - labelSize.width) / 2.0f;

            int    RAND_MAX = 32767;
            Random rand     = new Random();

            CCSize  winSize        = CCDirector.sharedDirector().getWinSize();
            CCPoint endPos         = new CCPoint(-winSize.width / 4.0f, winSize.height * (0.5f + (float)rand.Next() / (2.0f * RAND_MAX)));
            float   duration       = 1;
            float   rotateDuration = 0.2f;
            int     repeatTime     = 5;

            label.position = beginPos;

            CCAction seq = CCSequence.actions(
                CCSpawn.actions(
                    CCMoveTo.actionWithDuration(duration, endPos),
                    CCRepeat.actionWithAction(
                        CCRotateBy.actionWithDuration(rotateDuration, (rand.Next() % 2 > 0) ? 360 : -360),
                        (uint)repeatTime),
                    CCFadeOut.actionWithDuration(duration)),
                CCCallFuncN.actionWithTarget(this, callbackRemoveNodeWhenDidAction));

            label.runAction(seq);
            return(false);
        }
Exemplo n.º 10
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCSpawn.actionOneTwo(m_pOne.reverse(), m_pTwo.reverse()));
 }
Exemplo n.º 11
0
 public static CCFiniteTimeAction actions(params CCFiniteTimeAction[] actions)
 {
     return(CCSpawn.actionsWithArray(actions));
 }