Ejemplo n.º 1
0
        public StressTest2()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayer sublayer = new CCLayer();

            CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
            sp1.Position = (new CCPoint(80, s.Height / 2));

            CCActionInterval move = new CCMoveBy (3, new CCPoint(350, 0));
            CCActionInterval move_ease_inout3 = new CCEaseInOut((CCActionInterval) (move.Copy()), 2.0f);
            var move_ease_inout_back3 = (CCActionInterval) move_ease_inout3.Reverse();
            CCFiniteTimeAction seq3 = new CCSequence(move_ease_inout3, move_ease_inout_back3);
            sp1.RunAction(new CCRepeatForever ((CCActionInterval) seq3));
            sublayer.AddChild(sp1, 1);

            CCParticleFire fire = new CCParticleFire();
            fire.Texture = (CCTextureCache.SharedTextureCache.AddImage("Images/fire"));
            fire.Position = (new CCPoint(80, s.Height / 2 - 50));

            var copy_seq3 = (CCActionInterval) (seq3.Copy());

            fire.RunAction(new CCRepeatForever (copy_seq3));
            sublayer.AddChild(fire, 2);

            Schedule((shouldNotLeak), 6.0f);

            AddChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1);
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer1 = new CCLayerColor(new CCColor4B(0xFF, 0xFF, 0x00, 0x80), s.Width * 0.75f, s.Height * 0.75f);
            layer1.IgnoreAnchorPointForPosition = false;
            layer1.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            layer1.ChildClippingMode = CCClipMode.Bounds;
            AddChild(layer1, 1);

            s = layer1.ContentSize;

            m_pInnerLayer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80), s.Width * 0.5f, s.Height * 0.5f);
            m_pInnerLayer.IgnoreAnchorPointForPosition = false;
            m_pInnerLayer.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            m_pInnerLayer.ChildClippingMode = CCClipMode.Bounds;
            
            layer1.AddChild(m_pInnerLayer, 1);
            
            //
            // Add two labels using BM label class
            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("LABEL1", "fonts/konqa32.fnt");
            label1.Position = new CCPoint(m_pInnerLayer.ContentSize.Width, m_pInnerLayer.ContentSize.Height * 0.75f);
            m_pInnerLayer.AddChild(label1);
            
            CCLabelBMFont label2 = new CCLabelBMFont("LABEL2", "fonts/konqa32.fnt");
            label2.Position = new CCPoint(0, m_pInnerLayer.ContentSize.Height * 0.25f);
            m_pInnerLayer.AddChild(label2);

            float runTime = 12f;

            CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 3.0f);
            CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 1.0f);

            CCFiniteTimeAction seq = new CCRepeatForever(
                new CCSequence(scaleTo2, scaleTo3)
                );

            m_pInnerLayer.RunAction(seq);

            CCSize size = CCDirector.SharedDirector.WinSize;

            var move1 = new CCMoveTo(2, new CCPoint(size.Width / 2, size.Height));
            var move2 = new CCMoveTo(2, new CCPoint(size.Width, size.Height / 2));
            var move3 = new CCMoveTo(2, new CCPoint(size.Width / 2, 0));
            var move4 = new CCMoveTo(2, new CCPoint(0, size.Height / 2));

            layer1.RunAction(new CCRepeatForever(new CCSequence(move1, move2, move3, move4)));

        }
Ejemplo n.º 3
0
 public LayerMultiplexTest()
 {
     for (int i = 0; i < 3; i++)
     {
         CCLayer l = new CCLayer();
         CCSprite img = null;
         switch (i)
         {
             case 0:
                 img = new CCSprite("Images/grossini");
                 break;
             case 1:
                 img = new CCSprite("Images/grossinis_sister1");
                 break;
             case 2:
                 img = new CCSprite("Images/grossinis_sister2");
                 break;
         }
         img.AnchorPoint = CCPoint.Zero;
         img.Position = CCPoint.Zero;
         l.AddChild(img);
         l.AnchorPoint = new CCPoint(0.5f, 0.5f);
         l.Position = new CCPoint(1024/2f, 768/2f);
         child.AddLayer(l);
     }
     child.InAction = new CCFadeIn(1);
     AddChild(child);
     Schedule(new Action<float>(AutoMultiplex), 3f);
 }