Beispiel #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, 300);
            layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2));
            layer1.IgnoreAnchorPointForPosition = false;
            AddChild(layer1, 1);

            CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 300);
            layer2.Position = (new CCPoint((s.Width / 3) * 2, s.Height / 2));
            layer2.IgnoreAnchorPointForPosition = false;
            AddChild(layer2, 1);

            CCActionInterval actionTint = new CCTintBy (2, -255, -127, 0);
            CCActionInterval actionTintBack = (CCActionInterval)actionTint.Reverse();
            CCActionInterval seq1 = (CCActionInterval)CCSequence.FromActions(actionTint, actionTintBack);
            layer1.RunAction(seq1);

            CCActionInterval actionFade = new CCFadeOut  (2.0f);
            CCActionInterval actionFadeBack = (CCActionInterval)actionFade.Reverse();
            CCActionInterval seq2 = (CCActionInterval)CCSequence.FromActions(actionFade, actionFadeBack);
            layer2.RunAction(seq2);
        }
Beispiel #2
0
        public Atlas3()
        {
            m_time = 0;

            CCLayerColor col = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
            AddChild(col, -10);

            CCLabelBMFont label1 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");

            // testing anchors
            label1.AnchorPoint = new CCPoint(0, 0);
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            CCActionInterval fade = new CCFadeOut  (1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(fade, fade_in);
            CCAction repeat = new CCRepeatForever ((CCActionInterval)seq);
            label1.RunAction(repeat);


            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            CCLabelBMFont label2 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label2.AnchorPoint = new CCPoint(0.5f, 0.5f);
            label2.Color = ccRED;
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.RunAction((CCAction)(repeat.Copy()));

            CCLabelBMFont label3 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label3.AnchorPoint = new CCPoint(1, 1);
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);


            CCSize s = CCDirector.SharedDirector.WinSize;
            label1.Position = new CCPoint();
            label2.Position = new CCPoint(s.Width / 2, s.Height / 2);
            label3.Position = new CCPoint(s.Width, s.Height);

            base.Schedule(step);//:@selector(step:)];
        }
        public LabelAtlasColorTest()
        {
            CCLabelAtlas label1 = new CCLabelAtlas("123 Test", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');
            AddChild(label1, 0, (int)TagSprite.kTagSprite1);
            label1.Position = new CCPoint(10, 100);
            label1.Opacity = 200;

            CCLabelAtlas label2 = new CCLabelAtlas("0123456789", "fonts/tuffy_bold_italic-charmap", 48, 64, ' ');
            AddChild(label2, 0, (int)TagSprite.kTagSprite2);
            label2.Position = new CCPoint(10, 200);
            label2.Color = ccRED;

            CCActionInterval fade = new CCFadeOut  (1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(fade, fade_in);
            CCAction repeat = new CCRepeatForever ((CCActionInterval)seq);
            label2.RunAction(repeat);

            m_time = 0;

            Schedule(step); //:@selector(step:)];
        }
Beispiel #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            m_tamara.Opacity = 0;
            var action1 = new CCFadeIn  (1.0f);
            var action1Back = action1.Reverse();

            var action2 = new CCFadeOut  (1.0f);
            var action2Back = action2.Reverse();

            m_tamara.RunAction(new CCSequence(action1, action1Back));
            m_kathia.RunAction(new CCSequence(action2, action2Back));
        }