Example #1
0
        public static CCProgressFromTo actionWithDuration(float duration, float fFromPercentage, float fToPercentage)
        {
            CCProgressFromTo cCProgressFromTo = new CCProgressFromTo();

            cCProgressFromTo.initWithDuration(duration, fFromPercentage, fToPercentage);
            return(cCProgressFromTo);
        }
Example #2
0
        /// <summary>
        /// Creates and initializes the action with a duration, a "from" percentage and a "to" percentage
        /// </summary>
        public static CCProgressFromTo actionWithDuration(float duration, float fFromPercentage, float fToPercentage)
        {
            CCProgressFromTo pProgressFromTo = new CCProgressFromTo();
            pProgressFromTo.initWithDuration(duration, fFromPercentage, fToPercentage);

            return pProgressFromTo;
        }
Example #3
0
        public override void onEnter()
        {
            base.onEnter();
            // create a transparent color layer
            // in which we are going to add our rendertextures
            CCSize size = CCDirector.sharedDirector().getWinSize();

            // create the second render texture for outScene
            CCRenderTexture outTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)size.width, (int)size.height);

            if (outTexture == null)
            {
                return;
            }

            outTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f);
            outTexture.position           = new CCPoint(size.width / 2, size.height / 2);
            outTexture.anchorPoint        = new CCPoint(0.5f, 0.5f);

            // render outScene to its texturebuffer
            outTexture.clear(0, 0, 0, 1);
            outTexture.begin();
            m_pOutScene.visit();
            outTexture.end();

            //	Since we've passed the outScene to the texture we don't need it.
            this.hideOutShowIn();

            //	We need the texture in RenderTexture.
            CCProgressTimer outNode = CCProgressTimer.progressWithTexture(outTexture.Sprite.Texture);

            // but it's flipped upside down so we flip the sprite
            //outNode.Sprite.->setFlipY(true);
            //	Return the radial type that we want to use
            outNode.Type        = radialType();
            outNode.Percentage  = 100.0f;
            outNode.position    = new CCPoint(size.width / 2, size.height / 2);
            outNode.anchorPoint = new CCPoint(0.5f, 0.5f);

            // create the blend action
            CCAction layerAction = CCSequence.actions
                                   (
                CCProgressFromTo.actionWithDuration(m_fDuration, 100.0f, 0.0f),
                CCCallFunc.actionWithTarget(this, base.finish)
                                   );

            // run the blend action
            outNode.runAction(layerAction);

            // add the layer (which contains our two rendertextures) to the scene
            this.addChild(outNode, 2, kSceneRadial);
        }
Example #4
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCProgressFromTo cCProgressFromTo = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCProgressFromTo = new CCProgressFromTo();
                pZone            = new CCZone(cCProgressFromTo);
            }
            else
            {
                cCProgressFromTo = (CCProgressFromTo)pZone.m_pCopyObject;
            }
            this.copyWithZone(pZone);
            cCProgressFromTo.initWithDuration(this.m_fDuration, this.m_fFrom, this.m_fTo);
            return(cCProgressFromTo);
        }
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCProgressFromTo pCopy = null;
            if (pZone != null && pZone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pCopy = (CCProgressFromTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCProgressFromTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            // CCActionInterval::copyWithZone(pZone);
            copyWithZone(pZone);
            pCopy.initWithDuration(m_fDuration, m_fFrom, m_fTo);

            // CC_SAFE_DELETE(pNewZone);
            return pCopy;
        }
Example #6
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone           pNewZone = null;
            CCProgressFromTo pCopy    = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pCopy = (CCProgressFromTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCProgressFromTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            // CCActionInterval::copyWithZone(pZone);
            copyWithZone(pZone);
            pCopy.initWithDuration(m_fDuration, m_fFrom, m_fTo);

            // CC_SAFE_DELETE(pNewZone);
            return(pCopy);
        }
Example #7
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCProgressFromTo.actionWithDuration(this.m_fDuration, this.m_fTo, this.m_fFrom));
 }
        public override void onEnter()
        {
            base.onEnter();
            CCSize          winSize = CCDirector.sharedDirector().getWinSize();
            CCRenderTexture cCPoint = CCRenderTexture.renderTextureWithWidthAndHeight((int)winSize.width, (int)winSize.height);

            if (cCPoint == null)
            {
                return;
            }
            cCPoint.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f);
            cCPoint.position           = new CCPoint(winSize.width / 2f, winSize.height / 2f);
            cCPoint.anchorPoint        = new CCPoint(0.5f, 0.5f);
            cCPoint.clear(0f, 0f, 0f, 1f);
            cCPoint.begin();
            this.m_pOutScene.visit();
            cCPoint.end();
            base.hideOutShowIn();
            CCProgressTimer cCProgressTimer = CCProgressTimer.progressWithTexture(cCPoint.Sprite.Texture);

            cCProgressTimer.Type        = this.radialType();
            cCProgressTimer.Percentage  = 100f;
            cCProgressTimer.position    = new CCPoint(winSize.width / 2f, winSize.height / 2f);
            cCProgressTimer.anchorPoint = new CCPoint(0.5f, 0.5f);
            CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCProgressFromTo.actionWithDuration(this.m_fDuration, 100f, 0f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            cCProgressTimer.runAction(CCSequence.actions(cCFiniteTimeActionArray));
            this.addChild(cCProgressTimer, 2, 2147483647);
        }