Selaa lähdekoodia

增加房间内玩家id列表, 增加根据uid查询玩家信息的方法.

王刚 3 vuotta sitten
vanhempi
commit
72f7ec115a

+ 3 - 1
CSserver/MultiDup/server/Room.cs

@@ -191,7 +191,9 @@ namespace MultiDup
                     p.room = this;
                     p.room = this;
                     this.ClientPeers.Add(p.Id, p);
                     this.ClientPeers.Add(p.Id, p);
                 }
                 }
-                Broadcast(TargetType.All, eProtocalCommand.ScMdEnterRoom, new SC_MD_EnterRoom() { Uid = p.UID, Zoneid = p.zoneid });
+                var list = new SC_MD_EnterRoom() { Uid = p.UID, Zoneid = p.zoneid };
+                ClientPeers.Values.ToList().ForEach(c => list.PlayerUids.Add(c.UID));
+                Broadcast(TargetType.All, eProtocalCommand.ScMdEnterRoom, list);
             }
             }
             else
             else
             {
             {

+ 2 - 0
CSserver/PBReferens/pb/MultiDup.proto

@@ -62,6 +62,8 @@ package MultiDup;
 	 int32 Mapid=3;
 	 int32 Mapid=3;
 	 string Ip=4;         // 战斗服务器ip
 	 string Ip=4;         // 战斗服务器ip
 	 int32 Port=5;        // 战斗服务器端口
 	 int32 Port=5;        // 战斗服务器端口
+	 repeated string  PlayerUids=6;
+
  }
  }
   // 多人副本, 离开房间
   // 多人副本, 离开房间
  message SC_MD_LeaveRoom {
  message SC_MD_LeaveRoom {

+ 25 - 4
CSserver/PBReferens/pbcs/MultiDup.cs

@@ -34,10 +34,11 @@ namespace MultiDup {
             "NwoJUm9vbUluZm9zGAEgAygLMiQuTXVsdGlEdXAuU0NfTURfR2V0Um9vbUxp",
             "NwoJUm9vbUluZm9zGAEgAygLMiQuTXVsdGlEdXAuU0NfTURfR2V0Um9vbUxp",
             "c3QuUm9vbUluZm8aUwoIUm9vbUluZm8SDgoGUm9vbUlkGAEgASgFEg0KBU1h",
             "c3QuUm9vbUluZm8aUwoIUm9vbUluZm8SDgoGUm9vbUlkGAEgASgFEg0KBU1h",
             "cGlkGAIgASgFEhIKClBsYXllclVpZHMYAyADKAkSFAoMYmF0dGxlc2VydmVy",
             "cGlkGAIgASgFEhIKClBsYXllclVpZHMYAyADKAkSFAoMYmF0dGxlc2VydmVy",
-            "GAQgASgJIlcKD1NDX01EX0VudGVyUm9vbRIOCgZab25laWQYASABKAUSCwoD",
+            "GAQgASgJImsKD1NDX01EX0VudGVyUm9vbRIOCgZab25laWQYASABKAUSCwoD",
             "VWlkGAIgASgJEg0KBU1hcGlkGAMgASgFEgoKAklwGAQgASgJEgwKBFBvcnQY",
             "VWlkGAIgASgJEg0KBU1hcGlkGAMgASgFEgoKAklwGAQgASgJEgwKBFBvcnQY",
-            "BSABKAUiLgoPU0NfTURfTGVhdmVSb29tEg4KBlpvbmVpZBgBIAEoBRILCgNV",
-            "aWQYAiABKAkiEAoOU0NfTURfQmVnaW5EdXBiBnByb3RvMw=="));
+            "BSABKAUSEgoKUGxheWVyVWlkcxgGIAMoCSIuCg9TQ19NRF9MZWF2ZVJvb20S",
+            "DgoGWm9uZWlkGAEgASgFEgsKA1VpZBgCIAEoCSIQCg5TQ19NRF9CZWdpbkR1",
+            "cGIGcHJvdG8z"));
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr::FileDescriptor[] { },
           new pbr::FileDescriptor[] { },
           new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
           new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
@@ -48,7 +49,7 @@ namespace MultiDup {
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.CS_MD_BeginDup), global::MultiDup.CS_MD_BeginDup.Parser, new[]{ "Zoneid", "Uid" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.CS_MD_BeginDup), global::MultiDup.CS_MD_BeginDup.Parser, new[]{ "Zoneid", "Uid" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_CreateRoom), global::MultiDup.SC_MD_CreateRoom.Parser, new[]{ "Zoneid", "Uid", "Mapid", "RoomId" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_CreateRoom), global::MultiDup.SC_MD_CreateRoom.Parser, new[]{ "Zoneid", "Uid", "Mapid", "RoomId" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_GetRoomList), global::MultiDup.SC_MD_GetRoomList.Parser, new[]{ "RoomInfos" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_GetRoomList.Types.RoomInfo), global::MultiDup.SC_MD_GetRoomList.Types.RoomInfo.Parser, new[]{ "RoomId", "Mapid", "PlayerUids", "Battleserver" }, null, null, null)}),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_GetRoomList), global::MultiDup.SC_MD_GetRoomList.Parser, new[]{ "RoomInfos" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_GetRoomList.Types.RoomInfo), global::MultiDup.SC_MD_GetRoomList.Types.RoomInfo.Parser, new[]{ "RoomId", "Mapid", "PlayerUids", "Battleserver" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_EnterRoom), global::MultiDup.SC_MD_EnterRoom.Parser, new[]{ "Zoneid", "Uid", "Mapid", "Ip", "Port" }, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_EnterRoom), global::MultiDup.SC_MD_EnterRoom.Parser, new[]{ "Zoneid", "Uid", "Mapid", "Ip", "Port", "PlayerUids" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_LeaveRoom), global::MultiDup.SC_MD_LeaveRoom.Parser, new[]{ "Zoneid", "Uid" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_LeaveRoom), global::MultiDup.SC_MD_LeaveRoom.Parser, new[]{ "Zoneid", "Uid" }, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_BeginDup), global::MultiDup.SC_MD_BeginDup.Parser, null, null, null, null)
             new pbr::GeneratedClrTypeInfo(typeof(global::MultiDup.SC_MD_BeginDup), global::MultiDup.SC_MD_BeginDup.Parser, null, null, null, null)
           }));
           }));
@@ -1427,6 +1428,7 @@ namespace MultiDup {
       mapid_ = other.mapid_;
       mapid_ = other.mapid_;
       ip_ = other.ip_;
       ip_ = other.ip_;
       port_ = other.port_;
       port_ = other.port_;
+      playerUids_ = other.playerUids_.Clone();
     }
     }
 
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1498,6 +1500,16 @@ namespace MultiDup {
       }
       }
     }
     }
 
 
+    /// <summary>Field number for the "PlayerUids" field.</summary>
+    public const int PlayerUidsFieldNumber = 6;
+    private static readonly pb::FieldCodec<string> _repeated_playerUids_codec
+        = pb::FieldCodec.ForString(50);
+    private readonly pbc::RepeatedField<string> playerUids_ = new pbc::RepeatedField<string>();
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public pbc::RepeatedField<string> PlayerUids {
+      get { return playerUids_; }
+    }
+
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     public override bool Equals(object other) {
     public override bool Equals(object other) {
       return Equals(other as SC_MD_EnterRoom);
       return Equals(other as SC_MD_EnterRoom);
@@ -1516,6 +1528,7 @@ namespace MultiDup {
       if (Mapid != other.Mapid) return false;
       if (Mapid != other.Mapid) return false;
       if (Ip != other.Ip) return false;
       if (Ip != other.Ip) return false;
       if (Port != other.Port) return false;
       if (Port != other.Port) return false;
+      if(!playerUids_.Equals(other.playerUids_)) return false;
       return true;
       return true;
     }
     }
 
 
@@ -1527,6 +1540,7 @@ namespace MultiDup {
       if (Mapid != 0) hash ^= Mapid.GetHashCode();
       if (Mapid != 0) hash ^= Mapid.GetHashCode();
       if (Ip.Length != 0) hash ^= Ip.GetHashCode();
       if (Ip.Length != 0) hash ^= Ip.GetHashCode();
       if (Port != 0) hash ^= Port.GetHashCode();
       if (Port != 0) hash ^= Port.GetHashCode();
+      hash ^= playerUids_.GetHashCode();
       return hash;
       return hash;
     }
     }
 
 
@@ -1557,6 +1571,7 @@ namespace MultiDup {
         output.WriteRawTag(40);
         output.WriteRawTag(40);
         output.WriteInt32(Port);
         output.WriteInt32(Port);
       }
       }
+      playerUids_.WriteTo(output, _repeated_playerUids_codec);
     }
     }
 
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1577,6 +1592,7 @@ namespace MultiDup {
       if (Port != 0) {
       if (Port != 0) {
         size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
         size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
       }
       }
+      size += playerUids_.CalculateSize(_repeated_playerUids_codec);
       return size;
       return size;
     }
     }
 
 
@@ -1600,6 +1616,7 @@ namespace MultiDup {
       if (other.Port != 0) {
       if (other.Port != 0) {
         Port = other.Port;
         Port = other.Port;
       }
       }
+      playerUids_.Add(other.playerUids_);
     }
     }
 
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1630,6 +1647,10 @@ namespace MultiDup {
             Port = input.ReadInt32();
             Port = input.ReadInt32();
             break;
             break;
           }
           }
+          case 50: {
+            playerUids_.AddEntriesFrom(input, _repeated_playerUids_codec);
+            break;
+          }
         }
         }
       }
       }
     }
     }

+ 11 - 7
Gameserver/Amfphp/base/CmdCode.php

@@ -159,7 +159,11 @@ class CmdCode {
      * 6015 收集玩家意见和bug
      * 6015 收集玩家意见和bug
      */
      */
     const cmd_user_ctxBack = 6015;
     const cmd_user_ctxBack = 6015;
-    const cmd_user_text = 6016;
+
+    /**
+     * 6016 查询其他玩家信息
+     */
+    const cmd_user_other_info = 6016;
     // </editor-fold>
     // </editor-fold>
     //
     //
     // <editor-fold defaultstate="collapsed" desc="好友操作码 - 61xx">
     // <editor-fold defaultstate="collapsed" desc="好友操作码 - 61xx">
@@ -620,12 +624,12 @@ class CmdCode {
      * 武器替换
      * 武器替换
      */
      */
     const cmd_store_weaponReplace = 6423;
     const cmd_store_weaponReplace = 6423;
-    
+
     /**
     /**
      * 宝石合成
      * 宝石合成
      */
      */
     const cmd_store_GemCompose = 6424;
     const cmd_store_GemCompose = 6424;
-    
+
     /**
     /**
      * 宝石研究等级提升
      * 宝石研究等级提升
      */
      */
@@ -635,12 +639,12 @@ class CmdCode {
      * 宝石镶嵌
      * 宝石镶嵌
      */
      */
     const cmd_store_GemSet = 6426;
     const cmd_store_GemSet = 6426;
-    
+
     /*
     /*
      * 宝石卸下
      * 宝石卸下
      */
      */
     const cmd_store_GemRemove = 6427;
     const cmd_store_GemRemove = 6427;
-    
+
 // </editor-fold>
 // </editor-fold>
     //
     //
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 65xx">
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 65xx">
@@ -1216,9 +1220,9 @@ class CmdCode {
      * 积分兑换道具
      * 积分兑换道具
      */
      */
     const cmd_college_ScoreExchangeItem = 7304;
     const cmd_college_ScoreExchangeItem = 7304;
-    
+
     /**
     /**
-     * 
+     *
      */
      */
     const cmd_college_GetCollegeData = 7305;
     const cmd_college_GetCollegeData = 7305;
     /**
     /**

+ 16 - 2
Gameserver/Amfphp/process/UserProc.php

@@ -47,11 +47,25 @@ class UserProc {
                 return self::InitVolcData();
                 return self::InitVolcData();
             case CmdCode::cmd_user_ctxBack:                                     # 6015 收集玩家反馈
             case CmdCode::cmd_user_ctxBack:                                     # 6015 收集玩家反馈
                 return self::UserCtxBack();
                 return self::UserCtxBack();
+            case CmdCode::cmd_user_other_info:                                  # 6016 拉取其他玩家信息
+                return self::UserOtherPlayerInfo();
             default:
             default:
                 Err(ErrCode::cmd_err);
                 Err(ErrCode::cmd_err);
         }
         }
     }
     }
 
 
+    /**
+     * 6016 拉取其他玩家的信息.
+     */
+    public static function UserOtherPlayerInfo() {
+
+        $zoneId = req()->zoneid;
+        list($other_uid) = req()->paras;
+
+        $info = UserProc::getUserInfo($zoneId, $other_uid);
+        return Resp::ok($info);
+    }
+
     /**
     /**
      * 6015 收集玩家反馈
      * 6015 收集玩家反馈
      */
      */
@@ -349,12 +363,12 @@ class UserProc {
             PayProc::checkDeltest();                                            # 检查内侧充值记录(函数内部会只检查一次)
             PayProc::checkDeltest();                                            # 检查内侧充值记录(函数内部会只检查一次)
             $college = new Info_College(req()->userInfo->game->college);
             $college = new Info_College(req()->userInfo->game->college);
             $college->initTaskCard();
             $college->initTaskCard();
-            
+
             req()->userInfo->game->colleg = $college;
             req()->userInfo->game->colleg = $college;
             UserProc::updateUserInfo();                                         # 这一步回存操作只有在 userInfo正常存在的情况下才进行
             UserProc::updateUserInfo();                                         # 这一步回存操作只有在 userInfo正常存在的情况下才进行
             $resp = Resp::ok($userInfo);                                        # 设置返回值
             $resp = Resp::ok($userInfo);                                        # 设置返回值
             self::backupUserInfo();                                             # 数据回写
             self::backupUserInfo();                                             # 数据回写
-           
+
             AuctionProc::TriggerSettlement();                                   #结算流拍信息
             AuctionProc::TriggerSettlement();                                   #结算流拍信息
             self::updtateUserZoneInfo();                                        # 1. 更新玩家分区记录
             self::updtateUserZoneInfo();                                        # 1. 更新玩家分区记录
         }
         }