| | |
| | |
|
| | | // 加载配置文件
|
| | | 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
|
| | |
| | |
|
| | | public override void Release()
|
| | | {
|
| | | // 清空 ChestsAwardConfig 字典
|
| | | ClearConfigDictionary<ChestsAwardConfig>();
|
| | | // 清空 CTGConfig 字典
|
| | | ClearConfigDictionary<CTGConfig>();
|
| | | // 清空 DamageNumConfig 字典
|
| | | ClearConfigDictionary<DamageNumConfig>();
|
| | | // 清空 DirtyWordConfig 字典
|
| | | ClearConfigDictionary<DirtyWordConfig>();
|
| | | // 清空 FaceConfig 字典
|
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 FightPowerRatioConfig 字典
|
| | | ClearConfigDictionary<FightPowerRatioConfig>();
|
| | | // 清空 HeroLineupHaloConfig 字典
|
| | |
| | | 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
|
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年8月17日
|
| | | // [ Date ]: 2025年9月9日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int[] FetterIDList;
|
| | | public float UIScale;
|
| | | public string Desc;
|
| | | public int[] TalentList;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | | 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)
|
| | | {
|
| | |
| | | return GetHeroAwakeConfig(heroID, awakeLv) != null; |
| | | } |
| | | |
| | | //解锁指定天赋槽位需要的觉醒等级 |
| | | public static int GetAwakeLVByUnLockGiftIndex(int heroID, int index) |
| | | { |
| | | Dictionary<int, HeroAwakeConfig> tempDic = null; |
| | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | public static int GetMaxAwakeLV(int heroID) |
| | | { |
| | |
| | | if (!configDics.TryGetValue(heroID, out tempDic)) |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | return tempDic.Count; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 因为觉醒降低了星级,保留历史最大星级 |
| | | public int heroStarMaxBefore |
| | | { |
| | | get |
| | | { |
| | | return heroStar; |
| | | // if (itemHero == null) |
| | | // return 0; |
| | | // return itemHero.GetUseDataFirstValue(74); |
| | | } |
| | | } |
| | | |
| | | // 71 # 英雄天赋ID列表 |
| | | public List<int> talentIDList |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 武将培养界面 |
| | | /// 武将遣散界面 |
| | | /// </summary> |
| | | public class HeroDeleteWin : UIBase |
| | | { |
| | |
| | | HeroInfo hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectDeleteHeroList[i]); |
| | | if (hero == null) |
| | | continue; |
| | | if (hero.heroStar > 1) |
| | | if (hero.heroStarMaxBefore > 1) |
| | | { |
| | | hasStarHero = true; |
| | | break; |
| | |
| | | { |
| | | 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) => |
| | |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | HeroUIManager.Instance.selectDeleteHeroList.Clear(); |
| | | } |
| | | }); |
| | | }, itemName:$"( {HeroUIManager.Instance.deletePayBackPer}% )"); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | 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); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (hero.heroLevel > 1) |
| | | { |
| | | HeroUIManager.Instance.ResetBtnClick(hero); |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (hero.heroStar > 0) |
| | | { |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("HeroGift13"), (bool isOK) => |
| | | { |
| | |
| | | [SerializeField] GameObject emptyGo; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | |
| | | scroller.OnRefreshCell += Scroller_OnRefreshCell; |
| | | TeamManager.Instance.OnTeamChange += OnTeamChange; |
| | | PackManager.Instance.RefreshItemLockEvent += RefreshItemLockEvent; |
| | | HeroManager.Instance.onHeroChangeEvent += OnHeroChangeEvent; |
| | | Display(); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | { |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | void OnHeroChangeEvent(HeroInfo hero) |
| | | { |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | } |
| | |
| | | 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)) |
| | |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | [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; |
| | |
| | | }); |
| | | |
| | | lockBtn.AddListener(() => { hero.ChangeLockState(); }); |
| | | resetBtn.AddListener(ResetBtnClick); |
| | | resetBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.ResetBtnClick(hero); |
| | | }); |
| | | deleteBtn.AddListener(DeleteHero); |
| | | awakeBtn.AddListener(() => |
| | | { |
| | |
| | | |
| | | potentialCellList = new List<GameObject>(); |
| | | awakeCellList = new List<GameObject>(); |
| | | |
| | | freezeTipBtn.AddListener(() => |
| | | { |
| | | freezeTipGo.SetActive(!freezeTipGo.activeSelf); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | RefreshFetter(); |
| | | RefreshGift(); |
| | | RefreshAwake(); |
| | | RefreshFreeze(); |
| | | } |
| | | |
| | | void RefreshItemLockEvent(PackType type, string guid, bool lockState) |
| | |
| | | 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() |
| | | { |
| | |
| | | { |
| | | 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"); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | public List<int> heroBeforeAwakeGiftIDList = new List<int>(); //会有重复的ID,不要用字典 |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | 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)); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | 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"); |
| | |
| | | public static string generalItemTip2; |
| | | |
| | | public static List<Item> getItems { get; private set; } |
| | | public static string replaceItemName; |
| | | /// <summary> |
| | | /// 多物品确认框 |
| | | /// </summary> |
| | |
| | | /// <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; |
| | |
| | | OnPopConfirmClickEvent = func; |
| | | moneyType = type; |
| | | moneyNeedCount = moneyCnt; |
| | | replaceItemName = itemName; |
| | | if (!UIManager.Instance.IsOpened<ItemsConfirmWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<ItemsConfirmWin>(); |
| | |
| | | [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));
|
| | |
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | | itemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemName.text = string.IsNullOrEmpty(replaceItemName) ? ItemConfig.Get(itemID).ItemName : replaceItemName;
|
| | | }
|
| | | }
|
| | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var _cell = cell as ItemsConfirmCell;
|
| | | _cell?.Display(cell.index);
|
| | | _cell?.Display(cell.index, ConfirmCancel.replaceItemName);
|
| | | }
|
| | |
|
| | | void CreateScroller()
|