588 公会攻防战 修复若干bug
1. 修复入口红点 点击打开攻防战界面后消失bug
2.打开宝库奖励预览界面默认选中胜者奖励
3.宝库格子领取后 格子编号显示置灰、道具名改为玩家名
# Conflicts:
# Main/System/GuildAtkDefBat/GuildAtkDefBatTreasureWin.cs
| | |
| | | public void ClearMainRedpoint() |
| | | { |
| | | hasShowedMainRedpoint = true; |
| | | mainRedpoint.state = RedPointState.None; |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | private bool HasShopFreeItem() |
| | |
| | | /// <summary>宝库奖励类型ID (对应CA504的RewardType)</summary> |
| | | public const byte TREASURE_REWARD_TYPE = 11; |
| | | |
| | | /// <summary>缓存格子开启记录: Key=格子编号(1~n), Value=AwardID</summary> |
| | | public Dictionary<int, int> treasureGridRecords = new Dictionary<int, int>(); |
| | | /// <summary>缓存格子开启记录: Key=格子编号(1~n), Value=开启记录</summary> |
| | | public Dictionary<int, GuildAtkDefBatTreasureRecord> treasureGridRecords = new Dictionary<int, GuildAtkDefBatTreasureRecord>(); |
| | | |
| | | /// <summary>标记宝库窗口是否打开,用于收到A525时自动刷新</summary> |
| | | public bool isTreasureWinOpen = false; |
| | |
| | | { |
| | | if (mem.GridNum > 0) |
| | | { |
| | | treasureGridRecords[mem.GridNum] = mem.AwardID; |
| | | treasureGridRecords[mem.GridNum] = new GuildAtkDefBatTreasureRecord |
| | | { |
| | | AwardID = mem.AwardID, |
| | | PlayerName = UIHelper.ServerStringTrim(mem.Name), |
| | | }; |
| | | } |
| | | } |
| | | |
| | | if (isTreasureWinOpen) |
| | | { |
| | | int openGrid = pendingOpenGridIndex; |
| | | if (openGrid > 0 && treasureGridRecords.TryGetValue(openGrid, out var awardID)) |
| | | GuildAtkDefBatTreasureRecord treasureRecord; |
| | | if (openGrid > 0 && treasureGridRecords.TryGetValue(openGrid, out treasureRecord)) |
| | | { |
| | | pendingOpenGridIndex = 0; |
| | | OnTreasureGridOpenEvent?.Invoke(openGrid, awardID); |
| | | OnTreasureGridOpenEvent?.Invoke(openGrid, treasureRecord.AwardID); |
| | | } |
| | | OnTreasureDataUpdateEvent?.Invoke(); |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | public class GuildAtkDefBatTreasureRecord |
| | | { |
| | | public int AwardID; |
| | | public string PlayerName; |
| | | } |
| | |
| | | /// <param name="startIndex">起始格子序号(从1开始)</param> |
| | | /// <param name="gridCount">总格子数</param> |
| | | /// <param name="isWin">是否胜利</param> |
| | | /// <param name="openedGrids">已开启的格子字典 Key=格子编号, Value=AwardID</param> |
| | | /// <param name="openedGrids">已开启的格子字典 Key=格子编号, Value=开启记录</param> |
| | | /// <param name="openAnimGridIndex">播放开启动画的格子编号(0=无)</param> |
| | | public void SetData(int startIndex, int gridCount, bool isWin, Dictionary<int, int> openedGrids, int openAnimGridIndex = 0) |
| | | public void SetData(int startIndex, int gridCount, bool isWin, Dictionary<int, GuildAtkDefBatTreasureRecord> openedGrids, int openAnimGridIndex = 0) |
| | | { |
| | | for (int i = 0; i < grids.Length; i++) |
| | | { |
| | |
| | | { |
| | | grids[i].SetActive(true); |
| | | int awardID = 0; |
| | | bool isOpened = openedGrids != null && openedGrids.TryGetValue(gridIndex, out awardID); |
| | | string playerName = string.Empty; |
| | | GuildAtkDefBatTreasureRecord treasureRecord = null; |
| | | bool isOpened = openedGrids != null && openedGrids.TryGetValue(gridIndex, out treasureRecord); |
| | | if (isOpened && treasureRecord != null) |
| | | { |
| | | awardID = treasureRecord.AwardID; |
| | | playerName = treasureRecord.PlayerName; |
| | | } |
| | | bool playAnim = openAnimGridIndex > 0 && gridIndex == openAnimGridIndex; |
| | | grids[i].Init(gridIndex, isWin, isOpened, (ushort)awardID, playAnim); |
| | | grids[i].Init(gridIndex, isWin, isOpened, (ushort)awardID, playerName, playAnim); |
| | | } |
| | | else |
| | | { |
| | |
| | | private int gridIndex; |
| | | private bool isOpened; |
| | | private ushort awardID; |
| | | private string playerName; |
| | | |
| | | /// <summary> |
| | | /// 初始化格子 |
| | |
| | | /// <param name="isWin">是否胜利</param> |
| | | /// <param name="opened">是否已开启</param> |
| | | /// <param name="awardId">奖励ID(已开启时有效)</param> |
| | | /// <param name="name">开启格子的玩家名</param> |
| | | /// <param name="playOpenAnim">是否播放开启动画(翻牌破碎特效)</param> |
| | | public void Init(int index, bool isWin, bool opened, ushort awardId, bool playOpenAnim = false) |
| | | public void Init(int index, bool isWin, bool opened, ushort awardId, string name, bool playOpenAnim = false) |
| | | { |
| | | gridIndex = index; |
| | | isOpened = opened; |
| | | awardID = awardId; |
| | | playerName = name; |
| | | |
| | | // 格子序号 |
| | | topNumText.text = index.ToString(); |
| | |
| | | topNumText.SetActive(!isOpened); |
| | | |
| | | qualityImage.SetActive(isOpened); |
| | | itemImage.SetActive(isOpened); |
| | | itemCntText.text = string.Empty; |
| | | itemNameText.text = isOpened ? playerName : string.Empty; |
| | | |
| | | if (isOpened && awardID > 0) |
| | | { |
| | | var config = FamilyAtkDefBatTreasureConfig.Get(awardID); |
| | |
| | | { |
| | | itemImage.SetItemSprite(config.ItemID); |
| | | itemCntText.text = config.ItemCount > 1 ? $"x{config.ItemCount}" : string.Empty; |
| | | itemNameText.text = itemConfig.ItemName; |
| | | } |
| | | |
| | | qualityImage.SetSprite($"GuildAtkDefBatTreasureAwardColor{config.AwardColor}"); |
| | |
| | | |
| | | awardButton.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<GuildAtkDefBatAwardPreviewWin>(); |
| | | UIManager.Instance.OpenWindow<GuildAtkDefBatAwardPreviewWin>(1); |
| | | }); |
| | | |
| | | lastLineButton.AddListener(() => |