本文整理汇总了C#中Cocos2D.CCSequence类的典型用法代码示例。如果您正苦于以下问题:C# CCSequence类的具体用法?C# CCSequence怎么用?C# CCSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCSequence类属于Cocos2D命名空间,在下文中一共展示了CCSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StressTest2
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);
}
示例2: OnEnter
public override void OnEnter()
{
base.OnEnter();
var s = CCDirector.SharedDirector.WinSize;
var layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, s.Height - 50);
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), 100, s.Height - 50);
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: NodeToWorld
public NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite back = new CCSprite(TestResource.s_back3);
AddChild(back, -10);
back.AnchorPoint = (new CCPoint(0, 0));
CCSize backSize = back.ContentSize;
CCMenuItem item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
CCMenu menu = new CCMenu(item);
menu.AlignItemsVertically();
menu.Position = (new CCPoint(backSize.Width / 2, backSize.Height / 2));
back.AddChild(menu);
CCActionInterval rot = new CCRotateBy (5, 360);
CCAction fe = new CCRepeatForever (rot);
item.RunAction(fe);
CCActionInterval move = new CCMoveBy (3, new CCPoint(200, 0));
var move_back = (CCActionInterval) move.Reverse();
CCFiniteTimeAction seq = new CCSequence(move, move_back);
CCAction fe2 = new CCRepeatForever ((CCActionInterval) seq);
back.RunAction(fe2);
}
示例4: CCSequence
protected CCSequence(CCSequence sequence) : base(sequence)
{
var param1 = sequence.m_pActions[0].Copy() as CCFiniteTimeAction;
var param2 = sequence.m_pActions[1].Copy() as CCFiniteTimeAction;
InitOneTwo(param1, param2);
}
示例5: FadeThenRemove
public void FadeThenRemove(float delta)
{
var seq = new CCSequence(
new CCFadeTo (1.0f,0),
new CCCallFunc(RemoveSpriteAndBody));
sprite.RunAction(seq);
}
示例6: 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);
}
示例7: 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 = CCTileMapAtlas.Create(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.Texture.SetAntiAliasTexParameters();
// 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 ((CCActionInterval) seq));
AddChild(voidNode, -1, kTagTileMap);
}
示例8: AllShapesAction
/// <summary>
/// Creates a sequence of actions that causes a sprite to move using all the actions on the screen.
/// </summary>
/// <param name="repeatForever">A boolean value that determines if the action should be repeated indefinitely.</param>
/// <returns></returns>
internal static CCAction AllShapesAction(bool repeatForever)
{
// Create a new action sequence that will move the sprite using all the other actions
CCActionInterval allAction = new CCSequence(RotateAction(false), ScaleAction(false), JumpAction(false), BoxAction(false), TriangleAction(false));
// See if we're repeating the action indefinitely
if (repeatForever) allAction = new CCRepeatForever(allAction);
return allAction;
}
示例9: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCProgressTo to = new CCProgressTo(6, 100);
CCAction tint = new CCSequence(new CCTintTo (1, 255, 0, 0),
new CCTintTo (1, 0, 255, 0),
new CCTintTo (1, 0, 0, 255));
CCAction 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.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));
}
示例10: Atlas4
public Atlas4()
{
m_time = 0;
// Upper Label
CCLabelBMFont label = new CCLabelBMFont("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");
AddChild(label);
CCSize s = CCDirector.SharedDirector.WinSize;
label.Position = new CCPoint(s.Width / 2, s.Height / 2);
label.AnchorPoint = new CCPoint(0.5f, 0.5f);
CCSprite BChar = (CCSprite)label.GetChildByTag(0);
CCSprite FChar = (CCSprite)label.GetChildByTag(7);
CCSprite AChar = (CCSprite)label.GetChildByTag(12);
CCActionInterval rotate = new CCRotateBy (2, 360);
CCAction rot_4ever = new CCRepeatForever (rotate);
CCActionInterval scale = new CCScaleBy(2, 1.5f);
CCFiniteTimeAction scale_back = scale.Reverse();
CCFiniteTimeAction scale_seq = new CCSequence(scale, scale_back);
CCAction scale_4ever = new CCRepeatForever ((CCActionInterval)scale_seq);
CCActionInterval jump = new CCJumpBy (0.5f, new CCPoint(), 60, 1);
CCAction jump_4ever = new CCRepeatForever (jump);
CCActionInterval fade_out = new CCFadeOut (1);
CCActionInterval fade_in = new CCFadeIn (1);
CCFiniteTimeAction seq = new CCSequence(fade_out, fade_in);
CCAction fade_4ever = new CCRepeatForever ((CCActionInterval)seq);
BChar.RunAction(rot_4ever);
BChar.RunAction(scale_4ever);
FChar.RunAction(jump_4ever);
AChar.RunAction(fade_4ever);
// Bottom Label
CCLabelBMFont label2 = new CCLabelBMFont("00.0", "fonts/bitmapFontTest.fnt");
AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
label2.Position = new CCPoint(s.Width / 2.0f, 80);
CCSprite lastChar = (CCSprite)label2.GetChildByTag(3);
lastChar.RunAction((CCAction)(rot_4ever.Copy()));
//schedule( schedule_selector(Atlas4::step), 0.1f);
base.Schedule(step, 0.1f);
}
示例11: AddJiggle
public static void AddJiggle(CCNode targetSprite)
{
var swingTime = CCRandom.Next(10, 31) / 100f;
var rotateLeftAction = new CCRotateBy(swingTime, 1);
var rotateRightAction = new CCRotateBy(swingTime * 2, -2);
var rotateBackAction = new CCRotateBy(swingTime, 1);
var rotateSequence = new CCSequence(rotateLeftAction, rotateRightAction, rotateBackAction);
var repeatAction = new CCRepeatForever(rotateSequence);
targetSprite.RunAction(repeatAction);
}
示例12: BoxAction
/// <summary>
/// Creates a sequence of actions that causes a sprite to move in a box shape on the screen.
/// </summary>
/// <param name="repeatForever">A boolean value that determines if the action should be repeated indefinitely.</param>
/// <returns></returns>
internal static CCFiniteTimeAction BoxAction(bool repeatForever)
{
// Create a new action sequence that will move the sprite in a box shape at fixed positions on the screen
CCActionInterval boxAction = new CCSequence(
new CCMoveTo(1, new CCPoint(100, 100)),
new CCMoveTo(1, new CCPoint(100, 500)),
new CCMoveTo(1, new CCPoint(500, 500)),
new CCMoveTo(1, new CCPoint(500, 100)));
// See if we're repeating the action indefinitely
if (repeatForever) boxAction = new CCRepeatForever(boxAction);
return boxAction;
}
示例13: Atlas3
public Atlas3()
{
m_time = 0;
CCLayerColor col = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
AddChild(col, -10);
CCLabelBMFont label1 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");
// testing anchors
label1.AnchorPoint = new CCPoint(0, 0);
AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
CCActionInterval fade = new CCFadeOut (1.0f);
CCFiniteTimeAction fade_in = fade.Reverse();
CCFiniteTimeAction seq = new CCSequence(fade, fade_in);
CCAction repeat = new CCRepeatForever ((CCActionInterval)seq);
label1.RunAction(repeat);
// VERY IMPORTANT
// color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
// If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
// Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
CCLabelBMFont label2 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");
// testing anchors
label2.AnchorPoint = new CCPoint(0.5f, 0.5f);
label2.Color = ccRED;
AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
label2.RunAction((CCAction)(repeat.Copy()));
CCLabelBMFont label3 = new CCLabelBMFont("Test", "fonts/bitmapFontTest2.fnt");
// testing anchors
label3.AnchorPoint = new CCPoint(1, 1);
AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);
CCSize s = CCDirector.SharedDirector.WinSize;
label1.Position = new CCPoint();
label2.Position = new CCPoint(s.Width / 2, s.Height / 2);
label3.Position = new CCPoint(s.Width, s.Height);
base.Schedule(step);//:@selector(step:)];
}
示例14: LabelTTFA8Test
public LabelTTFA8Test()
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCLayerColor layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
AddChild(layer, -10);
// CCLabelBMFont
CCLabelTTF label1 = new CCLabelTTF("Testing A8 Format", "Marker Felt", 38);
AddChild(label1);
label1.Color = CCTypes.CCRed;
label1.Position = new CCPoint(s.Width / 2, s.Height / 2);
CCFadeOut fadeOut = new CCFadeOut (2);
CCFadeIn fadeIn = new CCFadeIn (2);
CCFiniteTimeAction seq = new CCSequence(fadeOut, fadeIn);
CCRepeatForever forever = new CCRepeatForever ((CCActionInterval) seq);
label1.RunAction(forever);
}
示例15: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCActionInterval inA, outA;
m_pInScene.Visible = false;
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if (m_eOrientation == CCTransitionOrientation.UpOver)
{
inDeltaZ = 90;
inAngleZ = 270;
outDeltaZ = 90;
outAngleZ = 0;
}
else
{
inDeltaZ = -90;
inAngleZ = 90;
outDeltaZ = -90;
outAngleZ = 0;
}
inA = new CCSequence
(
new CCDelayTime (m_fDuration / 2),
new CCShow(),
new CCOrbitCamera(m_fDuration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
new CCCallFunc(Finish)
);
outA = new CCSequence
(
new CCOrbitCamera(m_fDuration / 2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
new CCHide(),
new CCDelayTime (m_fDuration / 2)
);
m_pInScene.RunAction(inA);
m_pOutScene.RunAction(outA);
}