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