public int UpdateLevelByExperience() { XSoulLevelConfig level_config = XSoulLevelConfigProvider.Instance.GetDataById(ItemId); if (level_config == null) { return(0); } m_CurLevelExperience = m_Experience; for (int i = 2; i <= level_config.m_MaxLevel; i++) { int cur_level_exp = 0; if (level_config.m_LevelExperience.TryGetValue(i, out cur_level_exp)) { if (m_CurLevelExperience >= cur_level_exp) { m_CurLevelExperience -= cur_level_exp; m_Level = i; } else { break; } } else { break; } } if (m_Level == level_config.m_MaxLevel) { m_CurLevelExperience = 0; } return(m_CurLevelExperience); }
//检查xhun相关 public static void CheckXhun() { bool has = false; RoleInfo role = LobbyClient.Instance.CurrentRole; XSoulInfo <XSoulPartInfo> xsoul_info = role.GetXSoulInfo(); if (xsoul_info == null) { return; } XSoulPartInfo xsoul_part_into = xsoul_info.GetXSoulPartData(XSoulPart.kWeapon); if (xsoul_part_into == null) { return; } ItemDataInfo itemInfo = xsoul_part_into.XSoulPartItem; if (itemInfo == null) { return; } int curExp = itemInfo.CurLevelExperience; int id = itemInfo.ItemId; int lv = itemInfo.Level; XSoulLevelConfig config = XSoulLevelConfigProvider.Instance.GetDataById(id); if (lv < config.m_MaxLevel) { int maxExp = 0; int nextLv = lv + 1 <= config.m_MaxLevel ? lv + 1 : config.m_MaxLevel; config.m_LevelExperience.TryGetValue(nextLv, out maxExp); int remainExp = maxExp - curExp; //剩余经验 int[] hunIds = config.m_ExperienceProvideItems; int hunExp = 0; //魂丹总经验 for (int i = 0; i < hunIds.Length; i++) { ItemDataInfo item = GetItemDataInfoById(hunIds[i]); if (item != null) { ItemConfig itemConfig = ItemConfigProvider.Instance.GetDataById(hunIds[i]); if (itemConfig != null) { hunExp += item.ItemNum * itemConfig.m_ExperienceProvide; } } } if (remainExp <= hunExp) { has = true; } } ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_systemnewtip_state_change", "ui", SystemNewTipType.Xhun, has); }