公会发送indication

back_recharge
lvxinran 2019-08-09 15:04:12 +08:00
parent e3d9585568
commit 50cb1525c2
1 changed files with 28 additions and 13 deletions

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.family;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
import com.ljsd.jieling.config.SGuildSetting;
import com.ljsd.jieling.core.GlobalsDef;
@ -647,17 +648,9 @@ public class GuildLogic {
}
public static void sendFamilyBaseUpdateIndication(GuildInfo guildInfo){
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
CommonProto.FamilyBaseInfo familyBaseInfo = CBean2Proto.getFamilyBaseInfo(guildInfo);
Family.FamilyChangeIndication build = Family.FamilyChangeIndication.newBuilder().setFamilyBaseInfo(familyBaseInfo).build();
for(Set<Integer> items : members.values()){
for(Integer sendUid : items){
ISession session = OnlineUserManager.getSessionByUid(sendUid);
if(session!=null){
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.FAMILY_CHANGE_BASE_INDICATION_VALUE,build,true);
}
}
}
sendIndicationToMember(guildInfo,MessageTypeProto.MessageType.FAMILY_CHANGE_BASE_INDICATION,build);
}
@ -723,19 +716,17 @@ public class GuildLogic {
* @param messageType
* @throws Exception
*/
public static void viewDefendInfo(ISession session,int buildId, MessageTypeProto.MessageType messageType) throws Exception {
public static void viewDefendInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
int gid = user.getPlayerInfoManager().getGuildId();
GuildInfo guildInfo =GuilidManager.guildInfoMap.get(gid);
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder();
for(Map.Entry<Integer, Integer> entry:defendInfo.entrySet()){
if(entry.getValue()!=buildId){
continue;
}
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
defend.setStarCount(5);
defend.setUid(entry.getKey());
defend.setBuildId(entry.getValue());
response.addInfo(defend);
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
@ -782,6 +773,30 @@ public class GuildLogic {
}
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
guildInfo.updateDefendInfo(uid,buildId);
//重复,可提出
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
defend.setBuildId(buildId);
defend.setUid(uid);
defend.setStarCount(5);
sendIndicationToMember(guildInfo,messageType,defend.build());
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
/**
* 线indication
* @param guildInfo
* @param messageType
* @param generatedMessage
*/
private static void sendIndicationToMember(GuildInfo guildInfo, MessageTypeProto.MessageType messageType, GeneratedMessage generatedMessage){
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
for(Set<Integer> items : members.values()){
for(Integer sendUid : items){
ISession isession = OnlineUserManager.getSessionByUid(sendUid);
if(isession!=null){
MessageUtil.sendIndicationMessage(isession,1,messageType.getNumber(),generatedMessage,true);
}
}
}
}
}