本文整理汇总了C#中cocos2d.CCNode类的典型用法代码示例。如果您正苦于以下问题:C# CCNode类的具体用法?C# CCNode怎么用?C# CCNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCNode类属于cocos2d命名空间,在下文中一共展示了CCNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: showCurrentTest
public override void showCurrentTest()
{
CCNode ccnode = new CCNode();
ParticleMainScene pScene = (ParticleMainScene)ccnode.parent;
int subTest = pScene.getSubTestNum();
int parNum = pScene.getParticlesNum();
ParticleMainScene pNewScene = null;
switch (m_nCurCase)
{
case 0:
pNewScene = new ParticlePerformTest1();
break;
case 1:
pNewScene = new ParticlePerformTest2();
break;
case 2:
pNewScene = new ParticlePerformTest3();
break;
case 3:
pNewScene = new ParticlePerformTest4();
break;
}
PerformanceParticleTest.s_nParCurIdx = m_nCurCase;
if (pNewScene != null)
{
pNewScene.initWithSubTest(subTest, parNum);
CCDirector.sharedDirector().replaceScene(pNewScene);
}
}
示例2: 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);
}
}
示例3: startWithTarget
public override void startWithTarget(CCNode pTarget)
{
base.startWithTarget(pTarget);
CCGridBase newgrid = this.getGrid();
CCNode t = m_pTarget;
CCGridBase targetGrid = t.Grid;
if (targetGrid != null && targetGrid.ReuseGrid > 0)
{
if (targetGrid.Active && targetGrid.GridSize.x == m_sGridSize.x
&& targetGrid.GridSize.y == m_sGridSize.y)
{
targetGrid.reuse();
}
}
else
{
if (targetGrid != null && targetGrid.Active)
{
targetGrid.Active = false;
}
t.Grid = newgrid;
t.Grid.Active = true;
}
}
示例4: showCurrentTest
public override void showCurrentTest()
{
CCNode ccnode = new CCNode();
int nNodes = ((NodeChildrenMainScene)ccnode.parent).getQuantityOfNodes();
NodeChildrenMainScene pScene = null;
switch (PerformBasicLayer.m_nCurCase)
{
// case 0:
// pScene = new IterateSpriteSheetFastEnum();
// break;
case 0:
pScene = new IterateSpriteSheetCArray();
break;
case 1:
pScene = new AddSpriteSheet();
break;
case 2:
pScene = new RemoveSpriteSheet();
break;
case 3:
pScene = new ReorderSpriteSheet();
break;
}
PerformanceNodeChildrenTest.s_nCurCase = PerformBasicLayer.m_nCurCase;
if (pScene != null)
{
pScene.initWithQuantityOfNodes(nNodes);
CCDirector.sharedDirector().replaceScene(pScene);
}
}
示例5: addAction
// actions
/// <summary>
/// Adds an action with a target.
/// If the target is already present, then the action will be added to the existing target.
/// If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
/// When the target is paused, the queued actions won't be 'ticked'.
/// </summary>
public void addAction(CCAction action, CCNode target, bool paused)
{
Debug.Assert(action != null);
Debug.Assert(target != null);
tHashElement element = null;
if (!m_pTargets.ContainsKey(target))
{
element = new tHashElement();
element.paused = paused;
element.target = target;
m_pTargets.Add(target, element);
}
else
{
element = m_pTargets[target];
}
actionAllocWithHashElement(element);
Debug.Assert(!element.actions.Contains(action));
element.actions.Add(action);
action.startWithTarget(target);
}
示例6: GetActionByTag
public CCAction GetActionByTag(int tag, CCNode target)
{
Debug.Assert(tag != (int) ActionTag.kCCActionTagInvalid);
HashElement element;
if (m_pTargets.TryGetValue(target, out element))
{
if (element.Actions != null)
{
int limit = element.Actions.Count;
for (int i = 0; i < limit; i++)
{
CCAction action = element.Actions[i];
if (action.Tag == tag)
{
return action;
}
}
CCLog.Log("cocos2d : getActionByTag: Tag " + tag + " not found");
}
}
else
{
CCLog.Log("cocos2d : getActionByTag: Target not found");
}
return null;
}
示例7: 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;
}
}
示例8: addChild
// super methods
public virtual void addChild(CCNode child, UInt32 zOrder, int tag)
{
// CC_UNUSED_PARAM(zOrder);
// CC_UNUSED_PARAM(child);
// CC_UNUSED_PARAM(tag);
Debug.Assert(false, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
}
示例9: startWithTarget
public override void startWithTarget(CCNode pTarget)
{
base.startWithTarget(pTarget);
m_fDeltaX = m_fSkewX;
m_fDeltaY = m_fSkewY;
m_fEndSkewX = m_fStartSkewX + m_fDeltaX;
m_fEndSkewY = m_fStartSkewY + m_fDeltaY;
}
示例10: itemFromNormalSprite
/// <summary>
/// creates a menu item with a normal,selected and disabled image with target/selector
/// </summary>
/// <param name="normalSprite"></param>
/// <param name="selectedSprite"></param>
/// <param name="disabledSprite"></param>
/// <param name="target"></param>
/// <param name="selector"></param>
/// <returns></returns>
public static CCMenuItemSprite itemFromNormalSprite(CCNode normalSprite, CCNode selectedSprite, CCNode disabledSprite,
SelectorProtocol target, SEL_MenuHandler selector)
{
CCMenuItemSprite pRet = new CCMenuItemSprite();
pRet.initFromNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
//pRet->autorelease();
return pRet;
}
示例11: getRect
public static CCRect getRect(CCNode node)
{
CCRect rc = new CCRect();
rc.Origin = node.Position;
rc.Size = node.ContentSize;
rc.Origin.X -= rc.Size.Width / 2;
rc.Origin.Y -= rc.Size.Height / 2;
return rc;
}
示例12: startWithTarget
public override void startWithTarget(CCNode pTarget)
{
base.startWithTarget(pTarget);
CCCamera camera = pTarget.Camera;
camera.getCenterXYZ(out m_fCenterXOrig, out m_fCenterYOrig, out m_fCenterZOrig);
camera.getEyeXYZ(out m_fEyeXOrig, out m_fEyeYOrig, out m_fEyeZOrig);
camera.getUpXYZ(out m_fUpXOrig, out m_fUpYOrig, out m_fUpZOrig);
}
示例13: getRect
public static CCRect getRect(CCNode pNode)
{
CCRect rc = new CCRect();
rc.origin = pNode.position;
rc.size = pNode.contentSize;
rc.origin.x -= rc.size.width / 2;
rc.origin.y -= rc.size.height / 2;
return rc;
}
示例14: startWithTarget
public virtual void startWithTarget(CCNode pTarget)
{
base.startWithTarget(pTarget);
if (m_pTarget.Grid != null && m_pTarget.Grid.Active != null)
{
m_pTarget.Grid.ReuseGrid = m_pTarget.Grid.ReuseGrid + m_nTimes;
}
}
示例15: NumberOfRunningActionsInTarget
public int NumberOfRunningActionsInTarget(CCNode target)
{
HashElement element;
if (m_pTargets.TryGetValue(target, out element))
{
return (element.Actions != null) ? element.Actions.Count : 0;
}
return 0;
}