Exemplo n.º 1
0
        public Atlas4()
        {
            m_time = 0;

            // Upper Label
            CCLabelBMFont label = CCLabelBMFont.labelWithString("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");

            addChild(label);

            CCSize s = CCDirector.sharedDirector().getWinSize();

            label.position    = new CCPoint(s.width / 2, s.height / 2);
            label.anchorPoint = new CCPoint(0.5f, 0.5f);


            CCSprite BChar = (CCSprite)label.getChildByTag(1);
            CCSprite FChar = (CCSprite)label.getChildByTag(7);
            CCSprite AChar = (CCSprite)label.getChildByTag(12);


            CCActionInterval rotate    = CCRotateBy.actionWithDuration(2, 360);
            CCAction         rot_4ever = CCRepeatForever.actionWithAction(rotate);

            CCActionInterval scale = CCScaleBy.actionWithDuration(2, 1.5f);
            //CCActionInterval scale_back = scale.reverse();
            CCActionInterval   scale_back  = null;
            CCFiniteTimeAction scale_seq   = CCSequence.actions(scale, scale_back, null);
            CCAction           scale_4ever = CCRepeatForever.actionWithAction((CCActionInterval)scale_seq);

            CCActionInterval jump       = CCJumpBy.actionWithDuration(0.5f, new CCPoint(), 60, 1);
            CCAction         jump_4ever = CCRepeatForever.actionWithAction(jump);

            CCActionInterval   fade_out   = CCFadeOut.actionWithDuration(1);
            CCActionInterval   fade_in    = CCFadeIn.actionWithDuration(1);
            CCFiniteTimeAction seq        = CCSequence.actions(fade_out, fade_in, null);
            CCAction           fade_4ever = CCRepeatForever.actionWithAction((CCActionInterval)seq);

            BChar.runAction(rot_4ever);
            BChar.runAction(scale_4ever);
            FChar.runAction(jump_4ever);
            AChar.runAction(fade_4ever);


            // Bottom Label
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("00.0", "fonts/bitmapFontTest.fnt");

            addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.position = new CCPoint(s.width / 2.0f, 80);

            CCSprite lastChar = (CCSprite)label2.getChildByTag(3);

            lastChar.runAction((CCAction)(rot_4ever.copy()));

            //schedule( schedule_selector(Atlas4::step), 0.1f);
            base.schedule(step, 0.1f);
        }
Exemplo n.º 2
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);
        }
        public override void onEnter()
        {
            base.onEnter();

            CCLayerColor l = CCLayerColor.layerWithColor(m_tColor);

            m_pInScene.visible = false;

            addChild(l, 2, kSceneFade);
            CCNode f = getChildByTag(kSceneFade);

            CCActionInterval a = (CCActionInterval)CCSequence.actions
                                 (
                CCFadeIn.actionWithDuration(m_fDuration / 2),
                CCCallFunc.actionWithTarget(this, (base.hideOutShowIn)),
                CCFadeOut.actionWithDuration(m_fDuration / 2),
                CCCallFunc.actionWithTarget(this, (base.finish))
                                 );

            f.runAction(a);
        }
Exemplo n.º 4
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.º 5
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCFadeOut.actionWithDuration(this.m_fDuration));
 }
Exemplo n.º 6
0
        public override void onEnter()
        {
            base.onEnter();
            CCLayerColor cCLayerColor = CCLayerColor.layerWithColor(this.m_tColor);

            this.m_pInScene.visible = false;
            this.addChild(cCLayerColor, 2, 2147483647);
            CCNode childByTag = base.getChildByTag(2147483647);

            CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCFadeIn.actionWithDuration(this.m_fDuration / 2f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.hideOutShowIn)), CCFadeOut.actionWithDuration(this.m_fDuration / 2f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            childByTag.runAction((CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray));
        }
Exemplo n.º 7
0
 public override CCFiniteTimeAction Reverse()
 {
     return(CCFadeOut.actionWithDuration(Duration));
 }