protected override Tuple <bool, double> allocateY(Size size) { var barrier = DanmakuLib.getPosition(pool.FindAll((i) => { var x = ((TranslateTransform)i.RenderTransform).X; return(x - DanmakuConfig.HORIZONTAL_PADDING < 0); })); return(DanmakuLib.getSlotFromTop(size, offset, canvas.Height, barrier)); }
protected override Tuple <bool, double> allocateY(Size size) { // 获取出可能阻挡新弹幕的旧弹幕 var barrier = DanmakuLib.getPosition(pool.FindAll((i) => { var x = ((TranslateTransform)i.RenderTransform).X; if (x <= 0) { x = canvas.Width; } return(i.ActualWidth + x + DanmakuConfig.HORIZONTAL_PADDING > canvas.Width); })); return(DanmakuLib.getSlotFromTop(size, offset, canvas.Height, barrier)); }
protected override void attachTransform(TextBlock tb, EventHandler handler, double y) { var x = (canvas.Width - tb.ActualWidth) / 2; DanmakuLib.attachStaticTransform(tb, handler, new Point(x, y), DanmakuConfig.DANMAKU_TTL / 2); }
protected override Tuple <bool, double> allocateY(Size size) { var barrier = DanmakuLib.getPosition(pool); return(DanmakuLib.getSlotFromBottom(size, offset, canvas.Height, barrier)); }
protected override void attachTransform(TextBlock tb, EventHandler handler, double y) { DanmakuLib.attachHorizontalTransform(tb, handler, new Point(0, y), -tb.ActualWidth, canvas.Width, DanmakuConfig.DANMAKU_TTL); }