• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cocos2D.CCBReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Cocos2D.CCBReader的典型用法代码示例。如果您正苦于以下问题:C# CCBReader类的具体用法?C# CCBReader怎么用?C# CCBReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CCBReader类属于Cocos2D命名空间,在下文中一共展示了CCBReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
     }
 }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:29,代码来源:CCMenuItemImageLoader.cs


示例2: openTest

        public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = CCNodeLoaderLibrary.NewDefaultCCNodeLoaderLibrary();

            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.Label = (pCCBFileName);

            CCScene scene = new CCScene();
            scene.AddChild(node);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor;
            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            CCDirector.SharedDirector.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:34,代码来源:HelloCocosBuilder.cs


示例3: 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);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCScrollViewLoader.cs


示例4: 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);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCScrollViewLoader.cs


示例5: 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);
     }
 }
开发者ID:liwq-net,项目名称:UIFactory,代码行数:11,代码来源:CCMenuItemLoader.cs


示例6: OnHandlePropTypeCCBFile

 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);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:12,代码来源:CCScrollViewLoader.cs


示例7: OnHandlePropTypeIntegerLabeled

 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);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:12,代码来源:CCScrollViewLoader.cs


示例8: OnHandlePropTypeBlock

 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);
     }
 }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:14,代码来源:CCMenuItemLoader.cs


示例9: OnHandlePropTypeCheck

 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_CLIPSTOBOUNDS)
     {
         ((CCScrollView) node).ClippingToBounds = pCheck;
     }
     else if (propertyName == PROPERTY_BOUNCES)
     {
         ((CCScrollView) node).Bounceable = pCheck;
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:15,代码来源:CCScrollViewLoader.cs


示例10: runThisTest

        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);
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:20,代码来源:CocosBuilderTest.cs


示例11: onAnimationsTestClicked

        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 = CCNodeLoaderLibrary.NewDefaultCCNodeLoaderLibrary();

            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, ref actionManager);
            ((AnimationsTestLayer) animationsTest).setAnimationManager(actionManager);

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

            CCScene scene = new CCScene();
            scene.AddChild(animationsTest);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor;
            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            CCDirector.SharedDirector.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:36,代码来源:HelloCocosBuilder.cs


示例12: ParsePropTypeTexture

        protected virtual CCTexture2D ParsePropTypeTexture(CCNode node, CCNode parent, CCBReader reader)
        {
            string spriteFile = reader.ReadCachedString();

            if (!String.IsNullOrEmpty(spriteFile))
            {
                return CCTextureCache.SharedTextureCache.AddImage(CCFileUtils.RemoveExtension(spriteFile));
            }
            return null;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:10,代码来源:CCNodeLoader.cs


示例13: ParsePropTypeAnimation

        protected virtual CCAnimation ParsePropTypeAnimation(CCNode node, CCNode parent, CCBReader reader)
        {
            string animationFile = reader.ReadCachedString();
            string animation = reader.ReadCachedString();

            CCAnimation ccAnimation = null;

            // Support for stripping relative file paths, since ios doesn't currently
            // know what to do with them, since its pulling from bundle.
            // Eventually this should be handled by a client side asset manager
            // interface which figured out what resources to load.
            // TODO Does this problem exist in C++?
            animation = CCBReader.LastPathComponent(animation);
            animationFile = CCBReader.LastPathComponent(animationFile);

            if (!String.IsNullOrEmpty(animation))
            {
                CCAnimationCache animationCache = CCAnimationCache.SharedAnimationCache;
                animationCache.AddAnimationsWithFile(animationFile);

                ccAnimation = animationCache.AnimationByName(animation);
            }
            return ccAnimation;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:24,代码来源:CCNodeLoader.cs


示例14: ParsePropTypeByte

        protected virtual byte ParsePropTypeByte(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            byte ret = reader.ReadByte();

            if (reader.AnimatedProperties.Contains(propertyName))
            {
                reader.AnimationManager.SetBaseValue(new CCBValue(ret), node, propertyName);
            }

            return ret;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:11,代码来源:CCNodeLoader.cs


示例15: ParsePropTypeBlockCcControl

        protected virtual BlockCCControlData ParsePropTypeBlockCcControl(CCNode node, CCNode parent, CCBReader reader)
        {
            string selectorName = reader.ReadCachedString();
            var selectorTarget = (CCBTargetType) reader.ReadInt(false);
            var controlEvents = (CCControlEvent) reader.ReadInt(false);

            if (selectorTarget != CCBTargetType.None)
            {
                if (!reader.IsJSControlled())
                {
                    object target = null;
                    if (selectorTarget == CCBTargetType.DocumentRoot)
                    {
                        target = reader.AnimationManager.RootNode;
                    }
                    else if (selectorTarget == CCBTargetType.Owner)
                    {
                        target = reader.Owner;
                    }

                    if (target != null)
                    {
                        if (selectorName.Length > 0)
                        {
                            Action<object, CCControlEvent> selCCControlHandler = null;

                            var targetAsCCBSelectorResolver = target as ICCBSelectorResolver;
                            if (targetAsCCBSelectorResolver != null)
                            {
                                selCCControlHandler = targetAsCCBSelectorResolver.OnResolveCCBCCControlSelector(target,
                                                                                                                selectorName);
                            }
                            if (selCCControlHandler == null)
                            {
                                ICCBSelectorResolver ccbSelectorResolver = reader.SelectorResolver;
                                if (ccbSelectorResolver != null)
                                {
                                    selCCControlHandler = ccbSelectorResolver.OnResolveCCBCCControlSelector(target,
                                                                                                            selectorName);
                                }
                            }

                            if (selCCControlHandler == null)
                            {
                                CCLog.Log("Skipping selector '{0}' since no CCBSelectorResolver is present.",
                                          selectorName);
                            }
                            else
                            {
                                var blockCCControlData = new BlockCCControlData();
                                blockCCControlData.mSELCCControlHandler = selCCControlHandler;

                                blockCCControlData.mTarget = target;
                                blockCCControlData.mControlEvents = controlEvents;

                                return blockCCControlData;
                            }
                        }
                        else
                        {
                            CCLog.Log("Unexpected empty selector.");
                        }
                    }
                    else
                    {
                        CCLog.Log("Unexpected NULL target for selector.");
                    }
                }
                else
                {
                    if (selectorTarget == CCBTargetType.DocumentRoot)
                    {
                        reader.AddDocumentCallbackNode(node);
                        reader.AddDocumentCallbackName(selectorName);

                    }
                    else
                    {
                        reader.AddOwnerCallbackNode(node);
                        reader.AddOwnerCallbackName(selectorName);
                    }
                }
            }

            return null;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:86,代码来源:CCNodeLoader.cs


示例16: ParsePropTypeFontTTF

        protected virtual string ParsePropTypeFontTTF(CCNode node, CCNode parent, CCBReader reader)
        {
            string fontTTF = reader.ReadCachedString();

            // CCString * ttfEnding = ".ttf";

            // TODO Fix me if it is wrong
            /* If the fontTTF comes with the ".ttf" extension, prepend the absolute path. 
             * System fonts come without the ".ttf" extension and do not need the path prepended. */
            /*
            if(CCBReader.endsWith(CCBReader.toLowerCase(fontTTF), ttfEnding)){
                fontTTF = CCBReader.concat(reader.getCCBRootPath(), fontTTF);
            }
             */

            return fontTTF;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:17,代码来源:CCNodeLoader.cs


示例17: ParsePropTypeBlendFunc

        protected virtual CCBlendFunc ParsePropTypeBlendFunc(CCNode node, CCNode parent, CCBReader reader)
        {
            int source = reader.ReadInt(false);
            int destination = reader.ReadInt(false);

            CCBlendFunc blendFunc;
            blendFunc.Source = source;
            blendFunc.Destination = destination;

            return blendFunc;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:11,代码来源:CCNodeLoader.cs


示例18: ParsePropTypeColor4FVar

        protected virtual CCColor4F[] ParsePropTypeColor4FVar(CCNode node, CCNode parent, CCBReader reader)
        {
            float red = reader.ReadFloat();
            float green = reader.ReadFloat();
            float blue = reader.ReadFloat();
            float alpha = reader.ReadFloat();
            float redVar = reader.ReadFloat();
            float greenVar = reader.ReadFloat();
            float blueVar = reader.ReadFloat();
            float alphaVar = reader.ReadFloat();

            var colors = new CCColor4F[2];
            colors[0].R = red;
            colors[0].G = green;
            colors[0].B = blue;
            colors[0].A = alpha;

            colors[1].R = redVar;
            colors[1].G = greenVar;
            colors[1].B = blueVar;
            colors[1].A = alphaVar;

            return colors;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:24,代码来源:CCNodeLoader.cs


示例19: ParsePropTypeColor3

        protected virtual CCColor3B ParsePropTypeColor3(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            byte red = reader.ReadByte();
            byte green = reader.ReadByte();
            byte blue = reader.ReadByte();

            var color = new CCColor3B(red, green, blue);
            if (reader.AnimatedProperties.Contains(propertyName))
            {
                CCColor3BWapper value = new CCColor3BWapper(color);
                reader.AnimationManager.SetBaseValue(value, node, propertyName);
            }
            return color;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:14,代码来源:CCNodeLoader.cs


示例20: ParsePropTypeFloatScale

        protected virtual float ParsePropTypeFloatScale(CCNode node, CCNode parent, CCBReader reader)
        {
            float f = reader.ReadFloat();

            int type = reader.ReadInt(false);

            if ((CCBScaleType) type == CCBScaleType.MultiplyResolution)
            {
                f *= CCBReader.ResolutionScale;
            }

            return f;
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:13,代码来源:CCNodeLoader.cs



注:本文中的Cocos2D.CCBReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cocos2D.CCColor3B类代码示例发布时间:2022-05-24
下一篇:
C# MobileAPI.BaseMessage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap