| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | |
| | | using UnityEngine; |
| | | |
| | | //重生 遣散 |
| | | public partial class HeroUIManager : GameSystemManager<HeroUIManager> |
| | | { |
| | | |
| | | |
| | | #region 重生 遣散 |
| | | public int awakeRebirthCnt { get; private set; } |
| | | public int payBackMoneyType; |
| | | public int rebornAwakeHeroMaxCount; //觉醒武将每日的最大重生次数 |
| | | public string rebornFormula; //重生等级重置的消耗,参数 heroLV武将等级,最终消耗为公式+觉醒消耗 |
| | | public int rebornPayBackPer; //重生返还的百分比 |
| | | public int deletePayBackPer; //遣散返还的百分比 |
| | | |
| | | public List<string> heroDeleteSortList { get; private set; } = new List<string>(); |
| | | public int selectHeroDeleteListJob = 0; //筛选职业 |
| | |
| | | } |
| | | |
| | | |
| | | #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)); |
| | | |
| | | } |
| | | } |
| | | |