From 7ee06a9d53a47b106458c571fadbb7583b570766 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 09 九月 2025 22:57:20 +0800
Subject: [PATCH] 117 【武将】武将系统 - 重生新逻辑

---
 Main/System/Tip/ConfirmCancel.cs              |    4 
 Main/System/Tip/ItemsConfirmWin.cs            |    2 
 Main/Config/ConfigManager.cs                  |   59 ++++++
 Main/System/HeroUI/HeroGiftRoleListCell.cs    |    9 +
 Main/System/HeroUI/HeroGiftLineCell.cs        |    2 
 Main/System/HeroUI/HeroUIManager.Reborn.cs    |  129 +++++++++++++++
 Main/System/Tip/ItemsConfirmCell.cs           |    4 
 Main/System/Hero/HeroInfo.Talent.cs           |   11 +
 Main/System/HeroUI/HeroGiftWashWin.cs         |   14 +
 Main/Config/PartialConfigs/HeroAwakeConfig.cs |    4 
 Main/System/HeroUI/HeroShowBaseCell.cs        |   23 ++
 Main/Config/Configs/HeroConfig.cs             |   17 ++
 Main/System/HeroUI/HeroGiftRoleListWin.cs     |   11 +
 Main/System/HeroUI/HeroUIManager.Awake.cs     |   26 +++
 Main/System/HeroUI/HeroDeleteWin.cs           |   20 +
 Main/System/HeroUI/HeroTrainWin.cs            |  116 ++++++--------
 Main/System/HeroUI/HeroUIManager.cs           |    4 
 17 files changed, 365 insertions(+), 90 deletions(-)

diff --git a/Main/Config/ConfigManager.cs b/Main/Config/ConfigManager.cs
index 49c6096..7035beb 100644
--- a/Main/Config/ConfigManager.cs
+++ b/Main/Config/ConfigManager.cs
@@ -38,15 +38,32 @@
 
         // 鍔犺浇閰嶇疆鏂囦欢
         HashSet<Type> configTypes = new HashSet<Type>() {
+            typeof(ChestsAwardConfig),
+            typeof(CTGConfig),
+            typeof(DamageNumConfig),
             typeof(DirtyWordConfig),
+            typeof(FaceConfig),
             typeof(FightPowerRatioConfig),
             typeof(HeroLineupHaloConfig),
             typeof(HeroQualityLVConfig),
             typeof(InvestConfig),
             typeof(ItemConfig),
+            typeof(MainChapterConfig),
             typeof(MainLevelConfig),
-            typeof(PlayerLVConfig),
-            typeof(TitleStarUpConfig)
+            typeof(NPCConfig),
+            typeof(NPCExConfig),
+            typeof(NPCLineupConfig),
+            typeof(OrderInfoConfig),
+            typeof(PlayerAttrConfig),
+            typeof(PlayerFaceConfig),
+            typeof(StoreConfig),
+            typeof(SuccessConfig),
+            typeof(SysInfoConfig),
+            typeof(TitleStarUpConfig),
+            typeof(TreasureSetConfig),
+            typeof(TreeLVConfig),
+            typeof(WindowSearchConfig),
+            typeof(XBGetItemConfig)
         };
 
 #if UNITY_EDITOR
@@ -196,8 +213,16 @@
 
     public override void Release()
     {
+        // 娓呯┖ ChestsAwardConfig 瀛楀吀
+        ClearConfigDictionary<ChestsAwardConfig>();
+        // 娓呯┖ CTGConfig 瀛楀吀
+        ClearConfigDictionary<CTGConfig>();
+        // 娓呯┖ DamageNumConfig 瀛楀吀
+        ClearConfigDictionary<DamageNumConfig>();
         // 娓呯┖ DirtyWordConfig 瀛楀吀
         ClearConfigDictionary<DirtyWordConfig>();
+        // 娓呯┖ FaceConfig 瀛楀吀
+        ClearConfigDictionary<FaceConfig>();
         // 娓呯┖ FightPowerRatioConfig 瀛楀吀
         ClearConfigDictionary<FightPowerRatioConfig>();
         // 娓呯┖ HeroLineupHaloConfig 瀛楀吀
@@ -208,12 +233,38 @@
         ClearConfigDictionary<InvestConfig>();
         // 娓呯┖ ItemConfig 瀛楀吀
         ClearConfigDictionary<ItemConfig>();
+        // 娓呯┖ MainChapterConfig 瀛楀吀
+        ClearConfigDictionary<MainChapterConfig>();
         // 娓呯┖ MainLevelConfig 瀛楀吀
         ClearConfigDictionary<MainLevelConfig>();
-        // 娓呯┖ PlayerLVConfig 瀛楀吀
-        ClearConfigDictionary<PlayerLVConfig>();
+        // 娓呯┖ NPCConfig 瀛楀吀
+        ClearConfigDictionary<NPCConfig>();
+        // 娓呯┖ NPCExConfig 瀛楀吀
+        ClearConfigDictionary<NPCExConfig>();
+        // 娓呯┖ NPCLineupConfig 瀛楀吀
+        ClearConfigDictionary<NPCLineupConfig>();
+        // 娓呯┖ OrderInfoConfig 瀛楀吀
+        ClearConfigDictionary<OrderInfoConfig>();
+        // 娓呯┖ PlayerAttrConfig 瀛楀吀
+        ClearConfigDictionary<PlayerAttrConfig>();
+        // 娓呯┖ PlayerFaceConfig 瀛楀吀
+        ClearConfigDictionary<PlayerFaceConfig>();
+        // 娓呯┖ StoreConfig 瀛楀吀
+        ClearConfigDictionary<StoreConfig>();
+        // 娓呯┖ SuccessConfig 瀛楀吀
+        ClearConfigDictionary<SuccessConfig>();
+        // 娓呯┖ SysInfoConfig 瀛楀吀
+        ClearConfigDictionary<SysInfoConfig>();
         // 娓呯┖ TitleStarUpConfig 瀛楀吀
         ClearConfigDictionary<TitleStarUpConfig>();
+        // 娓呯┖ TreasureSetConfig 瀛楀吀
+        ClearConfigDictionary<TreasureSetConfig>();
+        // 娓呯┖ TreeLVConfig 瀛楀吀
+        ClearConfigDictionary<TreeLVConfig>();
+        // 娓呯┖ WindowSearchConfig 瀛楀吀
+        ClearConfigDictionary<WindowSearchConfig>();
+        // 娓呯┖ XBGetItemConfig 瀛楀吀
+        ClearConfigDictionary<XBGetItemConfig>();
     }
 
 #if UNITY_EDITOR
diff --git a/Main/Config/Configs/HeroConfig.cs b/Main/Config/Configs/HeroConfig.cs
index 4b8810f..9f364eb 100644
--- a/Main/Config/Configs/HeroConfig.cs
+++ b/Main/Config/Configs/HeroConfig.cs
@@ -1,6 +1,6 @@
 锘�//--------------------------------------------------------
 //    [Author]:           YYL
-//    [  Date ]:           2025骞�8鏈�17鏃�
+//    [  Date ]:           2025骞�9鏈�9鏃�
 //--------------------------------------------------------
 
 using System.Collections.Generic;
@@ -32,6 +32,7 @@
 	public int[] FetterIDList;
 	public float UIScale;
 	public string Desc;
+	public int[] TalentList;
 
     public override int LoadKey(string _key)
     {
@@ -98,6 +99,20 @@
 			float.TryParse(tables[14],out UIScale); 
 
 			Desc = tables[15];
+
+			if (tables[16].Contains("["))
+			{
+				TalentList = JsonMapper.ToObject<int[]>(tables[16]);
+			}
+			else
+			{
+				string[] TalentListStringArray = tables[16].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+				TalentList = new int[TalentListStringArray.Length];
+				for (int i=0;i<TalentListStringArray.Length;i++)
+				{
+					 int.TryParse(TalentListStringArray[i],out TalentList[i]);
+				}
+			}
         }
         catch (Exception exception)
         {
diff --git a/Main/Config/PartialConfigs/HeroAwakeConfig.cs b/Main/Config/PartialConfigs/HeroAwakeConfig.cs
index 52466ce..f93655e 100644
--- a/Main/Config/PartialConfigs/HeroAwakeConfig.cs
+++ b/Main/Config/PartialConfigs/HeroAwakeConfig.cs
@@ -49,6 +49,7 @@
         return GetHeroAwakeConfig(heroID, awakeLv) != null;
     }
 
+    //瑙i攣鎸囧畾澶╄祴妲戒綅闇�瑕佺殑瑙夐啋绛夌骇
     public static int GetAwakeLVByUnLockGiftIndex(int heroID, int index)
     {
         Dictionary<int, HeroAwakeConfig> tempDic = null;
@@ -66,6 +67,7 @@
         }
         return 0;
     }
+
     
     public static int GetMaxAwakeLV(int heroID)
     {
@@ -73,7 +75,7 @@
         if (!configDics.TryGetValue(heroID, out tempDic))
         {
             return 0;
-        }        
+        }
         return tempDic.Count;
     }
 }
diff --git a/Main/System/Hero/HeroInfo.Talent.cs b/Main/System/Hero/HeroInfo.Talent.cs
index 38ad22d..563e47d 100644
--- a/Main/System/Hero/HeroInfo.Talent.cs
+++ b/Main/System/Hero/HeroInfo.Talent.cs
@@ -16,6 +16,17 @@
 		}
 	}
 
+	// 鍥犱负瑙夐啋闄嶄綆浜嗘槦绾э紝淇濈暀鍘嗗彶鏈�澶ф槦绾�
+	public int heroStarMaxBefore
+	{
+		get
+		{
+			return heroStar;
+			// if (itemHero == null)
+			// 	return 0;
+			// return itemHero.GetUseDataFirstValue(74);
+		}
+	}
 
 	// 71 # 鑻遍泟澶╄祴ID鍒楄〃
 	public List<int> talentIDList
diff --git a/Main/System/HeroUI/HeroDeleteWin.cs b/Main/System/HeroUI/HeroDeleteWin.cs
index ddfb73e..fd7b9bf 100644
--- a/Main/System/HeroUI/HeroDeleteWin.cs
+++ b/Main/System/HeroUI/HeroDeleteWin.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
@@ -5,7 +6,7 @@
 
 
 /// <summary>
-/// 姝﹀皢鍩瑰吇鐣岄潰
+/// 姝﹀皢閬f暎鐣岄潰
 /// </summary>
 public class HeroDeleteWin : UIBase
 {
@@ -150,7 +151,7 @@
             HeroInfo hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectDeleteHeroList[i]);
             if (hero == null)
                 continue;
-            if (hero.heroStar > 1)
+            if (hero.heroStarMaxBefore > 1)
             {
                 hasStarHero = true;
                 break;
@@ -192,16 +193,25 @@
             {
                 if (!tmpDict.ContainsKey(itemInfo[0]))
                 {
-                    tmpDict.Add(itemInfo[0], itemInfo[1] * (1 + hero.heroStar));
+                    tmpDict.Add(itemInfo[0], itemInfo[1] * (1 + hero.heroStarMaxBefore));
                 }
                 else
                 {
-                    tmpDict[itemInfo[0]] += itemInfo[1] * (1 + hero.heroStar);
+                    tmpDict[itemInfo[0]] += itemInfo[1] * (1 + hero.heroStarMaxBefore);
                 }
             }
 
             allItemDict = CommonFunc.AddDict(allItemDict, tmpDict);
         }
+
+        //璁$畻杩旇繕姣斾緥
+        var _list = allItemDict.Keys.ToList();
+        foreach (var key in _list)
+        {
+            allItemDict[key] = Math.Max((long)(allItemDict[key] * HeroUIManager.Instance.deletePayBackPer / 100.0), 1);
+        }
+
+
 
         List<Item> items = CommonFunc.ChangeToItemList(allItemDict);
         ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard25"), Language.Get("herocard26"), (bool isOk) =>
@@ -220,7 +230,7 @@
                 GameNetSystem.Instance.SendInfo(pack);
                 HeroUIManager.Instance.selectDeleteHeroList.Clear();
             }
-        });
+        }, itemName:$"( {HeroUIManager.Instance.deletePayBackPer}% )");
 
     }
 
diff --git a/Main/System/HeroUI/HeroGiftLineCell.cs b/Main/System/HeroUI/HeroGiftLineCell.cs
index d4237d4..ce685b9 100644
--- a/Main/System/HeroUI/HeroGiftLineCell.cs
+++ b/Main/System/HeroUI/HeroGiftLineCell.cs
@@ -11,7 +11,7 @@
         {
             if (index < configList.Count)
             {
-                var giftID = configList[index];
+                var giftID = configList[index + i];
                 var giftLV = HeroUIManager.Instance.maxGiftLevel;
                 cardList[i].SetActive(true);
                 cardList[i].Init(giftID, giftLV);
diff --git a/Main/System/HeroUI/HeroGiftRoleListCell.cs b/Main/System/HeroUI/HeroGiftRoleListCell.cs
index c016d95..e84aec0 100644
--- a/Main/System/HeroUI/HeroGiftRoleListCell.cs
+++ b/Main/System/HeroUI/HeroGiftRoleListCell.cs
@@ -63,8 +63,15 @@
             return;
         }
 
+        if (hero.heroLevel > 1)
+        {
+            HeroUIManager.Instance.ResetBtnClick(hero);
+            return;
+        }
+
+
         if (hero.heroStar > 0)
-        { 
+        {
             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
             Language.Get("HeroGift13"), (bool isOK) =>
                 {
diff --git a/Main/System/HeroUI/HeroGiftRoleListWin.cs b/Main/System/HeroUI/HeroGiftRoleListWin.cs
index e50a3ad..4fc4beb 100644
--- a/Main/System/HeroUI/HeroGiftRoleListWin.cs
+++ b/Main/System/HeroUI/HeroGiftRoleListWin.cs
@@ -12,7 +12,7 @@
     [SerializeField] GameObject emptyGo;
 
 
-    
+
 
     protected override void OnPreOpen()
     {
@@ -20,6 +20,7 @@
         scroller.OnRefreshCell += Scroller_OnRefreshCell;
         TeamManager.Instance.OnTeamChange += OnTeamChange;
         PackManager.Instance.RefreshItemLockEvent += RefreshItemLockEvent;
+        HeroManager.Instance.onHeroChangeEvent += OnHeroChangeEvent;
         Display();
     }
 
@@ -28,13 +29,14 @@
         scroller.OnRefreshCell -= Scroller_OnRefreshCell;
         TeamManager.Instance.OnTeamChange -= OnTeamChange;
         PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent;
+        HeroManager.Instance.onHeroChangeEvent -= OnHeroChangeEvent;
         HeroUIManager.Instance.heroEatList.Clear();
     }
 
 
     public void Display()
     {
-        
+
         if (HeroUIManager.Instance.heroEatList.Count <= 0)
         {
             emptyGo.SetActive(true);
@@ -67,4 +69,9 @@
     {
         scroller.m_Scorller.RefreshActiveCellViews();
     }
+    
+    void OnHeroChangeEvent(HeroInfo hero)
+    {
+        scroller.m_Scorller.RefreshActiveCellViews();
+    }
 }
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroGiftWashWin.cs b/Main/System/HeroUI/HeroGiftWashWin.cs
index 0795e5f..0fe90d1 100644
--- a/Main/System/HeroUI/HeroGiftWashWin.cs
+++ b/Main/System/HeroUI/HeroGiftWashWin.cs
@@ -110,6 +110,20 @@
             return;
         }
 
+        //娲楃偧鍜岃閱掔殑澶╄祴鏈鐞嗕笉鍙悶鍣�
+        if (hero.talentRandomIDList.Count > 0)
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroGift4");
+            return;
+        }
+
+        if (hero.talentAwakeRandomIDList.Count > 0)
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroGift5");
+            return;
+        }
+
+
         //鏍规嵁閿佺姸鎬佸垽鏂潗鏂欐槸鍚﹁冻澶�
         if (!ItemLogicUtility.CheckItemCount(PackType.Item, HeroUIManager.Instance.washItemID,
         HeroUIManager.Instance.GetTalentLockUseWashCount(hero), 2))
diff --git a/Main/System/HeroUI/HeroShowBaseCell.cs b/Main/System/HeroUI/HeroShowBaseCell.cs
index cc86c69..594a8cf 100644
--- a/Main/System/HeroUI/HeroShowBaseCell.cs
+++ b/Main/System/HeroUI/HeroShowBaseCell.cs
@@ -116,6 +116,21 @@
             return m_LvTextOutline;
         }
     }
+
+    Button m_StarBtn;
+    Button starBtn
+    {
+        get
+        {
+            if (m_StarBtn == null)
+            {
+                m_StarBtn = this.transform.GetComponent<Button>("Container_HeroShow/layout/layout/stars");
+            }
+            return m_StarBtn;
+        }
+    }
+
+
     void Awake()
     {
         LoadPrefab();
@@ -170,12 +185,18 @@
             lvText.SetActive(false);
         }
         else
-        { 
+        {
             lvText.SetActive(true);
             lvText.text = string.Format("{0}{1} {2}", Language.Get("L1094"), lv, awakelv == 0 ? Language.Get("herocard13") : Language.Get("herocard12", awakelv));
             heroLVOutline.colorType = awakelv == 0 ? QualityTextColType.None : QualityTextColType.red;
         }
 
+        starBtn.AddListener(() =>
+        { 
+            SmallTipWin.showText = Language.Get("HeroGift14", star);
+            SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+            UIManager.Instance.OpenWindow<SmallTipWin>();
+        });
     }
 
     GameObject cellContainer;
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 75e77b7..50da7d0 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -80,6 +80,12 @@
     [SerializeField] Text starUPBtnText;
     [SerializeField] Button washBtn;
 
+    //鍐荤粨澶勭悊
+    [SerializeField] Button freezeTipBtn;
+    [SerializeField] GameObject freezeTipGo;
+    [SerializeField] Text freezeStarText;
+    [SerializeField] Text freezeAawkeLVText;
+    [SerializeField] List<Image> starImgFreezeList;
 
     string guid;
     HeroInfo hero;
@@ -107,7 +113,10 @@
         });
 
         lockBtn.AddListener(() => { hero.ChangeLockState(); });
-        resetBtn.AddListener(ResetBtnClick);
+        resetBtn.AddListener(() =>
+        {
+            HeroUIManager.Instance.ResetBtnClick(hero);
+        });
         deleteBtn.AddListener(DeleteHero);
         awakeBtn.AddListener(() =>
         {
@@ -156,6 +165,11 @@
 
         potentialCellList = new List<GameObject>();
         awakeCellList = new List<GameObject>();
+
+        freezeTipBtn.AddListener(() =>
+        { 
+            freezeTipGo.SetActive(!freezeTipGo.activeSelf);
+        });
     }
 
 
@@ -226,6 +240,7 @@
         RefreshFetter();
         RefreshGift();
         RefreshAwake();
+        RefreshFreeze();
     }
 
     void RefreshItemLockEvent(PackType type, string guid, bool lockState)
@@ -276,74 +291,9 @@
         Display();
     }
 
-    void ResetBtnClick()
-    {
-        //鍗囩骇銆佺獊鐮淬�佽閱�
-        if (hero.heroLevel == 1 && hero.breakLevel == 0 && hero.awakeLevel == 0)
-        {
-            SysNotifyMgr.Instance.ShowTip("HeroCanNotReset");
-            return;
-        }
-
-        List<Item> items = new List<Item>();
 
 
-        var payBack1 = CommonFunc.AddDict(HeroUIManager.Instance.GetHeroLVPayBack(hero.Quality, hero.heroLevel),
-        HeroUIManager.Instance.GetHeroBreakPayBack(hero.Quality, hero.breakLevel));
 
-        //宸茶閱掔殑闇�瑕佹秷鑰楄揣甯�
-        if (hero.awakeLevel == 0)
-        {
-            items = CommonFunc.ChangeToItemList(payBack1);
-            ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard42"), Language.Get("herocard43"), (bool isOk) =>
-            {
-                if (isOk)
-                {
-                    //鍙戝寘
-                    SendReborn(hero.itemHero.gridIndex);
-                }
-            });
-        }
-        else
-        {
-
-            if (HeroUIManager.Instance.awakeRebirthCnt >= HeroUIManager.Instance.rebornAwakeHeroMaxCount)
-            {
-                SysNotifyMgr.Instance.ShowTip("HeroRebornAwakeMax");
-                return;
-            }
-
-            payBack1 = CommonFunc.AddDict(payBack1, HeroUIManager.Instance.GetHeroQualityAwakePayBack(hero.Quality, hero.awakeLevel));
-            items = CommonFunc.ChangeToItemList(payBack1);
-            var info2 = Language.Get("herocard44", HeroUIManager.Instance.rebornAwakeHeroMaxCount - HeroUIManager.Instance.awakeRebirthCnt);
-            var payBackMoney = HeroQualityAwakeConfig.GetQualityAwakeConfig(hero.Quality, hero.awakeLevel).RebirthCostMoney;
-            ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard42"), Language.Get("herocard43"), (bool isOk) =>
-            {
-                if (isOk)
-                {
-                    if (UIHelper.GetMoneyCnt(HeroUIManager.Instance.payBackMoneyType) < payBackMoney)
-                    {
-                        ItemTipUtility.ShowMoneyTip(HeroUIManager.Instance.payBackMoneyType);
-                        return;
-                    }
-                    //鍙戝寘
-                    SendReborn(hero.itemHero.gridIndex);
-                }
-            }, info2, "", payBackMoney, HeroUIManager.Instance.payBackMoneyType);
-
-        }
-
-    }
-
-    void SendReborn(int index)
-    {
-        var pack = new CB239_tagCSHeroRebirth();
-        pack.ItemIndex = (ushort)index;
-        GameNetSystem.Instance.SendInfo(pack);
-
-        HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
-
-    }
 
     void DeleteHero()
     {
@@ -707,7 +657,7 @@
             {
                 for (int k = 0; k < config.AttrIDList.Length; k++)
                 {
-                    awakeStr += PlayerPropertyConfig.GetFullDescription(config.AttrIDList[k], config.AttrValueList[k],  "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"))
+                    awakeStr += PlayerPropertyConfig.GetFullDescription(config.AttrIDList[k], config.AttrValueList[k], "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"))
                     + (k == config.AttrIDList.Length - 1 ? "" : "\n");
                 }
             }
@@ -732,4 +682,36 @@
             return;
         fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
     }
+
+    void RefreshFreeze()
+    {
+        //鑷冲皯闇�瑕佽閱掑埌澶氬皯绾�
+        int needAwakeLV = HeroUIManager.Instance.GetAwakeLVByStarLV(hero.heroId, hero.heroStarMaxBefore);
+        if (hero.awakeLevel < needAwakeLV)
+        {
+            freezeTipBtn.SetActive(true);
+            //鏄熺骇
+            for (int i = 0; i < starImgFreezeList.Count; i++)
+            {
+                if ((hero.heroStarMaxBefore - 1) % starImgFreezeList.Count >= i)
+                {
+                    starImgFreezeList[i].SetActive(true);
+                    starImgFreezeList[i].SetSprite("herostar" + (((hero.heroStarMaxBefore - 1) / starImgFreezeList.Count) + 1) * starImgFreezeList.Count);
+                }
+                else
+                {
+                    starImgFreezeList[i].SetActive(false);
+                }
+            }
+            freezeStarText.text = Language.Get("HeroAwake16", hero.heroStarMaxBefore);
+            freezeAawkeLVText.text = Language.Get("HeroAwake17", needAwakeLV);
+
+        }
+        else
+        {
+            freezeTipBtn.SetActive(false);
+        }
+        
+        freezeTipGo.SetActive(false);
+    }
 }
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroUIManager.Awake.cs b/Main/System/HeroUI/HeroUIManager.Awake.cs
index 733cde1..2cbfe02 100644
--- a/Main/System/HeroUI/HeroUIManager.Awake.cs
+++ b/Main/System/HeroUI/HeroUIManager.Awake.cs
@@ -12,5 +12,31 @@
     public List<int> heroBeforeAwakeGiftIDList = new List<int>();    //浼氭湁閲嶅鐨処D锛屼笉瑕佺敤瀛楀吀
     public List<int> heroBeforeAwakeGiftLevelList = new List<int>();
 
+
+    //杈惧埌X鏄熼渶瑕佺殑瑙夐啋绛夌骇
+    public int GetAwakeLVByStarLV(int heroID, int starLV)
+    {
+        var config = HeroConfig.Get(heroID);
+        var starCnt = HeroQualityConfig.Get(config.Quality).InitStarUpper;
+        if (starLV <= starCnt)
+            return 0;
+
+        Dictionary<int, HeroAwakeConfig> tempDic = null;
+        if (!HeroAwakeConfig.configDics.TryGetValue(heroID, out tempDic))
+        {
+            return 0;
+        }
+        foreach (var item in tempDic)
+        {
+            starCnt += item.Value.AddStarUpper;
+            if (starCnt >= starLV)
+            {
+                return item.Key;
+            }
+        }
+        return 0;
+    }
+
+
 }
 
diff --git a/Main/System/HeroUI/HeroUIManager.Reborn.cs b/Main/System/HeroUI/HeroUIManager.Reborn.cs
index 23064e3..18aee2a 100644
--- a/Main/System/HeroUI/HeroUIManager.Reborn.cs
+++ b/Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -1,17 +1,20 @@
 锘縰sing System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 using UnityEngine;
 
+//閲嶇敓 閬f暎
 public partial class HeroUIManager : GameSystemManager<HeroUIManager>
 {
 
-
-    #region 閲嶇敓 閬f暎
     public int awakeRebirthCnt { get; private set; }
     public int payBackMoneyType;
     public int rebornAwakeHeroMaxCount; //瑙夐啋姝﹀皢姣忔棩鐨勬渶澶ч噸鐢熸鏁�
+    public string rebornFormula;    //閲嶇敓绛夌骇閲嶇疆鐨勬秷鑰楋紝鍙傛暟 heroLV姝﹀皢绛夌骇锛屾渶缁堟秷鑰椾负鍏紡+瑙夐啋娑堣��
+    public int rebornPayBackPer;    //閲嶇敓杩旇繕鐨勭櫨鍒嗘瘮
+    public int deletePayBackPer;    //閬f暎杩旇繕鐨勭櫨鍒嗘瘮
 
     public List<string> heroDeleteSortList { get; private set; } = new List<string>();
     public int selectHeroDeleteListJob = 0;    //绛涢�夎亴涓�
@@ -143,7 +146,127 @@
     }
 
 
-    #endregion
+    public void ResetBtnClick(HeroInfo hero)
+    {
+        //鍗囩骇銆佺獊鐮淬�佽閱�
+        if (hero.heroLevel == 1 && hero.breakLevel == 0 && hero.awakeLevel == 0)
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroCanNotReset");
+            return;
+        }
 
+        //娲楃偧鍜岃閱掔殑澶╄祴鏈鐞嗕笉鍙悶鍣�
+        if (hero.talentRandomIDList.Count > 0)
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroGift4");
+            return;
+        }
+
+        if (hero.talentAwakeRandomIDList.Count > 0)
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroGift5");
+            return;
+        }
+
+
+        List<Item> items = new List<Item>();
+        var payBack1 = CommonFunc.AddDict(GetHeroLVPayBack(hero.Quality, hero.heroLevel), GetHeroBreakPayBack(hero.Quality, hero.breakLevel));
+
+        Dictionary<string, double> rebornParam = new Dictionary<string, double>();  //閲嶇敓娑堣�楀叕寮忓弬鏁�
+        //鍏堣绠楁湁娌℃秷鑰�
+        rebornParam.Add("heroLV", hero.heroLevel);
+        int costCnt = (int)JaceCalculator.Calculate(rebornFormula, rebornParam);
+        
+        //閲嶇敓绛夌骇閲嶇疆鐨勬秷鑰楋紝鍙傛暟 heroLV姝﹀皢绛夌骇锛屾渶缁堟秷鑰椾负鍏紡+瑙夐啋娑堣��
+        if (hero.awakeLevel == 0)
+        {
+            //璁$畻杩旇繕姣斾緥
+            var _list = payBack1.Keys.ToList();
+            foreach (var key in _list)
+            {
+                payBack1[key] = Math.Max((long)(payBack1[key] * rebornPayBackPer / 100.0), 1);
+            }
+
+            items = CommonFunc.ChangeToItemList(payBack1);
+
+            if (costCnt == 0)
+            {
+                //鏃犳秷鑰楁樉绀�
+                ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard42"), Language.Get("herocard43"), (bool isOk) =>
+                {
+                    if (isOk)
+                    {
+                        //鍙戝寘
+                        SendReborn(hero);
+                    }
+                }, itemName:$"( {rebornPayBackPer}% )");
+            }
+            else
+            {
+                //鏈夋秷鑰楁樉绀�
+                ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard42"), Language.Get("herocard43"), (bool isOk) =>
+                {
+                    if (isOk)
+                    {
+                        if (UIHelper.GetMoneyCnt(payBackMoneyType) < costCnt)
+                        {
+                            ItemTipUtility.ShowMoneyTip(payBackMoneyType);
+                            return;
+                        }
+                        //鍙戝寘
+                        SendReborn(hero);
+                    }
+                }, "", "", costCnt, payBackMoneyType, $"( {rebornPayBackPer}% )");
+            }
+        }
+        else
+        {
+
+            if (awakeRebirthCnt >= rebornAwakeHeroMaxCount)
+            {
+                SysNotifyMgr.Instance.ShowTip("HeroRebornAwakeMax");
+                return;
+            }
+
+            payBack1 = CommonFunc.AddDict(payBack1, GetHeroQualityAwakePayBack(hero.Quality, hero.awakeLevel));
+
+            //璁$畻杩旇繕姣斾緥
+            var _list = payBack1.Keys.ToList();
+            foreach (var key in _list)
+            {
+                payBack1[key] = Math.Max((long)(payBack1[key] * rebornPayBackPer / 100.0), 1);
+            }
+
+
+            items = CommonFunc.ChangeToItemList(payBack1);
+            var info2 = Language.Get("herocard44", rebornAwakeHeroMaxCount - awakeRebirthCnt);
+            var payBackMoney = HeroQualityAwakeConfig.GetQualityAwakeConfig(hero.Quality, hero.awakeLevel).RebirthCostMoney + costCnt;
+            ConfirmCancel.ShowItemsConfirm(items, Language.Get("herocard42"), Language.Get("herocard43"), (bool isOk) =>
+            {
+                if (isOk)
+                {
+                    if (UIHelper.GetMoneyCnt(payBackMoneyType) < payBackMoney)
+                    {
+                        ItemTipUtility.ShowMoneyTip(payBackMoneyType);
+                        return;
+                    }
+                    //鍙戝寘
+                    SendReborn(hero);
+                }
+            }, info2, "", payBackMoney, payBackMoneyType, $"( {rebornPayBackPer}% )");
+
+        }
+
+    }
+
+    void SendReborn(HeroInfo hero)
+    {
+        var pack = new CB239_tagCSHeroRebirth();
+        pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
+        GameNetSystem.Instance.SendInfo(pack);
+
+        lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
+
+    }
 }
 
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 996ca7b..679d42d 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -39,6 +39,10 @@
         var config = FuncConfigConfig.Get("HeroRebirth");
         payBackMoneyType = int.Parse(config.Numerical1);
         rebornAwakeHeroMaxCount = int.Parse(config.Numerical2);
+        rebornFormula = config.Numerical3;
+        rebornPayBackPer = int.Parse(config.Numerical4);
+        deletePayBackPer = int.Parse(config.Numerical5);
+        
         ParseGiftConfig();
 
         config = FuncConfigConfig.Get("HeroBook");
diff --git a/Main/System/Tip/ConfirmCancel.cs b/Main/System/Tip/ConfirmCancel.cs
index f763ca2..9a214a9 100644
--- a/Main/System/Tip/ConfirmCancel.cs
+++ b/Main/System/Tip/ConfirmCancel.cs
@@ -258,6 +258,7 @@
     public static string generalItemTip2;
 
     public static List<Item> getItems { get; private set; }
+    public static string replaceItemName;
     /// <summary>
     /// 澶氱墿鍝佺‘璁ゆ
     /// </summary>
@@ -270,7 +271,7 @@
     /// <param name="moneyCnt"></param>
     /// <param name="type"></param>
     public static void ShowItemsConfirm(List<Item> items, string tiltle, string info, Action<bool> func,
-        string info2 = "", string btnText = "", int moneyCnt = 0, int type = 0)
+        string info2 = "", string btnText = "", int moneyCnt = 0, int type = 0, string itemName = "")
     {
         getItems = items;
         generalTitle = tiltle;
@@ -280,6 +281,7 @@
         OnPopConfirmClickEvent = func;
         moneyType = type;
         moneyNeedCount = moneyCnt;
+        replaceItemName = itemName;
         if (!UIManager.Instance.IsOpened<ItemsConfirmWin>())
         {
             UIManager.Instance.OpenWindow<ItemsConfirmWin>();
diff --git a/Main/System/Tip/ItemsConfirmCell.cs b/Main/System/Tip/ItemsConfirmCell.cs
index b4b6e85..9415abc 100644
--- a/Main/System/Tip/ItemsConfirmCell.cs
+++ b/Main/System/Tip/ItemsConfirmCell.cs
@@ -6,7 +6,7 @@
     [SerializeField] ItemCell itemCell;
     [SerializeField] Text itemName;
 
-    public void Display(int index)
+    public void Display(int index, string replaceItemName)
     {
         int itemID = ConfirmCancel.getItems[index].id;
         itemCell.Init(new ItemCellModel(itemID, false, ConfirmCancel.getItems[index].countEx));
@@ -14,6 +14,6 @@
         {
             ItemTipUtility.Show(itemID);
         });
-        itemName.text = ItemConfig.Get(itemID).ItemName;
+        itemName.text = string.IsNullOrEmpty(replaceItemName) ? ItemConfig.Get(itemID).ItemName : replaceItemName;
     }
 }
diff --git a/Main/System/Tip/ItemsConfirmWin.cs b/Main/System/Tip/ItemsConfirmWin.cs
index d05234e..7a16f8a 100644
--- a/Main/System/Tip/ItemsConfirmWin.cs
+++ b/Main/System/Tip/ItemsConfirmWin.cs
@@ -76,7 +76,7 @@
     void OnRefreshCell(ScrollerDataType type, CellView cell)
     {
         var _cell = cell as ItemsConfirmCell;
-        _cell?.Display(cell.index);
+        _cell?.Display(cell.index, ConfirmCancel.replaceItemName);
     }
 
     void CreateScroller()

--
Gitblit v1.8.0