public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo action = new CCProgressTo(2, 100); /** * Our image on the left should be a radial progress indicator, clockwise */ CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathBlock)); left.Type = CCProgressTimerType.Radial; AddChild(left); left.Midpoint = new CCPoint(0.25f, 0.75f); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever ((CCActionInterval) action.Copy())); /** * Our image on the left should be a radial progress indicator, counter clockwise */ CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathBlock)); right.Type = CCProgressTimerType.Radial; right.Midpoint = new CCPoint(0.75f, 0.25f); /** * Note the reverse property (default=NO) is only added to the right image. That's how * we get a counter clockwise progress. */ AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever ((CCActionInterval) action.Copy())); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo to1 = new CCProgressTo(2, 100); CCProgressTo to2 = new CCProgressTo(2, 100); CCProgressTimer left = new CCProgressTimer(s_pPathSister1); left.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the left since the midpoint is 0 for the x left.Midpoint = new CCPoint(0, 0); // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change left.BarChangeRate = new CCPoint(1, 0); AddChild(left); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever (to1)); CCProgressTimer right = new CCProgressTimer(s_pPathSister2); right.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the left since the midpoint is 1 for the x right.Midpoint = new CCPoint(1, 0); // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change right.BarChangeRate = new CCPoint(1, 0); AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever (to2)); }
public override void onEnter() { base.onEnter(); CCSize winSize = CCDirector.sharedDirector().getWinSize(); CCRenderTexture cCPoint = CCRenderTexture.renderTextureWithWidthAndHeight((int)winSize.width, (int)winSize.height); if (cCPoint == null) { return; } cCPoint.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCPoint.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.clear(0f, 0f, 0f, 1f); cCPoint.begin(); this.m_pOutScene.visit(); cCPoint.end(); base.hideOutShowIn(); CCProgressTimer cCProgressTimer = CCProgressTimer.progressWithTexture(cCPoint.Sprite.Texture); cCProgressTimer.Type = this.radialType(); cCProgressTimer.Percentage = 100f; cCProgressTimer.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCProgressTimer.anchorPoint = new CCPoint(0.5f, 0.5f); CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCProgressFromTo.actionWithDuration(this.m_fDuration, 100f, 0f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) }; cCProgressTimer.runAction(CCSequence.actions(cCFiniteTimeActionArray)); this.addChild(cCProgressTimer, 2, 2147483647); }
public static CCProgressTimer progressWithTexture(CCTexture2D pTexture) { CCProgressTimer cCProgressTimer = new CCProgressTimer(); if (cCProgressTimer.initWithTexture(pTexture)) { return(cCProgressTimer); } return(null); }
public static CCProgressTimer progressWithFile(string pszFileName) { CCProgressTimer cCProgressTimer = new CCProgressTimer(); if (cCProgressTimer.initWithFile(pszFileName)) { return(cCProgressTimer); } return(null); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo to = new CCProgressTo(6, 100); CCAction tint = CCSequence.FromActions(new CCTintTo (1, 255, 0, 0), new CCTintTo (1, 0, 255, 0), new CCTintTo (1, 0, 0, 255)); CCAction fade = CCSequence.FromActions(new CCFadeTo (1.0f, 0), new CCFadeTo (1.0f, 255)); CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathSister1)); left.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y left.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change left.BarChangeRate = new CCPoint(1, 0); AddChild(left); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); left.RunAction(new CCRepeatForever ((CCActionInterval) tint.Copy())); left.AddChild(new CCLabelTTF("Tint", "arial", 20.0f)); CCProgressTimer middle = new CCProgressTimer(new CCSprite(s_pPathSister2)); middle.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change middle.BarChangeRate = new CCPoint(1, 1); AddChild(middle); middle.Position = new CCPoint(s.Width / 2, s.Height / 2); middle.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); middle.RunAction(new CCRepeatForever ((CCActionInterval) fade.Copy())); middle.AddChild(new CCLabelTTF("Fade", "arial", 20.0f)); CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathSister2)); right.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y right.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change right.BarChangeRate = new CCPoint(0, 1); AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); right.RunAction(new CCRepeatForever ((CCActionInterval) tint.Copy())); right.RunAction(new CCRepeatForever ((CCActionInterval) fade.Copy())); right.AddChild(new CCLabelTTF("Tint and Fade", "arial", 20.0f)); }
public override void onEnter() { base.onEnter(); // create a transparent color layer // in which we are going to add our rendertextures CCSize size = CCDirector.sharedDirector().getWinSize(); // create the second render texture for outScene CCRenderTexture outTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)size.width, (int)size.height); if (outTexture == null) { return; } outTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); outTexture.position = new CCPoint(size.width / 2, size.height / 2); outTexture.anchorPoint = new CCPoint(0.5f, 0.5f); // render outScene to its texturebuffer outTexture.clear(0, 0, 0, 1); outTexture.begin(); m_pOutScene.visit(); outTexture.end(); // Since we've passed the outScene to the texture we don't need it. this.hideOutShowIn(); // We need the texture in RenderTexture. CCProgressTimer outNode = CCProgressTimer.progressWithTexture(outTexture.Sprite.Texture); // but it's flipped upside down so we flip the sprite //outNode.Sprite.->setFlipY(true); // Return the radial type that we want to use outNode.Type = radialType(); outNode.Percentage = 100.0f; outNode.position = new CCPoint(size.width / 2, size.height / 2); outNode.anchorPoint = new CCPoint(0.5f, 0.5f); // create the blend action CCAction layerAction = CCSequence.actions ( CCProgressFromTo.actionWithDuration(m_fDuration, 100.0f, 0.0f), CCCallFunc.actionWithTarget(this, base.finish) ); // run the blend action outNode.runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene this.addChild(outNode, 2, kSceneRadial); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo to = new CCProgressTo(6, 100); CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini.plist"); CCProgressTimer left = new CCProgressTimer(new CCSprite("grossini_dance_01.png")); left.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y left.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change left.BarChangeRate = new CCPoint(1, 0); AddChild(left); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); CCProgressTimer middle = new CCProgressTimer(new CCSprite("grossini_dance_02.png")); middle.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change middle.BarChangeRate = new CCPoint(1, 1); AddChild(middle); middle.Position = new CCPoint(s.Width / 2, s.Height / 2); middle.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); CCProgressTimer right = new CCProgressTimer(new CCSprite("grossini_dance_03.png")); right.Type = CCProgressTimerType.Radial; // Setup for a bar starting from the bottom since the midpoint is 0 for the y right.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change right.BarChangeRate = new CCPoint(0, 1); AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo to = new CCProgressTo(2, 100); CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathSister1)); left.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y left.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change left.BarChangeRate = new CCPoint(1, 0); AddChild(left); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); CCProgressTimer middle = new CCProgressTimer(new CCSprite(s_pPathSister2)); middle.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change middle.BarChangeRate = new CCPoint(1, 1); AddChild(middle); middle.Position = new CCPoint(s.Width / 2, s.Height / 2); middle.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathSister2)); right.Type = CCProgressTimerType.Bar; // Setup for a bar starting from the bottom since the midpoint is 0 for the y right.Midpoint = new CCPoint(0.5f, 0.5f); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change right.BarChangeRate = new CCPoint(0, 1); AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever ((CCActionInterval) to.Copy())); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; CCProgressTo to1 = new CCProgressTo(2, 100); CCProgressTo to2 = new CCProgressTo(2, 100); CCProgressTimer left = new CCProgressTimer(s_pPathSister1); left.Type = CCProgressTimerType.Radial; AddChild(left); left.Position = new CCPoint(100, s.Height / 2); left.RunAction(new CCRepeatForever (to1)); CCProgressTimer right = new CCProgressTimer(s_pPathBlock); right.Type = CCProgressTimerType.Radial; right.ReverseProgress = true; AddChild(right); right.Position = new CCPoint(s.Width - 100, s.Height / 2); right.RunAction(new CCRepeatForever (to2)); }
public static CCProgressTimer progressWithTexture(CCTexture2D pTexture) { CCProgressTimer pProgressTimer = new CCProgressTimer(); if (pProgressTimer.initWithTexture(pTexture)) { return pProgressTimer; } return null; }
public static CCProgressTimer progressWithFile(string pszFileName) { CCProgressTimer pProgressTimer = new CCProgressTimer(); if (pProgressTimer.initWithFile(pszFileName)) { return pProgressTimer; } return null; }
/** Creates a progress timer with the sprite as the shape the timer goes through */ public static CCProgressTimer Create(CCSprite sp) { var pProgressTimer = new CCProgressTimer(); pProgressTimer.InitWithSprite(sp); return pProgressTimer; }