using Assets.MyGame.Scripts.Net; using Newtonsoft.Json; using System; /// /// 机器人 (JQR = 机器人) WebSocket 发送方法 /// 对接 FishGameHub 的 BotFireCannon / BotKillFish /// 机器人操作无需签名验证 /// public partial class WebSocketSendList { /// /// 机器人发炮(无需签名验证) /// 对应服务端 FishGameHub.BotFireCannon(roomId, botUserId, gold, count) /// 返回子弹ID列表由 RoomFireNotice 事件广播 /// /// 房间ID /// 机器人用户ID(格式: bot_xxxxxxxx) /// 单发金币数量 /// 发炮数量 public static void BotFireCannon( string roomId, string botUserId, long gold, int count ) { var sendObj = new WebSocketSendList( "BotFireCannon", roomId, botUserId, gold, count ); WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj)); } /// /// 机器人击杀鱼(无需签名验证,服务端概率判定) /// 对应服务端 FishGameHub.BotKillFish(roomId, botUserId, fishNumber, fishId, gold, bulletId) /// 击杀结果由 RoomKillNotice 事件广播 /// /// 房间ID /// 机器人用户ID /// 鱼编号(种类,如 fish_01) /// 鱼唯一 ID /// 金币数量 /// 子弹 ID(必须从 BotFireCannon 返回的 bulletIds 中取用) public static void BotKillFish( string roomId, string botUserId, string fishNumber, string fishId, long gold, string bulletId ) { var sendObj = new WebSocketSendList( "BotKillFish", roomId, botUserId, fishNumber, fishId, gold, bulletId ); WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj)); } }