Esempio n. 1
0
 public EffectInstance(Timestep step, Entity entity, EntityPainter painter, EntityUniverseFacade facade, Blob data)
 {
     this._entityId = data.GetLong("id");
     this._message  = data.GetString("message");
     this._color    = new Color()
     {
         PackedValue = (uint)data.GetLong("color")
     };
     this._scale = (float)data.GetDouble("scale");
     this._align = (BmFontAlign)data.GetLong("align");
 }
Esempio n. 2
0
 /// <summary>
 /// Abuse the render function to trigger our UI
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="painter"></param>
 /// <param name="renderTimestep"></param>
 /// <param name="graphics"></param>
 /// <param name="matrix"></param>
 /// <param name="renderOrigin"></param>
 /// <param name="position"></param>
 /// <param name="renderMode"></param>
 public void Render(Entity entity, EntityPainter painter, Timestep renderTimestep, DeviceContext graphics, Matrix4F matrix, Vector3D renderOrigin, Vector3D position, RenderMode renderMode)
 {
     if (!this._completed && renderMode == RenderMode.Normal)
     {
         this._completed = true;
         if (ClientContext.PlayerFacade.IsLocalPlayer(entity) && !ClientContext.OverlayController.IsOpen())
         {
             BetterSigns.Instance.SignController.Setup(this._entityId, this._message, this._color, this._scale, this._align);
             BetterSigns.Instance.SignController.Show();
         }
     }
 }
Esempio n. 3
0
        private static void DrawTop(DeviceContext graphics, ref Matrix4F matrix, Vector3D renderOrigin, Entity avatar,
                                    EntityPainter avatarPainter, Universe universe, Timestep timestep)
        {
            InitializeContentManager(graphics);
            var mouseState = ClientContext.InputSource.GetMouseState();

            try {
                foreach (var window in FoxUIHook.Instance.Windows)
                {
                    if (window.Visible && window.AlwaysOnTop && !window.IsDisposed)
                    {
                        window.DrawTop(graphics, ref matrix, avatar, avatarPainter, universe, timestep, mouseState.Vector2());
                    }
                }
            } catch (InvalidOperationException) {
                // stop enumeration bugs
            }
        }
Esempio n. 4
0
 public void Render(Entity entity, EntityPainter painter, Timestep renderTimestep, DeviceContext graphics, ref Matrix4F matrix,
                    Vector3D renderOrigin, Vector3D position, RenderMode renderMode)
 {
 }
 public IEffect Instance(Timestep step, Entity entity, EntityPainter painter, EntityUniverseFacade facade, Blob data,
                         EffectDefinition definition, EffectMode mode)
 {
     return(new ModOptionsEvent());
 }
Esempio n. 6
0
        internal void DrawTop(DeviceContext graphics, ref Matrix4F matrix, Entity avatar,
                              EntityPainter avatarPainter, Universe universe, Timestep timestep, Vector2 mouseLocation)
        {
            if (_spriteBatch == null)
            {
                _spriteBatch = new SpriteBatch(graphics.Graphics.GraphicsDevice);
            }
            else if (_spriteBatch.IsDisposed)
            {
                _spriteBatch = new SpriteBatch(graphics.Graphics.GraphicsDevice);
            }

            if (_escape)
            {
                if (!graphics.IsActive())
                {
                    Dispose();
                    return;
                }
            }

            try {
                _spriteBatch.End();
            } catch {
                // ignore
            }

            _spriteBatch.Begin();

            var size = Container.GetSize();

            Vector2 origin;

            ViewPort = graphics.Graphics.GraphicsDevice.Viewport;

            switch (Alignment)
            {
            case UiAlignment.TopLeft:
                origin = new Vector2(0, 0);
                break;

            case UiAlignment.TopCenter:
                origin = new Vector2((ViewPort.Width / 2) - (size.X / 2), 0);
                break;

            case UiAlignment.TopRight:
                origin = new Vector2(ViewPort.Width - size.X, 0);
                break;

            case UiAlignment.MiddleLeft:
                origin = new Vector2(0, (ViewPort.Height / 2) - (size.Y / 2));
                break;

            case UiAlignment.MiddleCenter:
            default:
                origin = new Vector2((ViewPort.Width / 2) - (size.X / 2), (ViewPort.Height / 2) - (size.Y / 2));
                break;

            case UiAlignment.MiddleRight:
                origin = new Vector2(ViewPort.Width - size.X, (ViewPort.Height / 2) - (size.Y / 2));
                break;

            case UiAlignment.BottomLeft:
                origin = new Vector2(0, ViewPort.Height - size.Y);
                break;

            case UiAlignment.BottomCenter:
                origin = new Vector2((ViewPort.Width / 2) - (size.X / 2), ViewPort.Height - size.Y);
                break;

            case UiAlignment.BottomRight:
                origin = new Vector2(ViewPort.Width - size.X, ViewPort.Height - size.Y);
                break;
            }

            Container.Draw(graphics, avatar, universe, origin, _spriteBatch, mouseLocation, _spriteBatch.GraphicsDevice.ScissorRectangle);
            if (!_spriteBatch.IsDisposed)
            {
                _spriteBatch.End();
            }
        }