ReadFloat() public static méthode

public static ReadFloat ( byte data, Cursor cursor ) : float
data byte
cursor Cursor
Résultat float
Exemple #1
0
        public static Vector2 ReadVector2(byte[] data, Cursor cursor)
        {
            Vector2 retVal = new Vector2();

            retVal.x = Utils.ReadFloat(data, cursor);
            retVal.y = Utils.ReadFloat(data, cursor);
            return(retVal);
        }
Exemple #2
0
        public TagPlaceObject(Flash flash, byte[] data, Cursor cursor)
        {
            this.flash = flash;
            int dataLength = Utils.ReadInt32(data, cursor);
            int nextIndex  = cursor.index + dataLength;

            //parse
            hasMatrix         = Utils.ReadByte(data, cursor) != 0;
            hasMove           = Utils.ReadByte(data, cursor) != 0;
            hasCharacter      = Utils.ReadByte(data, cursor) != 0;
            hasColorTransform = Utils.ReadByte(data, cursor) != 0;
            bool hasName = Utils.ReadByte(data, cursor) != 0;

            hasVisible = Utils.ReadByte(data, cursor) != 0;
            depth      = Utils.ReadInt32(data, cursor);

            if (hasCharacter)
            {
                characterId = Utils.ReadInt32(data, cursor);
            }

            if (hasMatrix)
            {
                position = Utils.ReadVector2(data, cursor);
                rotation = Utils.ReadFloat(data, cursor);
                scaleX   = Utils.ReadFloat(data, cursor);
                scaleY   = Utils.ReadFloat(data, cursor);
            }
            else
            {
                position = Vector2.zero;
                rotation = 0;
                scaleX   = 1;
                scaleY   = 1;
            }
            if (hasVisible)
            {
                visible = Utils.ReadByte(data, cursor) != 0;
            }

            if (hasColorTransform)
            {
                colorTransform = Utils.ReadColorTransform(data, cursor);
            }
            else
            {
                colorTransform = ColorTransform.Default;
            }

            if (hasName)
            {
                instanceName = Utils.ReadString(data, cursor);
            }

            cursor.index = nextIndex;
        }
Exemple #3
0
        public static Color ReadColor4f(byte[] data, Cursor cursor)
        {
            Color color = new Color();

            color.r = Utils.ReadFloat(data, cursor);
            color.g = Utils.ReadFloat(data, cursor);
            color.b = Utils.ReadFloat(data, cursor);
            color.a = Utils.ReadFloat(data, cursor);
            return(color);
        }
Exemple #4
0
        public static Rect ReadRect(byte[] data, Cursor cursor)
        {
            Rect retVal = new Rect();

            retVal.x      = Utils.ReadFloat(data, cursor);
            retVal.y      = Utils.ReadFloat(data, cursor);
            retVal.width  = Utils.ReadFloat(data, cursor);
            retVal.height = Utils.ReadFloat(data, cursor);
            return(retVal);
        }
Exemple #5
0
        public static ColorTransform ReadColorTransform(byte[] data, Cursor cursor)
        {
            ColorTransform ctr   = new ColorTransform();
            int            mtype = Utils.ReadInt32(data, cursor);

            if (mtype == 1)
            {
                ctr.tint = new Color(1, 1, 1, 1);
            }
            else if (mtype == 2)
            {
                Color color = new Color();
                color.r  = Utils.ReadFloat(data, cursor);
                color.g  = Utils.ReadFloat(data, cursor);
                color.b  = Utils.ReadFloat(data, cursor);
                color.a  = Utils.ReadFloat(data, cursor);
                ctr.tint = color;
            }
            else
            {
                ctr.tint = new Color(0, 0, 0, 0);
            }
            int atype = Utils.ReadInt32(data, cursor);

            if (atype == 1)
            {
                ctr.add = new Color(255, 255, 255, 255);
            }
            else if (atype == 2)
            {
                Color32 color = new Color();
                color.r = Utils.ReadByte(data, cursor);
                color.g = Utils.ReadByte(data, cursor);
                color.b = Utils.ReadByte(data, cursor);
                color.a = Utils.ReadByte(data, cursor);
                ctr.add = color;
            }
            else
            {
                ctr.add = new Color(0, 0, 0, 0);
            }
            return(ctr);
        }
 public TagDefineDisplay(Flash flash, byte[] data, Cursor cursor) : base(flash, data, cursor)
 {
     this.preScale = Utils.ReadFloat(data, cursor);
 }