public bool IsSame(IBlockPlaceSendEvent other) { if (other == null) { return false; } bool result = this.Block == other.Block; if (other is BlockPlaceSendEvent) { return result; } var coinEvent = other as CoinDoorPlaceSendEvent; if (coinEvent != null) { if (this._data.CoinsToCollect != coinEvent.CoinsToCollect) result = false; return result; } var labelEvent = other as LabelPlaceSendEvent; if (labelEvent != null) { if (this._data.Text != labelEvent.Text) result = false; return result; } var worldPortalEvent = other as WorldPortalPlaceSendEvent; if (worldPortalEvent != null) { if (this._data.WorldPortalTarget != worldPortalEvent.WorldPortalTarget) result = false; return result; } var rotatableEvent = other as RotatablePlaceSendEvent; if (rotatableEvent != null) { if (this._data.Rotation != rotatableEvent.Rotation) result = false; return result; } var soundEvent = other as SoundPlaceSendEvent; if (soundEvent != null) { if (this._data.SoundId != soundEvent.SoundId) result = false; return result; } var portalEvent = other as PortalPlaceSendEvent; if (portalEvent != null) { if (this._data.PortalId != portalEvent.PortalId || this._data.PortalTarget != portalEvent.PortalTarget || this._data.PortalRotation != portalEvent.PortalRotation) result = false; return result; } throw new NotSupportedException("The given send message is not supported."); }
public UploadRequestEvent(IBlockPlaceSendEvent sendEvent) { this.SendEvent = sendEvent; }
/// <summary> /// Calls the correct event for the given BlockPlaceSendEvent. /// Note that this does NOT check if the block was skipped! /// </summary> /// <param name="e"></param> public void RaiseEvent(IBlockPlaceSendEvent e) { var blockEvent = e as BlockPlaceSendEvent; if (blockEvent != null) { this.Events.Raise(blockEvent); return; } var coinEvent = e as CoinDoorPlaceSendEvent; if (coinEvent != null) { this.Events.Raise(coinEvent); return; } var deathDoorEvent = e as DeathDoorPlaceSendEvent; if (deathDoorEvent != null) { this.Events.Raise(deathDoorEvent); return; } var purpleDoorEvent = e as PurpleDoorPlaceSendEvent; if (purpleDoorEvent != null) { this.Events.Raise(purpleDoorEvent); return; } var labelEvent = e as LabelPlaceSendEvent; if (labelEvent != null) { this.Events.Raise(labelEvent); return; } var signEvent = e as SignPlaceSendEvent; if (signEvent != null) { this.Events.Raise(signEvent); return; } var worldPortalEvent = e as WorldPortalPlaceSendEvent; if (worldPortalEvent != null) { this.Events.Raise(worldPortalEvent); return; } var rotatableEvent = e as RotatablePlaceSendEvent; if (rotatableEvent != null) { this.Events.Raise(rotatableEvent); return; } var soundEvent = e as SoundPlaceSendEvent; if (soundEvent != null) { this.Events.Raise(soundEvent); return; } var portalEvent = e as PortalPlaceSendEvent; if (portalEvent != null) { this.Events.Raise(portalEvent); } }
private bool IsUploaded(IBlockPlaceSendEvent e) { try { return (this._world[e.Layer, e.X, e.Y].IsSame(e)); } catch (Exception ex) { this.Logger.Log("Uploading block at Layer: {0}, X: {1}, Y: {2}, Block: {3} failed! {4}", e.Layer, e.X, e.Y, e.Block, ex.Message); return false; } }
private bool IsUploaded(IBlockPlaceSendEvent e) { return (this._world[e.Layer, e.X, e.Y].IsSame(e)); }