use of master.flame.danmaku.danmaku.model.SpecialDanmaku in project DanmakuFlameMaster by Bilibili.
the class DanmakuFactory method updateSpecialDanmakusDate.
private void updateSpecialDanmakusDate(final float scaleX, final float scaleY) {
IDanmakus list = sSpecialDanmakus;
list.forEachSync(new IDanmakus.DefaultConsumer<BaseDanmaku>() {
@Override
public int accept(BaseDanmaku danmaku) {
SpecialDanmaku speicalDanmaku = (SpecialDanmaku) danmaku;
fillTranslationData(speicalDanmaku, speicalDanmaku.beginX, speicalDanmaku.beginY, speicalDanmaku.endX, speicalDanmaku.endY, speicalDanmaku.translationDuration, speicalDanmaku.translationStartDelay, scaleX, scaleY);
LinePath[] linePaths = speicalDanmaku.linePaths;
if (linePaths != null && linePaths.length > 0) {
int length = linePaths.length;
float[][] points = new float[length + 1][2];
for (int j = 0; j < length; j++) {
points[j] = linePaths[j].getBeginPoint();
points[j + 1] = linePaths[j].getEndPoint();
}
fillLinePathData(speicalDanmaku, points, scaleX, scaleY);
}
return ACTION_CONTINUE;
}
});
}
use of master.flame.danmaku.danmaku.model.SpecialDanmaku in project ABPlayer by winkstu.
the class DanmakuFactory method createDanmaku.
/**
* 创建弹幕数据请尽量使用此方法,参考BiliDanmakuParser或AcfunDanmakuParser
* @param type 弹幕类型
* @param viewportWidth danmakuview宽度,会影响滚动弹幕的存活时间(duration)
* @param viewportHeight danmakuview高度
* @param viewportSizeFactor 会影响滚动弹幕的速度/存活时间(duration)
* @return
*/
public static BaseDanmaku createDanmaku(int type, float viewportWidth, float viewportHeight, float viewportSizeFactor) {
boolean sizeChanged = updateViewportState(viewportWidth, viewportHeight, viewportSizeFactor);
if (MAX_Duration_Scroll_Danmaku == null) {
MAX_Duration_Scroll_Danmaku = new Duration(REAL_DANMAKU_DURATION);
MAX_Duration_Scroll_Danmaku.setFactor(DanmakuGlobalConfig.DEFAULT.scrollSpeedFactor);
} else if (sizeChanged) {
MAX_Duration_Scroll_Danmaku.setValue(REAL_DANMAKU_DURATION);
}
if (MAX_Duration_Fix_Danmaku == null) {
MAX_Duration_Fix_Danmaku = new Duration(COMMON_DANMAKU_DURATION);
}
if (sizeChanged && viewportWidth > 0) {
updateMaxDanmakuDuration();
float scaleX = 1f;
float scaleY = 1f;
if (CURRENT_DISP_WIDTH > 0 && CURRENT_DISP_HEIGHT > 0) {
scaleX = viewportWidth / (float) CURRENT_DISP_WIDTH;
scaleY = viewportHeight / (float) CURRENT_DISP_HEIGHT;
}
if (viewportHeight > 0) {
updateSpecialDanmakusDate(scaleX, scaleY);
}
}
BaseDanmaku instance = null;
switch(type) {
case // 从右往左滚动
1:
instance = new R2LDanmaku(MAX_Duration_Scroll_Danmaku);
break;
case // 底端固定
4:
instance = new FBDanmaku(MAX_Duration_Fix_Danmaku);
break;
case // 顶端固定
5:
instance = new FTDanmaku(MAX_Duration_Fix_Danmaku);
break;
case // 从左往右滚动
6:
instance = new L2RDanmaku(MAX_Duration_Scroll_Danmaku);
break;
case // 特殊弹幕
7:
instance = new SpecialDanmaku();
sSpecialDanmakus.addItem(instance);
break;
}
return instance;
}
use of master.flame.danmaku.danmaku.model.SpecialDanmaku in project ABPlayer by winkstu.
the class DanmakuFactory method updateSpecialDanmakusDate.
private static void updateSpecialDanmakusDate(float scaleX, float scaleY) {
IDanmakus list = sSpecialDanmakus;
IDanmakuIterator it = list.iterator();
while (it.hasNext()) {
SpecialDanmaku speicalDanmaku = (SpecialDanmaku) it.next();
fillTranslationData(speicalDanmaku, speicalDanmaku.beginX, speicalDanmaku.beginY, speicalDanmaku.endX, speicalDanmaku.endY, speicalDanmaku.translationDuration, speicalDanmaku.translationStartDelay, scaleX, scaleY);
LinePath[] linePaths = speicalDanmaku.linePaths;
if (linePaths != null && linePaths.length > 0) {
int length = linePaths.length;
float[][] points = new float[length + 1][2];
for (int j = 0; j < length; j++) {
points[j] = linePaths[j].getBeginPoint();
points[j + 1] = linePaths[j].getEndPoint();
}
fillLinePathData(speicalDanmaku, points, scaleX, scaleY);
}
}
}
use of master.flame.danmaku.danmaku.model.SpecialDanmaku in project DanmakuFlameMaster by Bilibili.
the class DanmakuFactory method createDanmaku.
/**
* 创建弹幕数据请尽量使用此方法,参考BiliDanmakuParser或AcfunDanmakuParser
* @param type 弹幕类型
* @param viewportWidth danmakuview宽度,会影响滚动弹幕的存活时间(duration)
* @param viewportHeight danmakuview高度
* @param viewportSizeFactor 会影响滚动弹幕的速度/存活时间(duration)
* @return
*/
public BaseDanmaku createDanmaku(int type, float viewportWidth, float viewportHeight, float viewportSizeFactor, float scrollSpeedFactor) {
int oldDispWidth = CURRENT_DISP_WIDTH;
int oldDispHeight = CURRENT_DISP_HEIGHT;
boolean sizeChanged = updateViewportState(viewportWidth, viewportHeight, viewportSizeFactor);
if (MAX_Duration_Scroll_Danmaku == null) {
MAX_Duration_Scroll_Danmaku = new Duration(REAL_DANMAKU_DURATION);
MAX_Duration_Scroll_Danmaku.setFactor(scrollSpeedFactor);
} else if (sizeChanged) {
MAX_Duration_Scroll_Danmaku.setValue(REAL_DANMAKU_DURATION);
}
if (MAX_Duration_Fix_Danmaku == null) {
MAX_Duration_Fix_Danmaku = new Duration(COMMON_DANMAKU_DURATION);
}
if (sizeChanged && viewportWidth > 0) {
updateMaxDanmakuDuration();
float scaleX = 1f;
float scaleY = 1f;
if (oldDispWidth > 0 && oldDispHeight > 0) {
scaleX = viewportWidth / (float) oldDispWidth;
scaleY = viewportHeight / (float) oldDispHeight;
}
if (viewportHeight > 0) {
updateSpecialDanmakusDate(scaleX, scaleY);
}
}
BaseDanmaku instance = null;
switch(type) {
case // 从右往左滚动
1:
instance = new R2LDanmaku(MAX_Duration_Scroll_Danmaku);
break;
case // 底端固定
4:
instance = new FBDanmaku(MAX_Duration_Fix_Danmaku);
break;
case // 顶端固定
5:
instance = new FTDanmaku(MAX_Duration_Fix_Danmaku);
break;
case // 从左往右滚动
6:
instance = new L2RDanmaku(MAX_Duration_Scroll_Danmaku);
break;
case // 特殊弹幕
7:
instance = new SpecialDanmaku();
sSpecialDanmakus.addItem(instance);
break;
}
return instance;
}
Aggregations