代码整理

master_dev
grimm 2024-05-07 17:28:01 +08:00
parent ff8bda897d
commit e0b8ebf56c
1 changed files with 16 additions and 8 deletions

View File

@ -128,18 +128,26 @@ public class MessageUtil {
user.getPlayerInfoManager().setReds(reds);
}
public static void sendBagIndication(int sendUid,int type, List<CommonProto.Item> sendToFront,boolean isMax) {
if(!isMax){
if(null!= SimpleTransaction.current()){
PlayerInfoProto.UpdateBagIndication.Builder build = PlayerInfoProto.UpdateBagIndication.newBuilder().addAllItem(sendToFront).setType(type).setIsMax(isMax?1:0);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.UPDATE_BAG_INDICATION_VALUE));
public static void sendBagIndication(int sendUid, int type, List<CommonProto.Item> sendToFront, boolean isIndicationMax) {
PlayerInfoProto.UpdateBagIndication.Builder builder = PlayerInfoProto.UpdateBagIndication.newBuilder()
.addAllItem(sendToFront)
.setType(type);
if (isIndicationMax) {
builder.setIsMax(1);
} else {
builder.setIsMax(0);
SimpleTransaction transaction = SimpleTransaction.current();
if (transaction != null) {
transaction.dealWhileCommit(new SimpleTransaction.SendTask(builder.build(), MessageTypeProto.MessageType.UPDATE_BAG_INDICATION_VALUE));
return;
}
}
ISession session = OnlineUserManager.sessionMap.get(sendUid);
if(session!=null){
PlayerInfoProto.UpdateBagIndication build = PlayerInfoProto.UpdateBagIndication.newBuilder().addAllItem(sendToFront).setType(type).setIsMax(isMax?1:0).build();
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.UPDATE_BAG_INDICATION_VALUE,build,true);
if (session != null) {
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.UPDATE_BAG_INDICATION_VALUE, builder.build(), true);
}
}