少年修仙传客户端代码仓库
lcy
2024-09-13 6ea52c11ed5f026e5c0bf432b5d182433c3e826b
10250 仙宫 支持相同玩家同时是多个仙官的情况
2个文件已修改
66 ■■■■■ 已修改文件
System/CelestialPalace/CelestialPalaceModel.cs 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/CelestialPalace/CelestialPalaceRoomWin.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/CelestialPalace/CelestialPalaceModel.cs
@@ -81,7 +81,7 @@
        // <仙宫Id,玩家Id> 仙宫对应玩家字典
        public Dictionary<int, List<uint>> allPlayerDict = new Dictionary<int, List<uint>>();
        // <玩家Id,玩家详细信息> 所有玩家信息字典
        public Dictionary<uint, CelestialPalacePlayer> allPlayerInfoDict = new Dictionary<uint, CelestialPalacePlayer>();
        public Dictionary<int, Dictionary<uint, CelestialPalacePlayer>> allPlayerInfoDict = new Dictionary<int, Dictionary<uint, CelestialPalacePlayer>>();
        // <奖励索引,是否已领取> 奖励领取状态字典
        public Dictionary<int, bool> xgHaveDict = new Dictionary<int, bool>();
        // <仙宫Id,是否需要重新查询仙名录> 是否发查仙名录包字典
@@ -214,24 +214,28 @@
        public void UpdateXiangongNewPlayerInfo(HA927_tagGCXiangongNewPlayerInfo vNetData)
        {
            // 更新所有玩家信息字典
            int xgId = (int)vNetData.XiangongID;
            if (!allPlayerInfoDict.ContainsKey(xgId))
                allPlayerInfoDict[xgId] = new Dictionary<uint, CelestialPalacePlayer>();
            var newPlayerList = vNetData.NewPlayerList;
            for (int i = 0; i < newPlayerList.Length; i++)
            {
                uint playerId = newPlayerList[i].PlayerID;
                if (!allPlayerInfoDict.ContainsKey(playerId))
                    allPlayerInfoDict[playerId] = new CelestialPalacePlayer();
                allPlayerInfoDict[playerId].AddTime = newPlayerList[i].AddTime;
                allPlayerInfoDict[playerId].ServerID = newPlayerList[i].ServerID;
                allPlayerInfoDict[playerId].PlayerID = newPlayerList[i].PlayerID;
                allPlayerInfoDict[playerId].Name = newPlayerList[i].Name;
                allPlayerInfoDict[playerId].LV = newPlayerList[i].LV;
                allPlayerInfoDict[playerId].Job = newPlayerList[i].Job;
                allPlayerInfoDict[playerId].RealmLV = newPlayerList[i].RealmLV;
                allPlayerInfoDict[playerId].EquipShowSwitch = newPlayerList[i].EquipShowSwitch;
                allPlayerInfoDict[playerId].EquipShowID = newPlayerList[i].EquipShowID;
                if (!allPlayerInfoDict[xgId].ContainsKey(playerId))
                    allPlayerInfoDict[xgId][playerId] = new CelestialPalacePlayer();
                allPlayerInfoDict[xgId][playerId].AddTime = newPlayerList[i].AddTime;
                allPlayerInfoDict[xgId][playerId].ServerID = newPlayerList[i].ServerID;
                allPlayerInfoDict[xgId][playerId].PlayerID = newPlayerList[i].PlayerID;
                allPlayerInfoDict[xgId][playerId].Name = newPlayerList[i].Name;
                allPlayerInfoDict[xgId][playerId].LV = newPlayerList[i].LV;
                allPlayerInfoDict[xgId][playerId].Job = newPlayerList[i].Job;
                allPlayerInfoDict[xgId][playerId].RealmLV = newPlayerList[i].RealmLV;
                allPlayerInfoDict[xgId][playerId].EquipShowSwitch = newPlayerList[i].EquipShowSwitch;
                allPlayerInfoDict[xgId][playerId].EquipShowID = newPlayerList[i].EquipShowID;
            }
            // 更新仙宫对应玩家字典
            int xgId = (int)vNetData.XiangongID;
            if (!allPlayerDict.ContainsKey(xgId))
                allPlayerDict[xgId] = new List<uint>();
            for (int i = 0; i < newPlayerList.Length; i++)
@@ -249,24 +253,28 @@
        // 仙宫仙名录玩家信息
        public void UpdateXiangongRecPlayerInfo(HA928_tagGCXiangongRecPlayerInfo vNetData)
        {
            int xgId = (int)vNetData.XiangongID;
            // 更新所有玩家信息字典
            if (!allPlayerInfoDict.ContainsKey(xgId))
                allPlayerInfoDict[xgId] = new Dictionary<uint, CelestialPalacePlayer>();
            var recPlayerList = vNetData.RecPlayerList;
            for (int i = 0; i < recPlayerList.Length; i++)
            {
                uint playerId = recPlayerList[i].PlayerID;
                if (!allPlayerInfoDict.ContainsKey(playerId))
                    allPlayerInfoDict[playerId] = new CelestialPalacePlayer();
                allPlayerInfoDict[playerId].AddTime = recPlayerList[i].AddTime;
                allPlayerInfoDict[playerId].ServerID = recPlayerList[i].ServerID;
                allPlayerInfoDict[playerId].PlayerID = recPlayerList[i].PlayerID;
                allPlayerInfoDict[playerId].Name = recPlayerList[i].Name;
                allPlayerInfoDict[playerId].LV = recPlayerList[i].LV;
                allPlayerInfoDict[playerId].Job = recPlayerList[i].Job;
                allPlayerInfoDict[playerId].RealmLV = recPlayerList[i].RealmLV;
                if (!allPlayerInfoDict[xgId].ContainsKey(playerId))
                    allPlayerInfoDict[xgId][playerId] = new CelestialPalacePlayer();
                allPlayerInfoDict[xgId][playerId].AddTime = recPlayerList[i].AddTime;
                allPlayerInfoDict[xgId][playerId].ServerID = recPlayerList[i].ServerID;
                allPlayerInfoDict[xgId][playerId].PlayerID = recPlayerList[i].PlayerID;
                allPlayerInfoDict[xgId][playerId].Name = recPlayerList[i].Name;
                allPlayerInfoDict[xgId][playerId].LV = recPlayerList[i].LV;
                allPlayerInfoDict[xgId][playerId].Job = recPlayerList[i].Job;
                allPlayerInfoDict[xgId][playerId].RealmLV = recPlayerList[i].RealmLV;
            }
            // 更新仙宫对应玩家字典
            int xgId = (int)vNetData.XiangongID;
            if (!allPlayerDict.ContainsKey(xgId))
                allPlayerDict[xgId] = new List<uint>();
            for (int i = 0; i < recPlayerList.Length; i++)
@@ -630,11 +638,11 @@
        {
            newPlayerList = new List<uint>();
            var serverNow = TimeUtility.GetTodayStartTime(); // 获取服务器当前时间的当天0点
            if (!XiangongConfig.Has(xgId) || allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var list) || list == null || allPlayerInfoDict == null)
            if (!XiangongConfig.Has(xgId) || allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var list) || list == null || allPlayerInfoDict == null || !allPlayerInfoDict.TryGetValue(xgId, out var xgInfo) || xgInfo == null)
                return false;
            for (int i = 0; i < list.Count; i++)
            {
                if (!allPlayerInfoDict.TryGetValue(list[i], out var celestialPalacePlayer) || celestialPalacePlayer == null)
                if (!xgInfo.TryGetValue(list[i], out var celestialPalacePlayer) || celestialPalacePlayer == null)
                    continue;
                uint showTimes = (uint)XiangongConfig.Get(xgId).ShowDays;
                // 获取玩家晋升的时间点,并取该天的开始时间(0点)
@@ -662,12 +670,12 @@
        public List<CelestialPalacePlayer> GetXGPlayInfo(int xgId)
        {
            List<CelestialPalacePlayer> xgPlayerList = new List<CelestialPalacePlayer>();
            if (allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var playerIdList))
            if (allPlayerDict == null || !allPlayerDict.TryGetValue(xgId, out var playerIdList) || !allPlayerInfoDict.TryGetValue(xgId, out var xgInfo) || xgInfo == null)
                return xgPlayerList;
            for (int i = 0; i < playerIdList.Count; i++)
            {
                uint playerId = playerIdList[i];
                if (allPlayerInfoDict == null || !allPlayerInfoDict.TryGetValue(playerId, out var celestialPalacePlayerInfo))
                if (!xgInfo.TryGetValue(playerId, out var celestialPalacePlayerInfo))
                    continue;
                xgPlayerList.Add(celestialPalacePlayerInfo);
            }
System/CelestialPalace/CelestialPalaceRoomWin.cs
@@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
using vnxbqy.UI;
@@ -78,7 +79,8 @@
            if (currentIndex < 0 || currentIndex > newPlayerList.Count - 1)
                return;
            uint nowPlayerId = newPlayerList[currentIndex];
            if (model.allPlayerInfoDict == null || !model.allPlayerInfoDict.TryGetValue(nowPlayerId, out var celestialPalacePlayer))
            if (model.allPlayerInfoDict == null || !model.allPlayerInfoDict.TryGetValue(xgId, out var xgInfo) || xgInfo == null||
                !xgInfo.TryGetValue(nowPlayerId, out var celestialPalacePlayer))
                return;
            model.ShowTitle(titleId, imgTitlePlayer);
            imgHead.SetSprite(UIHelper.GetHeadIcon((int)celestialPalacePlayer.Job));