Example #1
0
        public string DebugText()
        {
            StringBuilder s = new StringBuilder();

            s.Append("{ [" + this.RawLength.ToString() + "] ");
            s.Append("[" + this.Type.ToString() + "] ");
            s.Append("[" + this.Originator.ToString() + "] ");

            if (Data is NetMouseState)
            {
                NetMouseState p = (NetMouseState)Data;
                s.Append(p.DebugString() + " }");

                return(s.ToString());
            }
            if (Data is NetKeyboardState)
            {
                NetKeyboardState p = (NetKeyboardState)Data;
                s.Append(p.DebugString() + " }");

                return(s.ToString());
            }
            if (Data is NetSprite)
            {
                NetSprite p = (NetSprite)Data;
                s.Append(p.DebugString() + " }");

                return(s.ToString());
            }

            s.Append("Malformed Payload }");

            return(s.ToString());
        }
Example #2
0
        /// <summary>
        /// Creates a new byte array (generic action object) with a NetSprite as the payload.
        /// </summary>
        /// <param name="NSprite"></param>
        /// <param name="playerNum"></param>
        /// <returns></returns>
        public byte[] CreateAction(NetSprite NSprite, byte playerNum)
        {
            byte[] bytesOut = new byte[HEADER_PAYL + NSprite.ENDPOINT];

            SetType(ref bytesOut, TYPE_TEXTURE_UPDATE);
            SetOriginator(ref bytesOut, ORIGINATOR_SERVER);
            SetPayload(ref bytesOut, NSprite.ToBytes());

            return(bytesOut);
        }