diff --git a/Assets/MyGame/Scripts/Manager/CreateFishManager.cs b/Assets/MyGame/Scripts/Manager/CreateFishManager.cs index 669343bcc..a99814dc8 100644 --- a/Assets/MyGame/Scripts/Manager/CreateFishManager.cs +++ b/Assets/MyGame/Scripts/Manager/CreateFishManager.cs @@ -629,10 +629,10 @@ public class CreateFishManager : MonoSingleton return; //foreach (var item in bossList) //{ - // if (item.fishNumber == "13037") + // if (item.fishNumber == "11030") // item.isCreate = 2; - // if (item.fishNumber == "11035") + // if (item.fishNumber == "11027") // item.isCreate = 2; // // if (item.fishNumber == "11030") // // item.isCreate = 2; diff --git a/Assets/MyGame/Scripts/Net/APIManager.cs b/Assets/MyGame/Scripts/Net/APIManager.cs index 41d7e919a..40d09d5ff 100644 --- a/Assets/MyGame/Scripts/Net/APIManager.cs +++ b/Assets/MyGame/Scripts/Net/APIManager.cs @@ -178,6 +178,21 @@ namespace Assets.MyGame.Scripts.Net dic_API[APIType.Customer_Status] = "/customerapi/Customer/status"; dic_API[APIType.Customer_ChatLog] = "/customerapi/Customer/chatlog/{conversationId}"; dic_API[APIType.Customer_MyConversations] = "/customerapi/Customer/my-conversations"; + + // ---------------- 补充:暂未使用但已注册,方便后续接入 ---------------- + dic_API[APIType.Login_LoginByPassword] = "/api/Login/LoginByPassword"; + dic_API[APIType.User_GetUserAssets] = "/api/User/GetUserAssets"; + dic_API[APIType.User_GetFishingReturnInfo] = "/api/User/GetFishingReturnInfo"; + dic_API[APIType.User_ClaimFishingReturn] = "/api/User/ClaimFishingReturn"; + dic_API[APIType.ActivityConfig_LotteryConfig] = "/api/ActivityConfig/lotteryConfig"; + dic_API[APIType.Lottery_Config] = "/api/Lottery/Config"; + dic_API[APIType.Lottery_Draw] = "/api/Lottery/Draw"; + dic_API[APIType.Lottery_UserStatus] = "/api/Lottery/UserStatus"; + dic_API[APIType.Lottery_DrawnPrizes] = "/api/Lottery/DrawnPrizes"; + dic_API[APIType.SummonCard_Use] = "/api/SummonCard/use"; + dic_API[APIType.Dict_GetByCode] = "/api/Dict/GetByCode"; + dic_API[APIType.Dict_GetListByCode] = "/api/Dict/GetListByCode"; + dic_API[APIType.Hall_GetBattleOrderLevelStatus] = "/api/Hall/GetBattleOrderLevelStatus"; } // ---------------- GET ---------------- diff --git a/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs b/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs new file mode 100644 index 000000000..e65aded28 --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs @@ -0,0 +1,71 @@ +using System; + +namespace Assets.MyGame.Scripts.Net.APIRequest.Params +{ + // ============================================================ + // 补充参数类:以下接口暂未接入业务,但已注册到 APIManager, + // 方便后续快速接入。按 swagger 路径分组放置。 + // ============================================================ + + // ---------------- /api/Login/LoginByPassword(POST) ---------------- + /// 密码登录请求体 + [Serializable] + public class LoginByPasswordParam : RequestParamBase + { + /// 账号(手机号/用户名) + public string account; + /// 密码 + public string password; + } + + // ---------------- /api/User/GetFishingReturnInfo(GET) ---------------- + /// 获取捕鱼返利信息参数 + [Serializable] + public class GetFishingReturnInfoParam : RequestParamBase + { + // 后端文档未明确字段,预留 userId;按需补充 + public string userId; + } + + // ---------------- /api/User/ClaimFishingReturn(GET) ---------------- + /// 领取捕鱼返利参数 + [Serializable] + public class ClaimFishingReturnParam : RequestParamBase + { + public string userId; + } + + // ---------------- /api/Lottery/Draw(GET) ---------------- + /// 抽奖参数 + [Serializable] + public class LotteryDrawParam : RequestParamBase + { + /// 抽奖活动 ID(按后端定义补充) + public int lotteryId; + } + + // ---------------- /api/SummonCard/use(GET) ---------------- + /// 使用召唤卡参数 + [Serializable] + public class SummonCardUseParam : RequestParamBase + { + /// 召唤卡编号 + public string cardNumber; + } + + // ---------------- /api/Dict/GetByCode(GET) ---------------- + /// 字典查询参数(按 code 取单条) + [Serializable] + public class DictGetByCodeParam : RequestParamBase + { + public string code; + } + + // ---------------- /api/Dict/GetListByCode(GET) ---------------- + /// 字典列表查询参数(按 code 取列表) + [Serializable] + public class DictGetListByCodeParam : RequestParamBase + { + public string code; + } +} diff --git a/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs.meta b/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs.meta new file mode 100644 index 000000000..93ac65001 --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIRequest/Params/SupplementParams.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ba31229aeeedc2459e34f8417b52a88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs b/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs new file mode 100644 index 000000000..59aca8793 --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs @@ -0,0 +1,117 @@ +using Assets.MyGame.Scripts.Net.API; +using Assets.MyGame.Scripts.Net.APIRequest.Params; +using Assets.MyGame.Scripts.Net.APIResponses; +using System; +using System.Collections.Generic; + +namespace Assets.MyGame.Scripts.Net +{ + /// + /// 补充请求方法:以下接口暂未接入业务,仅注册调用入口。 + /// 字段类型为推测,接入业务前请按后端实际返回再调整。 + /// + public static partial class APIRequestList + { + // ---------------- Login ---------------- + + /// + /// 密码登录(POST /api/Login/LoginByPassword) + /// 当前用 LoginPhone 已够用,暂不接入。 + /// + public static void LoginByPassword(LoginByPasswordParam req, Action callback) + { + APIManager.Response(APIType.Login_LoginByPassword, req, obj => + { + GameManager.Instance.user = obj; + callback?.Invoke(obj); + }); + } + + // ---------------- User ---------------- + + /// + /// 获取当前用户资产 + 背包(GET /api/User/GetUserAssets) + /// 当前直接用 GetUser 已够用,暂不接入。 + /// + public static void GetUserAssets(Action callback) + { + APIManager.Response(APIType.User_GetUserAssets, callback); + } + + /// 获取捕鱼返利信息(GET /api/User/GetFishingReturnInfo) + public static void GetFishingReturnInfo(Action callback) + { + APIManager.Response(APIType.User_GetFishingReturnInfo, callback); + } + + /// 领取捕鱼返利金币(GET /api/User/ClaimFishingReturn) + public static void ClaimFishingReturn(Action callback) + { + APIManager.Response(APIType.User_ClaimFishingReturn, callback); + } + + // ---------------- ActivityConfig ---------------- + + /// 奖池抽奖活动配置(GET /api/ActivityConfig/lotteryConfig) + public static void GetLotteryActivityConfig(Action callback) + { + APIManager.Response(APIType.ActivityConfig_LotteryConfig, callback); + } + + // ---------------- Lottery ---------------- + + /// 抽奖配置(GET /api/Lottery/Config) + public static void GetLotteryConfig(Action callback) + { + APIManager.Response(APIType.Lottery_Config, callback); + } + + /// 抽奖(GET /api/Lottery/Draw) + public static void LotteryDraw(LotteryDrawParam req, Action callback) + { + APIManager.Response(APIType.Lottery_Draw, req, callback); + } + + /// 用户抽奖状态(GET /api/Lottery/UserStatus) + public static void GetLotteryUserStatus(Action callback) + { + APIManager.Response(APIType.Lottery_UserStatus, callback); + } + + /// 已抽奖项(GET /api/Lottery/DrawnPrizes) + public static void GetLotteryDrawnPrizes(Action> callback) + { + APIManager.Response>(APIType.Lottery_DrawnPrizes, callback); + } + + // ---------------- SummonCard ---------------- + + /// 使用召唤卡(GET /api/SummonCard/use) + public static void UseSummonCard(SummonCardUseParam req, Action callback) + { + APIManager.Response(APIType.SummonCard_Use, req, callback); + } + + // ---------------- Dict ---------------- + + /// 字典单条查询(GET /api/Dict/GetByCode) + public static void GetDictByCode(DictGetByCodeParam req, Action callback) + { + APIManager.Response(APIType.Dict_GetByCode, req, callback); + } + + /// 字典列表查询(GET /api/Dict/GetListByCode) + public static void GetDictListByCode(DictGetListByCodeParam req, Action> callback) + { + APIManager.Response>(APIType.Dict_GetListByCode, req, callback); + } + + // ---------------- Hall ---------------- + + /// 获取战令各等级奖励领取状态(GET /api/Hall/GetBattleOrderLevelStatus) + public static void GetBattleOrderLevelStatus(Action callback) + { + APIManager.Response(APIType.Hall_GetBattleOrderLevelStatus, callback); + } + } +} diff --git a/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs.meta b/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs.meta new file mode 100644 index 000000000..bc4a68f7e --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIRequestList_Supplement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 143eabfa275ff2d48bf4ca896d6d9d34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs b/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs new file mode 100644 index 000000000..03d8e9fbd --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; + +namespace Assets.MyGame.Scripts.Net.APIResponses +{ + // ============================================================ + // 补充响应类:以下接口暂未接入业务,但已注册到 APIManager, + // 方便后续快速接入。按 swagger 路径分组放置。 + // 字段类型为推测,接入业务前请按后端实际返回再调整。 + // ============================================================ + + // ---------------- /api/User/GetUserAssets ---------------- + /// 用户资产 + 背包统一响应 + [Serializable] + public class UserAssetsResponse + { + public string userId; + public long gold; + public int diamond; + public long safeBoxGold; + public int level; + public long exp; + public int vipLevel; + public List props; + } + + // ---------------- /api/User/GetFishingReturnInfo ---------------- + /// 捕鱼返利信息 + [Serializable] + public class FishingReturnInfoResponse + { + /// 待领取返利金币 + public long pendingGold; + /// 累计返利金币 + public long totalGold; + /// 上次结算时间 + public long lastSettleTime; + /// 是否可领取 + public bool canClaim; + } + + // ---------------- /api/User/ClaimFishingReturn ---------------- + /// 领取捕鱼返利响应 + [Serializable] + public class ClaimFishingReturnResponse + { + /// 本次领取金币 + public long claimedGold; + /// 领取时间 + public long claimTime; + } + + // ---------------- /api/ActivityConfig/lotteryConfig & /api/Lottery/Config ---------------- + /// 抽奖活动配置 + [Serializable] + public class LotteryConfigResponse + { + public int lotteryId; + public string name; + public long startTime; + public long endTime; + public List prizes; + } + + [Serializable] + public class LotteryPrizeInfo + { + public int prizeId; + public string prizeName; + public int prizeType; // 1=金币 2=钻石 3=道具 + public int count; + public int weight; // 权重 + public string icon; + } + + // ---------------- /api/Lottery/Draw ---------------- + /// 抽奖结果 + [Serializable] + public class LotteryDrawResponse + { + public int prizeId; + public string prizeName; + public int prizeType; + public int count; + public long drawTime; + } + + // ---------------- /api/Lottery/UserStatus ---------------- + /// 用户抽奖状态 + [Serializable] + public class LotteryUserStatusResponse + { + public int lotteryId; + public int freeCount; // 剩余免费次数 + public int paidCount; // 剩余付费次数 + public long lastDrawTime; + } + + // ---------------- /api/Lottery/DrawnPrizes ---------------- + /// 已抽奖项记录 + [Serializable] + public class LotteryDrawnPrizeItem + { + public int prizeId; + public string prizeName; + public int prizeType; + public int count; + public long drawTime; + } + + // ---------------- /api/SummonCard/use ---------------- + /// 使用召唤卡响应 + [Serializable] + public class SummonCardUseResponse + { + public bool success; + public string message; + public List drops; // 掉落道具列表 + } + + // ---------------- /api/Dict/GetByCode ---------------- + /// 字典单条 + [Serializable] + public class DictItem + { + public string code; + public string name; + public string value; + public string remark; + } + + // ---------------- /api/Hall/GetBattleOrderLevelStatus ---------------- + /// 战令各等级奖励领取状态 + [Serializable] + public class BattleOrderLevelStatusResponse + { + public int currentLevel; + public List normalReceivedLevels; // 普通奖励已领取等级 + public List luxuryReceivedLevels; // 豪华奖励已领取等级 + public List supremeReceivedLevels; // 至尊奖励已领取等级 + } +} diff --git a/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs.meta b/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs.meta new file mode 100644 index 000000000..1985023fb --- /dev/null +++ b/Assets/MyGame/Scripts/Net/APIResponses/SupplementResponses.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1fcbfa8b86b09c347b35eb726285010c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyGame/Scripts/Net/APIType.cs b/Assets/MyGame/Scripts/Net/APIType.cs index 33ee749d7..9469d44db 100644 --- a/Assets/MyGame/Scripts/Net/APIType.cs +++ b/Assets/MyGame/Scripts/Net/APIType.cs @@ -376,5 +376,46 @@ namespace Assets.MyGame.Scripts.Net /// 获取我的会话列表(含消息)GET Customer_MyConversations, + + // ---------------- 补充:暂未使用但已注册,方便后续接入 ---------------- + + /// 密码登录(POST /api/Login/LoginByPassword) + Login_LoginByPassword, + + /// 获取当前用户资产和背包(GET /api/User/GetUserAssets) + User_GetUserAssets, + + /// 获取捕鱼返利信息(GET /api/User/GetFishingReturnInfo) + User_GetFishingReturnInfo, + + /// 领取捕鱼返利金币(GET /api/User/ClaimFishingReturn) + User_ClaimFishingReturn, + + /// 奖池抽奖活动配置(GET /api/ActivityConfig/lotteryConfig) + ActivityConfig_LotteryConfig, + + /// 抽奖配置(GET /api/Lottery/Config) + Lottery_Config, + + /// 抽奖(GET /api/Lottery/Draw) + Lottery_Draw, + + /// 用户抽奖状态(GET /api/Lottery/UserStatus) + Lottery_UserStatus, + + /// 已抽奖项(GET /api/Lottery/DrawnPrizes) + Lottery_DrawnPrizes, + + /// 使用召唤卡(GET /api/SummonCard/use) + SummonCard_Use, + + /// 字典查询(GET /api/Dict/GetByCode) + Dict_GetByCode, + + /// 字典列表查询(GET /api/Dict/GetListByCode) + Dict_GetListByCode, + + /// 获取战令各等级奖励领取状态(GET /api/Hall/GetBattleOrderLevelStatus) + Hall_GetBattleOrderLevelStatus, } } \ No newline at end of file diff --git a/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs b/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs index 5ece96924..30b6af8cc 100644 --- a/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs +++ b/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs @@ -394,6 +394,9 @@ namespace Assets.MyGame.Scripts.Net case "KillAnnouncement": WebSocketReponseList.KillAnnouncement(msg); break; + case "LevelChangedNEW": + WebSocketReponseList.LevelChanged(msg); + break; default: break; } @@ -609,6 +612,50 @@ namespace Assets.MyGame.Scripts.Net } break; + // ======== FishGameHub / FishRoomHub 补充事件 ======== + + case "BotLeaveRoomNoticeNEW": + { + // 机器人退出房间,数据 { userId } + var data = JsonConvert.DeserializeObject>>(msg).arguments[0]; + string botUserId = data != null && data.TryGetValue("userId", out var buid) ? buid?.ToString() : ""; + Debug.Log($"[FishGameHub] 机器人退出: {botUserId}"); + WebSocketReponseList.BotLeaveRoom(botUserId); + } + break; + + case "HostDisconnectNEW": + { + // 房主断线,其他玩家可接受机器人控制权 + Debug.Log("[FishGameHub] 房主断线,可接受机器人控制权"); + WebSocketReponseList.HostDisconnect(); + } + break; + + case "OnSeatChange": + { + // 座位变更 { type, userId, position, showWaiting? } + var data = JsonConvert.DeserializeObject>>(msg).arguments[0]; + if (data != null) + { + int seatType = data.TryGetValue("type", out var t) ? Convert.ToInt32(t) : 0; + string userId = data.TryGetValue("userId", out var u) ? u?.ToString() : ""; + int position = data.TryGetValue("position", out var p) ? Convert.ToInt32(p) : -1; + bool showWaiting = data.TryGetValue("showWaiting", out var sw) && Convert.ToBoolean(sw); + Debug.Log($"[FishGameHub] 座位变更: type={seatType}, userId={userId}, position={position}, showWaiting={showWaiting}"); + WebSocketReponseList.SeatChange(seatType, userId, position, showWaiting); + } + } + break; + + case "RoomChange": + { + // FishRoomHub 房间变化通知(人数/状态变更),更新房间列表 + Debug.Log("[FishRoomHub] 房间变化通知"); + WebSocketReponseList.RoomChangeNotice(msg); + } + break; + default: break; } diff --git a/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs b/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs index 94ac16ef4..40fa87e05 100644 --- a/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs +++ b/Assets/MyGame/Scripts/Net/WebSocketReponseList.cs @@ -449,6 +449,156 @@ namespace Assets.MyGame.Scripts.Net UIManager.Instance.ShowBoardGongGao(data.text); } + /// + /// LoginHub LevelChangedNEW — 后台修改玩家等级 + /// 直接调用 GetUser 刷新用户数据,触发 OnUserDataChanged 同步 UI + /// + public static void LevelChanged(string msg) + { + var data = JsonConvert.DeserializeObject>(msg).arguments[0]; + var userId = GameManager.Instance?.user?.id; + if (!string.IsNullOrEmpty(userId)) + APIRequestList.GetUser(userId, a => GameManager.Instance.UpdataUserData(a)); + } + + // ---------------- FishGameHub 补充 ---------------- + + /// + /// FishGameHub BotLeaveRoomNoticeNEW — 机器人退出房间 + /// 仅触发对应座位显示等待,不影响本地玩家(自己退出走 LeaveRoomResult) + /// + public static void BotLeaveRoom(string botUserId) + { + if (string.IsNullOrEmpty(botUserId)) return; + switch (GameManager.Instance.gameData.currGameType) + { + case GameType.FLZY: + ReleaseBotSit(UIPanel.MainGamePanelFLZY, botUserId); + break; + case GameType.YYSC: + ReleaseBotSit(UIPanel.MainGamePanelYYSC, botUserId); + break; + case GameType.XJMH: + ReleaseBotSit(UIPanel.MainGamePanelXJMH, botUserId); + break; + case GameType.HHWK: + ReleaseBotSit(UIPanel.MainGamePanelHHWK, botUserId); + break; + default: + break; + } + } + + /// 释放机器人座位(显示等待界面,标记为 bot) + private static void ReleaseBotSit(UIPanel panelName, string botUserId) + { + var panel = UIManager.Instance.Get(panelName); + if (panel == null) return; + foreach (var sit in panel.list_Sits) + { + if (sit.user == botUserId) + { + sit.isBot = true; + sit.ShowWaiting(); + break; + } + } + } + + /// + /// FishGameHub HostDisconnectNEW — 房主断线 + /// 其他玩家可接受机器人控制权。本地房主引用若已断线则转移给本地首个非人机玩家。 + /// + public static void HostDisconnect() + { + // 房主断线 → 触发房主转移(SitPosData 已封装好转移逻辑) + SitPosData.TransferRoomOwner(); + } + + /// + /// FishGameHub OnSeatChange — 座位变更 + /// { type, userId, position, showWaiting? } + /// type 字段后端未明确定义,先按 showWaiting 决定显示状态 + /// + public static void SeatChange(int seatType, string userId, int position, bool showWaiting) + { + if (string.IsNullOrEmpty(userId) || position < 0) return; + + GameMainPanel_FishBase panel = null; + switch (GameManager.Instance.gameData.currGameType) + { + case GameType.FLZY: + panel = UIManager.Instance.Get(UIPanel.MainGamePanelFLZY); + break; + case GameType.YYSC: + panel = UIManager.Instance.Get(UIPanel.MainGamePanelYYSC); + break; + case GameType.XJMH: + panel = UIManager.Instance.Get(UIPanel.MainGamePanelXJMH); + break; + case GameType.HHWK: + panel = UIManager.Instance.Get(UIPanel.MainGamePanelHHWK); + break; + default: + break; + } + if (panel == null) return; + + var targetSit = panel.list_Sits.Find(s => s.posID == position); + if (targetSit == null) return; + + if (showWaiting) + { + // 显示等待界面(玩家离开该座位) + targetSit.ShowWaiting(); + } + else + { + // 玩家进入该座位 + targetSit.isBot = !string.IsNullOrEmpty(userId) && userId.StartsWith("bot_"); + } + } + + /// + /// FishRoomHub RoomChange — 房间变化通知 + /// 房间列表界面收到时刷新显示。当前仅在房间列表 UI 开启时更新数据, + /// 具体刷新逻辑由 UIHome_BY_SelectRoomLevelPanel / 手动选座面板按需实现。 + /// + public static void RoomChangeNotice(string msg) + { + try + { + var roomData = JsonConvert.DeserializeObject>(msg).arguments[0]; + if (roomData == null) return; + // 通知手动选座面板刷新(若开启) + var homeMain = UIManager.Instance.Get(UIPanel.HomeMainPanel); + if (homeMain == null) return; + var selectRoomPanel = homeMain.subUIManager.Get(UIPanel.SelectRoomLeavePenel); + if (selectRoomPanel != null && selectRoomPanel.isMySelectRoom) + { + selectRoomPanel.panel_UIHome_BY_MySelectRoomPenel?.OnRoomChange(roomData); + } + } + catch (Exception e) + { + Debug.LogWarning("[RoomChangeNotice] 解析失败: " + e.Message); + } + } + + /// + /// LoginHub LevelChangedNEW 数据 + /// + [Serializable] + public class LevelChangedData + { + public int newLevel; + public long newExp; + public long newGold; + public int newDiamond; + public string source; + public string remark; + } + // ---------------- Customer ---------------- /// diff --git a/Assets/MyGame/Scripts/Net/WebSocketSendList_Fish.cs b/Assets/MyGame/Scripts/Net/WebSocketSendList_Fish.cs index 8007d0ecc..e637dad42 100644 --- a/Assets/MyGame/Scripts/Net/WebSocketSendList_Fish.cs +++ b/Assets/MyGame/Scripts/Net/WebSocketSendList_Fish.cs @@ -157,6 +157,26 @@ public partial class WebSocketSendList var sendObj = new WebSocketSendList("Bind", userId); WebSocketManager.Instance.Send(SocketType.login, JsonConvert.SerializeObject(sendObj)); } + + /// + /// 断线重连(必须先调用,重新加入房间前调用) + /// 对应服务端 FishGameHub.Reconnect(string userId) + /// + public static void Reconnect(string userId) + { + var sendObj = new WebSocketSendList("Reconnect", userId); + WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj)); + } + + /// + /// 获取玩家信息(结果通过 SendPlayerInfoResult 事件返回) + /// 对应服务端 FishGameHub.GetPlayerInfo(string roomId, string userId) + /// + public static void GetPlayerInfo(string roomId, string userId) + { + var sendObj = new WebSocketSendList("GetPlayerInfo", roomId, userId); + WebSocketManager.Instance.Send(SocketType.game, JsonConvert.SerializeObject(sendObj)); + } /// /// 加入房间 /// diff --git a/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JLBJ.prefab b/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JLBJ.prefab index c71021f06..1ea35221f 100644 --- a/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JLBJ.prefab +++ b/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JLBJ.prefab @@ -59,7 +59,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c8709d7f880a24c4b8e963ff8497bc8b, type: 3} m_Name: m_EditorClassIdentifier: - bjEndUI: {fileID: 0} + bjEndUI: {fileID: 4300126860111980404, guid: ee64541cedf5f2b409b6c5846977aa06, type: 3} useScorePanel: 0 tMP_Score: {fileID: 1728322933195366793} scorePanelPrefab: {fileID: 0} @@ -78,6 +78,7 @@ MonoBehaviour: coinFlyDuration: 0.5 coinArrivalInterval: 0.1 isSelf: 0 + autoFinishOnScoreFull: 1 totalBJCount: 0 currBJCount: 0 isEffEnd: 0 diff --git a/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JinLongEvent.cs b/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JinLongEvent.cs index 388bb7129..2ccca0137 100644 --- a/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JinLongEvent.cs +++ b/Assets/MyGame/aa/Game/FLZY/BOSS/JL/JinLongEvent.cs @@ -82,6 +82,8 @@ public class JinLongEvent : BJEventBase } bool isAddScore=false; + float a = 1f; + float elapsed = 0f; private void Update() { if (!isAddScore) return; @@ -90,7 +92,9 @@ public class JinLongEvent : BJEventBase // 第三阶段:currScore 增加到 maxScore if (currScore < maxScore) { - currScore += Random.Range(paoBei , paoBei*2); + elapsed += Time.deltaTime; + float t = elapsed / a; + currScore = (int)Mathf.Lerp(0, maxScore, t); if (currScore > maxScore) currScore = maxScore; diff --git a/Assets/MyGame/aa/Game/FLZY/BOSS/QL/Game173_Effect_LDJT.prefab b/Assets/MyGame/aa/Game/FLZY/BOSS/QL/Game173_Effect_LDJT.prefab index 5fc0f31ca..07499b10d 100644 --- a/Assets/MyGame/aa/Game/FLZY/BOSS/QL/Game173_Effect_LDJT.prefab +++ b/Assets/MyGame/aa/Game/FLZY/BOSS/QL/Game173_Effect_LDJT.prefab @@ -33343,8 +33343,9 @@ MonoBehaviour: m_Calls: [] m_text: m_isRightToLeft: 0 - m_fontAsset: {fileID: 0} - m_sharedMaterial: {fileID: 0} + m_fontAsset: {fileID: 11400000, guid: 5d4a713fdd931db4c9ce49f068b54e0a, type: 2} + m_sharedMaterial: {fileID: 3593458263369068374, guid: 5d4a713fdd931db4c9ce49f068b54e0a, + type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -33363,17 +33364,17 @@ MonoBehaviour: m_spriteAsset: {fileID: 0} m_tintAllSprites: 0 m_StyleSheet: {fileID: 0} - m_TextStyleHashCode: 0 + m_TextStyleHashCode: -1183493901 m_overrideHtmlColors: 0 m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: -99 + m_fontSize: 36 m_fontSizeBase: 36 m_fontWeight: 400 m_enableAutoSizing: 0 - m_fontSizeMin: 0 - m_fontSizeMax: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 m_fontStyle: 0 m_HorizontalAlignment: 1 m_VerticalAlignment: 256 @@ -33389,12 +33390,12 @@ MonoBehaviour: m_overflowMode: 0 m_linkedTextComponent: {fileID: 0} parentLinkedComponent: {fileID: 0} - m_enableKerning: 0 + m_enableKerning: 1 m_enableExtraPadding: 0 checkPaddingRequired: 0 m_isRichText: 1 m_parseCtrlCharacters: 1 - m_isOrthographic: 0 + m_isOrthographic: 1 m_isCullingEnabled: 0 m_horizontalMapping: 0 m_verticalMapping: 0 @@ -132361,7 +132362,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e4f5dd9a6b3cca14b960a02a2a8ab3a4, type: 3} m_Name: m_EditorClassIdentifier: - bjEndUI: {fileID: 0} + bjEndUI: {fileID: 1790254316978060978, guid: 24c31eadc42c2a84782806970ca46b14, type: 3} useScorePanel: 1 tMP_Score: {fileID: 6528776512666913368} scorePanelPrefab: {fileID: 0} diff --git a/Assets/MyGame/aa/Game/FLZY/BOSS/QL/LeiLongEvent.cs b/Assets/MyGame/aa/Game/FLZY/BOSS/QL/LeiLongEvent.cs index 38cd5a33b..1e71b6e97 100644 --- a/Assets/MyGame/aa/Game/FLZY/BOSS/QL/LeiLongEvent.cs +++ b/Assets/MyGame/aa/Game/FLZY/BOSS/QL/LeiLongEvent.cs @@ -83,13 +83,20 @@ public class LeiLongEvent : BJEventBase tMP_longzhu1.text = longzhu1.ToString(); } bool isAddScore=false; - float a = 1f; + float a = 3f; + float elapsed = 0f; + private void Update() { + if (isAddScore) { if (currScore < maxScore - paoBei) { - currScore += Random.Range(paoBei, paoBei*2); + elapsed += Time.deltaTime; + float t = elapsed / a; + currScore = (int)Mathf.Lerp(0, maxScore, t); + + //currScore += Random.Range(paoBei, paoBei*2); tMP_Score.text = currScore.ToString(); } else @@ -104,7 +111,15 @@ public class LeiLongEvent : BJEventBase } public override void die() { - base.die(); + StartCoroutine(i()); + } + public IEnumerator i() + { + yield return new WaitForSeconds(1f); + transform.DOScale(Vector3.zero, 0.5f).OnComplete(() => + { + Destroy(gameObject); + }); } } diff --git a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_MySelectRoomPanel.cs b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_MySelectRoomPanel.cs index cafd57dc1..e1d4577e2 100644 --- a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_MySelectRoomPanel.cs +++ b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_MySelectRoomPanel.cs @@ -178,19 +178,7 @@ public class UIHome_BY_MySelectRoomPanel : SubUIBase tran.name = item.roomId; itemListDic[item.roomId] = tran; - var slider = tran.transform.GetChild(0).GetComponent(); - int allPlayerCount = item.currentOnlinePlayerCount + item.robotCount; - if (slider != null) - { - slider.value = (float)allPlayerCount / (float)item.maxPlayerCount; - if (allPlayerCount >= item.maxPlayerCount && slider.fillRect != null && slider.fillRect.childCount > 0) - slider.fillRect.GetChild(0).gameObject.SetActive(true); - } - - if (tran.transform.GetChild(0).childCount > 3 && tran.transform.GetChild(0).GetChild(3) != null) - tran.transform.GetChild(0).GetChild(3).GetComponent().text = allPlayerCount + "/" + item.maxPlayerCount; - if (tran.transform.childCount > 1 && tran.transform.GetChild(1) != null) - tran.transform.GetChild(1).GetComponent().text = item.roomNumber.ToString(); + UpdateRoomItemUI(tran, item.currentOnlinePlayerCount, item.robotCount, item.maxPlayerCount, item.roomNumber); i++; } @@ -198,4 +186,34 @@ public class UIHome_BY_MySelectRoomPanel : SubUIBase scroll.horizontalNormalizedPosition = 0; pageNum = 1; } + + /// + /// FishRoomHub RoomChange 通知:更新单个房间项的人数显示 + /// + public void OnRoomChange(RoomChangeResponse room) + { + if (room == null || string.IsNullOrEmpty(room.roomId)) return; + if (!itemListDic.TryGetValue(room.roomId, out var tran) || tran == null) return; + UpdateRoomItemUI(tran, room.currentOnlinePlayerCount, room.robotCount, room.maxPlayerCount, room.roomNumber); + } + + /// 更新单个房间项的 UI(slider + 人数文本 + 房间号) + private void UpdateRoomItemUI(Transform tran, int currentOnline, int robot, int maxPlayer, int roomNumber) + { + var slider = tran.transform.GetChild(0).GetComponent(); + int allPlayerCount = currentOnline + robot; + if (slider != null) + { + slider.value = (float)allPlayerCount / (float)maxPlayer; + if (allPlayerCount >= maxPlayer && slider.fillRect != null && slider.fillRect.childCount > 0) + slider.fillRect.GetChild(0).gameObject.SetActive(true); + else if (allPlayerCount < maxPlayer && slider.fillRect != null && slider.fillRect.childCount > 0) + slider.fillRect.GetChild(0).gameObject.SetActive(false); + } + + if (tran.transform.GetChild(0).childCount > 3 && tran.transform.GetChild(0).GetChild(3) != null) + tran.transform.GetChild(0).GetChild(3).GetComponent().text = allPlayerCount + "/" + maxPlayer; + if (tran.transform.childCount > 1 && tran.transform.GetChild(1) != null) + tran.transform.GetChild(1).GetComponent().text = roomNumber.ToString(); + } }