private IElement EvaluateProductionLineItem(Section section, Rectangle position) { if (!_modelViews.ContainsKey(section)) { var ratio = position.Height / (float)position.Width; _modelViews[section] = new ModelView { RenderFunc = ctx => _shipSectionRenderer.Render(ctx, Matrix.Identity, section), Position = new Rectangle(0, 30, (int)(Vw * 20 - 10), (int)(12 * Vh - 30)), View = Matrix.CreateLookAt(new Vector3(3f, 5f, 3f), Vector3.Zero, Vector3.Up), Projection = Matrix.CreateOrthographicOffCenter(-2, 2, -2 * ratio, 2 * ratio, 0.001f, 10000f) }; } return(new Pane( new Text(section.Module.ShortName) { Position = new Rectangle(10, 10, 0, 0), Colour = new Color(230, 230, 230) }, _modelViews[section] ) { Background = new ColourBackgroundStyling { Colour = new Color(45, 45, 45) }, Init = el => el.Events.Subscribe <ClickUIEvent>(ev => { _buildPlacer.Update(() => _buildPlacer.StartPlacing(section)); }), Position = position }); }
public void Render(RenderContext context) { var parentTransform = Entity.Parent.Get <Transform>().WorldTransform; if (_shipTopology.SectionAt(GridLocation) != null) { _shipRenderer.Render(context, Transform.WorldTransform * parentTransform, _shipTopology.SectionAt(GridLocation)); } }
public void Render(RenderContext context) { context.GraphicsDevice.DepthStencilState = DepthStencilState.Default; var camera = CameraManager.ActiveCamera; if (_shipTopology.SectionAt(GridLocation) != null) { _shipRenderer.Render(context, Transform.WorldTransform, _shipTopology.SectionAt(GridLocation)); //_floorModel.SetDiffuseColour(Color.Gray); } else { //_floorModel.SetDiffuseColour(Color.DarkSlateBlue); } _floorModel.Draw(Offset * Transform.WorldTransform, camera.View, camera.Projection); }
public void Render(RenderContext context) { if (PlacingSection != null) { if (HoverNode != null) { _shipRenderer.Render( context, new Transform { Location = HexagonHelpers.GetGridWorldPosition(HoverNode.GridLocation) }.WorldTransform, PlacingSection ); } } }