public StressTest2() { CCSize s = CCDirector.sharedDirector().getWinSize(); CCLayer sublayer = CCLayer.node(); CCSprite sp1 = CCSprite.spriteWithFile(TestResource.s_pPathSister1); sp1.position = (new CCPoint(80, s.height / 2)); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0)); CCActionInterval move_ease_inout3 = CCEaseInOut.actionWithAction((CCActionInterval)(move.copy()), 2.0f); CCActionInterval move_ease_inout_back3 = (CCActionInterval)move_ease_inout3.reverse(); CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_inout3, move_ease_inout_back3); sp1.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq3)); sublayer.addChild(sp1, 1); CCParticleFire fire = CCParticleFire.node(); fire.Texture = (CCTextureCache.sharedTextureCache().addImage("Images/fire")); fire.position = (new CCPoint(80, s.height / 2 - 50)); CCActionInterval copy_seq3 = (CCActionInterval)(seq3.copy()); fire.runAction(CCRepeatForever.actionWithAction(copy_seq3)); sublayer.addChild(fire, 2); schedule((shouldNotLeak), 6.0f); addChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1); }
public static CCScene Scene(this CCLayer layer) { var scene = new CCScene(); scene.Add(layer); return(scene); }
protected override void AddedToScene() { base.AddedToScene(); contentLayer = new CCLayer(); Window.IsUseDepthTesting = true; node = new CCNode(Layer.VisibleBoundsWorldspace.Size); node.AnchorPoint = CCPoint.AnchorMiddle; node.IgnoreAnchorPointForPosition = true; AddChild(contentLayer); contentLayer.AddChild(node); dir = 1; time = 0; sprites = new CCSprite[numOfSprites]; for (int i = 0; i < 5; i++) { CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121)); node.AddChild(sprite, 0); sprites[i] = sprite; } for (int i = 5; i < 11; i++) { CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 0, 85, 121)); node.AddChild(sprite, 0); sprites[i] = sprite; } }
public static CCScene ToScene(this CCLayer layer, CCWindow window) { var scene = new CCScene(window); scene.AddChild(layer); return(scene); }
public CardHistory(int xAnchorPt, int yAnchorPt, int height, int width, CCLayer targetLayer) : base(xAnchorPt, yAnchorPt, ScaleHeight(height), ScaleWidth(width), targetLayer) { this.yAnchor = yAnchorPt; this.xAnchor = xAnchorPt; this.cardIconsPlayed = new List <CCSprite>(); //this.drawBackground(); }
public TextLayer() : base() { contentLayer = new CCLayer(); CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace); contentLayer.Camera = contentCamera; var bg = new CCSprite(TestResource.s_back3); BaseNode = bg; contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground); var Kathia = new CCSprite(TestResource.s_pPathSister2); BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia); var sc = new CCScaleBy(2, 5); var sc_back = sc.Reverse(); Kathia.RunAction(new CCRepeatForever(sc, sc_back)); var Tamara = new CCSprite(TestResource.s_pPathSister1); BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara); var sc2 = new CCScaleBy(2, 5); var sc2_back = sc2.Reverse(); Tamara.RunAction(new CCRepeatForever(sc2, sc2_back)); var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255)); contentLayer.AddChild(colorBackground, -1); }
public GameScene(CCGameView gameView) : base(gameView) { layer = new GameLayer(); this.AddLayer(layer); fireworks = new CCParticleFireworks(CCPoint.Zero); explosion = new CCParticleExplosion(CCPoint.Zero); startLocation = CCPoint.Zero; fireworks.StartColor = new CCColor4F(CCColor3B.Yellow); fireworks.Position = new CCPoint(App.ScreenWidth / 1.5f, App.ScreenHeight / 1.5f); layer.AddChild(fireworks); explosion.StartColor = new CCColor4F(CCColor3B.Red); explosion.EndColor = new CCColor4F(CCColor3B.Black); explosion.Position = new CCPoint(App.ScreenWidth / 3f, App.ScreenHeight / 3f); layer.AddChild(explosion); //Device.StartTimer(TimeSpan.FromMilliseconds(2000), HandleFunc); var touchEvent = new CCEventListenerTouchOneByOne(); touchEvent.OnTouchBegan = (CCTouch arg1, CCEvent arg2) => { CCPoint newLocation = new CCPoint(arg1.LocationOnScreen.X * xRatio, App.ScreenHeight - arg1.LocationOnScreen.Y * yRatio); startLocation = newLocation; return(HandleFunc()); }; // AddEventListener(touchEvent); }
public GameLayer(World world, HexMexCamera camera, CCColor4B color) : base(color) { HexMexCamera = camera; TouchHandler = new GameTouchHandler(this, HexMexCamera); World = world; var hexagonLayer = new HexagonLayer(World, HexMexCamera); var edgeLayer = new EdgeLayer(World, HexMexCamera); var resourcePackageLayer = new ResourcePackageLayer(World, HexMexCamera); var structureLayer = new StructureLayer(World, HexMexCamera); var controlLayer = new ButtonLayer(World, HexMexCamera); var statisticLayer = new StatisticLayer(World); var researchButtonLayer = new ReseachLayer(World); var menuLayer = new MenuLayer(World, HexMexCamera); controlLayer.ConstructionRequested += (buttonLayer, buildButton) => ConstructionMenuRequested(buildButton, menuLayer); controlLayer.DisplayStructureRequested += (buttonLayer, structureButton) => DisplayStructureMenu(structureButton, menuLayer); researchButtonLayer.ResearchButtonTouched += rbl => DisplayResearchMenu(menuLayer); var layers = new CCLayer[] { hexagonLayer, edgeLayer, resourcePackageLayer, structureLayer, controlLayer, statisticLayer, researchButtonLayer, menuLayer }; foreach (var layer in layers) { AddChild(layer); } TouchLayers = new ReadOnlyCollection <TouchLayer>(layers.OfType <TouchLayer>().Reverse().ToList()); BuildMenu = new BuildMenu(World.UnlockManager, World.GameSettings.VisualSettings, World.GameSettings.LanguageSettings, world.GameSettings.BuildingDescriptionDatabase); BuildMenu.ConstructionRequested += ConstructBuilding; StructureMenu = new StructureMenu(World.GameSettings.VisualSettings, World); ResearchMenu = new ResearchMenu(World.GameSettings.BuildingDescriptionDatabase, World.UnlockManager, World.GameSettings.VisualSettings, World.GameSettings.LanguageSettings); Schedule(); }
void shouldNotLeak(float dt) { unschedule((shouldNotLeak)); CCLayer sublayer = (CCLayer)getChildByTag(CocosNodeTestStaticLibrary.kTagSprite1); sublayer.removeAllChildrenWithCleanup(true); }
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 = CCSequence.FromActions(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); }
public GameScene(CCWindow mainWindow) : base(mainWindow) { mainLayer = new CCLayer(); AddChild(mainLayer); paddleSprite = new CCSprite("paddle"); paddleSprite.PositionX = 100; paddleSprite.PositionY = 100; mainLayer.AddChild(paddleSprite); ballSprite = new CCSprite("ball"); ballSprite.PositionX = 320; ballSprite.PositionY = 600; mainLayer.AddChild(ballSprite); scoreLabel = new CCLabelTtf("Score: 0", "arial", 22); scoreLabel.PositionX = mainLayer.VisibleBoundsWorldspace.MinX + 20; scoreLabel.PositionY = mainLayer.VisibleBoundsWorldspace.MaxY - 20; scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft; mainLayer.AddChild(scoreLabel); Schedule(RunGameLogic); touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesMoved = HandleTouchesMoved; AddEventListener(touchListener, this); }
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); }
public override void runThisTest() { CCLayer pLayer = nextEffectAdvanceAction(); AddChild(pLayer); CCDirector.SharedDirector.ReplaceScene(this); }
public override void runThisTest() { CCLayer pLayer = nextTextureTest(); addChild(pLayer); CCDirector.sharedDirector().replaceScene(this); }
public override void runThisTest() { CCLayer pLayer = nextTextureTest(); AddChild(pLayer); Scene.Director.ReplaceScene(this); }
public ScrollView(CCSize size, CCNode container) { if (container == null) { container = new CCLayer { IgnoreAnchorPointForPosition = false, AnchorPoint = CCPoint.Zero }; } container.Position = new CCPoint(0.0f, 0.0f); _container = container; ViewSize = size; TouchEnabled = true; Delegate = null; Bounceable = false; ClippingToBounds = true; Direction = CcScrollViewDirection.Both; MinScale = MaxScale = 1.0f; _touches = new List <CCTouch>(); _touchLength = 0.0f; _minScale = 0.5f; _maxScale = 6.5f; AddChild(container); }
public override void runThisTest() { CCLayer pLayer = nextParallaxAction(); AddChild(pLayer); Scene.Director.ReplaceScene(this); }
public override void OnEnter() { base.OnEnter(); CCSize winSize = Layer.VisibleBoundsWorldspace.Size; float x = winSize.Width / 2; float y = 0 + (winSize.Height / 2); var rgba = new CCLayer(); rgba.IsColorCascaded = true; rgba.IsOpacityCascaded = true; AddChild(rgba); CCLog.Log("S9CascadeOpacityAndColor ..."); var blocks_scaled_with_insets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png"); CCLog.Log("... created"); blocks_scaled_with_insets.Position = new CCPoint(x, y); CCLog.Log("... setPosition"); rgba.AddChild(blocks_scaled_with_insets); var actions = new CCSequence(new CCFadeIn(1), new CCTintTo(1, 0, 255, 0), new CCTintTo(1, 255, 255, 255), new CCFadeOut(1)); var repeat = new CCRepeatForever(actions); rgba.RunAction(repeat); CCLog.Log("AddChild"); CCLog.Log("... S9CascadeOpacityAndColor done."); }
public override void runThisTest() { CCLayer pLayer = nextTestCase(); AddChild(pLayer); CCDirector.SharedDirector.ReplaceScene(this); }
public static CCLayer restartTestCase() { CCLayer pLayer = createTestCase(sceneIdx); //pLayer->autorelease(); return(pLayer); }
public static CCLayer restartAction() { CCLayer pLayer = createLayer(sceneIdx); //pLayer->autorelease(); return(pLayer); }
public static CCScene GameScene(CCWindow mainWindow) { var scene = new CCScene(mainWindow); var layer = new CCLayer(); scene.AddChild(layer); return(scene); }
private void CreateLayers() { gameplayLayer = new CCLayer(); this.AddChild(gameplayLayer); hudLayer = new CCLayer(); this.AddChild(hudLayer); }
public override void runThisTest() { CCLayer layer = nextTestCase(); AddChild(layer); Director.ReplaceScene(this); }
public static CCLayer nextTestAction() { sceneIdx++; sceneIdx = sceneIdx % MAX_LAYER; CCLayer pLayer = createTestLayer(sceneIdx); return(pLayer); }
public override void runThisTest() { CCLayer layer = NextSpriteTestAction(); AddChild(layer); Director.ReplaceScene(this); }
private void CreateLayers() { backgroundLayer = new CCLayer(); this.AddLayer(backgroundLayer); gameplayLayer = new CCLayer(); this.AddLayer(gameplayLayer); }
public override void runThisTest() { CCLayer pLayer = RotateWorldMainLayer.node(); AddChild(pLayer); RunAction(new CCRotateBy(4, -360)); CCDirector.SharedDirector.ReplaceScene(this); }
public void restartCallback(object pSender) { CCScene pScene = new SchedulerTestScene(); CCLayer pLayer = SchedulerTestScene.restartSchedulerTest(); pScene.AddChild(pLayer); Scene.Director.ReplaceScene(pScene); }
public override void runThisTest() { CCLayer pLayer = ActionManagerTest.nextActionManagerAction(); AddChild(pLayer); CCDirector.SharedDirector.ReplaceScene(this); }