From 7674f5aee893b74cc0d616b9c40467c8846f243c Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 05 八月 2025 20:59:25 +0800
Subject: [PATCH] 122 子 【武将】武将系统 - 武将列表界面
---
Main/Utility/UIHelper.cs | 5 +
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta | 11 +++
Main/System/KnapSack/PackManager.cs | 23 ++++++-
Main/System/HeroUI/HeroPosWin.cs | 26 +++++---
Main/System/Message/ImgAnalysis.cs | 6 +-
Main/Config/Configs/PlayerPropertyConfig.cs | 2
Main/System/HeroUI/HeroListWin.cs | 63 +++++++++++++++------
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs | 19 ++++++
Main/System/HeroUI/HeroUIManager.cs | 24 ++++++--
9 files changed, 138 insertions(+), 41 deletions(-)
diff --git a/Main/Config/Configs/PlayerPropertyConfig.cs b/Main/Config/Configs/PlayerPropertyConfig.cs
index 522ecf4..626e8a3 100644
--- a/Main/Config/Configs/PlayerPropertyConfig.cs
+++ b/Main/Config/Configs/PlayerPropertyConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�5鏃�
+// [ Date ]: Tuesday, August 5, 2025
//--------------------------------------------------------
using System.Collections.Generic;
diff --git a/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs b/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs
new file mode 100644
index 0000000..6210b59
--- /dev/null
+++ b/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs
@@ -0,0 +1,19 @@
+using UnityEngine;
+using System.Collections;
+
+//07 41 閫氱敤璐拱Pack绌洪棿#tagCOpenPackCount
+
+public class C0741_tagCOpenPackCount : GameNetPackBasic {
+ public byte PackType; //鑳屽寘绫诲瀷:rptItem, rptEquip, rptWarehouse
+ public byte Count; //璐拱鏍兼暟
+
+ public C0741_tagCOpenPackCount () {
+ _cmd = (ushort)0x0741;
+ }
+
+ public override void WriteToBytes () {
+ WriteBytes (PackType, NetDataType.BYTE);
+ WriteBytes (Count, NetDataType.BYTE);
+ }
+
+}
diff --git a/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta b/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta
new file mode 100644
index 0000000..0e98142
--- /dev/null
+++ b/Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0daeb1940fa9b4f49be0a222d4484650
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/HeroUI/HeroListWin.cs b/Main/System/HeroUI/HeroListWin.cs
index db06fc2..c3e1a84 100644
--- a/Main/System/HeroUI/HeroListWin.cs
+++ b/Main/System/HeroUI/HeroListWin.cs
@@ -17,10 +17,7 @@
[SerializeField] Button attrOnTipBtn;
[SerializeField] Button changeHeroPosBtn; //甯冮樀鎸夐挳
-
-
- private List<Image> countrySelectImgList;
- private List<Image> jobSelectImgList;
+ [SerializeField] HeroSelectBehaviour fiterManager; //姝﹀皢绛涢��
SinglePack singlePack;
@@ -41,10 +38,12 @@
protected override void OnPreOpen()
{
+ HeroUIManager.Instance.selectHeroListJob = 0;
+ HeroUIManager.Instance.selectHeroListCountry = 0;
singlePack = PackManager.Instance.GetSinglePack(PackType.Hero);
heroListScroller.OnRefreshCell += OnRefreshCell;
- //闇�瑕佽�冭檻璋冩暣涓烘灏嗙殑浜嬩欢锛岃�屼笉鏄儗鍖�
- PackManager.Instance.RefreshItemEvent += RefreshPakCount;
+ PackManager.Instance.gridRefreshEvent += GridRefreshEvent;
+ PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
HeroUIManager.Instance.SortHeroList();
CreateScroller();
Refresh();
@@ -53,13 +52,25 @@
protected override void OnPreClose()
{
heroListScroller.OnRefreshCell -= OnRefreshCell;
- PackManager.Instance.RefreshItemEvent -= RefreshPakCount;
+ PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
+ PackManager.Instance.gridRefreshEvent -= GridRefreshEvent;
}
public override void Refresh()
{
- if (singlePack == null || singlePack.GetAllItems().Count <= 0)
+ RefreshEmptyTip();
+ OnBattleTeamAttrPer();
+
+ RefreshPackCount();
+
+ fiterManager.Display(0, HeroUIManager.Instance.selectHeroListJob, HeroUIManager.Instance.selectHeroListCountry, SelectJobCountry);
+
+ }
+
+ void RefreshEmptyTip()
+ {
+ if (HeroUIManager.Instance.heroSortList.Count <= 0)
{
heroListEmpty.SetActive(true);
heroListScroller.SetActive(false);
@@ -69,10 +80,15 @@
heroListEmpty.SetActive(false);
heroListScroller.SetActive(true);
}
+ }
- OnBattleTeamAttrPer();
-
- RefreshPakCount(PackType.Hero, 0, 0);
+ void SelectJobCountry(int job, int country)
+ {
+ HeroUIManager.Instance.selectHeroListJob = job;
+ HeroUIManager.Instance.selectHeroListCountry = country;
+ HeroUIManager.Instance.SortHeroList();
+ RefreshEmptyTip();
+ CreateScroller();
}
//涓婇樀鍔犳垚
@@ -92,7 +108,7 @@
valuePer += hero.GetOnBattleAddPer();
}
}
-
+
}
//涓婇樀灞炴��
for (int i = 0; i < attrOnList.Count; i++)
@@ -120,18 +136,29 @@
heroListScroller.Restart();
}
- void RefreshPakCount(PackType type, int index, int itemID)
+ void RefreshItemEvent(PackType type, int index, int itemID)
{
if (type != PackType.Hero)
return;
- if (singlePack == null)
- 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();
+ }
}
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index 0cbf08c..5689a2c 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -136,16 +136,7 @@
RefreshFlyHead();
RefreshConn();
- if (HeroManager.Instance.GetHeroCount() == 0)
- {
- heroListEmpty.SetActive(true);
- heroListScroller.SetActive(false);
- }
- else
- {
- heroListEmpty.SetActive(false);
- heroListScroller.SetActive(true);
- }
+ RefreshEmptyTip();
showConnTipToggleBtn.isOn = isToggleOn;
@@ -181,6 +172,21 @@
HeroUIManager.Instance.selectTeamPosCountry = country;
HeroUIManager.Instance.SortHeroOnTeamList();
CreateScroller();
+ RefreshEmptyTip();
+ }
+
+ void RefreshEmptyTip()
+ {
+ if (HeroUIManager.Instance.heroOnTeamSortList.Count <= 0)
+ {
+ heroListEmpty.SetActive(true);
+ heroListScroller.SetActive(false);
+ }
+ else
+ {
+ heroListEmpty.SetActive(false);
+ heroListScroller.SetActive(true);
+ }
}
void OnRefreshCell(ScrollerDataType type, CellView cell)
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 7ef1281..57155c6 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using dnlib.DotNet;
using UnityEngine;
@@ -11,6 +12,8 @@
{
#region 姝﹀皢鍒楄〃鐣岄潰
public List<string> heroSortList { get; private set; } = new List<string>(); //涓婇樀涓轰富绾跨殑鍒楄〃
+ public int selectHeroListJob = 0; //姝﹀皢鍒楄〃鐣岄潰 绛涢�夎亴涓�
+ public int selectHeroListCountry = 0; //姝﹀皢鍒楄〃鐣岄潰绛涢�夊浗瀹�
#endregion
@@ -46,18 +49,27 @@
return;
}
-
+ var buyInfo = PackManager.Instance.BuyPackGirdNeedData(PackType.Hero);
ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
- Language.Get("HeroPack1", GeneralDefine.MoneyDisplayModel[1],1, 1), (bool isOK)=>
- {
-
- });
+ Language.Get("HeroPack1", UIHelper.GetIconNameWithMoneyType(buyInfo[0]), buyInfo[1], buyInfo[2]),
+ (bool isOK) =>
+ {
+ if (isOK)
+ {
+ if (UIHelper.GetMoneyCnt(buyInfo[0]) < (ulong)buyInfo[1])
+ {
+ SysNotifyMgr.Instance.ShowTip("LackMoney",buyInfo[0]);
+ return;
+ }
+ PackManager.Instance.BuyPackGird(PackType.Hero);
+ }
+ });
}
//鍒锋柊鏃舵満, 鎵撳紑姝﹀皢鐣岄潰 鎴栬�� 鍏抽棴鍔熻兘鐣岄潰
public void SortHeroList()
{
- heroSortList = HeroManager.Instance.GetHeroGuidList();
+ heroSortList = HeroManager.Instance.GetHeroGuidList(selectHeroListJob, selectHeroListCountry);
heroSortList.Sort(CmpHero);
}
diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index dcd15ab..33b60d5 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/Main/System/KnapSack/PackManager.cs
@@ -35,7 +35,6 @@
//璇昏〃鏁版嵁
public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氳儗鍖呮牸瀛愭渶澶ф暟閲�
- public Dictionary<int, int> PackInitCountDict = new Dictionary<int, int>(); //鑳屽寘绫诲瀷锛氬垵濮嬫暟閲�
public int initBagGridCount { get; private set; } //鍒濆鐗╁搧鑳屽寘鏍煎瓙鏁�
public int[] itemPackSortTyps { get; private set; } //鑳屽寘鐗╁搧鐨勬寜绫诲瀷鎺掑簭
public List<string> composeItemGuidList = new List<string>(); //鍚堟垚鍒楄〃鐗╁搧guid
@@ -266,9 +265,28 @@
}
}
+ //璐拱鎵�闇�淇℃伅 [璐у竵绫诲瀷锛岃揣甯佹暟閲忥紝璐拱鏍兼暟]
public int[] BuyPackGirdNeedData(PackType packType)
{
- return null;
+ var curPackGirdCnt = GetSinglePack(packType).unlockedGridCount;
+ if (curPackGirdCnt >= PackMaxCountDict[(int)packType])
+ return null;
+
+ int buyTimes = 0;
+ PackGirdServerBuyCountDict.TryGetValue((int)packType, out buyTimes);
+ var moneyType = openGirdMoneyDict[(int)packType];
+ var moneyCntList = openGirdMoneyValueDict[(int)packType];
+ var money = moneyCntList[Math.Min(buyTimes, moneyCntList.Length - 1)];
+ var girdCntList = openGirdCountDict[(int)packType];
+ var buyGirdCnt = girdCntList[Math.Min(buyTimes, girdCntList.Length - 1)];
+ return new[] {moneyType, money, buyGirdCnt};
+ }
+
+ public void BuyPackGird(PackType packType)
+ {
+ var netPack = new C0741_tagCOpenPackCount();
+ netPack.PackType = (byte)packType;
+ GameNetSystem.Instance.SendInfo(netPack);
}
public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount)
@@ -483,7 +501,6 @@
autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1);
var config= FuncConfigConfig.Get("InitBagCellCount");
initBagGridCount = int.Parse(config.Numerical1);
- PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2);
config = FuncConfigConfig.Get("PackageSortPriority");
itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1);
diff --git a/Main/System/Message/ImgAnalysis.cs b/Main/System/Message/ImgAnalysis.cs
index 8923bb5..5d6e268 100644
--- a/Main/System/Message/ImgAnalysis.cs
+++ b/Main/System/Message/ImgAnalysis.cs
@@ -177,9 +177,9 @@
private void InverseToRichText()
{
m_StringBuilder.Append("<color=#00000000><quad ");
- m_StringBuilder.Append(string.Format("size={0} ", presentImgInfo.height* presentImgInfo.scale));
- float ratio = (float)Math.Round((float)presentImgInfo.width / presentImgInfo.height * presentImgInfo.scale, 1);
- m_StringBuilder.Append(string.Format("width={0} ", ratio));
+ m_StringBuilder.Append(string.Format("size={0} ", presentImgInfo.height)); // 鍗犱綅鍍忕礌
+ float ratio = 1f;
+ m_StringBuilder.Append(string.Format("width={0} ", ratio)); //鍩虹size鐨勭缉鏀炬瘮鐜�
m_StringBuilder.Append(string.Format("index={0}", presentImgInfo.index));
m_StringBuilder.Append("/></color>");
}
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index f135ca8..518c9e5 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -80,6 +80,11 @@
_image.SetSprite(iconKey);
}
+ public static string GetIconNameWithMoneyType(int moneyType)
+ {
+ return StringUtility.Contact("Money_Type_", moneyType);
+ }
+
/// <summary>
/// 鍒嗙瀛楃涓叉彃鍏ョ┖鏍�
/// </summary>
--
Gitblit v1.8.0