Esempio n. 1
0
        /// <summary>
        /// Called when a note block is added.
        /// </summary>
        /// <param name="m">The message.</param>
        public void OnAddNoteblock(Message m)
        {
            // Extract data.
            int x = m.GetInteger(0),
                y = m.GetInteger(1),
                id = m.GetInteger(2),
                note = m.GetInteger(3);

            // Update relevant objects.
            Block b;

            switch (id)
            {
                case BlockIds.Action.Music.Percussion:
                    b = new PercussionBlock(x, y, note);
                    break;
                case BlockIds.Action.Music.Piano:
                    b = new PianoBlock(x, y, note);
                    break;
                default:
                    Tools.SkylightMessage("Error: noteblock does not exist");
                    return;
            }

            this._in.Source.Map[x, y, 0] = b;

            // Fire the event.
            var e = new BlockEventArgs(b, m, this._in.Source);

            this._in.Source.Pull.NoteBlock.SoundBlockEvent(e);
        }
Esempio n. 2
0
        /// <summary>
        /// Called when a user adds Sci-Fi blocks or spikes.
        /// </summary>
        /// <param name="m">The message.</param>
        public void OnAddScifiOrSpikes(Message m)
        {
            // Extract data.
            int x = m.GetInteger(0),
                y = m.GetInteger(1),
                id = m.GetInteger(2),
                rotation = m.GetInteger(3);

            // Update relevant objects.
            var b = new Block(id, x, y, 0, rotation);

            this._in.Source.Map[x, y, 0] = b;

            // Fire the event.
            var e = new BlockEventArgs(b, m, this._in.Source);

            this._in.Source.Pull.AddSpecialBlock.RotateEvent(e);
        }
Esempio n. 3
0
        /// <summary>
        /// Called when [add coin door or gate].
        /// </summary>
        /// <param name="m">The m.</param>
        public void OnAddCoinDoorOrGate(Message m)
        {
            // Extract data.
            int x = m.GetInteger(0),
                y = m.GetInteger(1),
                id = m.GetInteger(2),
                coinsRequired = m.GetInteger(3);

            // Update relevant objects.
            var b = new CoinBlock(x, y, coinsRequired, false) { IsGate = id == BlockIds.Action.Gates.Coin };

            this._in.Source.Map[x, y, 0] = b;

            // Fire the event.
            var e = new BlockEventArgs(b, m, this._in.Source);

            this._in.Source.Pull.CoinObject.CoinBlockEvent(e);
        }
Esempio n. 4
0
        /// <summary>
        /// Called when [ts].
        /// </summary>
        /// <param name="m">
        /// The m.
        /// </param>
        private void OnTs(Message m)
        {
            // Extract data.
            int id = m.GetInteger(0), x = m.GetInteger(1), y = m.GetInteger(2);

            string text = m.GetString(3);

            // Update relevant objects.
            var b = new TextBlock(id, x, y, text);

            this.Source.Map[x, y, 0] = b;

            // Fire the event.
            var e = new BlockEventArgs(b, m, this.Source);

            this.Source.Pull.CoinBlockEvent(e);
        }
Esempio n. 5
0
        /// <summary>
        /// Called when [pt].
        /// </summary>
        /// <param name="m">
        /// The m.
        /// </param>
        private void OnPt(Message m)
        {
            // Extract data.
            int x = m.GetInteger(0),
                y = m.GetInteger(1),
                blockId = m.GetInteger(2),
                rotation = m.GetInteger(3),
                portalId = m.GetInteger(4),
                portalDestination = m.GetInteger(5);

            // Update relevant objects.
            bool isVisible = blockId == BlockIds.Action.Portals.Normal;

            var b = new PortalBlock(x, y, rotation, portalId, portalDestination, isVisible);

            this.Source.Map[x, y, 1] = b;

            // Fire the event.
            var e = new BlockEventArgs(b, m, this.Source);

            this.Source.Pull.PortalBlockEvent(e);
        }