当前位置: 首页>>代码示例>>C#>>正文


C# CCSprite.RepeatForever方法代码示例

本文整理汇总了C#中CocosSharp.CCSprite.RepeatForever方法的典型用法代码示例。如果您正苦于以下问题:C# CCSprite.RepeatForever方法的具体用法?C# CCSprite.RepeatForever怎么用?C# CCSprite.RepeatForever使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CocosSharp.CCSprite的用法示例。


在下文中一共展示了CCSprite.RepeatForever方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NodeToWorld3D

		public NodeToWorld3D()
		{
			//
			// This code tests that nodeToParent works OK:
			//  - It tests different anchor Points
			//  - It tests different children anchor points

			parent = new CCNode();
			parent.AnchorPoint = new CCPoint(0.5f, 0.5f);
			AddChild(parent);

			back = new CCSprite(TestResource.s_back3);
			parent.AddChild(back, -10);
			back.AnchorPoint = CCPoint.Zero;


			var item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
			menu = new CCMenu(item);
			menu.AlignItemsVertically();

			back.AddChild(menu);

			item.RepeatForever(CocosNodeTestStaticLibrary.nodeRotate);

			back.RepeatForever(CocosNodeTestStaticLibrary.nodeMove, CocosNodeTestStaticLibrary.nodeMove.Reverse());

			parent.RunAction (CocosNodeTestStaticLibrary.nodeOrbit);
		}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:28,代码来源:NodeToWorld.cs

示例2: OnEnter

		public override void OnEnter()
		{
			base.OnEnter();

			var s = Layer.VisibleBoundsWorldspace.Size;

			var sprite = new CCSprite("Images/grossinis_sister1.png");
			sprite.Position = VisibleBoundsWorldspace.Center;
			AddChild(sprite);
			sprite.RepeatForever(rotateBy);

			// Add a menu item to resume the Scheduled actions.

			CCMenuItemFont.FontSize = 32;
			CCMenuItemFont.FontName = "MarkerFelt";
			var menu = new CCMenu(
				new CCMenuItemFont("Resume", resume)
			);

			menu.AlignItemsVertically(4);
			menu.Position = new CCPoint(s.Width / 2, s.Height / 4);
			AddChild(menu);


			Schedule ();
			Schedule (tick1, 0.5f);
			Schedule (tick2, 1.0f);
			Schedule (pause, 3.0f, 0, 0);
		}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:29,代码来源:SchedulerPauseResume.cs

示例3: StressTest2

        public StressTest2()
        {
			var sublayer = new CCLayer();

			var sp1 = new CCSprite(TestResource.s_pPathSister1);
            

			var move = new CCMoveBy (3, new CCPoint(350, 0));
			var move_ease_inout3 = new CCEaseInOut(move, 2.0f);
			var move_ease_inout_back3 = move_ease_inout3.Reverse();
			var seq3 = new CCSequence(move_ease_inout3, move_ease_inout_back3);
			sp1.RepeatForever(seq3);

            sublayer.AddChild(sp1, 1, CocosNodeTestStaticLibrary.kTagSprite2);

			var fire = new CCParticleFire(CCPoint.Zero) { Tag = CocosNodeTestStaticLibrary.kTagSprite3 };
            fire.Texture = (CCTextureCache.SharedTextureCache.AddImage("Images/fire"));

			fire.RepeatForever(seq3);
            sublayer.AddChild(fire, 2);

            Schedule(shouldNotLeak, 6.0f);

            AddChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:25,代码来源:StressTest2.cs

示例4: OnEnter

		public override void OnEnter()
		{
            CCRect visibleBounds = Layer.VisibleBoundsWorldspace;

            base.OnEnter();

			bgNode = new CCNodeGrid ();
			bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            contentLayer.AddChild (bgNode);
            //bgNode.Position = visibleBounds.Center;

			var bg = new CCSprite("Images/background3");
            //bg.AnchorPoint = CCPoint.AnchorMiddle;
            bg.Position = visibleBounds.Center;

            //bgNode.ContentSize = bg.ContentSize;

			bgNode.AddChild (bg);


            Target1 = new CCNodeGrid();
            Target1.AnchorPoint = CCPoint.AnchorMiddle;

			grossini = new CCSprite("Images/grossinis_sister2");
            Target1.AddChild(grossini);
            bgNode.AddChild (Target1);

            Target1.Position = bg.BoundingBox.Center + new CCPoint(-100.0f, 0.0f);
            //grossini.Position = 

			var sc = new CCScaleBy(2, 5);
			var sc_back = sc.Reverse();
            Target1.RepeatForever(sc, sc_back);

            Target2 = new CCNodeGrid();
            Target2.AnchorPoint = CCPoint.AnchorMiddle;

            tamara = new CCSprite("Images/grossinis_sister1");

            Target2.AddChild(tamara);
            bgNode.AddChild(Target2);

            Target2.Position = bg.BoundingBox.Center + new CCPoint(100.0f, 0.0f);

			var sc2 = new CCScaleBy(2, 5);
			var sc2_back = sc2.Reverse();

			tamara.RepeatForever(sc2, sc2_back);

		}
开发者ID:AnimaRobotics,项目名称:CocosSharp,代码行数:50,代码来源:EffectAdvanceTextLayer.cs

示例5: OnEnter

		public override void OnEnter()
		{
			base.OnEnter();

			var s = Layer.VisibleBoundsWorldspace.Size;

			var sprite = new CCSprite("Images/grossinis_sister1.png");
			sprite.Position = CCVisibleRect.Center;
			AddChild(sprite);
			sprite.RepeatForever(rotateBy);

			Schedule(tick1, 0.5f);
			Schedule(tick2, 1.0f);
			Schedule(tick3, 1.5f);
			Schedule(tick4, 1.5f);
			Schedule(unscheduleAll, 4);
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:17,代码来源:SchedulerUnscheduleAll.cs

示例6: CameraCenterTest

		//CCWindowProjection preProjection;

        public CameraCenterTest()
        {
            CCSprite sprite;
			CCOrbitCamera orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);;

            // LEFT-TOP
			sprite = new CCSprite("Images/white-512x512") { Tag = 100 };
			AddChild(sprite, 0);
            sprite.Color = CCColor3B.Red;

            sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50);
            sprite.RepeatForever(orbit);

            // LEFT-BOTTOM
			sprite = new CCSprite("Images/white-512x512") { Tag = 101 };
			AddChild(sprite, 0);
            sprite.Color = CCColor3B.Blue;

            sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50);
			sprite.RepeatForever(orbit);


            // RIGHT-TOP
			sprite = new CCSprite("Images/white-512x512") { Tag = 102 };
			AddChild(sprite, 0);
            sprite.Color = CCColor3B.Yellow;

            sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50);
			sprite.RepeatForever(orbit);

            // RIGHT-BOTTOM
			sprite = new CCSprite("Images/white-512x512") { Tag = 103 };
			AddChild(sprite, 0);
            sprite.Color = CCColor3B.Green;

            sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50);
			sprite.RepeatForever(orbit);

            // CENTER
			sprite = new CCSprite("Images/white-512x512") { Tag = 104 };
			AddChild(sprite, 0);
            sprite.Color = CCColor3B.White;

            sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50);
			sprite.RepeatForever(orbit);
        }
开发者ID:kkarol93,项目名称:CocosSharp,代码行数:48,代码来源:CameraCenterTest.cs

示例7: AddedToScene

        protected override void AddedToScene()
        {
            base.AddedToScene();

			var listener = new CCEventListenerTouchAllAtOnce();
			listener.OnTouchesEnded = onTouchesEnded;

			AddEventListener(listener);    

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

			var rotate = new CCRotateBy (10, 360);

			for (int i = 0; i < 3; i++)
			{
				CCSprite sprite = new CCSprite("Images/grossini");
				sprite.Position = (new CCPoint(s.Width / 4 * (i + 1), s.Height / 2));

				CCSprite point = new CCSprite("Images/r1");
				point.Scale = 0.25f;
				point.Position = sprite.Position;
				AddChild(point, 10, 100 + i);

				switch (i)
				{
					case 0:
						sprite.AnchorPoint = CCPoint.AnchorLowerLeft;
						break;
					case 1:
						sprite.AnchorPoint = CCPoint.AnchorMiddle;
						break;
					case 2:
						sprite.AnchorPoint = CCPoint.AnchorUpperRight;
						break;
				}

				point.Position = sprite.Position;

				sprite.RepeatForever(rotate);

				AddChild(sprite, i);
			}
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:43,代码来源:ConvertToNode.cs

示例8: AddBanana

		CCSprite AddBanana ()
		{
			var banana = new CCSprite ("Banana");

			double rnd = new Random ().NextDouble ();
			double randomX = (rnd > 0) 
				? rnd * CCDirector.SharedDirector.WinSize.Width - banana.ContentSize.Width / 2 
				: banana.ContentSize.Width / 2;
	
			banana.Position = new CCPoint ((float)randomX, CCDirector.SharedDirector.WinSize.Height - banana.ContentSize.Height / 2);

			AddChild (banana);

			var moveBanana = new CCMoveTo (5.0f, new CCPoint (banana.Position.X, 0));

			banana.RunActions (moveBanana, moveBananaComplete);

			banana.RepeatForever (rotateBanana);

			return banana;
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:21,代码来源:GameLayer.cs

示例9: TMXIsoZorder

        public TMXIsoZorder() : base("TileMaps/iso-test-zorder")
        {
            m_tamara = new CCSprite(pathSister1);
            tileLayersContainer.AddChild(m_tamara, tileMap.Children.Count);
            tileLayersContainer.Position = new CCPoint(-50.0f, -50.0f);

            m_tamara.AnchorPoint = CCPoint.Zero;

			m_tamara.RepeatForever(move, back);

            Schedule(repositionSprite);
        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:12,代码来源:TileMapTest.cs

示例10: AddBanana

        CCSprite AddBanana()
        {
            var spriteSheet = new CCSpriteSheet ("animations/monkey.plist");
            var banana = new CCSprite (spriteSheet.Frames.Find ((x) => x.TextureFilename.StartsWith ("Banana")));

            var p = GetRandomPosition (banana.ContentSize);
            banana.Position = p;
            banana.Scale = 0.5f;

            AddChild (banana);

            var moveBanana = new CCMoveTo (5.0f, new CCPoint (banana.Position.X, 0));
            banana.RunActions (moveBanana, moveBananaComplete);
            banana.RepeatForever (rotateBanana);

            return banana;
        }
开发者ID:jonathanzuniga,项目名称:GoneBananas,代码行数:17,代码来源:GameLayer.cs

示例11: OnEnter

        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();


			var sister1 = new CCSprite("Images/grossinis_sister1.png");
			var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabelBMFont("Test", "fonts/bitmapFontTest.fnt");
			// by default a CCLabelBMFont has IsColorModifiedByOpacity on by default if the 
			// texture atlas is PreMultipliedAlpha.  Label as used by Cocos2d-x by default has
			// this set to false.  Maybe this is a bug in Cocos2d-x?
			label.IsColorModifiedByOpacity = false;
    
            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild( layer1, 0, kTagLayer);
    
            sister1.Position= new CCPoint( s.Width*1/3, s.Height/2);
            sister2.Position = new CCPoint( s.Width*2/3, s.Height/2);
            label.Position = new CCPoint(s.Width / 2, s.Height / 2);

			// Define our delay time
			var delay = new CCDelayTime (1);

			layer1.RepeatForever(
                        new CCFadeTo(4, 0),
                        new CCFadeTo(4, 255),
						delay
                );

			// We only have to define them once.
			var fadeTo11 = new CCFadeTo (2, 0);
			var fadeTo12 = new CCFadeTo (2, 255);

			sister1.RepeatForever(
						fadeTo11,
						fadeTo12,
						fadeTo11,
						fadeTo12,
						delay
                );
    
    
            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:50,代码来源:LayerTest1.cs

示例12: OnEnter

        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();

            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabel("Test", "fonts/bitmapFontTest.fnt");

            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild(layer1, 0, kTagLayer);

            sister1.Position = new CCPoint(s.Width * 1 / 3, s.Height / 2);
            sister2.Position = new CCPoint(s.Width * 2 / 3, s.Height / 2);
            label.Position = new CCPoint(s.Width / 2, s.Height / 2);

			// Define our delay time
			var delay = new CCDelayTime (1);

			layer1.RepeatForever (
                new CCTintTo(6, 255, 0, 255),
                new CCTintTo(6, 255, 255, 255),
				delay
                );

			sister1.RepeatForever (
                new CCTintTo(2, 255, 255, 0),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 0, 255, 255),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 255, 0, 255),
                new CCTintTo(2, 255, 255, 255),
				delay
                );

            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:42,代码来源:LayerTest1.cs

示例13: TMXOrthoZorder

		public TMXOrthoZorder()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-zorder");
            AddChild(map, 0, kTagTileMap);

            m_tamara = new CCSprite(pathSister1);
            map.AddChild(m_tamara, map.Children.Count);
			m_tamara.AnchorPoint = CCPoint.AnchorMiddleBottom;

			m_tamara.RepeatForever(move, back);

            Schedule(repositionSprite);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:13,代码来源:TileMapTest.cs

示例14: TMXIsoZorder

        public TMXIsoZorder()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-zorder");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height);

            m_tamara = new CCSprite(pathSister1);
            map.AddChild(m_tamara, map.Children.Count);

            m_tamara.AnchorPoint = (new CCPoint(0.5f, 0));

			m_tamara.RepeatForever(move, back);

            Schedule(repositionSprite);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:17,代码来源:TileMapTest.cs

示例15: TMXIsoZorderFromStream

        public TMXIsoZorderFromStream() : base(new System.IO.StreamReader(CCFileUtils.GetFileStream("TileMaps/iso-test-zorder1.tmx")))
        {
            m_tamara = new CCSprite(pathSister1);
            tileLayersContainer.AddChild(m_tamara, tileMap.Children.Count);
            tileLayersContainer.Position = new CCPoint(-50.0f, -50.0f);

            m_tamara.AnchorPoint = CCPoint.Zero;

            m_tamara.RepeatForever(move, back);

            Schedule(repositionSprite);
        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:12,代码来源:TileMapTest.cs


注:本文中的CocosSharp.CCSprite.RepeatForever方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。