Esempio n. 1
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80));
            layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2));
            layer1.IgnoreAnchorPointForPosition = false;
            AddChild(layer1, 1);

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

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

            var actionFade = new CCFadeOut(2.0f);
            var actionFadeBack = actionFade.Reverse();
            var seq2 = new CCSequence(actionFade, actionFadeBack);
            layer2.RunAction(seq2);
        }
        public LabelSystemFontColorAndOpacity()
        {
            m_time = 0;

            Color = new CCColor3B(128, 128, 128);
            Opacity = 255;

            label1 = new CCLabel("Label FadeOut/FadeIn", "fonts/Marker Felt.ttf", 40, CCLabelFormat.SystemFont)
                { 
                    Color = CCColor3B.Orange,
                    // testing anchors
                    AnchorPoint = CCPoint.AnchorLowerLeft
                };

            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);

			var fade = new CCFadeOut  (1.0f);
			var fade_in = fade.Reverse();
			label1.RepeatForever ( fade, fade_in);

            label2 = new CCLabel("Label TintTo", "fonts/MorrisRoman-Black.ttf", 40, CCLabelFormat.SystemFont)                
                { 
                    Color = CCColor3B.Red,
                    // testing anchors
                    AnchorPoint = CCPoint.AnchorMiddle
                };

            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

			label2.RepeatForever( new CCTintTo (1, 255, 0, 0), new CCTintTo (1, 0, 255, 0), new CCTintTo (1, 0, 0, 255));

            label3 = new CCLabel("Label\nPlain\nBlue", "Helvetica", 40, CCLabelFormat.SystemFont)
                { 
                    Color = CCColor3B.Blue,
                    Opacity = 128,
                    // testing anchors
                    AnchorPoint = CCPoint.AnchorUpperRight
                };
            
             AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            //base.Schedule(step);
        }
Esempio n. 3
0
        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;

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

            m_time = 0;

            Schedule(step); //:@selector(step:)];
        }
        public LabelFNTColorAndOpacity()
        {
            m_time = 0;

            Color = new CCColor3B(128, 128, 128);
            Opacity = 255;

			label1 = new CCLabel("Label1", "fonts/bitmapFontTest2.fnt");

            // testing anchors
			label1.AnchorPoint = CCPoint.AnchorLowerLeft;
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);

			var fade = new CCFadeOut  (1.0f);
			var fade_in = fade.Reverse();
			label1.RepeatForever ( fade, fade_in);


            // 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
			label2 = new CCLabel("Label2", "fonts/bitmapFontTest2.fnt");
            // testing anchors
			label2.AnchorPoint = CCPoint.AnchorMiddle;
            label2.Color = CCColor3B.Red;
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

			label2.RepeatForever( new CCTintTo (1, 255, 0, 0), new CCTintTo (1, 0, 255, 0), new CCTintTo (1, 0, 0, 255));

			label3 = new CCLabel("Label3", "fonts/bitmapFontTest2.fnt");
            // testing anchors
			label3.AnchorPoint = CCPoint.AnchorUpperRight;
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            base.Schedule(step);
        }
Esempio n. 5
0
        public ActionFade()
        {
            action1 = new CCFadeIn(1.0f);
            action1Back = action1.Reverse();

            action2 = new CCFadeOut(1.0f);
            action2Back = action2.Reverse();
        }
        protected override void AddedToScene()
        {
            base.AddedToScene();

            var visibleRect = VisibleBoundsWorldspace;

            loading.Position = visibleRect.Center;

            LoadLabel((fntFNT) =>
                {
                    
                    label1 = new CCLabel(fntFNT, "Label1", CCSize.Zero, CCLabelFormat.BitMapFont);
                    AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
                    //// testing anchors
                    label1.AnchorPoint = CCPoint.AnchorLowerLeft;
                    label1.Position = visibleRect.LeftBottom();

                    var fade = new CCFadeOut(1.0f);
                    var fade_in = fade.Reverse();
                    label1.RepeatForever(fade, fade_in);

                    // 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
                    label2 = new CCLabel(fntFNT, "Label2", CCSize.Zero, CCLabelFormat.BitMapFont);
                    // testing anchors
                    label2.AnchorPoint = CCPoint.AnchorMiddle;
                    label2.Color = CCColor3B.Red;
                    label2.Position = visibleRect.Center();
                    AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);

                    label2.RepeatForever(new CCTintTo(1, 255, 0, 0), new CCTintTo(1, 0, 255, 0), new CCTintTo(1, 0, 0, 255));

                    label3 = new CCLabel(fntFNT, "Label3", CCSize.Zero, CCLabelFormat.BitMapFont);
                    // testing anchors
                    label3.AnchorPoint = CCPoint.AnchorUpperRight;
                    label3.Position = visibleRect.RightTop();
                    AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

                    loading.Visible = false;
                }
            );

        }