本文整理汇总了C#中CocosSharp.CCSequence类的典型用法代码示例。如果您正苦于以下问题:C# CCSequence类的具体用法?C# CCSequence怎么用?C# CCSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCSequence类属于CocosSharp命名空间,在下文中一共展示了CCSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameLayer
public GameLayer()
: base(CCColor4B.Blue, CCColor4B.AliceBlue)
{
// Set the layer gradient direction
this.Vector = new CCPoint (0.5f, 0.5f);
// Create and add sprites
// We will later be applying a wave action to these sprites
// These type of actions can only be applied to CCNodeGrid instances
// Therefore, wrap our sprites in a CCNodeGrid parent
monkeySprite1 = new CCNodeGrid ();
monkeySprite1.AddChild (new CCSprite ("monkey"));
AddChild (monkeySprite1);
monkeySprite2 = new CCNodeGrid ();
monkeySprite2.AddChild (new CCSprite ("monkey"));
AddChild (monkeySprite2);
// Define actions
var moveUp = new CCMoveBy (1.0f, new CCPoint (0.0f, 50.0f));
var moveDown = moveUp.Reverse ();
// A CCSequence action runs the list of actions in ... sequence!
CCSequence moveSeq = new CCSequence (new CCEaseBackInOut (moveUp), new CCEaseBackInOut (moveDown));
repeatedAction = new CCRepeatForever (moveSeq);
// A CCSpawn action runs the list of actions concurrently
dreamAction = new CCSpawn (new CCFadeIn (5.0f), new CCWaves (5.0f, new CCGridSize (10, 20), 4, 4));
// Schedule for method to be called every 0.1s
Schedule (UpdateLayerGradient, 0.1f);
}
示例2: OnEnter
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);
}
示例3: OnEnter
public override void OnEnter()
{
base.OnEnter();
var effect = new CCSequence(new CCDelayTime (2.0f), new CCShaky3D(5.0f, new CCGridSize(5, 5), 16, false));
// cleanup
RemoveChild(bgNode, true);
// background
var layer = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
AddChild(layer, -10);
var sprite = new CCSprite("Images/grossini");
sprite.Position = new CCPoint(50, 80);
layer.AddChild(sprite, 10);
// foreground
var layer2Node = new CCNode ();
var layer2 = new CCLayerColor(new CCColor4B(0, 255, 0, 255));
var fog = new CCSprite("Images/Fog");
var bf = new CCBlendFunc {Source = CCOGLES.GL_SRC_ALPHA, Destination = CCOGLES.GL_ONE_MINUS_SRC_ALPHA};
fog.BlendFunc = bf;
layer2.AddChild(fog, 1);
AddChild(layer2Node, 1);
layer2Node.AddChild (layer2);
layer2Node.RepeatForever(effect);
}
示例4: FadeThenRemove
public void FadeThenRemove(float delta)
{
var seq = new CCSequence(
new CCFadeTo(1.0f, 0),
new CCCallFunc(RemoveSpriteAndBody));
sprite.RunAction(seq);
}
示例5: CCSequence
public CCSequence (params CCFiniteTimeAction[] actions) : base ()
{
Actions = new CCFiniteTimeAction[2];
var prev = actions [0];
// Can't call base(duration) because we need to calculate duration here
float combinedDuration = 0.0f;
foreach (CCFiniteTimeAction action in actions)
{
combinedDuration += action.Duration;
}
Duration = combinedDuration;
if (actions.Length == 1)
{
InitCCSequence (prev, new CCExtraAction ());
}
else
{
// Basically what we are doing here is creating a whole bunch of
// nested CCSequences from the actions.
for (int i = 1; i < actions.Length - 1; i++)
{
prev = new CCSequence (prev, actions [i]);
}
InitCCSequence (prev, actions [actions.Length - 1]);
}
}
示例6: OnEnter
public override void OnEnter()
{
base.OnEnter();
Color = CCColor3B.Blue;
Opacity = 255;
// Make sure we set the Opacity to cascade or fadein action will not work correctly.
Target1.IsOpacityCascaded = true;
Target2.IsOpacityCascaded = true;
// Define actions
var moveUp = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f));
var moveDown = moveUp.Reverse();
// A CCSequence action runs the list of actions in ... sequence!
var moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown));
var repeatedAction = new CCRepeatForever(moveSeq);
// A CCSpawn action runs the list of actions concurrently
var dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 5, 20, true, false));
Target1.RunActions(dreamAction, repeatedAction);
Target2.RunActions(dreamAction, new CCDelayTime(0.5f), repeatedAction);
// moving background. Testing issue #244
var move = new CCMoveBy (3, new CCPoint(200, 0));
bgNode.RepeatForever(move, move.Reverse());
}
示例7: GameLayer
public GameLayer()
: base(CCColor4B.Blue, CCColor4B.AliceBlue)
{
// Set the layer gradient direction
this.Vector = new CCPoint(0.5f, 0.5f);
// Create and add sprites
monkeySprite1 = new CCSprite("monkey");
AddChild(monkeySprite1, 1);
monkeySprite2 = new CCSprite("monkey");
AddChild(monkeySprite2, 1);
// Define actions
var moveUp = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f));
var moveDown = moveUp.Reverse();
// A CCSequence action runs the list of actions in ... sequence!
CCSequence moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown));
repeatedAction = new CCRepeatForever(moveSeq);
// A CCSpawn action runs the list of actions concurrently
dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 4, 4));
// Schedule for method to be called every 0.1s
Schedule(UpdateLayerGradient, 0.1f);
}
示例8: 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);
}
示例9: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize winSize = VisibleBoundsWorldspace.Size;
float x = winSize.Center.X;
float y = winSize.Center.Y;
//var widgetSize = _widget->getContentSize();
var moveTo = new CCMoveBy(1.0f, new CCPoint(30, 0));
var moveBack = moveTo.Reverse();
var rotateBy = new CCRotateBy(1.0f, 180);
var scaleBy = new CCScaleTo(1.0f, -2.0f);
var action = new CCSequence(moveTo, moveBack, rotateBy, scaleBy);
var normalSprite1 = new CCSprite("Images/animationbuttonnormal.png");
normalSprite1.Position = winSize.Center;
normalSprite1.PositionX -= 100;
normalSprite1.PositionY += 100;
normalSprite1.FlipY = true;
AddChild(normalSprite1);
normalSprite1.RunAction(action);
var normalSprite2 = new CCScale9Sprite("Images/animationbuttonnormal.png");
normalSprite2.Position = winSize.Center;
normalSprite2.PositionX -= 80;
normalSprite2.PositionY += 100;
normalSprite2.IsScale9Enabled = false;
normalSprite2.Opacity = 100;
AddChild(normalSprite2);
normalSprite2.Color = CCColor3B.Green;
normalSprite2.RunAction(action);
var sp1 = new CCScale9Sprite("Images/animationbuttonnormal.png");
sp1.Position = winSize.Center;
sp1.PositionX -= 100;
sp1.PositionY -= 50;
sp1.Scale = 1.2f;
sp1.ContentSize = new CCSize(100, 100);
sp1.Color = CCColor3B.Green;
AddChild(sp1);
sp1.RunAction(action);
var sp2 = new CCScale9Sprite("Images/animationbuttonnormal.png");
sp2.Position = winSize.Center;
sp2.PositionX += 100;
sp2.PositionY -= 50;
sp2.PreferredSize = sp1.ContentSize * 1.2f;
sp2.ContentSize = new CCSize(100, 100);
sp2.Color = CCColor3B.Green;
AddChild(sp2);
sp2.RunAction(action);
}
示例10: OnEnter
public override void OnEnter() {
base.OnEnter();
var move = new CCActionEase(new CCMoveBy(1, new CCPoint(0, 20)));
var moveSeq = new CCSequence(move, move.Reverse());
AddAction(new CCRepeatForever(moveSeq));
}
示例11: disableMenuCallback
public void disableMenuCallback(object pSender)
{
menu1.Enabled = false;
var wait = new CCDelayTime (5);
var enable = new CCCallFunc(enableMenuCallback);
var seq = new CCSequence(wait, enable);
menu1.RunAction(seq);
}
示例12: CCSequenceState
public CCSequenceState (CCSequence action, CCNode target)
: base (action, target)
{
actionSequences = action.Actions;
hasInfiniteAction = (actionSequences [0] is CCRepeatForever) || (actionSequences [1] is CCRepeatForever);
split = actionSequences [0].Duration / Duration;
last = -1;
}
示例13: Parallax1
public Parallax1()
{
// Top Layer, a simple image
CCSprite cocosImage = new CCSprite(s_Power);
// scale the image (optional)
cocosImage.Scale = 2.5f;
// change the transform anchor point to 0,0 (optional)
cocosImage.AnchorPoint = new CCPoint(0, 0);
// // Middle layer: a Tile map atlas
// CCTileMapAtlas tilemap = new CCTileMapAtlas(s_TilesPng, s_LevelMapTga, 16, 16);
// tilemap.ReleaseMap();
//
// // change the transform anchor to 0,0 (optional)
// tilemap.AnchorPoint = new CCPoint(0, 0);
//
// // Anti Aliased images
// tilemap.IsAntialiased = true;
// background layer: another image
CCSprite background = new CCSprite(TestResource.s_back);
// scale the image (optional)
background.Scale = 1.5f;
// change the transform anchor point (optional)
background.AnchorPoint = new CCPoint(0, 0);
// create a void node, a parent node
CCParallaxNode voidNode = new CCParallaxNode();
// NOW add the 3 layers to the 'void' node
// background image is moved at a ratio of 0.4x, 0.5y
voidNode.AddChild(background, -1, new CCPoint(0.4f, 0.5f), new CCPoint(0, 0));
// tiles are moved at a ratio of 2.2x, 1.0y
// voidNode.AddChild(tilemap, 1, new CCPoint(2.2f, 1.0f), new CCPoint(0, -200));
// top image is moved at a ratio of 3.0x, 2.5y
voidNode.AddChild(cocosImage, 2, new CCPoint(3.0f, 2.5f), new CCPoint(200, 800));
// now create some actions that will move the 'void' node
// and the children of the 'void' node will move at different
// speed, thus, simulation the 3D environment
CCMoveBy goUp = new CCMoveBy (4, new CCPoint(0, -500));
CCFiniteTimeAction goDown = goUp.Reverse();
CCMoveBy go = new CCMoveBy (8, new CCPoint(-1000, 0));
CCFiniteTimeAction goBack = go.Reverse();
CCFiniteTimeAction seq = new CCSequence(goUp, go, goDown, goBack);
voidNode.RunAction(new CCRepeatForever ((CCFiniteTimeAction) seq));
AddChild(voidNode, -1, kTagTileMap);
}
示例14: disableMenuCallback
public void disableMenuCallback(object pSender)
{
m_pMenu1.Enabled = false;
CCDelayTime wait = new CCDelayTime (5);
CCCallFunc enable = new CCCallFunc(enableMenuCallback);
CCFiniteTimeAction seq = new CCSequence(wait, enable);
m_pMenu1.RunAction(seq);
}
示例15: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = Layer.VisibleBoundsWorldspace.Size;
var progressTo = new CCProgressTo(6, 100);
var tint = new CCSequence(new CCTintTo (1, 255, 0, 0),
new CCTintTo (1, 0, 255, 0),
new CCTintTo (1, 0, 0, 255));
var fade = new CCSequence(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.RepeatForever(progressTo);
left.RepeatForever(tint);
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.RepeatForever(progressTo);
middle.RepeatForever(fade);
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.RepeatForever(progressTo);
right.RepeatForever(tint);
right.RepeatForever(fade);
right.AddChild(new CCLabelTtf("Tint and Fade", "arial", 20.0f));
}