本文整理汇总了C#中Cocos2D.CCNode类的典型用法代码示例。如果您正苦于以下问题:C# CCNode类的具体用法?C# CCNode怎么用?C# CCNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCNode类属于Cocos2D命名空间,在下文中一共展示了CCNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnHandlePropTypeSpriteFrame
protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
CCBReader reader)
{
if (propertyName == PROPERTY_NORMALDISPLAYFRAME)
{
if (spriteFrame != null)
{
((CCMenuItemImage) node).SetNormalSpriteFrame(spriteFrame);
}
}
else if (propertyName == PROPERTY_SELECTEDDISPLAYFRAME)
{
if (spriteFrame != null)
{
((CCMenuItemImage) node).SetSelectedSpriteFrame(spriteFrame);
}
}
else if (propertyName == PROPERTY_DISABLEDDISPLAYFRAME)
{
if (spriteFrame != null)
{
((CCMenuItemImage) node).SetDisabledSpriteFrame(spriteFrame);
}
}
else
{
base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
}
}
示例2: StartWithTarget
public override void StartWithTarget(CCNode target)
{
base.StartWithTarget(target);
CCNode t = m_pTarget;
CCGridBase targetGrid = t.Grid;
if (targetGrid != null && targetGrid.ReuseGrid > 0)
{
Grid = targetGrid;
if (targetGrid.Active && targetGrid.GridSize.X == m_sGridSize.X
&& targetGrid.GridSize.Y == m_sGridSize.Y /*&& dynamic_cast<CCGridBase*>(targetGrid) != NULL*/)
{
targetGrid.Reuse();
}
else
{
Debug.Assert(false);
}
}
else
{
if (targetGrid != null && targetGrid.Active)
{
targetGrid.Active = false;
}
CCGridBase newgrid = Grid;
t.Grid = newgrid;
t.Grid.Active = true;
}
}
示例3: StartWithTarget
public override void StartWithTarget(CCNode target)
{
base.StartWithTarget(target);
foreach (CCFiniteTimeAction action in m_pActions)
{
action.StartWithTarget(target);
}
}
示例4: Init
public bool Init(CCNode stencil)
{
m_pStencil = stencil;
m_fAlphaThreshold = 1;
m_bInverted = false;
return true;
}
示例5: StartWithTarget
public override void StartWithTarget(CCNode target)
{
base.StartWithTarget(target);
for (int i = 0; i < m_pActions.Length; i++)
{
m_pActions[i].StartWithTarget(target);
}
}
示例6: InitWithLabel
protected bool InitWithLabel(CCNode label, SEL_MenuHandler selector)
{
base.InitWithTarget(selector);
m_fOriginalScale = 1.0f;
m_tColorBackup = CCTypes.CCWhite;
DisabledColor = new CCColor3B(126, 126, 126);
Label = label;
return true;
}
示例7: TextLayer
public TextLayer()
{
InitWithColor(CCTypes.CreateColor(32, 32, 32, 255));
float x, y;
CCSize size = CCDirector.SharedDirector.WinSize;
x = size.Width;
y = size.Height;
CCNode node = new CCNode ();
CCActionInterval effect = getAction();
node.RunAction(effect);
AddChild(node, 0, EffectTestScene.kTagBackground);
CCSprite bg = new CCSprite(TestResource.s_back3);
node.AddChild(bg, 0);
bg.AnchorPoint = new CCPoint(0.5f, 0.5f);
bg.Position = new CCPoint(size.Width / 2, size.Height / 2);
CCSprite grossini = new CCSprite(TestResource.s_pPathSister2);
node.AddChild(grossini, 1);
grossini.Position = new CCPoint(x / 3, y / 2);
CCActionInterval sc = new CCScaleBy(2, 5);
CCFiniteTimeAction sc_back = sc.Reverse();
grossini.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc, sc_back))));
//grossini.runAction(effect);
CCSprite tamara = new CCSprite(TestResource.s_pPathSister1);
node.AddChild(tamara, 1);
tamara.Position = new CCPoint(2 * x / 3, y / 2);
CCActionInterval sc2 = new CCScaleBy(2, 5);
CCFiniteTimeAction sc2_back = sc2.Reverse();
tamara.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc2, sc2_back))));
CCLabelTTF label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32);
label.Position = new CCPoint(x / 2, y - 80);
AddChild(label);
label.Tag = EffectTestScene.kTagLabel;
CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);
CCMenu menu = new CCMenu(item1, item2, item3);
menu.Position = new CCPoint(0, 0);
item1.Position = new CCPoint(size.Width / 2 - 100, 30);
item2.Position = new CCPoint(size.Width / 2, 30);
item3.Position = new CCPoint(size.Width / 2 + 100, 30);
AddChild(menu, 1);
Schedule(checkAnim);
}
示例8: StartWithTarget
protected internal override void StartWithTarget(CCNode target)
{
base.StartWithTarget(target);
m_fDeltaT = 1f / m_pPoints.Count;
m_previousPosition = target.Position;
m_accumulatedDiff = CCPoint.Zero;
}
示例9: SpriteHybrid
public SpriteHybrid()
{
CCSize s = CCDirector.SharedDirector.WinSize;
// parents
CCNode parent1 = new CCNode ();
CCSpriteBatchNode parent2 = new CCSpriteBatchNode("animations/grossini", 50);
AddChild(parent1, 0, (int)kTags.kTagNode);
AddChild(parent2, 0, (int)kTags.kTagSpriteBatchNode);
// IMPORTANT:
// The sprite frames will be cached AND RETAINED, and they won't be released unless you call
// CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames);
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("animations/grossini.plist");
// create 250 sprites
// only show 80% of them
for (int i = 0; i < 250; i++)
{
int spriteIdx = (int)(CCRandom.NextDouble() * 14);
string str = "";
string temp = "";
if (spriteIdx+1<10)
{
temp = "0" + (spriteIdx+1);
}
else
{
temp = (spriteIdx+1).ToString();
}
str = string.Format("grossini_dance_{0}.png", temp);
CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName(str);
CCSprite sprite = new CCSprite(frame);
parent1.AddChild(sprite, i, i);
float x = -1000;
float y = -1000;
if (CCRandom.NextDouble() < 0.2f)
{
x = (float)(CCRandom.NextDouble() * s.Width);
y = (float)(CCRandom.NextDouble() * s.Height);
}
sprite.Position = (new CCPoint(x, y));
CCActionInterval action = new CCRotateBy (4, 360);
sprite.RunAction(new CCRepeatForever (action));
}
m_usingSpriteBatchNode = false;
Schedule(reparentSprite, 2);
}
示例10: SpriteChildrenVisibilityIssue665
public SpriteChildrenVisibilityIssue665()
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("animations/grossini.plist");
CCNode aParent;
CCSprite sprite1, sprite2, sprite3;
//
// SpriteBatchNode
//
// parents
aParent = new CCSpriteBatchNode("animations/grossini", 50);
aParent.Position = (new CCPoint(s.Width / 3, s.Height / 2));
AddChild(aParent, 0);
sprite1 = new CCSprite("grossini_dance_01.png");
sprite1.Position = (new CCPoint(0, 0));
sprite2 = new CCSprite("grossini_dance_02.png");
sprite2.Position = (new CCPoint(20, 30));
sprite3 = new CCSprite("grossini_dance_03.png");
sprite3.Position = (new CCPoint(-20, 30));
// test issue #665
sprite1.Visible = false;
aParent.AddChild(sprite1);
sprite1.AddChild(sprite2, -2);
sprite1.AddChild(sprite3, 2);
//
// Sprite
//
aParent = new CCNode ();
aParent.Position = (new CCPoint(2 * s.Width / 3, s.Height / 2));
AddChild(aParent, 0);
sprite1 = new CCSprite("grossini_dance_01.png");
sprite1.Position = (new CCPoint(0, 0));
sprite2 = new CCSprite("grossini_dance_02.png");
sprite2.Position = (new CCPoint(20, 30));
sprite3 = new CCSprite("grossini_dance_03.png");
sprite3.Position = (new CCPoint(-20, 30));
// test issue #665
sprite1.Visible = false;
aParent.AddChild(sprite1);
sprite1.AddChild(sprite2, -2);
sprite1.AddChild(sprite3, 2);
}
示例11: OnHandlePropTypeFloat
protected override void OnHandlePropTypeFloat(CCNode node, CCNode parent, string propertyName, float pFloat, CCBReader reader)
{
if (propertyName == PROPERTY_SCALE)
{
node.Scale = pFloat;
}
else
{
base.OnHandlePropTypeFloat(node, parent, propertyName, pFloat, reader);
}
}
示例12: SetBaseValue
public void SetBaseValue(object pValue, CCNode node, string pPropName)
{
Dictionary<string, object> props;
if (!mBaseValues.TryGetValue(node, out props))
{
props = new Dictionary<string, object>();
mBaseValues.Add(node, props);
}
props[pPropName] = pValue;
}
示例13: OnHandlePropTypeSize
protected override void OnHandlePropTypeSize(CCNode node, CCNode parent, string propertyName, CCSize pSize, CCBReader reader)
{
if (propertyName == PROPERTY_CONTENTSIZE)
{
((CCScrollView) node).ViewSize = pSize;
}
else
{
base.OnHandlePropTypeSize(node, parent, propertyName, pSize, reader);
}
}
示例14: OnHandlePropTypeCheck
protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
{
if (propertyName == PROPERTY_ISENABLED)
{
((CCMenuItem) node).Enabled = pCheck;
}
else
{
base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
}
}
示例15: CCParallaxScrollOffset
public CCParallaxScrollOffset(CCNode node, CCPoint r, CCPoint p, CCPoint s, CCPoint v)
{
Child = node;
Ratio = r;
Offset = s;
RelativeVelocity = v;
Child.Position = p;
OriginalPosition = p;
//currPosition = p;
Child.AnchorPoint = CCPoint.AnchorLowerLeft;
}