function修改

back_recharge
lvxinran 2019-11-25 11:34:34 +08:00
parent 813ffebec6
commit 89122a8afd
3 changed files with 29 additions and 45 deletions

View File

@ -1,13 +1,11 @@
package com.ljsd.jieling.core;
import com.ljsd.jieling.core.function.ArenaFunction;
import com.ljsd.jieling.core.function.DefaultFunction;
import com.ljsd.jieling.core.function.EndlessFunction;
import com.ljsd.jieling.protocols.MessageTypeProto;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
/**
* 1 Lottery
@ -26,13 +24,14 @@ import java.util.function.Function;
* 14 Talking
*/
public enum FunctionIdEnum {
Lottery(1,new DefaultFunction(), MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE),
Team(2,new DefaultFunction(),MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE),
DifferDemons(3,new DefaultFunction(),MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_REQUEST_VALUE,MessageTypeProto.MessageType.POKEMON_ADVANCED_REQUEST_VALUE),
Guild(4,new DefaultFunction()),
WorkShop(5,new DefaultFunction(),MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE),
Foods(6,new DefaultFunction(),MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE),
Adventure(7,new DefaultFunction(),
Lottery(1,null, MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE),
Team(2,null,MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE),
DifferDemons(3,null,MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_REQUEST_VALUE,MessageTypeProto.MessageType.POKEMON_ADVANCED_REQUEST_VALUE),
Guild(4,null),
WorkShop(5,null,MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE),
Foods(6,null,MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE),
Adventure(7,null,
MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE,
MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_REQUEST_VALUE,
MessageTypeProto.MessageType.ADVENTURE_REWARD_REQUEST_VALUE,
@ -41,23 +40,23 @@ public enum FunctionIdEnum {
MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE),
Arena(8, new ArenaFunction()),
DailyTasks(12,new DefaultFunction()),
WorldBoss(13,new DefaultFunction()),
Talking(14,new DefaultFunction()),
DailyTasks(12,null),
WorldBoss(13,null),
Talking(14,null),
Store(20,new DefaultFunction()),
Store(20,null),
Endless(46,new EndlessFunction()),
Blood(47,new DefaultFunction()),
ToBeStronger(48,new DefaultFunction(),MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE),
SoulEquip(52,new DefaultFunction(),
Blood(47,null),
ToBeStronger(48,null,MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE),
SoulEquip(52,null,
MessageTypeProto.MessageType.SOUL_RAND_EQUIP_REQUEST_VALUE,
MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST_VALUE),
TopBattle(57,new DefaultFunction()),
WorkShopTech(101,new DefaultFunction(),MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE),
WorkShopCreateEquip(102,new DefaultFunction()),
WorkShopCreateProtectEquip(103,new DefaultFunction()),
WorkShopRebuildEquip(104,new DefaultFunction(),MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
TopBattle(57,null),
WorkShopTech(101,null,MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE),
WorkShopCreateEquip(102,null),
WorkShopCreateProtectEquip(103,null),
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
;
@ -75,7 +74,6 @@ public enum FunctionIdEnum {
}
}
}
private FunctionIdEnum(int functionId, FunctionManager manager,int... protos) {
this.manager = manager;
this.functionId = functionId;

View File

@ -1,21 +0,0 @@
package com.ljsd.jieling.core.function;
import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
/**
* @author lvxinran
* @date 2019/11/23
* @discribe
*/
public class DefaultFunction implements FunctionManager {
@Override
public void closeAction() {
}
@Override
public void startAction(TimeControllerOfFunction timeControllerOfFunction) {
}
}

View File

@ -5,6 +5,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
import com.ljsd.jieling.config.json.KTSDKConstans;
import com.ljsd.jieling.config.json.ServerProperties;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.function.FunctionContext;
import com.ljsd.jieling.db.mongo.MongoUtil;
@ -169,7 +170,10 @@ public class GlobalDataManaager {
continue;
}
TimeControllerOfFunction timeControllerOfFunction = openTimeOfFuntionCache.get(openId);
FunctionContext.getFunction(sameType).startAction(timeControllerOfFunction);
FunctionManager function = FunctionContext.getFunction(sameType);
if(function!=null){
function.startAction(timeControllerOfFunction);
}
}
}
@ -178,7 +182,10 @@ public class GlobalDataManaager {
for(Integer closeId : ids){
int sameType = STableManager.getConfig(SGlobalSystemConfig.class).get(closeId).getIsIDdSame();
// FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumById(sameType).g;
FunctionContext.getFunction(sameType).closeAction();
FunctionManager function = FunctionContext.getFunction(sameType);
if(function!=null){
function.closeAction();
}
}
}