From 5a4e34c8a85737c0fa5b5775122da31155cbaef3 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 09 二月 2026 14:46:01 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/HeroUI/HeroCollectionWin.cs | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 155 insertions(+), 1 deletions(-)
diff --git a/Main/System/HeroUI/HeroCollectionWin.cs b/Main/System/HeroUI/HeroCollectionWin.cs
index 6624ec1..16a2331 100644
--- a/Main/System/HeroUI/HeroCollectionWin.cs
+++ b/Main/System/HeroUI/HeroCollectionWin.cs
@@ -1,4 +1,6 @@
+using System;
using System.Collections.Generic;
+using System.Linq;
using UnityEngine;
using UnityEngine.UI;
@@ -8,20 +10,172 @@
/// </summary>
public class HeroCollectionWin : UIBase
{
+ [SerializeField] Button heroPackBtn;
+ [SerializeField] Text heroPackText;
+ [SerializeField] ScrollerController heroListScroller;
+ // [SerializeField] List<Text> totalAttrList;
+ [SerializeField] Button attrBtn;
+ [SerializeField] Transform heroSelectBehaviour;
+ HeroSelectBehaviour fiterManager; //姝﹀皢绛涢��
+ SinglePack singlePack;
protected override void InitComponent()
{
+ attrBtn.AddListener(() =>
+ {
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ SmallTipWin.showText = Language.Get("herocard6");
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ });
+ heroPackBtn.AddListener(() =>
+ {
+ HeroUIManager.Instance.QueryUnLockHeroPack();
+ });
+
+ fiterManager = HeroSelectBehaviour.Create(heroSelectBehaviour);
}
protected override void OnPreOpen()
{
-
+ singlePack = PackManager.Instance.GetSinglePack(PackType.Hero);
+ PackManager.Instance.gridRefreshEvent += GridRefreshEvent;
+ PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
+ HeroUIManager.Instance.OnHeroCollectEvent += OnHeroCollectEvent;
+ heroListScroller.OnRefreshCell += OnRefreshCell;
+ HeroUIManager.Instance.SortHeroCollectList();
+ Display();
}
protected override void OnPreClose()
{
+
+ PackManager.Instance.gridRefreshEvent -= GridRefreshEvent;
+ PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
+ HeroUIManager.Instance.OnHeroCollectEvent -= OnHeroCollectEvent;
+ heroListScroller.OnRefreshCell -= OnRefreshCell;
+ }
+
+
+ void Display()
+ {
+ fiterManager.Display(0, SelectJobCountry);
+
+ // CreateScroller();
+ // RefreshTotalAttr();
+ RefreshPackCount();
+ }
+
+
+ void RefreshItemEvent(PackType type, int index, int itemID)
+ {
+ if (type != PackType.Hero)
+ return;
+
+
+ RefreshPackCount();
+
+ }
+
+ void RefreshPackCount()
+ {
+ int count = singlePack.GetAllItems().Count;
+ heroPackText.text = UIHelper.AppendColor(count >= singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown,
+ string.Format("{0}/{1}", count, singlePack.unlockedGridCount));
+
+ }
+
+ void GridRefreshEvent(PackType type)
+ {
+ if (type != PackType.Hero)
+ return;
+
+ RefreshPackCount();
+ }
+
+
+ // void RefreshTotalAttr()
+ // {
+ // for (int i = 0; i < totalAttrList.Count; i++)
+ // {
+ // totalAttrList[i].text = PlayerPropertyConfig.GetFullDescription(PlayerPropertyConfig.basePerAttrs[i],
+ // HeroUIManager.Instance.allHeroBookPer);
+ // }
+ // }
+
+
+ /// 鍥炶皟鍙傛暟锛� 鑱屼笟锛屽浗瀹讹紝浼ゅ绫诲瀷锛�6澶ф垬鏂楀睘鎬э紝鐗规畩灞炴��
+ void SelectJobCountry(List<int> selects)
+ {
+ HeroUIManager.Instance.selectHeroCollectList = selects;
+ HeroUIManager.Instance.SortHeroCollectList();
+ CreateScroller();
+ }
+
+
+ void CreateScroller()
+ {
+ int jumpIndex = -1;
+ int index = -1;
+ heroListScroller.Refresh();
+ var _List = HeroUIManager.Instance.heroCollectDict.Keys.ToList();
+ _List.Reverse();
+ for (int i = 0; i < _List.Count; i++)
+ {
+ var ids = HeroUIManager.Instance.heroCollectDict[_List[i]];
+ if (ids.Count == 0)
+ continue;
+ //鍝佽川
+ heroListScroller.AddCell(ScrollerDataType.Header, _List[i]);
+ //姝﹀皢
+ for (int j = 0; j < ids.Count; j++)
+ {
+ if (j % 4 == 0)
+ {
+ index++;
+ CellInfo cellInfo = new CellInfo();
+ cellInfo.infoInt1 = _List[i];
+ heroListScroller.AddCell(ScrollerDataType.Normal, j, cellInfo);
+ }
+
+ if (jumpIndex == -1)
+ {
+ //妫�鏌ユ瘡涓灏�
+ if (HeroUIManager.Instance.IsBookShowRedPoint(ids[j]))
+ {
+ jumpIndex = index;
+ HeroUIManager.Instance.firstHeroIDBookUpdate = ids[j];
+ }
+ }
+ }
+ index++;
+ }
+ heroListScroller.Restart();
+ heroListScroller.JumpIndex(jumpIndex);
+ }
+
+
+
+ void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+ if (type == ScrollerDataType.Header)
+ {
+ var _cell = cell.GetComponent<Image>();
+ _cell.SetSprite("herocoltitle" + cell.index);
+ }
+ else if (type == ScrollerDataType.Normal)
+ {
+ var _cell = cell as HeroCollectionLineCell;
+ _cell?.Display(cell.index, cell.info.Value.infoInt1);
+
+ }
+ }
+
+ void OnHeroCollectEvent()
+ {
+ // RefreshTotalAttr();
+ heroListScroller.m_Scorller.RefreshActiveCellViews();
}
}
\ No newline at end of file
--
Gitblit v1.8.0