当前位置: 首页>>代码示例>>C#>>正文


C# CCBReader.ReadFloat方法代码示例

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


在下文中一共展示了CCBReader.ReadFloat方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: ParsePropTypeFloatVar

        protected virtual float[] ParsePropTypeFloatVar(CCNode node, CCNode parent, CCBReader reader)
        {
            float f = reader.ReadFloat();
            float fVar = reader.ReadFloat();

            var arr = new float[2];
            arr[0] = f;
            arr[1] = fVar;

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

示例4: ParsePropTypeFloat

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

示例5: ParsePropTypeDegrees

        protected virtual float ParsePropTypeDegrees(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            float ret = reader.ReadFloat();
            if (reader.AnimatedProperties.Contains(propertyName))
            {
                CCBValue value = new CCBValue(ret);
                reader.AnimationManager.SetBaseValue(value, node, propertyName);
            }

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

示例6: ParsePropTypeScaleLock

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

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

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

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

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

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

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

示例7: ParsePropTypeSize

        protected virtual CCSize ParsePropTypeSize(CCNode node, CCNode parent, CCBReader reader)
        {
            float width = reader.ReadFloat();
            float height = reader.ReadFloat();

            int type = reader.ReadInt(false);

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

            switch ((SizeType) type)
            {
                case SizeType.Absolute:
                    {
                        /* Nothing. */
                        break;
                    }
                case SizeType.RelativeContainer:
                    {
                        width = containerSize.Width - width;
                        height = containerSize.Height - height;
                        break;
                    }
                case SizeType.Percent:
                    {
                        width = (int) (containerSize.Width * width / 100.0f);
                        height = (int) (containerSize.Height * height / 100.0f);
                        break;
                    }
                case SizeType.HorizontalPercent:
                    {
                        width = (int) (containerSize.Width * width / 100.0f);
                        break;
                    }
                case SizeType.VerticalPercent:
                    {
                        height = (int) (containerSize.Height * height / 100.0f);
                        break;
                    }
                case SizeType.MultiplyResolution:
                    {
                        float resolutionScale = CCBReader.ResolutionScale;

                        width *= resolutionScale;
                        height *= resolutionScale;
                        break;
                    }
                default:
                    {
                        CCLog.Log("Unknown CCB type.");
                    }
                    break;
            }

            return new CCSize(width, height);
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:55,代码来源:CCNodeLoader.cs

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

示例9: ParsePropTypePosition

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

            var type = (CCBPositionType) 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>
                    {
                        new CCBValue(x),
                        new CCBValue(y),
                        new CCBValue((int) type)
                    };
                reader.AnimationManager.SetBaseValue(baseValue, node, propertyName);
            }

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

示例10: ParsePropTypeFloatXY

        protected virtual float[] ParsePropTypeFloatXY(CCNode pNode, CCNode pParent, CCBReader ccbReader)
        {
            float x = ccbReader.ReadFloat();
            float y = ccbReader.ReadFloat();

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

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


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