Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年8月5日
|
| | | // [ Date ]: Tuesday, December 9, 2025
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int QualityBreankID;
|
| | | public int Quality;
|
| | | public int BreakLV;
|
| | | public int LVMax;
|
| | | public int[] UPCostItem;
|
| | | public int UPLVNeed;
|
| | | public int[][] UPCostItemList;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | |
|
| | | int.TryParse(tables[2],out BreakLV);
|
| | |
|
| | | int.TryParse(tables[3],out LVMax); |
| | | int.TryParse(tables[3],out UPLVNeed); |
| | |
|
| | | if (tables[4].Contains("[")) |
| | | { |
| | | UPCostItem = JsonMapper.ToObject<int[]>(tables[4]); |
| | | } |
| | | else |
| | | { |
| | | string[] UPCostItemStringArray = tables[4].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | UPCostItem = new int[UPCostItemStringArray.Length]; |
| | | for (int i=0;i<UPCostItemStringArray.Length;i++) |
| | | { |
| | | int.TryParse(UPCostItemStringArray[i],out UPCostItem[i]); |
| | | } |
| | | }
|
| | | UPCostItemList = JsonMapper.ToObject<int[][]>(tables[4].Replace("(", "[").Replace(")", "]")); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | public partial class HeroQualityBreakConfig : ConfigBase<int, HeroQualityBreakConfig> |
| | | { |
| | | public static Dictionary<int, Dictionary<int, HeroQualityBreakConfig>> configDics = new Dictionary<int, Dictionary<int, HeroQualityBreakConfig>>(); |
| | | public static Dictionary<int, int> maxlvDic = new Dictionary<int, int>(); |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | |
| | | } |
| | | |
| | | tempDic[BreakLV] = this; |
| | | if (!maxlvDic.ContainsKey(LVMax) || LVMax > maxlvDic[Quality]) |
| | | { |
| | | maxlvDic[Quality] = LVMax; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | public partial class HeroQualityLVConfig : ConfigBase<int, HeroQualityLVConfig> |
| | | { |
| | | public static Dictionary<int, Dictionary<int, HeroQualityLVConfig>> configDics = new Dictionary<int, Dictionary<int, HeroQualityLVConfig>>(); |
| | | |
| | | public static Dictionary<int, int> maxlvDic = new Dictionary<int, int>(); |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | |
| | |
| | | } |
| | | |
| | | tempDic.Add(HeroLV, this); |
| | | if (!maxlvDic.ContainsKey(Quality) || HeroLV > maxlvDic[Quality]) |
| | | { |
| | | maxlvDic[Quality] = HeroLV; |
| | | } |
| | | } |
| | | |
| | | public static HeroQualityLVConfig GetQualityLVConfig(int quality, int lv) |
| | |
| | | OnUpdateFirstChargeInfo?.Invoke(); |
| | | } |
| | | |
| | | public string key { get { return StringUtility.Contact("FirstCharge_AllRewardsClaimed_Time_", PlayerDatas.Instance.baseData.PlayerID); } } |
| | | |
| | | /// <summary> |
| | | /// 检查是否所有首充奖励都已领取,如果是,则将当前服务器时间保存到本地 |
| | | /// </summary> |
| | | private void CheckAndSaveAllRewardsClaimedTime() |
| | | { |
| | | // 检查是否所有奖励都已领取 |
| | | if (IsAllFirstChargeRewardsClaimed()) |
| | | { |
| | | // 生成一个唯一的键来存储时间 |
| | | string key = $"FirstCharge_AllRewardsClaimed_Time_{PlayerDatas.Instance.baseData.PlayerID}"; |
| | | // 将当前服务器时间保存到本地 |
| | | LocalSave.SetString(key, TimeUtility.ServerNow.Ticks.ToString()); |
| | | } |
| | | if (LocalSave.HasKey(key)) |
| | | return; |
| | | // 所有奖励都已领取? |
| | | if (!IsAllFirstChargeRewardsClaimed()) |
| | | return; |
| | | // 将当前服务器时间保存到本地 |
| | | LocalSave.SetInt(key, TimeUtility.AllSeconds); |
| | | } |
| | | public void UpdateRedPoint() |
| | | { |
| | |
| | | // 检查是否已经过了所有奖励领取完毕后的第二天0点 |
| | | public bool IsNextDayAfterAllClaimed() |
| | | { |
| | | // 生成一个唯一的键来获取时间 |
| | | string key = $"FirstCharge_AllRewardsClaimed_Time_{PlayerDatas.Instance.baseData.PlayerID}"; |
| | | |
| | | // 检查是否存在记录的时间戳 |
| | | if (!LocalSave.HasKey(key)) |
| | | return false; |
| | | |
| | | // 获取记录的时间戳 |
| | | string timeString = LocalSave.GetString(key); |
| | | if (string.IsNullOrEmpty(timeString)) |
| | | int time = LocalSave.GetInt(key); |
| | | if (time <= 0) |
| | | return false; |
| | | |
| | | // 解析时间戳 |
| | | if (!long.TryParse(timeString, out long ticks)) |
| | | return false; |
| | | |
| | | // 将时间戳转换为DateTime |
| | | DateTime allRewardsClaimedTime = new DateTime(ticks); |
| | | |
| | | // 计算第二天0点的时间 |
| | | DateTime nextDayStart = allRewardsClaimedTime.Date.AddDays(1); |
| | | |
| | | // 判断当前服务器时间是否已经过了第二天0点 |
| | | DateTime serverNow = TimeUtility.ServerNow; |
| | | return serverNow >= nextDayStart; |
| | | DateTime endDateTime = TimeUtility.GetTime((uint)time).Date.AddDays(1); |
| | | return TimeUtility.ServerNow >= endDateTime; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | [SerializeField] Text breakLVText; |
| | | [SerializeField] Text nextBreakLVText; |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Text nextLVText; |
| | | // [SerializeField] Text lvText; |
| | | // [SerializeField] Text nextLVText; |
| | | [SerializeField] Text[] attrPerTextArr; |
| | | [SerializeField] Text[] nextAttrPerTextArr; |
| | | [SerializeField] Text potentialText; |
| | |
| | | { |
| | | breakLVText.text = "+" + (hero.breakLevel - 1); |
| | | nextBreakLVText.text = "+" + hero.breakLevel; |
| | | var beforeBreakLVConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel - 1); |
| | | lvText.text = beforeBreakLVConfig.LVMax.ToString(); |
| | | // var beforeBreakLVConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel - 1); |
| | | // lvText.text = beforeBreakLVConfig.LVMax.ToString(); |
| | | |
| | | nextLVText.text = hero.qualityBreakConfig.LVMax.ToString(); |
| | | // nextLVText.text = hero.qualityBreakConfig.LVMax.ToString(); |
| | | |
| | | for (int i = 0; i < attrPerTextArr.Length; i++) |
| | | { |
| | |
| | | |
| | | [SerializeField] Text breakLVText; |
| | | [SerializeField] Text nextBreakLVText; |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Text nextLVText; |
| | | // [SerializeField] Text lvText; |
| | | // [SerializeField] Text nextLVText; |
| | | [SerializeField] Text[] attrPerTextArr; |
| | | [SerializeField] Text[] nextAttrPerTextArr; |
| | | [SerializeField] Text potentialText; |
| | |
| | | { |
| | | breakLVText.text = "+" + hero.breakLevel; |
| | | nextBreakLVText.text = "+" + (hero.breakLevel + 1); |
| | | lvText.text = hero.qualityBreakConfig.LVMax.ToString(); |
| | | // lvText.text = hero.qualityBreakConfig.LVMax.ToString(); |
| | | |
| | | var nextBreakLVConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel + 1); |
| | | nextLVText.text = nextBreakLVConfig.LVMax.ToString(); |
| | | // var nextBreakLVConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel + 1); |
| | | // nextLVText.text = nextBreakLVConfig.LVMax.ToString(); |
| | | |
| | | for (int i = 0; i < attrPerTextArr.Length; i++) |
| | | { |
| | |
| | | hero.qualityConfig.BreakLVAddPer * (hero.breakLevel + 1)); |
| | | } |
| | | |
| | | moneyIcon.SetOrgSprite(ItemConfig.Get(hero.qualityBreakConfig.UPCostItem[0]).IconKey); |
| | | moneyText.text = UIHelper.ShowUseItem(PackType.Item, hero.qualityBreakConfig.UPCostItem[0], hero.qualityBreakConfig.UPCostItem[1]); |
| | | moneyIcon.SetOrgSprite(ItemConfig.Get(hero.qualityBreakConfig.UPCostItemList[0][0]).IconKey); |
| | | moneyText.text = UIHelper.ShowUseItem(PackType.Item, hero.qualityBreakConfig.UPCostItemList[0][0], hero.qualityBreakConfig.UPCostItemList[0][1]); |
| | | |
| | | var nextQualityBreakConfig = HeroBreakConfig.GetHeroBreakConfig(hero.heroId, hero.breakLevel + 1); |
| | | if (nextQualityBreakConfig == null) |
| | |
| | | |
| | | void BreakLV() |
| | | { |
| | | if (ItemLogicUtility.CheckItemCount(PackType.Item, hero.qualityBreakConfig.UPCostItem[0], hero.qualityBreakConfig.UPCostItem[1], 2)) |
| | | if (ItemLogicUtility.CheckItemCount(PackType.Item, hero.qualityBreakConfig.UPCostItemList[0][0], hero.qualityBreakConfig.UPCostItemList[0][1], 2)) |
| | | { |
| | | var pack = new CB232_tagCSHeroBreak(); |
| | | pack.ItemIndex = (ushort)hero.itemHero.gridIndex; |
| | |
| | | lvupBtnText.text = Language.Get("L1109"); |
| | | lvupMoneyIcon.SetActive(true); |
| | | |
| | | if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero)) |
| | | // if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero)) |
| | | // { |
| | | // lvupBtnText.text = Language.Get("L1111"); |
| | | // var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel); |
| | | // lvupMoneyIcon.SetOrgSprite(ItemConfig.Get(breakConfig.UPCostItemList[0][0]).IconKey); |
| | | // lvupMoneyText.text = UIHelper.ShowUseItem(PackType.Item, breakConfig.UPCostItemList[0][0], breakConfig.UPCostItemList[0][1]); |
| | | // } |
| | | // else |
| | | { |
| | | lvupBtnText.text = Language.Get("L1111"); |
| | | var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel); |
| | | lvupMoneyIcon.SetOrgSprite(ItemConfig.Get(breakConfig.UPCostItem[0]).IconKey); |
| | | lvupMoneyText.text = UIHelper.ShowUseItem(PackType.Item, breakConfig.UPCostItem[0], breakConfig.UPCostItem[1]); |
| | | } |
| | | else |
| | | { |
| | | lvupBtnText.text = Language.Get("L1109"); |
| | | // lvupBtnText.text = Language.Get("L1109"); |
| | | var lvupConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel); |
| | | lvupMoneyIcon.SetOrgSprite(ItemConfig.Get(lvupConfig.UPCostItem[0]).IconKey); |
| | | lvupMoneyText.text = UIHelper.ShowUseItem(PackType.Item, lvupConfig.UPCostItem[0], lvupConfig.UPCostItem[1]); |
| | |
| | | { |
| | | int itemID = 0; |
| | | long needCount = 0; |
| | | if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero)) |
| | | { |
| | | //突破 |
| | | if (!UIManager.Instance.IsOpened<HeroLVBreakWin>()) |
| | | { |
| | | HeroUIManager.Instance.selectHeroGuid = guid; |
| | | UIManager.Instance.OpenWindow<HeroLVBreakWin>(); |
| | | } |
| | | } |
| | | else |
| | | // if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero)) |
| | | // { |
| | | // //突破 |
| | | // if (!UIManager.Instance.IsOpened<HeroLVBreakWin>()) |
| | | // { |
| | | // HeroUIManager.Instance.selectHeroGuid = guid; |
| | | // UIManager.Instance.OpenWindow<HeroLVBreakWin>(); |
| | | // } |
| | | // } |
| | | // else |
| | | { |
| | | //升级 |
| | | var lvupConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel); |
| | |
| | | redpointGift.SetActive(true); |
| | | } |
| | | |
| | | var maxBreakLV = HeroBreakConfig.GetMaxBreakLv(hero.heroId); |
| | | if (hero.breakLevel < maxBreakLV) |
| | | { |
| | | if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero)) |
| | | { |
| | | var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel); |
| | | if (itemPack.GetCountById(breakConfig.UPCostItem[0]) >= breakConfig.UPCostItem[1]) |
| | | { |
| | | redpointLVUP.SetActive(true); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | // var maxBreakLV = HeroBreakConfig.GetMaxBreakLv(hero.heroId); |
| | | // if (hero.breakLevel < maxBreakLV) |
| | | // { |
| | | // if (HeroUIManager.Instance.IsCanBreak(hero)) |
| | | // { |
| | | // var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel); |
| | | // if (itemPack.GetCountById(breakConfig.UPCostItemList[0][0]) >= breakConfig.UPCostItemList[0][1]) |
| | | // { |
| | | // redpointLVUP.SetActive(true); |
| | | // return; |
| | | // } |
| | | // return; |
| | | // } |
| | | // } |
| | | |
| | | if (!HeroUIManager.Instance.IsLVMax(hero)) |
| | | { |
| | |
| | | for (int i = 0; i < lv; i++) |
| | | { |
| | | var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, i); |
| | | var itemID = config.UPCostItem[0]; |
| | | var count = config.UPCostItem[1]; |
| | | var itemID = config.UPCostItemList[0][0]; |
| | | var count = config.UPCostItemList[0][1]; |
| | | if (!itemCounDic.ContainsKey(itemID)) |
| | | { |
| | | itemCounDic[itemID] = count; |
| | |
| | | |
| | | public int GetMaxLV(int quality) |
| | | { |
| | | return HeroQualityBreakConfig.maxlvDic[quality]; |
| | | return HeroQualityLVConfig.maxlvDic[quality]; |
| | | } |
| | | |
| | | //是否达到最高级 |
| | |
| | | return hero.heroLevel >= GetMaxLV(hero.Quality); |
| | | |
| | | } |
| | | //突破限制的最高等级; 如果存在突破等级后不能再升级是策划配置问题 |
| | | public int GetMaxLVByBreakLV(int quality, int breakLevel) |
| | | //突破所需等级 |
| | | public int GetNeedLVByBreakLV(int quality, int breakLevel) |
| | | { |
| | | // for (int i = breakLevel; i >= 0; i--) |
| | | // { |
| | | // var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, i); |
| | | // if (config == null) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // return config.LVMax; |
| | | // } |
| | | return HeroQualityBreakConfig.GetQualityBreakConfig(quality, breakLevel).LVMax; |
| | | return HeroQualityBreakConfig.GetQualityBreakConfig(quality, breakLevel).UPLVNeed; |
| | | } |
| | | |
| | | //是否达到因突破限制的最高级 |
| | | public bool IsLVMaxByBreakLevel(HeroInfo hero) |
| | | //是否达到可突破的条件 |
| | | public bool IsCanBreak(HeroInfo hero) |
| | | { |
| | | return hero.heroLevel == GetMaxLVByBreakLV(hero.Quality, hero.breakLevel); |
| | | return hero.heroLevel >= GetNeedLVByBreakLV(hero.Quality, hero.breakLevel); |
| | | } |
| | | |
| | | public int GetAllHeroPer() |
| | |
| | | var maxBreakLV = HeroBreakConfig.GetMaxBreakLv(hero.heroId); |
| | | if (hero.breakLevel < maxBreakLV) |
| | | { |
| | | if (IsLVMaxByBreakLevel(hero)) |
| | | if (IsCanBreak(hero)) |
| | | { |
| | | var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel); |
| | | if (itemPack.GetCountById(breakConfig.UPCostItem[0]) >= breakConfig.UPCostItem[1]) |
| | | if (itemPack.GetCountById(breakConfig.UPCostItemList[0][0]) >= breakConfig.UPCostItemList[0][1]) |
| | | { |
| | | return 3; |
| | | } |
| | |
| | | |
| | | private void DisplayFirstChargeBtn() |
| | | { |
| | | bool isFirstChargeFuncOpen = FirstChargeManager.Instance.IsFuncOpen(); |
| | | if (FirstChargeManager.Instance.IsAllFirstChargeRewardsClaimed() && |
| | | FirstChargeManager.Instance.IsNextDayAfterAllClaimed()) |
| | | bool isFuncOpen = FirstChargeManager.Instance.IsFuncOpen(); |
| | | bool isAllHave = FirstChargeManager.Instance.IsAllFirstChargeRewardsClaimed(); |
| | | bool isNextDay = FirstChargeManager.Instance.IsNextDayAfterAllClaimed(); |
| | | |
| | | if (isAllHave && isNextDay) |
| | | { |
| | | FirstChargeBtn.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | FirstChargeBtn.SetActive(isFirstChargeFuncOpen); |
| | | FirstChargeBtn.SetActive(isFuncOpen); |
| | | } |
| | | } |
| | | |