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; } }
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); } }
public override void StartWithTarget(CCNode target) { base.StartWithTarget(target); foreach (CCFiniteTimeAction action in m_pActions) { action.StartWithTarget(target); } }
public bool Init(CCNode stencil) { m_pStencil = stencil; m_fAlphaThreshold = 1; m_bInverted = false; return true; }
public override void StartWithTarget(CCNode target) { base.StartWithTarget(target); for (int i = 0; i < m_pActions.Length; i++) { m_pActions[i].StartWithTarget(target); } }
protected internal override void StartWithTarget(CCNode target) { base.StartWithTarget(target); m_fDeltaT = 1f / m_pPoints.Count; m_previousPosition = target.Position; m_accumulatedDiff = CCPoint.Zero; }
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); }
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; }
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); }
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); }
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); } }
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; }
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); } }
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; }
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); } }
public CCSize GetContainerSize(CCNode node) { if (node != null) { return node.ContentSize; } else { return mRootContainerSize; } }
protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled, CCBReader reader) { if (propertyName == PROPERTY_DIRECTION) { ((CCScrollView) node).Direction = (CCScrollViewDirection) pIntegerLabeled; } else { base.OnHandlePropTypeFloatScale(node, parent, propertyName, pIntegerLabeled, reader); } }
public override void RemoveChild(CCNode child, bool cleanup) { for (int i = 0; i < m_pParallaxArray.Count; i++) { if (m_pParallaxArray[i].Child == child) { m_pParallaxArray.RemoveAt(i); break; } } base.RemoveChild(child, cleanup); }
public TextLayer() { InitWithColor(CCTypes.CreateColor(32, 32, 32, 255)); var node = new CCNode(); CCActionInterval effect = getAction(); node.RunAction(effect); AddChild(node, 0, EffectTestScene.kTagBackground); var bg = new CCSprite(TestResource.s_back3); node.AddChild(bg, 0); bg.AnchorPoint = new CCPoint(0.5f, 0.5f); bg.Position = CCVisibleRect.Center; var grossini = new CCSprite(TestResource.s_pPathSister2); node.AddChild(grossini, 1); grossini.Position = new CCPoint(CCVisibleRect.Left.X + CCVisibleRect.VisibleRect.Size.Width / 3, CCVisibleRect.Center.Y); CCActionInterval sc = new CCScaleBy(2, 5); CCFiniteTimeAction sc_back = sc.Reverse(); grossini.RunAction(new CCRepeatForever((new CCSequence(sc, sc_back)))); var tamara = new CCSprite(TestResource.s_pPathSister1); node.AddChild(tamara, 1); tamara.Position = new CCPoint(CCVisibleRect.Left.X + 2 * CCVisibleRect.VisibleRect.Size.Width / 3, CCVisibleRect.Center.Y); CCActionInterval sc2 = new CCScaleBy(2, 5); CCFiniteTimeAction sc2_back = sc2.Reverse(); tamara.RunAction(new CCRepeatForever((new CCSequence(sc2, sc2_back)))); var label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32); label.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Top.Y - 80); AddChild(label); label.Tag = EffectTestScene.kTagLabel; var item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback); var item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback); var item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback); var menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(CCVisibleRect.Center.X - item2.ContentSize.Width * 2, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); item2.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); item3.Position = new CCPoint(CCVisibleRect.Center.X + item2.ContentSize.Width * 2, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); AddChild(menu, 1); Schedule(checkAnim); }
protected override void OnHandlePropTypeCCBFile(CCNode node, CCNode parent, string propertyName, CCNode fileNode, CCBReader reader) { if (propertyName == PROPERTY_CONTAINER) { ((CCScrollView) node).Container = fileNode; ((CCScrollView) node).UpdateInset(); } else { base.OnHandlePropTypeCCBFile(node, parent, propertyName, fileNode, reader); } }
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); }
protected CCFollow(CCFollow follow) : base(follow) { m_nTag = follow.m_nTag; m_bBoundaryFullyCovered = follow.m_bBoundaryFullyCovered; m_bBoundarySet = follow.m_bBoundarySet; m_fBottomBoundary = follow.m_fBottomBoundary; m_fLeftBoundary = follow.m_fLeftBoundary; m_fRightBoundary = follow.m_fRightBoundary; m_fTopBoundary = follow.m_fTopBoundary; m_obFullScreenSize = follow.m_obFullScreenSize; m_obHalfScreenSize = follow.m_obHalfScreenSize; m_pobFollowedNode = follow.m_pobFollowedNode; }
protected bool InitWithLabel(CCNode label, Action<object> selector) { base.InitWithTarget(selector); m_fOriginalScale = 1.0f; m_tColorBackup = CCTypes.CCWhite; DisabledColor = new CCColor3B(126, 126, 126); Label = label; CascadeColorEnabled = true; CascadeOpacityEnabled = true; return true; }
public static CCSprite AddSpriteToTargetWithPosAndAnchor(string spriteName, CCNode target, CCPoint pos, CCPoint anchor) { var sprite = new CCSprite(spriteName); if (sprite == null) return null; sprite.Position = pos; sprite.AnchorPoint = anchor; target.AddChild(sprite); return sprite; }
public override bool Init() { if (base.Init()) { CCSize screenSize = CCDirector.SharedDirector.WinSize; CCNode layer = new CCNode(); layer.Position = new CCPoint(screenSize.Width / 2, screenSize.Height / 2); AddChild(layer, 1); float layer_width = 0; // Create the colour picker CCControlColourPicker colourPicker = new CCControlColourPicker(); colourPicker.Color = new CCColor3B(37, 46, 252); colourPicker.Position = new CCPoint(colourPicker.ContentSize.Width / 2, 0); // Add it to the layer layer.AddChild(colourPicker); // Add the target-action pair colourPicker.AddTargetWithActionForControlEvents(this, ColourValueChanged, CCControlEvent.ValueChanged); layer_width += colourPicker.ContentSize.Width; // Add the black background for the text CCScale9Sprite background = new CCScale9SpriteFile("extensions/buttonBackground.png"); background.ContentSize = new CCSize(150, 50); background.Position = new CCPoint(layer_width + background.ContentSize.Width / 2.0f, 0); layer.AddChild(background); layer_width += background.ContentSize.Width; _colorLabel = new CCLabelTTF("#color", "Arial", 26); _colorLabel.Position = background.Position; layer.AddChild(_colorLabel); // Set the layer size layer.ContentSize = new CCSize(layer_width, 0); layer.AnchorPoint = new CCPoint(0.5f, 0.5f); // Update the color text ColourValueChanged(colourPicker, CCControlEvent.ValueChanged); return true; } return false; }
protected override void OnHandlePropTypeBlock(CCNode node, CCNode parent, string propertyName, BlockData pBlockData, CCBReader reader) { if (propertyName == PROPERTY_BLOCK) { if (null != pBlockData) // Add this condition to allow CCMenuItemImage without target/selector predefined { ((CCMenuItem) node).SetTarget(pBlockData.mSELMenuHandler); } } else { base.OnHandlePropTypeBlock(node, parent, propertyName, pBlockData, reader); } }
public override bool Init() { if (base.Init()) { CCSize screenSize = CCDirector.SharedDirector.WinSize; CCNode layer = new CCNode (); layer.Position = new CCPoint(screenSize.Width / 2, screenSize.Height / 2); AddChild(layer, 1); float layer_width = 0.0f; // Add the black background for the text CCScale9Sprite background = new CCScale9SpriteFile("extensions/buttonBackground"); background.ContentSize = new CCSize(80, 50); background.Position = new CCPoint(layer_width + background.ContentSize.Width / 2.0f, 0); layer.AddChild(background); layer_width += background.ContentSize.Width; m_pDisplayValueLabel = new CCLabelTTF("#color", "Arial", 30); m_pDisplayValueLabel.Position = background.Position; layer.AddChild(m_pDisplayValueLabel); // Create the switch CCControlSwitch switchControl = new CCControlSwitch ( new CCSprite("extensions/switch-mask"), new CCSprite("extensions/switch-on"), new CCSprite("extensions/switch-off"), new CCSprite("extensions/switch-thumb"), new CCLabelTTF("On", "Arial", 16), new CCLabelTTF("Off", "Arial", 16) ); switchControl.Position = new CCPoint(layer_width + 10 + switchControl.ContentSize.Width / 2, 0); layer.AddChild(switchControl); switchControl.AddTargetWithActionForControlEvents(this, valueChanged, CCControlEvent.ValueChanged); // Set the layer size layer.ContentSize = new CCSize(layer_width, 0); layer.AnchorPoint = new CCPoint(0.5f, 0.5f); // Update the value label valueChanged(switchControl, CCControlEvent.ValueChanged); return true; } return false; }
public override bool Init() { if (base.Init()) { CCSize screenSize = CCDirector.SharedDirector.WinSize; var layer = new CCNode(); layer.Position = new CCPoint(screenSize.Width / 2, screenSize.Height / 2); AddChild(layer, 1); double layer_width = 0; // Add the black background for the text CCScale9Sprite background = new CCScale9SpriteFile("extensions/buttonBackground.png"); background.ContentSize = new CCSize(80, 50); background.Position = new CCPoint((float) layer_width + background.ContentSize.Width / 2.0f, 0); layer.AddChild(background); layer_width += background.ContentSize.Width; DisplayValueLabel = new CCLabelTTF("", "Arial", 30); _displayValueLabel.Position = background.Position; layer.AddChild(_displayValueLabel); // Add the slider var potentiometer = new CCControlPotentiometer("extensions/potentiometerTrack.png" , "extensions/potentiometerProgress.png" , "extensions/potentiometerButton.png"); potentiometer.Position = new CCPoint((float) layer_width + 10 + potentiometer.ContentSize.Width / 2, 0); // When the value of the slider will change, the given selector will be call potentiometer.AddTargetWithActionForControlEvents(this, ValueChanged, CCControlEvent.ValueChanged); layer.AddChild(potentiometer); layer_width += potentiometer.ContentSize.Width; // Set the layer size layer.ContentSize = new CCSize((float) layer_width, 0); layer.AnchorPoint = new CCPoint(0.5f, 0.5f); // Update the value label ValueChanged(potentiometer, CCControlEvent.ValueChanged); return true; } return false; }
public virtual void AddChild(CCNode child, int z, CCPoint ratio, CCPoint offset) { Debug.Assert(child != null, "Argument must be non-nil"); CCPointObject obj = new CCPointObject(ratio, offset); obj.Child = child; m_pParallaxArray.Add(obj); CCPoint pos = m_obPosition; pos.X = pos.X * ratio.X + offset.X; pos.Y = pos.Y * ratio.Y + offset.Y; child.Position = pos; base.AddChild(child, z, child.Tag); }
protected internal override void StartWithTarget(CCNode target) { base.StartWithTarget(target); var pSprite = (CCSprite) (target); m_pOrigFrame = null; if (m_pAnimation.RestoreOriginalFrame) { m_pOrigFrame = pSprite.DisplayFrame; } m_nNextFrame = 0; m_uExecutedLoops = 0; }
public CCControlButton(CCNode label, CCScale9Sprite backgroundSprite) { InitWithLabelAndBackgroundSprite(label, backgroundSprite); }
private CCNode ReadNodeGraph(CCNode parent) { /* Read class name. */ string className = ReadCachedString(); // Read assignment type and name var memberVarAssignmentType = (CCBTargetType)ReadInt(false); string memberVarAssignmentName = String.Empty; if (memberVarAssignmentType != CCBTargetType.None) { memberVarAssignmentName = ReadCachedString(); } CCNodeLoader ccNodeLoader = mCCNodeLoaderLibrary.GetCCNodeLoader(className); if (ccNodeLoader == null) { CCLog.Log("no corresponding node loader for %s", className); return(null); } CCNode node = ccNodeLoader.LoadCCNode(parent, this); // Set root node if (mActionManager.RootNode == null) { mActionManager.RootNode = node; } // Read animated properties var seqs = new Dictionary <int, Dictionary <string, CCBSequenceProperty> >(); mAnimatedProps.Clear(); int numSequence = ReadInt(false); for (int i = 0; i < numSequence; ++i) { int seqId = ReadInt(false); var seqNodeProps = new Dictionary <string, CCBSequenceProperty>(); int numProps = ReadInt(false); for (int j = 0; j < numProps; ++j) { var seqProp = new CCBSequenceProperty(); seqProp.Name = ReadCachedString(); seqProp.Type = (CCBPropType)ReadInt(false); mAnimatedProps.Add(seqProp.Name); int numKeyframes = ReadInt(false); for (int k = 0; k < numKeyframes; ++k) { CCBKeyframe keyframe = ReadKeyframe(seqProp.Type); seqProp.Keyframes.Add(keyframe); } seqNodeProps.Add(seqProp.Name, seqProp); } seqs.Add(seqId, seqNodeProps); } if (seqs.Count > 0) { mActionManager.AddNode(node, seqs); } // Read properties ccNodeLoader.ParseProperties(node, parent, this); // Handle sub ccb files (remove middle node) if (node is CCBFile) { var ccbFileNode = (CCBFile)node; CCNode embeddedNode = ccbFileNode.FileNode; embeddedNode.Position = ccbFileNode.Position; embeddedNode.Rotation = ccbFileNode.Rotation; embeddedNode.Scale = ccbFileNode.Scale; embeddedNode.Tag = ccbFileNode.Tag; embeddedNode.Visible = true; embeddedNode.IgnoreAnchorPointForPosition = ccbFileNode.IgnoreAnchorPointForPosition; ccbFileNode.FileNode = null; node = embeddedNode; } #if CCB_ENABLE_JAVASCRIPT /* * if (memberVarAssignmentType && memberVarAssignmentName && ![memberVarAssignmentName isEqualToString:@""]) * { * [[JSCocoa sharedController] setObject:node withName:memberVarAssignmentName]; * }*/ #else if (memberVarAssignmentType != CCBTargetType.None) { object target = null; if (memberVarAssignmentType == CCBTargetType.DocumentRoot) { target = mActionManager.RootNode; } else if (memberVarAssignmentType == CCBTargetType.Owner) { target = mOwner; } if (target != null) { bool assigned = false; var targetAsCCBMemberVariableAssigner = (ICCBMemberVariableAssigner)target; if (targetAsCCBMemberVariableAssigner != null) { assigned = targetAsCCBMemberVariableAssigner.OnAssignCCBMemberVariable(target, memberVarAssignmentName, node); } if (!assigned && mCCBMemberVariableAssigner != null) { mCCBMemberVariableAssigner.OnAssignCCBMemberVariable(target, memberVarAssignmentName, node); } } } #endif // CCB_ENABLE_JAVASCRIPT mAnimatedProps.Clear(); /* Read and add children. */ int numChildren = ReadInt(false); for (int i = 0; i < numChildren; i++) { CCNode child = ReadNodeGraph(node); node.AddChild(child); } // Call onNodeLoaded var nodeAsCCNodeLoaderListener = node as ICCNodeLoaderListener; if (nodeAsCCNodeLoaderListener != null) { nodeAsCCNodeLoaderListener.OnNodeLoaded(node, ccNodeLoader); } else if (mCCNodeLoaderListener != null) { mCCNodeLoaderListener.OnNodeLoaded(node, ccNodeLoader); } return(node); }
public override void StartWithTarget(CCNode target) { Debug.Assert(target is CCActionTweenDelegate, "target must implement CCActionTweenDelegate"); base.StartWithTarget(target); m_fDelta = m_fTo - m_fFrom; }
public void AddDocumentCallbackNode(CCNode node) { _actionManager.AddDocumentCallbackNode(node); }
public void AddOwnerCallbackNode(CCNode node) { _ownerCallbackNodes.Add(node); }
/** CCTMXLayer doesn't support adding a CCSprite manually. * @warning addchild(z, tag); is not supported on CCTMXLayer. Instead of setTileGID. */ public override void AddChild(CCNode child, int zOrder, int tag) { Debug.Assert(false, "addChild: is not supported on CCTMXLayer. Instead use setTileGID:at:/tileAt:"); }
public virtual bool InitWithLabelAndBackgroundSprite(CCNode node, CCScale9Sprite backgroundSprite) { if (base.Init()) { Debug.Assert(node != null, "Label must not be nil."); var label = node as ICCLabelProtocol; var rgbaLabel = node as ICCRGBAProtocol; Debug.Assert(backgroundSprite != null, "Background sprite must not be nil."); Debug.Assert(label != null || rgbaLabel != null || backgroundSprite != null); m_bParentInited = true; // Initialize the button state tables m_titleDispatchTable = new Dictionary <CCControlState, string>(); m_titleColorDispatchTable = new Dictionary <CCControlState, CCColor3B>(); m_titleLabelDispatchTable = new Dictionary <CCControlState, CCNode>(); m_backgroundSpriteDispatchTable = new Dictionary <CCControlState, CCScale9Sprite>(); TouchEnabled = true; m_isPushed = false; m_zoomOnTouchDown = true; m_currentTitle = null; // Adjust the background image by default SetAdjustBackgroundImage(true); PreferredSize = CCSize.Zero; // Zooming button by default m_zoomOnTouchDown = true; // Set the default anchor point IgnoreAnchorPointForPosition = false; AnchorPoint = new CCPoint(0.5f, 0.5f); // Set the nodes TitleLabel = node; BackgroundSprite = backgroundSprite; // Set the default color and opacity Color = new CCColor3B(255, 255, 255); Opacity = 255; IsOpacityModifyRGB = true; // Initialize the dispatch table string tempString = label.Label; //tempString->autorelease(); SetTitleForState(tempString, CCControlState.Normal); SetTitleColorForState(rgbaLabel.Color, CCControlState.Normal); SetTitleLabelForState(node, CCControlState.Normal); SetBackgroundSpriteForState(backgroundSprite, CCControlState.Normal); LabelAnchorPoint = new CCPoint(0.5f, 0.5f); NeedsLayout(); return(true); } //couldn't init the CCControl return(false); }
public CCControlHuePicker(CCNode target, CCPoint pos) { InitWithTargetAndPos(target, pos); }
/** * An initialized table view object * * @param dataSource data source; * @param size view size * @param container parent object for cells * @return table view */ public CCTableView(CCTableViewDataSource dataSource, CCSize size, CCNode container) { InitWithViewSize(size, container); DataSource = dataSource; _updateContentSize(); }
public override void StartWithTarget(CCNode target) { base.StartWithTarget(target); m_fDeltaT = 1f / m_pPoints.Count; }
int m_nCharLimit; // the textfield max char limit public void callbackRemoveNodeWhenDidAction(CCNode node) { this.RemoveChild(node, true); }
public override void StartWithTarget(CCNode target) { base.StartWithTarget(target); m_startPosition = target.Position; }