1
This commit is contained in:
@@ -322,7 +322,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
|
||||
foreach (var item in list_Sits)
|
||||
{
|
||||
if (item.posID == roomJoinNotice.position)
|
||||
if (item.posID == roomJoinNotice.Position)
|
||||
{
|
||||
currSitData = item;
|
||||
// ⭐ 长按本地座位的 img_OpenPT 开关炮台面板(与 btn_ChangeTurret 同逻辑)
|
||||
@@ -353,10 +353,10 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
else
|
||||
{
|
||||
var targetSit = list_Sits.Find(s => s.posID == roomJoinNotice.position);
|
||||
var targetSit = list_Sits.Find(s => s.posID == roomJoinNotice.Position);
|
||||
// ⭐ 优先用后端 isBot 字段判断,兼容 userId.StartsWith("bot_")
|
||||
bool isBotJoin = roomJoinNotice.isBot ||
|
||||
(!string.IsNullOrEmpty(roomJoinNotice.userId) && roomJoinNotice.userId.StartsWith("bot_"));
|
||||
bool isBotJoin = roomJoinNotice.IsBot ||
|
||||
(!string.IsNullOrEmpty(roomJoinNotice.UserId) && roomJoinNotice.UserId.StartsWith("bot_"));
|
||||
|
||||
if (isBotJoin)
|
||||
{
|
||||
@@ -376,7 +376,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
// 新玩家资源加载完毕后会主动发 requestSyncFish,
|
||||
// 房主收到后才广播场上活鱼(避免新玩家还没加载完就收包丢失)
|
||||
}
|
||||
JoinGame(roomJoinNotice.position, roomJoinNotice.gold, roomJoinNotice.diamond, roomJoinNotice.cannonMultiple, 0, roomJoinNotice.userId, roomJoinNotice.cannonId, roomJoinNotice.wingsId, roomJoinNotice.warGodId);
|
||||
JoinGame(roomJoinNotice.Position, roomJoinNotice.Gold, roomJoinNotice.Diamond, roomJoinNotice.CannonMultiple, 0, roomJoinNotice.UserId, roomJoinNotice.CannonId, roomJoinNotice.WingsId, roomJoinNotice.WarGodId);
|
||||
|
||||
}
|
||||
|
||||
@@ -612,8 +612,8 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
if (open)
|
||||
{
|
||||
BuildPropList();
|
||||
// ⭐ 数量是动态数据:每次打开面板都刷新一级角标(构建有一次性守卫,刷新无守卫)
|
||||
RefreshPropFirstLayerCounts();
|
||||
// ⭐ 数量是动态数据:每次打开面板拉最新背包再刷新(刮刮卡等面板内刮出/消耗的道具也能同步)
|
||||
RefreshPropCounts();
|
||||
}
|
||||
else
|
||||
ClosePropTwo(); // 关道具面板时一并收起二层并重置展开状态
|
||||
@@ -1552,6 +1552,26 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
/// <summary>二层冷却截止时刻(Time.time,全局一个):使用任意二层道具后所有二层道具一起倒计时;列表重建后据此恢复显示</summary>
|
||||
private float _propTwoCooldownEnd;
|
||||
|
||||
/// <summary>
|
||||
/// 刷新所有道具数量显示:默认先 GetUser 拉最新背包(服务端已扣/已发)再刷一级角标 + 二层列表;
|
||||
/// fetchUser=false 用于已在 GetUser 回调内的场景(数据已最新,避免重复请求)。
|
||||
/// </summary>
|
||||
private void RefreshPropCounts(bool fetchUser = true)
|
||||
{
|
||||
if (fetchUser)
|
||||
{
|
||||
APIRequestList.GetUser((user) =>
|
||||
{
|
||||
if (user != null)
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
RefreshPropCounts(false);
|
||||
});
|
||||
return;
|
||||
}
|
||||
RefreshPropFirstLayerCounts();
|
||||
RebuildPropTwo();
|
||||
}
|
||||
|
||||
/// <summary>刷新一级道具 child0 数量:该类型在道具表里只有 1 个道具(只有第一层、点击直达使用)时直接显示具体数量(为 0 就显示 0);
|
||||
/// 能展开二层的一级项(道具表里有多个道具)显示空</summary>
|
||||
private void RefreshPropFirstLayerCounts()
|
||||
@@ -1636,6 +1656,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
{
|
||||
ClosePropTwo(); // 顺带关掉可能开着的其它二层
|
||||
UsePropEffect(single);
|
||||
RefreshPropCounts(); // ⭐ 使用后拉最新背包,刷新所有道具数量显示
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1714,6 +1735,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
StartPropTwoCooldown(); // 使用后二层所有道具一起进入 5 秒冷却
|
||||
UsePropEffect(backend);
|
||||
RefreshPropCounts(); // ⭐ 使用后拉最新背包,刷新所有道具数量显示
|
||||
}
|
||||
|
||||
/// <summary>二层是否在冷却中(全局冷却:使用任意二层道具后所有二层道具一起倒计时)</summary>
|
||||
@@ -1792,17 +1814,16 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
// 游戏内简化为一次使用1个(背包里支持滑条选数量)
|
||||
var typeName = string.IsNullOrEmpty(p.name) ? PropEnum.VIP经验.ToString() : p.name;
|
||||
APIRequestList.UseVipExp(1, (result) =>
|
||||
{
|
||||
UIManager.Instance.ShowBoardError(string.IsNullOrEmpty(result) ? "使用成功" : result);
|
||||
// 刷新用户数据,同步道具数量与VIP经验
|
||||
APIRequestList.GetUser((user) =>
|
||||
{
|
||||
if (user != null)
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
RefreshPropFirstLayerCounts(); // 数量变化后同步刷新一级角标
|
||||
RebuildPropTwo(); // 二层开着的话同步刷新显示数量
|
||||
UIManager.Instance.ShowBoardError(string.IsNullOrEmpty(result) ? "使用成功" : result);
|
||||
// 刷新用户数据,同步道具数量与VIP经验
|
||||
APIRequestList.GetUser((user) =>
|
||||
{
|
||||
if (user != null)
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
RefreshPropCounts(false); // 数据已最新:刷新一级角标 + 二层数量显示
|
||||
});
|
||||
});
|
||||
});
|
||||
//UIManager.Instance.ShowTiShi($"确定使用1个{typeName}吗?", () =>
|
||||
//{
|
||||
// APIRequestList.UseVipExp(1, (result) =>
|
||||
@@ -1912,8 +1933,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
{
|
||||
if (user != null)
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
RefreshPropFirstLayerCounts(); // 鱼雷库存已扣,刷新一级角标
|
||||
RebuildPropTwo(); // 二层开着的话同步刷新数量
|
||||
RefreshPropCounts(false); // 数据已最新:刷新一级角标 + 二层数量显示
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3220,6 +3240,9 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>锁定图标 lockFX 固定 z 轴(相机 z=-500、爆奖特效 z=-100,lockFX 在爆奖前面取 -50;图片在子对象上带 z 偏移,太靠近相机会被近平面裁掉)</summary>
|
||||
private const float LockFXFixedZ = -50f;
|
||||
|
||||
private void UpdateSingleLockFX(SitPosData sit, MonsterContral monster, Transform hitPos, GameObject icon)
|
||||
{
|
||||
// ⭐ 核心原则:鱼还活着就显示图标,鱼死了才隐藏
|
||||
@@ -3242,7 +3265,9 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
}
|
||||
|
||||
if (!icon.activeSelf) icon.SetActive(true);
|
||||
pos.z = Camera.main.transform.position.z + 1;
|
||||
// ⭐ z 轴固定 -50:图片在子对象上带 z 偏移,太靠近相机(如相机前1格)会被近平面裁掉;
|
||||
// 相机 z=-500、爆奖特效 z=-100,-50 在爆奖前面位置正合适
|
||||
pos.z = LockFXFixedZ;
|
||||
icon.transform.position = pos;
|
||||
}
|
||||
private void CheckLockTargetValid()
|
||||
@@ -3336,8 +3361,9 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
if (currSitData.lockFX != null && target.gameObject.activeInHierarchy)
|
||||
{
|
||||
if (!currSitData.lockFX.activeSelf) currSitData.lockFX.SetActive(true);
|
||||
Vector3 p = lockTr.position;
|
||||
p.z = Camera.main.transform.position.z + 1;
|
||||
// ⭐ z 轴固定 -50(与每帧 UpdateSingleLockFX 一致):在爆奖特效(z=-100)前面
|
||||
var p = lockTr.position;
|
||||
p.z = LockFXFixedZ;
|
||||
currSitData.lockFX.transform.position = p;
|
||||
}
|
||||
}
|
||||
@@ -4126,7 +4152,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
// (RoomChangeResponse 用户列表,RoomInfo 消息下发),按 userId 查询
|
||||
var playerInfo = GameManager.Instance.gameData?.currRoomData?.players?
|
||||
.Find(p => p.userId == sit.user);
|
||||
sit.SetUserInfo(sit.user, playerInfo?.userName, playerInfo?.avatar, playerInfo?.vipLevel ?? 0);
|
||||
sit.SetUserInfo(sit.user, playerInfo?.userName, playerInfo?.avatar, playerInfo?.vipLevel ?? 0, playerInfo?.userNumber);
|
||||
|
||||
// ⭐ 记录金币流水:已加钱(进房设置初始金币,本地已执行)
|
||||
GameManager.LogGoldFlowAppliedGain("JoinGame", $"座位={sitNum} 初始金币={goldNum} 钻石={diamondNum} 炮台消耗={consumeGold} 房间={GameManager.Instance.gameData?.currRoomData?.roomId}");
|
||||
|
||||
Reference in New Issue
Block a user