事件监听
parent
2ee83fef78
commit
d6e2f5ffdd
|
|
@ -1687,7 +1687,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
// 外圈抽奖
|
||||
qiMenRandom(user, 1, rewards, hits);
|
||||
// 事件分发
|
||||
|
||||
Poster.getPoster().dispatchEvent(new QiMenDunJiaEvent(user.getId(),activityId,1));
|
||||
}
|
||||
// 处理奖励
|
||||
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, rewards, BIReason.QIMENDUNJIA_DRAW);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ package com.ljsd.jieling.logic.activity;
|
|||
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.DoubleRewardPoolInfo;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.QiMenDunJiaEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SLingLongPool;
|
||||
|
|
@ -20,6 +24,7 @@ public class QiMenDunJiaActivity extends AbstractActivity {
|
|||
|
||||
QiMenDunJiaActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, QiMenDunJiaEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -36,4 +41,18 @@ public class QiMenDunJiaActivity extends AbstractActivity {
|
|||
LOGGER.info("奇门遁甲/玲珑宝阁 初始化..."+id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
// 类型验证
|
||||
if (!(event instanceof QiMenDunJiaEvent)) {
|
||||
return;
|
||||
}
|
||||
// 获取信息
|
||||
QiMenDunJiaEvent drawCardEvent = (QiMenDunJiaEvent) event;
|
||||
// 用户
|
||||
User user = UserManager.getUser(drawCardEvent.getUserId());
|
||||
// 更新进度
|
||||
update(user,drawCardEvent.getNum());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/5/26 11:05
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class QiMenDunJiaEvent implements IEvent {
|
||||
|
||||
private int userId;
|
||||
private int activityId;
|
||||
private int num;
|
||||
|
||||
public QiMenDunJiaEvent(int userId, int activityId, int num) {
|
||||
this.userId = userId;
|
||||
this.activityId = activityId;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public void setActivityId(int activityId) {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue