本文整理汇总了Java中master.flame.danmaku.danmaku.model.IDisplayer类的典型用法代码示例。如果您正苦于以下问题:Java IDisplayer类的具体用法?Java IDisplayer怎么用?Java IDisplayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDisplayer类属于master.flame.danmaku.danmaku.model包,在下文中一共展示了IDisplayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: willHitInDuration
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public static boolean willHitInDuration(IDisplayer disp, BaseDanmaku d1, BaseDanmaku d2, long duration, long currTime) {
int type1 = d1.getType();
if (type1 != d2.getType()) {
return false;
}
if (d1.isOutside()) {
return false;
}
long dTime = d2.time - d1.time;
if (dTime < 0) {
return true;
}
if (Math.abs(dTime) >= duration || d1.isTimeOut() || d2.isTimeOut()) {
return false;
}
if (type1 == 5 || type1 == 4) {
return true;
}
return checkHitAtTime(disp, d1, d2, currTime) || checkHitAtTime(disp, d1, d2, d1.time + d1.getDuration());
}
示例2: fix
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public void fix(BaseDanmaku danmaku, IDisplayer disp, Verifier verifier) {
int type = danmaku.getType();
switch (type) {
case BaseDanmaku.TYPE_SCROLL_RL:
rldrInstance.fix(danmaku, disp, verifier);
break;
case BaseDanmaku.TYPE_SCROLL_LR:
lrdrInstance.fix(danmaku, disp, verifier);
break;
case BaseDanmaku.TYPE_FIX_TOP:
ftdrInstance.fix(danmaku, disp, verifier);
break;
case BaseDanmaku.TYPE_FIX_BOTTOM:
fbdrInstance.fix(danmaku, disp, verifier);
break;
case BaseDanmaku.TYPE_SPECIAL:
danmaku.layout(disp, 0, 0);
break;
}
}
示例3: willHitInDuration
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
/**
* 检测两个弹幕是否会碰撞
* 允许不同类型弹幕的碰撞
* @param d1
* @param d2
* @return
*/
public static boolean willHitInDuration(IDisplayer disp, BaseDanmaku d1, BaseDanmaku d2,
long duration, long currTime) {
final int type1 = d1.getType();
final int type2 = d2.getType();
// allow hit if different type
if(type1 != type2)
return false;
if(d1.isOutside()){
return false;
}
long dTime = d2.time - d1.time;
if (dTime <= 0)
return true;
if (Math.abs(dTime) >= duration || d1.isTimeOut() || d2.isTimeOut()) {
return false;
}
if (type1 == BaseDanmaku.TYPE_FIX_TOP || type1 == BaseDanmaku.TYPE_FIX_BOTTOM) {
return true;
}
return checkHitAtTime(disp, d1, d2, currTime)
|| checkHitAtTime(disp, d1, d2, d1.time + d1.getDuration());
}
示例4: initDanmuConfig
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
/**
* 初始化配置
*/
private void initDanmuConfig() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5); // 滚动弹幕最大显示5行
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext
.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_NONE)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)//越大速度越慢
.setScaleTextSize(1.2f)
.setCacheStuffer(new BackgroundCacheStuffer(), mCacheStufferAdapter)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例5: willHitInDuration
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
/**
* 检测两个弹幕是否会碰撞
* 允许不同类型弹幕的碰撞
* @param d1
* @param d2
* @return
*/
public static boolean willHitInDuration(IDisplayer disp, BaseDanmaku d1, BaseDanmaku d2,
long duration, long currTime) {
final int type1 = d1.getType();
final int type2 = d2.getType();
// allow hit if different type
if(type1 != type2)
return false;
if(d1.isOutside()){
return false;
}
long dTime = d2.time - d1.time;
if (dTime < 0)
return true;
if (Math.abs(dTime) >= duration || d1.isTimeOut() || d2.isTimeOut()) {
return false;
}
if (type1 == BaseDanmaku.TYPE_FIX_TOP || type1 == BaseDanmaku.TYPE_FIX_BOTTOM) {
return true;
}
return checkHitAtTime(disp, d1, d2, currTime)
|| checkHitAtTime(disp, d1, d2, d1.time + d1.getDuration());
}
示例6: initDanmaku
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
private void initDanmaku() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
// 滚动弹幕最大显示3行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(1.2f)
.setCacheStuffer(new SpannedCacheStuffer(), null) // 图文混排使用SpannedCacheStuffer
// .setCacheStuffer(new BackgroundCacheStuffer()) // 绘制背景使用BackgroundCacheStuffer
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例7: setDisplayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
@Override
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
super.setDisplayer(disp);
mDispScaleX = mDispWidth / DanmakuFactory.BILI_PLAYER_WIDTH;
mDispScaleY = mDispHeight / DanmakuFactory.BILI_PLAYER_HEIGHT;
return this;
}
示例8: initMediaPlayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
@SuppressLint("UseSparseArrays")
private void initMediaPlayer() {
//配置播放器
MediaController mMediaController = new MediaController(this);
mMediaController.setTitle(title);
mPlayerView.setMediaController(mMediaController);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(onInfoListener);
mPlayerView.setOnSeekCompleteListener(onSeekCompleteListener);
mPlayerView.setOnCompletionListener(onCompletionListener);
mPlayerView.setOnControllerEventsListener(onControllerEventsListener);
//设置弹幕开关监听
mMediaController.setDanmakuSwitchListener(this);
//设置返回键监听
mMediaController.setVideoBackEvent(this);
//配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
//设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
//滚动弹幕最大显示5行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
//设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
//设置弹幕样式
danmakuContext = DanmakuContext.create();
danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例9: setDisplayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
@Override
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
super.setDisplayer(disp);
mDispScaleX = mDispWidth / DanmakuFactory.BILI_PLAYER_WIDTH;
mDispScaleY = mDispHeight / DanmakuFactory.BILI_PLAYER_HEIGHT;
return this;
}
示例10: initMediaPlayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
private void initMediaPlayer() {
MediaController controller = new MediaController(this);
controller.setTitle(mTitle);
mPlayerView.setMediaController(controller);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(mOnInfoListener);
mPlayerView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mPlayerView.setOnCompletionListener(mOnCompletionListener);
mPlayerView.setOnControlEventsListener(mOnControlEventsListener);
// 设置弹幕开关监听
controller.setDanmakuSwitchListener(this);
// 设置返回键监听
controller.setVideoBackListener(this);
// 配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
// 滚动屏幕最大显示五行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
// 设置弹幕样式
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例11: setDisplayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
this.mDisp = disp;
this.mDispWidth = disp.getWidth();
this.mDispHeight = disp.getHeight();
this.mDispDensity = disp.getDensity();
this.mScaledDensity = disp.getScaledDensity();
this.mContext.mDanmakuFactory.updateViewportState((float) this.mDispWidth, (float) this.mDispHeight, getViewportSizeFactor());
this.mContext.mDanmakuFactory.updateMaxDanmakuDuration();
return this;
}
示例12: createDanmaku
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public BaseDanmaku createDanmaku(int type, IDisplayer disp, float viewportScale, float scrollSpeedFactor) {
if (disp == null) {
return null;
}
this.sLastDisp = disp;
return createDanmaku(type, disp.getWidth(), disp.getHeight(), viewportScale, scrollSpeedFactor);
}
示例13: fix
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public void fix(BaseDanmaku danmaku, IDisplayer disp, Verifier verifier) {
switch (danmaku.getType()) {
case 1:
if (this.rldrInstance == null) {
this.rldrInstance = new RLDanmakusRetainer();
}
this.rldrInstance.fix(danmaku, disp, verifier);
return;
case 4:
if (this.fbdrInstance == null) {
this.fbdrInstance = new FBDanmakusRetainer();
}
this.fbdrInstance.fix(danmaku, disp, verifier);
return;
case 5:
if (this.ftdrInstance == null) {
this.ftdrInstance = new FTDanmakusRetainer();
}
this.ftdrInstance.fix(danmaku, disp, verifier);
return;
case 6:
if (this.lrdrInstance == null) {
this.lrdrInstance = new RLDanmakusRetainer();
}
this.lrdrInstance.fix(danmaku, disp, verifier);
return;
case 7:
danmaku.layout(disp, 0.0f, 0.0f);
return;
default:
return;
}
}
示例14: checkHitAtTime
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
private static boolean checkHitAtTime(IDisplayer disp, BaseDanmaku d1, BaseDanmaku d2, long time) {
float[] rectArr1 = d1.getRectAtTime(disp, time);
float[] rectArr2 = d2.getRectAtTime(disp, time);
if (rectArr1 == null || rectArr2 == null) {
return false;
}
return checkHit(d1.getType(), d2.getType(), rectArr1, rectArr2);
}
示例15: setDisplayer
import master.flame.danmaku.danmaku.model.IDisplayer; //导入依赖的package包/类
public BaseDanmakuParser setDisplayer(IDisplayer disp){
mDisp = disp;
mDispWidth = disp.getWidth();
mDispHeight = disp.getHeight();
mDispDensity = disp.getDensity();
mScaledDensity = disp.getScaledDensity();
mContext.mDanmakuFactory.updateViewportState(mDispWidth, mDispHeight, getViewportSizeFactor());
mContext.mDanmakuFactory.updateMaxDanmakuDuration();
return this;
}