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

C# cocos2d.CCBReader类代码示例

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

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



CCBReader类属于cocos2d命名空间,在下文中一共展示了CCBReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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:HarkDev,项目名称:cocos2d-xna,代码行数:35,代码来源:HelloCocosBuilder.cs


示例2: runThisTest

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


示例3: 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:HarkDev,项目名称:cocos2d-xna,代码行数:29,代码来源:CCMenuItemImageLoader.cs


示例4: 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:eickegao,项目名称:cocos2d-xna,代码行数:11,代码来源:CCScrollViewLoader.cs


示例5: 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:eickegao,项目名称:cocos2d-xna,代码行数:11,代码来源:CCScrollViewLoader.cs


示例6: 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:HarkDev,项目名称:cocos2d-xna,代码行数:11,代码来源:CCMenuItemLoader.cs


示例7: 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:eickegao,项目名称:cocos2d-xna,代码行数:12,代码来源:CCScrollViewLoader.cs


示例8: 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:eickegao,项目名称:cocos2d-xna,代码行数:12,代码来源:CCScrollViewLoader.cs


示例9: 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:HarkDev,项目名称:cocos2d-xna,代码行数:14,代码来源:CCMenuItemLoader.cs


示例10: 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:eickegao,项目名称:cocos2d-xna,代码行数:15,代码来源:CCScrollViewLoader.cs


示例11: ParsePropTypeScaleLock

        protected virtual float[] ParsePropTypeScaleLock(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            float x = reader.ReadFloat();
            float y = reader.ReadFloat();

            var type = (kCCBScaleType) reader.ReadInt(false);

            CCBHelper.SetRelativeScale(node, x, y, type, propertyName);

            if (reader.AnimatedProperties.Contains(propertyName))
            {
                var baseValue = new List<CCBValue>
                    {
                        CCBValue.Create(x),
                        CCBValue.Create(y),
                        CCBValue.Create((int) type)
                    };
                reader.AnimationManager.SetBaseValue(baseValue, node, propertyName);
            }

            if (type == kCCBScaleType.kCCBScaleTypeMultiplyResolution)
            {
                x *= CCBReader.ResolutionScale;
                y *= CCBReader.ResolutionScale;
            }

            var scaleLock = new float[2];
            scaleLock[0] = x;
            scaleLock[1] = y;

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


示例12: ParsePropTypePosition

        protected virtual CCPoint ParsePropTypePosition(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            float x = reader.ReadFloat();
            float y = reader.ReadFloat();

            var type = (kCCBPositionType) reader.ReadInt(false);

            CCSize containerSize = reader.AnimationManager.GetContainerSize(parent);

            CCPoint pt = CCBHelper.GetAbsolutePosition(new CCPoint(x, y), type, containerSize, propertyName);
            node.Position = CCBHelper.GetAbsolutePosition(pt, type, containerSize, propertyName);

            if (reader.AnimatedProperties.Contains(propertyName))
            {
                var baseValue = new List<CCBValue>
                    {
                        CCBValue.Create(x),
                        CCBValue.Create(y),
                        CCBValue.Create((int) type)
                    };
                reader.AnimationManager.SetBaseValue(baseValue, node, propertyName);
            }

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


示例13: ParsePropTypePointLock

        protected virtual CCPoint ParsePropTypePointLock(CCNode node, CCNode parent, CCBReader reader)
        {
            float x = reader.ReadFloat();
            float y = reader.ReadFloat();

            return new CCPoint(x, y);
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:7,代码来源:CCNodeLoader.cs


示例14: ParsePropTypeIntegerLabeled

 protected virtual int ParsePropTypeIntegerLabeled(CCNode node, CCNode parent, CCBReader reader)
 {
     return reader.ReadInt(true);
 }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:4,代码来源:CCNodeLoader.cs


示例15: ParsePropTypeCheck

        protected virtual bool ParsePropTypeCheck(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            bool ret = reader.ReadBool();

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

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


示例16: 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:homocury,项目名称:cocos2d-xna,代码行数:24,代码来源:CCNodeLoader.cs


示例17: ParsePropTypeBlock

        protected virtual BlockData ParsePropTypeBlock(CCNode node, CCNode parent, CCBReader reader)
        {
            string selectorName = reader.ReadCachedString();
            var selectorTarget = (kCCBTargetType) reader.ReadInt(false);

            if (selectorTarget != kCCBTargetType.kCCBTargetTypeNone)
            {
                object target = null;
                if (selectorTarget == kCCBTargetType.kCCBTargetTypeDocumentRoot)
                {
                    target = reader.AnimationManager.RootNode;
                }
                else if (selectorTarget == kCCBTargetType.kCCBTargetTypeOwner)
                {
                    target = reader.Owner;

                    /* Scripting specific code because selector function is common for all callbacks.
                     * So if we had 1 target and 1 selector function, the context (callback function name)
                     * would get lost. Hence the need for a new target for each callback.
                     */
                    if (reader.hasScriptingOwner)
                    {
                        var proxy = (CCBScriptOwnerProtocol) reader.Owner;
                        if (proxy != null)
                        {
                            target = proxy.CreateNew() as object;
                        }
                    }
                }

                if (target != null)
                {
                    if (selectorName.Length > 0)
                    {
                        SEL_MenuHandler selMenuHandler = null;

                        var targetAsCCBSelectorResolver = target as CCBSelectorResolver;

                        if (targetAsCCBSelectorResolver != null)
                        {
                            selMenuHandler = targetAsCCBSelectorResolver.OnResolveCCBCCMenuItemSelector(target, selectorName);
                        }
                        if (selMenuHandler == null)
                        {
                            CCBSelectorResolver ccbSelectorResolver = reader.SelectorResolver;
                            if (ccbSelectorResolver != null)
                            {
                                selMenuHandler = ccbSelectorResolver.OnResolveCCBCCMenuItemSelector(target, selectorName);
                            }
                        }

                        if (selMenuHandler == null)
                        {
                            CCLog.Log("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName);
                        }
                        else
                        {
                            var blockData = new BlockData();
                            blockData.mSELMenuHandler = selMenuHandler;

                            blockData.mTarget = target;

                            return blockData;
                        }
                    }
                    else
                    {
                        CCLog.Log("Unexpected empty selector.");
                    }
                }
                else
                {
                    CCLog.Log("Unexpected NULL target for selector.");
                }
            }

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


示例18: ParsePropTypeFloatScale

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

            int type = reader.ReadInt(false);

            if ((kCCBScaleType) type == kCCBScaleType.kCCBScaleTypeMultiplyResolution)
            {
                f *= CCBReader.ResolutionScale;
            }

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


示例19: 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(CCBValue.Create(ret), node, propertyName);
            }

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


示例20: ParsePropTypeFlip

        protected virtual bool[] ParsePropTypeFlip(CCNode node, CCNode parent, CCBReader reader)
        {
            bool flipX = reader.ReadBool();
            bool flipY = reader.ReadBool();

            var arr = new bool[2];
            arr[0] = flipX;
            arr[1] = flipY;

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# cocos2d.CCLabelTTF类代码示例发布时间:2022-05-26
下一篇:
C# cocos2d.CCActionInterval类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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