public override void ClientUpdate(Timestep timestep, Entity entity, AvatarController avatarController, EntityUniverseFacade facade) { BetterSignTileStateEntityLogic logic = entity.TileStateEntityLogic as BetterSignTileStateEntityLogic; if (logic != null) { string message = logic.GetMessage(); Color color = logic.GetColor(); float scale = logic.GetScale(); BmFontAlign align = logic.GetAlign(); if (message != this._message || color != this._color || scale != this._scale || align != this._align) { this.WorldTextRenderer.Purge(); // If the message is not blank add it to the WorldTextRenderer if (message != "") { this._textInitialized = false; } } } }
/// <summary> /// Clear out any old pending draw calls pre-render /// </summary> /// <param name="graphics"></param> /// <param name="renderOrigin"></param> /// <param name="entity"></param> /// <param name="avatarController"></param> /// <param name="renderTimestep"></param> public override void BeforeRender(DeviceContext graphics, Vector3D renderOrigin, Entity entity, AvatarController avatarController, Timestep renderTimestep) { this.WorldTextRenderer.Init(graphics); if (!this._textInitialized) { //GameContext.DebugGraphics.Enabled = true; BetterSignTileStateEntityLogic logic = entity.TileStateEntityLogic as BetterSignTileStateEntityLogic; if (logic != null) { this._position = logic.GetCenterPosition(); if (this._position != Vector3D.Zero) { this._rotation = (logic.GetVariation() >> 10) & 3; this._message = logic.GetMessage(); this._color = logic.GetColor(); this._scale = logic.GetScale(); this._align = logic.GetAlign(); this.WorldTextRenderer.DrawString( this._message, logic.GetTextRegionSize(), this._align, Vector3D.Zero, this._position, this._scale, this._rotation, this._color ); this._textInitialized = true; } } } }