Example #1
0
        public static string SerializeCircuitProperties(CellProperties properties)
        {
            string str = "";

            if (properties.CircuitIds != null)
            {
                foreach (int circuitId in properties.CircuitIds)
                {
                    if (circuitId > 0)
                    {
                        str += "" + CharCircuit;
                        str += Transcode64.To64(properties.PhysicsId);
                        str += Transcode64.To64(circuitId);
                    }
                }
            }

            return(str);
        }
Example #2
0
        //Serialize cellproperties to a string
        private static string SerializeRectProperties(CellProperties properties, bool Mode2D)
        {
            string str = "";

            if (Mode2D)
            {
                str += CharRects2D;
            }
            else
            {
                str += CharRgba;
            }

            byte r, g, b, a;

            Transcode64.RecodeUlongtoRgba(properties.Rgba, out r, out g, out b, out a);
            str += Transcode64.To64(r);
            str += Transcode64.To64(g);
            str += Transcode64.To64(b);
            str += Transcode64.To64(a);
            str += Transcode64.To64(properties.ShapeId);
            str += Transcode64.To64(properties.TextureId);

            if (properties.GroupId > 0)
            {
                str += "" + CharGroup;
                str += Transcode64.To64(properties.GroupId);
            }

            if (properties.WorldId > 0)
            {
                str += "" + CharWorld;
                str += Transcode64.To64((byte)((properties.WorldId >> 24) & 0xFF));
                str += Transcode64.To64((byte)((properties.WorldId >> 16) & 0xFF));
                str += Transcode64.To64((byte)((properties.WorldId >> 8) & 0xFF));
                str += Transcode64.To64((byte)((properties.WorldId >> 0) & 0xFF));
            }

            return(str);
        }