Exemplo n.º 1
0
        public override void runThisTest()
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = CCNodeLoaderLibrary.NewDefaultCCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("HelloCocosBuilderLayer", new Loader <HelloCocosBuilderLayer>());

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            CCNode node = ccbReader.ReadNodeGraphFromFile("ccb/HelloCocosBuilder.ccbi", this);

            foreach (CCNode c in node.Children)
            {
                CCLog.Log("Node is at {0},{1}", c.PositionX, c.PositionY);
            }

            if (node != null)
            {
                AddChild(node);
            }

            CCDirector.SharedDirector.ReplaceScene(this);
        }
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL)
     {
         if (spriteFrame != null)
         {
             ((CCControlButton)node).SetBackgroundSpriteFrameForState(spriteFrame, CCControlState.Normal);
         }
     }
     else if (propertyName == PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED)
     {
         if (spriteFrame != null)
         {
             ((CCControlButton)node).SetBackgroundSpriteFrameForState(spriteFrame, CCControlState.Highlighted);
         }
     }
     else if (propertyName == PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED)
     {
         if (spriteFrame != null)
         {
             ((CCControlButton)node).SetBackgroundSpriteFrameForState(spriteFrame, CCControlState.Disabled);
         }
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 3
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_TOUCH_ENABLED)
     {
         ((CCLayer) node).TouchEnabled = pCheck;
     }
     else if (propertyName == PROPERTY_ACCELEROMETER_ENABLED)
     {
         ((CCLayer) node).AccelerometerEnabled = pCheck;
     }
     else if (propertyName == PROPERTY_MOUSE_ENABLED)
     {
         // TODO XXX
         CCLog.Log("The property '{0}' is not supported!", PROPERTY_MOUSE_ENABLED);
     }
     else if (propertyName == PROPERTY_KEYBOARD_ENABLED)
     {
         // TODO XXX
         CCLog.Log("The property '{0}' is not supported!", PROPERTY_KEYBOARD_ENABLED);
         // This comes closest: ((CCLayer *)node).setKeypadEnabled(pCheck);
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
Exemplo n.º 4
0
 protected override void OnHandlePropTypeFloatScale(CCNode node, CCNode parent, string propertyName, float floatScale, CCBReader reader)
 {
     if (propertyName == PROPERTY_FONTSIZE)
     {
         ((CCLabelTTF) node).FontSize = floatScale;
     }
     else
     {
         base.OnHandlePropTypeFloatScale(node, parent, propertyName, floatScale, reader);
     }
 }
Exemplo n.º 5
0
 protected override void OnHandlePropTypeFontTTF(CCNode node, CCNode parent, string propertyName, string fontTTF, CCBReader reader)
 {
     if (propertyName == PROPERTY_FONTNAME)
     {
         ((CCLabelTTF) node).FontName = fontTTF;
     }
     else
     {
         base.OnHandlePropTypeFontTTF(node, parent, propertyName, fontTTF, reader);
     }
 }
 protected override void OnHandlePropTypeInteger(CCNode node, CCNode parent, string propertyName, int pInteger, CCBReader reader)
 {
     if (propertyName == PROPERTY_TOTALPARTICLES)
     {
         ((CCParticleSystemQuad) node).TotalParticles = pInteger;
     }
     else
     {
         base.OnHandlePropTypeInteger(node, parent, propertyName, pInteger, reader);
     }
 }
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_COLOR)
     {
         ((CCLabelBMFont) node).Color = color;
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 8
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_ZOOMONTOUCHDOWN)
     {
         ((CCControlButton) node).ZoomOnTouchDown = pCheck;
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
 protected override void OnHandlePropTypeByte(CCNode node, CCNode parent, string propertyName, byte pByte, CCBReader reader)
 {
     if (propertyName == PROPERTY_OPACITY)
     {
         ((CCLabelBMFont) node).Opacity = pByte;
     }
     else
     {
         base.OnHandlePropTypeByte(node, parent, propertyName, pByte, reader);
     }
 }
Exemplo n.º 10
0
 protected override void OnHandlePropTypeFntFile(CCNode node, CCNode parent, string propertyName, string pFntFile, CCBReader reader)
 {
     if (propertyName == PROPERTY_FNTFILE)
     {
         ((CCLabelBMFont) node).FntFile = pFntFile;
     }
     else
     {
         base.OnHandlePropTypeFntFile(node, parent, propertyName, pFntFile, reader);
     }
 }
Exemplo n.º 11
0
 protected override void OnHandlePropTypeText(CCNode node, CCNode parent, string propertyName, string pText, CCBReader reader)
 {
     if (propertyName == PROPERTY_STRING)
     {
         ((CCLabelBMFont) node).Label = (pText);
     }
     else
     {
         base.OnHandlePropTypeText(node, parent, propertyName, pText, reader);
     }
 }
Exemplo n.º 12
0
 protected override void OnHandlePropTypeCCBFile(CCNode node, CCNode parent, string propertyName, CCNode fileNode, CCBReader reader)
 {
     if (propertyName == PROPERTY_CCBFILE)
     {
         ((CCBFile) node).FileNode = fileNode;
     }
     else
     {
         base.OnHandlePropTypeCCBFile(node, parent, propertyName, fileNode, reader);
     }
 }
Exemplo n.º 13
0
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_EMITERMODE)
     {
         ((CCParticleSystemQuad)node).EmitterMode = (CCEmitterMode)pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeIntegerLabeled(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
Exemplo n.º 14
0
 protected override void OnHandlePropTypeTexture(CCNode node, CCNode parent, string propertyName, CCTexture2D texture,
                                                 CCBReader reader)
 {
     if (propertyName == PROPERTY_TEXTURE)
     {
         ((CCParticleSystemQuad)node).Texture = texture;
     }
     else
     {
         base.OnHandlePropTypeTexture(node, parent, propertyName, texture, reader);
     }
 }
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_DISPLAYFRAME)
     {
         ((CCSprite)node).DisplayFrame = spriteFrame;
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_EMITERMODE)
     {
         ((CCParticleSystemQuad) node).EmitterMode = (CCEmitterMode) pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeIntegerLabeled(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
Exemplo n.º 17
0
 protected override void OnHandlePropTypeBlendFunc(CCNode node, CCNode parent, string propertyName, CCBlendFunc blendFunc,
                                                   CCBReader reader)
 {
     if (propertyName == PROPERTY_BLENDFUNC)
     {
         ((CCLabelBMFont) node).BlendFunc = blendFunc;
     }
     else
     {
         base.OnHandlePropTypeBlendFunc(node, parent, propertyName, blendFunc, reader);
     }
 }
Exemplo n.º 18
0
 protected override void OnHandlePropTypeBlendFunc(CCNode node, CCNode parent, string propertyName, CCBlendFunc blendFunc,
                                                   CCBReader reader)
 {
     if (propertyName == PROPERTY_BLENDFUNC)
     {
         ((CCLabelBMFont)node).BlendFunc = blendFunc;
     }
     else
     {
         base.OnHandlePropTypeBlendFunc(node, parent, propertyName, blendFunc, reader);
     }
 }
Exemplo n.º 19
0
 protected override void OnHandlePropTypeFlip(CCNode node, CCNode parent, string propertyName, bool[] pFlip, CCBReader reader)
 {
     if (propertyName == PROPERTY_FLIP)
     {
         ((CCSprite) node).FlipX = pFlip[0];
         ((CCSprite) node).FlipY = pFlip[1];
     }
     else
     {
         base.OnHandlePropTypeFlip(node, parent, propertyName, pFlip, reader);
     }
 }
Exemplo n.º 20
0
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_DISPLAYFRAME)
     {
         ((CCSprite) node).DisplayFrame = spriteFrame;
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 21
0
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_SPRITEFRAME)
     {
         ((CCScale9Sprite)node).InitWithSpriteFrame(spriteFrame);
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 22
0
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_SPRITEFRAME)
     {
         ((CCScale9Sprite) node).InitWithSpriteFrame(spriteFrame);
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 23
0
 protected override void OnHandlePropTypeBlendFunc(CCNode node, CCNode parent, string propertyName, CCBlendFunc blendFunc,
                                                   CCBReader reader)
 {
     if (propertyName == PROPERTY_BLENDFUNC)
     {
         // TODO Not exported by CocosBuilder yet!
         // ((CCScale9Sprite )node).setBlendFunc(blendFunc);
     }
     else
     {
         base.OnHandlePropTypeBlendFunc(node, parent, propertyName, blendFunc, reader);
     }
 }
Exemplo n.º 24
0
 protected override void OnHandlePropTypeBlockCcControl(CCNode node, CCNode parent, string propertyName,
                                                        BlockCCControlData blockControlData, CCBReader reader)
 {
     if (propertyName == PROPERTY_CCCONTROL)
     {
         ((CCControl) node).AddTargetWithActionForControlEvents(blockControlData.mTarget, blockControlData.mSELCCControlHandler,
                                                                blockControlData.mControlEvents);
     }
     else
     {
         base.OnHandlePropTypeBlockCcControl(node, parent, propertyName, blockControlData, reader);
     }
 }
Exemplo n.º 25
0
 protected override void OnHandlePropTypeBlendFunc(CCNode node, CCNode parent, string propertyName, CCBlendFunc blendFunc,
                                                   CCBReader reader)
 {
     if (propertyName == PROPERTY_BLENDFUNC)
     {
         // TODO Not exported by CocosBuilder yet!
         // ((CCScale9Sprite )node).setBlendFunc(blendFunc);
     }
     else
     {
         base.OnHandlePropTypeBlendFunc(node, parent, propertyName, blendFunc, reader);
     }
 }
Exemplo n.º 26
0
        protected override void OnHandlePropTypePoint(CCNode node, CCNode parent, string propertyName, CCPoint point, CCBReader reader)
        {
            if (propertyName == PROPERTY_VECTOR)
            {
                ((CCLayerGradient) node).Vector = point;

                // TODO Not passed along the ccbi file.
                // ((CCLayerGradient *)node).setCompressedInterpolation(true);
            }
            else
            {
                base.OnHandlePropTypePoint(node, parent, propertyName, point, reader);
            }
        }
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_EMITERMODE)
     {
         // FIX ME: We want to set EmitterMode only during construction of particle System
         // For now we will comment this out
         // ((CCParticleSystemQuad) node).EmitterMode = (CCEmitterMode) pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeIntegerLabeled(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_EMITERMODE)
     {
         // FIX ME: We want to set EmitterMode only during construction of particle System
         // For now we will comment this out
         // ((CCParticleSystemQuad) node).EmitterMode = (CCEmitterMode) pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeIntegerLabeled(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
Exemplo n.º 29
0
 protected override void OnHandlePropTypeSize(CCNode node, CCNode parent, string propertyName, CCSize pSize, CCBReader reader)
 {
     if (propertyName == PROPERTY_CONTENTSIZE)
     {
         //((CCScale9Sprite )node).setContentSize(pSize);
     }
     else if (propertyName == PROPERTY_PREFEREDSIZE)
     {
         ((CCScale9Sprite) node).PreferredSize = pSize;
     }
     else
     {
         base.OnHandlePropTypeSize(node, parent, propertyName, pSize, reader);
     }
 }
Exemplo n.º 30
0
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTCOLOR)
     {
         ((CCLayerGradient) node).StartColor = color;
     }
     else if (propertyName == PROPERTY_ENDCOLOR)
     {
         ((CCLayerGradient) node).EndColor = color;
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 31
0
 protected override void OnHandlePropTypeByte(CCNode node, CCNode parent, string propertyName, byte pByte, CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTOPACITY)
     {
         ((CCLayerGradient) node).StartOpacity = pByte;
     }
     else if (propertyName == PROPERTY_ENDOPACITY)
     {
         ((CCLayerGradient) node).EndOpacity = pByte;
     }
     else
     {
         base.OnHandlePropTypeByte(node, parent, propertyName, pByte, reader);
     }
 }
Exemplo n.º 32
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_ENABLED)
     {
         ((CCControl) node).Enabled = pCheck;
     }
     else if (propertyName == PROPERTY_SELECTED)
     {
         ((CCControl) node).Selected = pCheck;
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
 protected override void OnHandlePropTypeFloat(CCNode node, CCNode parent, string propertyName, float pFloat, CCBReader reader)
 {
     if (propertyName == PROPERTY_EMISSIONRATE)
     {
         ((CCParticleSystemQuad) node).EmissionRate = pFloat;
     }
     else if (propertyName == PROPERTY_DURATION)
     {
         ((CCParticleSystemQuad) node).Duration = pFloat;
     }
     else
     {
         base.OnHandlePropTypeFloat(node, parent, propertyName, pFloat, reader);
     }
 }
 protected override void OnHandlePropTypePoint(CCNode node, CCNode parent, string propertyName, CCPoint point, CCBReader reader)
 {
     if (propertyName == PROPERTY_POSVAR)
     {
         ((CCParticleSystemQuad) node).PositionVar = point;
     }
     else if (propertyName == PROPERTY_GRAVITY)
     {
         ((CCParticleSystemQuad) node).Gravity = point;
     }
     else
     {
         base.OnHandlePropTypePoint(node, parent, propertyName, point, reader);
     }
 }
Exemplo n.º 35
0
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_HORIZONTALALIGNMENT)
     {
         ((CCLabelTtf)node).HorizontalAlignment = (CCTextAlignment)pIntegerLabeled;
     }
     else if (propertyName == PROPERTY_VERTICALALIGNMENT)
     {
         ((CCLabelTtf)node).VerticalAlignment = (CCVerticalTextAlignment)pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeFloatScale(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
 protected override void OnHandlePropTypeColor4FVar(CCNode node, CCNode parent, string propertyName, CCColor4F[] colorVar,
                                                    CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTCOLOR)
     {
         ((CCParticleSystemQuad) node).StartColor = (colorVar[0]);
         ((CCParticleSystemQuad) node).StartColorVar = (colorVar[1]);
     }
     else if (propertyName == PROPERTY_ENDCOLOR)
     {
         ((CCParticleSystemQuad) node).EndColor = (colorVar[0]);
         ((CCParticleSystemQuad) node).EndColorVar = (colorVar[1]);
     }
     else
     {
         base.OnHandlePropTypeColor4FVar(node, parent, propertyName, colorVar, reader);
     }
 }
Exemplo n.º 37
0
 protected override void OnHandlePropTypeColor4FVar(CCNode node, CCNode parent, string propertyName, CCColor4F[] colorVar,
                                                    CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTCOLOR)
     {
         ((CCParticleSystemQuad)node).StartColor    = (colorVar[0]);
         ((CCParticleSystemQuad)node).StartColorVar = (colorVar[1]);
     }
     else if (propertyName == PROPERTY_ENDCOLOR)
     {
         ((CCParticleSystemQuad)node).EndColor    = (colorVar[0]);
         ((CCParticleSystemQuad)node).EndColorVar = (colorVar[1]);
     }
     else
     {
         base.OnHandlePropTypeColor4FVar(node, parent, propertyName, colorVar, reader);
     }
 }
Exemplo n.º 38
0
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_DISPLAYFRAME)
     {
         if (spriteFrame != null)
         {
             ((CCSprite) node).SpriteFrame = spriteFrame;
         }
         else
         {
             CCLog.Log("ERROR: SpriteFrame NULL");
         }
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 39
0
 protected override void OnHandlePropTypeFloatScale(CCNode node, CCNode parent, string propertyName, float floatScale, CCBReader reader)
 {
     if (propertyName == PROPERTY_TITLETTFSIZE_NORMAL)
     {
         ((CCControlButton) node).SetTitleTtfSizeForState(floatScale, CCControlState.Normal);
     }
     else if (propertyName == PROPERTY_TITLETTFSIZE_HIGHLIGHTED)
     {
         ((CCControlButton) node).SetTitleTtfSizeForState(floatScale, CCControlState.Highlighted);
     }
     else if (propertyName == PROPERTY_TITLETTFSIZE_DISABLED)
     {
         ((CCControlButton) node).SetTitleTtfSizeForState(floatScale, CCControlState.Disabled);
     }
     else
     {
         base.OnHandlePropTypeFloatScale(node, parent, propertyName, floatScale, reader);
     }
 }
Exemplo n.º 40
0
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_TITLECOLOR_NORMAL)
     {
         ((CCControlButton) node).SetTitleColorForState(color, CCControlState.Normal);
     }
     else if (propertyName == PROPERTY_TITLECOLOR_HIGHLIGHTED)
     {
         ((CCControlButton) node).SetTitleColorForState(color, CCControlState.Highlighted);
     }
     else if (propertyName == PROPERTY_TITLECOLOR_DISABLED)
     {
         ((CCControlButton) node).SetTitleColorForState(color, CCControlState.Disabled);
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 41
0
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_DISPLAYFRAME)
     {
         if (spriteFrame != null)
         {
             ((CCSprite)node).SpriteFrame = spriteFrame;
         }
         else
         {
             CCLog.Log("ERROR: SpriteFrame NULL");
         }
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
Exemplo n.º 42
0
        public override void runThisTest()
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("HelloCocosBuilderLayer", new Loader <HelloCocosBuilderLayer>());

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            CCNode node = ccbReader.ReadNodeGraphFromFile("ccb/HelloCocosBuilder.ccbi", this);

            if (node != null)
            {
                AddChild(node);
            }

            CCDirector.SharedDirector.ReplaceScene(this);
        }
Exemplo n.º 43
0
        public void onAnimationsTestClicked(object pSender, CCControlEvent pCCControlEvent)
        {
            // Load node graph (TestAnimations is a sub class of CCLayer) and retrieve the ccb action manager
            CCBAnimationManager actionManager = null;

            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader <TestHeaderLayer>());
            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestAnimationsLayer", new Loader <AnimationsTestLayer>());


            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            // Load the scene from the ccbi-file, setting this class as
            // the owner will cause lblTestTitle to be set by the CCBReader.
            // lblTestTitle is in the TestHeader.ccbi, which is referenced
            // from each of the test scenes.
            CCNode animationsTest = ccbReader.ReadNodeGraphFromFile("ccb/ccb/TestAnimations.ccbi", this);

            ((AnimationsTestLayer)animationsTest).setAnimationManager(ccbReader.AnimationManager);

            mTestTitleLabelTTF.Text = ("TestAnimations.ccbi");

            CCScene scene = new CCScene(Scene);

            scene.AddChild(animationsTest);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor = new CCColor3B();

            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
Exemplo n.º 44
0
 protected override void OnHandlePropTypeFloat(CCNode node, CCNode parent, string propertyName, float pFloat, CCBReader reader)
 {
     if (propertyName == PROPERTY_INSETLEFT)
     {
         ((CCScale9Sprite) node).InsetLeft = pFloat;
     }
     else if (propertyName == PROPERTY_INSETTOP)
     {
         ((CCScale9Sprite) node).InsetTop = pFloat;
     }
     else if (propertyName == PROPERTY_INSETRIGHT)
     {
         ((CCScale9Sprite) node).InsetRight = pFloat;
     }
     else if (propertyName == PROPERTY_INSETBOTTOM)
     {
         ((CCScale9Sprite) node).InsetBottom = pFloat;
     }
     else
     {
         base.OnHandlePropTypeFloat(node, parent, propertyName, pFloat, reader);
     }
 }
Exemplo n.º 45
0
        public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader <TestHeaderLayer>());
            if (pCCNodeName != null && pCCNodeLoader != null)
            {
                ccNodeLoaderLibrary.RegisterCCNodeLoader(pCCNodeName, pCCNodeLoader);
            }

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            // Load the scene from the ccbi-file, setting this class as
            // the owner will cause lblTestTitle to be set by the CCBReader.
            // lblTestTitle is in the TestHeader.ccbi, which is referenced
            // from each of the test scenes.
            CCNode node = ccbReader.ReadNodeGraphFromFile(pCCBFileName, this);

            mTestTitleLabelTTF.Text = (pCCBFileName);

            CCScene scene = new CCScene(Scene);

            scene.AddChild(node);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor = new CCColor3B();

            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
Exemplo n.º 46
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_ZOOMONTOUCHDOWN)
     {
         ((CCControlButton)node).ZoomOnTouchDown = pCheck;
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
Exemplo n.º 47
0
 protected override void OnHandlePropTypeSize(CCNode node, CCNode parent, string propertyName, CCSize pSize, CCBReader reader)
 {
     if (propertyName == PROPERTY_CONTENTSIZE)
     {
         //((CCScale9Sprite )node).setContentSize(pSize);
     }
     else if (propertyName == PROPERTY_PREFEREDSIZE)
     {
         ((CCScale9Sprite)node).PreferredSize = pSize;
     }
     else
     {
         base.OnHandlePropTypeSize(node, parent, propertyName, pSize, reader);
     }
 }
Exemplo n.º 48
0
 protected override void OnHandlePropTypeFloat(CCNode node, CCNode parent, string propertyName, float pFloat, CCBReader reader)
 {
     if (propertyName == PROPERTY_INSETLEFT)
     {
         ((CCScale9Sprite)node).InsetLeft = pFloat;
     }
     else if (propertyName == PROPERTY_INSETTOP)
     {
         ((CCScale9Sprite)node).InsetTop = pFloat;
     }
     else if (propertyName == PROPERTY_INSETRIGHT)
     {
         ((CCScale9Sprite)node).InsetRight = pFloat;
     }
     else if (propertyName == PROPERTY_INSETBOTTOM)
     {
         ((CCScale9Sprite)node).InsetBottom = pFloat;
     }
     else
     {
         base.OnHandlePropTypeFloat(node, parent, propertyName, pFloat, reader);
     }
 }
Exemplo n.º 49
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_TOUCH_ENABLED)
     {
         //((CCLayer) node).TouchEnabled = pCheck;
     }
     else if (propertyName == PROPERTY_ACCELEROMETER_ENABLED)
     {
         //((CCLayer) node).AccelerometerEnabled = pCheck;
     }
     else if (propertyName == PROPERTY_MOUSE_ENABLED)
     {
         // TODO XXX
         CCLog.Log("The property '{0}' is not supported!", PROPERTY_MOUSE_ENABLED);
     }
     else if (propertyName == PROPERTY_KEYBOARD_ENABLED)
     {
         // TODO XXX
         CCLog.Log("The property '{0}' is not supported!", PROPERTY_KEYBOARD_ENABLED);
         // This comes closest: ((CCLayer *)node).setKeypadEnabled(pCheck);
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
 protected override void OnHandlePropTypeFlip(CCNode node, CCNode parent, string propertyName, bool[] pFlip, CCBReader reader)
 {
     if (propertyName == PROPERTY_FLIP)
     {
         ((CCSprite)node).FlipX = pFlip[0];
         ((CCSprite)node).FlipY = pFlip[1];
     }
     else
     {
         base.OnHandlePropTypeFlip(node, parent, propertyName, pFlip, reader);
     }
 }
Exemplo n.º 51
0
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_TITLECOLOR_NORMAL)
     {
         ((CCControlButton)node).SetTitleColorForState(color, CCControlState.Normal);
     }
     else if (propertyName == PROPERTY_TITLECOLOR_HIGHLIGHTED)
     {
         ((CCControlButton)node).SetTitleColorForState(color, CCControlState.Highlighted);
     }
     else if (propertyName == PROPERTY_TITLECOLOR_DISABLED)
     {
         ((CCControlButton)node).SetTitleColorForState(color, CCControlState.Disabled);
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 52
0
 protected override void OnHandlePropTypeFntFile(CCNode node, CCNode parent, string propertyName, string pFntFile, CCBReader reader)
 {
     if (propertyName == PROPERTY_FNTFILE)
     {
         ((CCLabelBMFont)node).FntFile = pFntFile;
     }
     else
     {
         base.OnHandlePropTypeFntFile(node, parent, propertyName, pFntFile, reader);
     }
 }
Exemplo n.º 53
0
 protected override void OnHandlePropTypeText(CCNode node, CCNode parent, string propertyName, string pText, CCBReader reader)
 {
     if (propertyName == PROPERTY_STRING)
     {
         ((CCLabelBMFont)node).Text = (pText);
     }
     else
     {
         base.OnHandlePropTypeText(node, parent, propertyName, pText, reader);
     }
 }
Exemplo n.º 54
0
 protected override void OnHandlePropTypeByte(CCNode node, CCNode parent, string propertyName, byte pByte, CCBReader reader)
 {
     if (propertyName == PROPERTY_OPACITY)
     {
         ((CCLabelBMFont)node).Opacity = pByte;
     }
     else
     {
         base.OnHandlePropTypeByte(node, parent, propertyName, pByte, reader);
     }
 }
Exemplo n.º 55
0
 protected override void OnHandlePropTypeCCBFile(CCNode node, CCNode parent, string propertyName, CCNode fileNode, CCBReader reader)
 {
     if (propertyName == PROPERTY_CCBFILE)
     {
         ((CCBFile)node).FileNode = fileNode;
     }
     else
     {
         base.OnHandlePropTypeCCBFile(node, parent, propertyName, fileNode, reader);
     }
 }
Exemplo n.º 56
0
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_COLOR)
     {
         ((CCLabelBMFont)node).Color = color;
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 57
0
 protected override void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTCOLOR)
     {
         ((CCLayerGradient)node).StartColor = color;
     }
     else if (propertyName == PROPERTY_ENDCOLOR)
     {
         ((CCLayerGradient)node).EndColor = color;
     }
     else
     {
         base.OnHandlePropTypeColor3(node, parent, propertyName, color, reader);
     }
 }
Exemplo n.º 58
0
 protected override void OnHandlePropTypeByte(CCNode node, CCNode parent, string propertyName, byte pByte, CCBReader reader)
 {
     if (propertyName == PROPERTY_STARTOPACITY)
     {
         ((CCLayerGradient)node).StartOpacity = pByte;
     }
     else if (propertyName == PROPERTY_ENDOPACITY)
     {
         ((CCLayerGradient)node).EndOpacity = pByte;
     }
     else
     {
         base.OnHandlePropTypeByte(node, parent, propertyName, pByte, reader);
     }
 }
Exemplo n.º 59
0
        protected override void OnHandlePropTypePoint(CCNode node, CCNode parent, string propertyName, CCPoint point, CCBReader reader)
        {
            if (propertyName == PROPERTY_VECTOR)
            {
                ((CCLayerGradient)node).Vector = point;

                // TODO Not passed along the ccbi file.
                // ((CCLayerGradient *)node).setCompressedInterpolation(true);
            }
            else
            {
                base.OnHandlePropTypePoint(node, parent, propertyName, point, reader);
            }
        }
Exemplo n.º 60
0
 protected override void OnHandlePropTypeFloatScale(CCNode node, CCNode parent, string propertyName, float floatScale, CCBReader reader)
 {
     if (propertyName == PROPERTY_TITLETTFSIZE_NORMAL)
     {
         ((CCControlButton)node).SetTitleTtfSizeForState(floatScale, CCControlState.Normal);
     }
     else if (propertyName == PROPERTY_TITLETTFSIZE_HIGHLIGHTED)
     {
         ((CCControlButton)node).SetTitleTtfSizeForState(floatScale, CCControlState.Highlighted);
     }
     else if (propertyName == PROPERTY_TITLETTFSIZE_DISABLED)
     {
         ((CCControlButton)node).SetTitleTtfSizeForState(floatScale, CCControlState.Disabled);
     }
     else
     {
         base.OnHandlePropTypeFloatScale(node, parent, propertyName, floatScale, reader);
     }
 }