四灵试炼次数修改
parent
f86f4e5676
commit
695de90a50
|
@ -67,17 +67,12 @@ public class FourChallengeLogic {
|
|||
* 例子 0,1,1,1
|
||||
*/
|
||||
public int[] status;
|
||||
/**
|
||||
* 策划表配置,开启时间
|
||||
*/
|
||||
public final int[][] config;
|
||||
|
||||
public static class Instance {
|
||||
public final static FourChallengeLogic instance = new FourChallengeLogic(STableManager.getConfig(SCampTowerSetting.class).get(1).getCampOpenDay());
|
||||
public final static FourChallengeLogic instance = new FourChallengeLogic();
|
||||
}
|
||||
|
||||
private FourChallengeLogic(int[][] config) {
|
||||
this.config = config;
|
||||
private FourChallengeLogic() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,16 +93,18 @@ public class FourChallengeLogic {
|
|||
* 检测试炼开启状态
|
||||
*/
|
||||
public void check() {
|
||||
int[][] config = STableManager.getConfig(SCampTowerSetting.class).get(1).getCampOpenDay();
|
||||
// 空,初始化长度为4
|
||||
status = new int[4];
|
||||
int[] state = new int[4];
|
||||
for (int[] statusConfig : config) {
|
||||
for (int i = 1; i < statusConfig.length; i++) {
|
||||
// 判断当前周几
|
||||
if (TimeUtils.getDayOfWeek() == statusConfig[i]) {
|
||||
status[statusConfig[0] - 1] = 1;
|
||||
state[statusConfig[0] - 1] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
status = state;
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,9 +382,7 @@ public class FourChallengeLogic {
|
|||
return;
|
||||
}
|
||||
// 检测一次
|
||||
if (status == null){
|
||||
check();
|
||||
}
|
||||
check();
|
||||
// 获取每天增加的天数
|
||||
int campOpenDay = STableManager.getConfig(SCampTowerSetting.class).get(1).getTimesAddPerDay();
|
||||
for (int i = 0; i < status.length; i++) {
|
||||
|
@ -416,9 +411,7 @@ public class FourChallengeLogic {
|
|||
return;
|
||||
}
|
||||
// 检测一次
|
||||
if (status == null){
|
||||
check();
|
||||
}
|
||||
check();
|
||||
// 获取每天增加的天数
|
||||
SCampTowerSetting towerSetting = STableManager.getConfig(SCampTowerSetting.class).get(1);
|
||||
int campOpenDay = towerSetting.getTimesAddPerDay();
|
||||
|
@ -432,9 +425,9 @@ public class FourChallengeLogic {
|
|||
int count = 0;
|
||||
// 开启的星期数,第一位是开启阵营,要调过,从1开始
|
||||
int[] openDay = towerSetting.getCampOpenDay()[i];
|
||||
for (int i1 = 1; i1 < openDay.length; i1++) {
|
||||
for (int j = 1; j < openDay.length; j++) {
|
||||
// 中间经过了几次开启时间
|
||||
count += TimeUtils.differentDaysToWeekday(time,TimeUtils.now(),openDay[i]);
|
||||
count += TimeUtils.differentDaysToWeekday(time,TimeUtils.now(),openDay[j]);
|
||||
}
|
||||
user.getPlayerInfoManager().addFourChallengeRemainTimes(i, campOpenDay*count);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue