public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (slice is NestedNodeSlice tslice) { tslice.Slice.Node.Draw(tslice.Slice, batch, position, scale, defaultFont, defaultColor, defaultShadowColor, line, flow); } }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } Component.visible = true; int x = (int)position.X; int y = (int)position.Y; if (x != Component.bounds.X || y != Component.bounds.Y) { Component.bounds = new Rectangle( x, y, Component.bounds.Width, Component.bounds.Height ); } OnDraw?.Invoke(batch, position, scale, defaultFont, defaultColor, defaultShadowColor); if (Component is ClickableTextureComponent cp) { cp.draw(batch); } else if (Component is ClickableAnimatedComponent can) { can.draw(batch); } }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } int shadowOffset = (int)ShadowOffset; int x = (int)position.X; int y = (int)position.Y + (int)Padding; if (shadowOffset != 0) { batch.Draw( Game1.uncoloredMenuTexture, new Rectangle( x - shadowOffset, y + shadowOffset, (int)slice.Width, (int)Size ), new Rectangle(16, 272, 28, 28), ShadowColor ?? defaultShadowColor ?? Game1.textShadowColor ); } batch.Draw( Game1.uncoloredMenuTexture, new Rectangle( x, y, (int)slice.Width, (int)Size ), new Rectangle(16, 272, 28, 28), Color ?? defaultColor ?? Game1.textColor ); }
public bool?WantComponent(IFlowNodeSlice slice) { if (NoComponent) { return(false); } return(null); }
public ClickableComponent?UseComponent(IFlowNodeSlice slice) { if (slice is NestedNodeSlice tslice) { return(tslice.Node.UseComponent(slice)); } return(null); }
public bool?WantComponent(IFlowNodeSlice slice) { if (slice is NestedNodeSlice tslice) { return(tslice.Node.WantComponent(slice)); } return(_wantComponent?.Invoke(slice)); }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } Sprite.Draw(batch, position, scale * Scale, Frame, Size); }
public bool _onHover(IFlowNodeSlice slice, int x, int y) { if (delHover?.Invoke(slice, x, y) ?? true) { Hovered = true; return(true); } return(false); }
public bool _onClick(IFlowNodeSlice slice, int x, int y) { if (delClick?.Invoke(slice, x, y) ?? false) { Selected = true; return(true); } return(false); }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (Selected) { if (SelectedTexture != null) { RenderHelper.DrawBox( batch, SelectedTexture, SelectedSource ?? SelectedTexture.Bounds, (int)position.X + 2, (int)position.Y + 2, (int)slice.Width - 4, (int)slice.Height - 4, SelectedColor ?? Color.White, scale: 4f, drawShadow: false ); } } else if (Hovered) { if (HoverTexture != null) { RenderHelper.DrawBox( batch, HoverTexture, HoverSource ?? HoverTexture.Bounds, (int)position.X, (int)position.Y, (int)slice.Width, (int)slice.Height, HoverColor ?? Color.White, scale: 4f, drawShadow: false ); } } Hovered = false; if (Flow.HasValue) { FlowHelper.RenderFlow( batch, Flow.Value, new Vector2( position.X + 12, position.Y + 12 ), defaultColor, defaultShadowColor: defaultShadowColor, lineOffset: 0 ); } }
public bool?WantComponent(IFlowNodeSlice slice) { return(true); }
public ClickableComponent?UseComponent(IFlowNodeSlice slice) { return(null); }
public ClickableComponent UseComponent(IFlowNodeSlice slice) { return(Component); }