1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.WebResponses;
|
||||
using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess;
|
||||
using Newtonsoft.Json;
|
||||
@@ -101,39 +101,37 @@ public partial class WebSocketSendList
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
}
|
||||
/// <summary>
|
||||
/// 发射子弹
|
||||
/// 真人玩家发射子弹(新版,对接服务端 RoomFireNotice 新签名)
|
||||
/// 服务端方法:FireCannon(roomId, userId, gold, count, bulletIds, extra, isBot)
|
||||
/// 广播事件:RoomFireNotice(roomId, userId, gold, count, bulletIds, extra, isBot)
|
||||
/// 新版无需 timestamp 和 sign,bulletIds 由客户端生成
|
||||
/// </summary>
|
||||
/// <param name="roomId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="roomId">房间ID</param>
|
||||
/// <param name="userId">玩家ID</param>
|
||||
/// <param name="gold">单价</param>
|
||||
/// <param name="count">数量</param>
|
||||
/// <summary>
|
||||
/// 发射子弹(与 KillFish 同结构版本)
|
||||
/// </summary>
|
||||
/// <param name="bulletIds">子弹ID列表(客户端生成,长度需等于 count)</param>
|
||||
/// <param name="extra">附加数据(SyncGameData)</param>
|
||||
/// <param name="isBot">是否机器人(真人玩家固定 false)</param>
|
||||
public static void FireCannon(
|
||||
string roomId,
|
||||
string userId,
|
||||
long gold,
|
||||
int count,
|
||||
List<string> bulletIds,
|
||||
object extra,
|
||||
string signKey
|
||||
bool isBot = false
|
||||
)
|
||||
{
|
||||
long timespan = BeijingTimeManager.Instance.CurrentTimestampMs; // 毫秒
|
||||
long timestamp = timespan / 1000; // 秒级
|
||||
|
||||
// FireCannon 的签名规则与 KillFish 一样:roomId|userId|gold|count|timestamp
|
||||
string sign = MakeFireCannonSign(roomId, userId, gold, count, timestamp, signKey);
|
||||
|
||||
var sendObj = new WebSocketSendList(
|
||||
"FireCannon",
|
||||
roomId,
|
||||
userId,
|
||||
gold,
|
||||
count,
|
||||
timestamp,
|
||||
sign,
|
||||
extra
|
||||
bulletIds,
|
||||
extra,
|
||||
isBot
|
||||
);
|
||||
|
||||
WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj));
|
||||
|
||||
Reference in New Issue
Block a user