| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using dnlib.DotNet; |
| | | |
| | | using UnityEngine; |
| | | |
| | |
| | | public class HeroUIManager : GameSystemManager<HeroUIManager> |
| | | { |
| | | #region 武将列表界面 |
| | | public List<string> heroSortList { get; private set; } = new List<string>(); //上阵为主线的列表 |
| | | public List<string> heroSortList { get; private set; } = new List<string>(); //上阵为主线的 GUID列表 |
| | | public int selectHeroListJob = 0; //武将列表界面 筛选职业 |
| | | public int selectHeroListCountry = 0; //武将列表界面筛选国家 |
| | | public string selectHeroGuid; //选中的武将id |
| | | #endregion |
| | | |
| | | public WaitHeroFuncResponse waitResponse; //请求武将功能 |
| | | |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | HeroManager.Instance.onHeroChangeEvent += OnHeroChangeEvent; |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; |
| | | HeroManager.Instance.onHeroChangeEvent -= OnHeroChangeEvent; |
| | | } |
| | | |
| | | void ParseConfig() |
| | | { |
| | | var config = FuncConfigConfig.Get("HeroRebirth"); |
| | | payBackMoneyType = int.Parse(config.Numerical1); |
| | | payBackMoney = int.Parse(config.Numerical2); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | heroSortList.Clear(); |
| | | heroOnTeamSortList.Clear(); |
| | | awakeRebirthCnt = 0; |
| | | waitResponse = default; |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | private void OnHeroChangeEvent(HeroInfo hero) |
| | | { |
| | | if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin) |
| | | return; |
| | | WaitServerResponse(hero); |
| | | } |
| | | |
| | | public override void Init() |
| | | private void WaitServerResponse(HeroInfo hero) |
| | | { |
| | | if (waitResponse.Equals(default(WaitHeroFuncResponse))) |
| | | { |
| | | return; |
| | | } |
| | | // 等待超过5秒 不处理 |
| | | var nowTime = Time.time; |
| | | if (waitResponse.time > 0f && waitResponse.time + 5 < nowTime) |
| | | { |
| | | waitResponse = default; |
| | | return; |
| | | } |
| | | |
| | | if (hero.itemHero.guid != waitResponse.guid) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (waitResponse.type == HeroFuncType.Break) |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroLVBreakSuccessWin>(); |
| | | } |
| | | |
| | | waitResponse = default; |
| | | |
| | | } |
| | | |
| | | public override void Release() |
| | | #region 武将UI常用接口 |
| | | public string GetCountryName(int index) |
| | | { |
| | | |
| | | return RichTextMsgReplaceConfig.GetRichReplace("Country", index); |
| | | } |
| | | |
| | | public string GetJobName(int index) |
| | | { |
| | | return RichTextMsgReplaceConfig.GetRichReplace("Class", index); |
| | | } |
| | | |
| | | public string GetCountryIconName(int index) |
| | | { |
| | | return StringUtility.Contact("herocountry", index); |
| | | } |
| | | |
| | | public string GetJobIconName(int index) |
| | | { |
| | | return StringUtility.Contact("herojob", index); |
| | | } |
| | | |
| | | public int GetMaxLV(int quality) |
| | | { |
| | | return HeroQualityBreakConfig.maxlvDic[quality]; |
| | | } |
| | | |
| | | //是否达到最高级 |
| | | public bool IsLVMax(HeroInfo hero) |
| | | { |
| | | return hero.heroLevel >= GetMaxLV(hero.Quality); |
| | | |
| | | } |
| | | //突破限制的最高等级 |
| | | public int GetMaxLVByBreakLV(int quality, int breakLevel) |
| | | { |
| | | return HeroQualityBreakConfig.GetQualityBreakConfig(quality, breakLevel).LVMax; |
| | | } |
| | | |
| | | public bool IsLVMaxByBreakLevel(HeroInfo hero) |
| | | { |
| | | return hero.heroLevel == GetMaxLVByBreakLV(hero.Quality, hero.breakLevel); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | public void QueryUnLockHeroPack() |
| | |
| | | { |
| | | if (UIHelper.GetMoneyCnt(buyInfo[0]) < (ulong)buyInfo[1]) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney",buyInfo[0]); |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", buyInfo[0]); |
| | | return; |
| | | } |
| | | PackManager.Instance.BuyPackGird(PackType.Hero); |
| | |
| | | |
| | | private TeamType m_SelectTeamType = TeamType.Story; //当前选中的是哪个阵容, 布阵相关逻辑使用 |
| | | public TeamType selectTeamType |
| | | { |
| | | { |
| | | get { return m_SelectTeamType; } |
| | | set |
| | | { |
| | |
| | | |
| | | m_SelectTeamType = value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public int selectTeamPosJob = 0; //布阵界面 筛选职业 |
| | | public int selectTeamPosCountry = 0; //布阵界面 筛选国家 |
| | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 重生 遣散 |
| | | public int awakeRebirthCnt { get; private set; } |
| | | public int payBackMoneyType; |
| | | public int payBackMoney; |
| | | public Dictionary<int, ulong> GetHeroLVPayBack(int quality, int lv) |
| | | { |
| | | //汇总返还总数量 |
| | | Dictionary<int, ulong> itemCounDic = new Dictionary<int, ulong>(); |
| | | for (int i = 1; i < lv; i++) |
| | | { |
| | | var config = HeroQualityLVConfig.GetQualityLVConfig(quality, lv); |
| | | var itemID = config.UPCostItem[0]; |
| | | var count = (ulong)config.UPCostItem[1]; |
| | | if (!itemCounDic.ContainsKey(itemID)) |
| | | { |
| | | itemCounDic[itemID] = count; |
| | | } |
| | | itemCounDic[itemID] = itemCounDic[itemID] + count; |
| | | } |
| | | |
| | | return itemCounDic; |
| | | } |
| | | |
| | | |
| | | public Dictionary<int, ulong> GetHeroBreakPayBack(int quality, int lv) |
| | | { |
| | | //汇总返还总数量 |
| | | Dictionary<int, ulong> itemCounDic = new Dictionary<int, ulong>(); |
| | | for (int i = 0; i < lv; i++) |
| | | { |
| | | var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, lv); |
| | | var itemID = config.UPCostItem[0]; |
| | | var count = (ulong)config.UPCostItem[1]; |
| | | if (!itemCounDic.ContainsKey(itemID)) |
| | | { |
| | | itemCounDic[itemID] = count; |
| | | } |
| | | itemCounDic[itemID] = itemCounDic[itemID] + count; |
| | | } |
| | | |
| | | return itemCounDic; |
| | | |
| | | |
| | | } |
| | | |
| | | public Dictionary<int, ulong> GetHeroQualityAwakePayBack(int quality, int lv) |
| | | { |
| | | //汇总返还总数量 |
| | | Dictionary<int, ulong> itemCounDic = new Dictionary<int, ulong>(); |
| | | for (int i = 0; i < lv; i++) |
| | | { |
| | | var config = HeroQualityAwakeConfig.GetQualityAwakeConfig(quality, lv); |
| | | var itemID = config.UPCostItem[0]; |
| | | var count = (ulong)config.UPCostItem[1]; |
| | | if (!itemCounDic.ContainsKey(itemID)) |
| | | { |
| | | itemCounDic[itemID] = count; |
| | | } |
| | | itemCounDic[itemID] = itemCounDic[itemID] + count; |
| | | } |
| | | |
| | | return itemCounDic; |
| | | } |
| | | |
| | | public void UpdateHeroInfo(HB125_tagSCPlayerHeroInfo netPack) |
| | | { |
| | | awakeRebirthCnt = netPack.AwakeRebirthCnt; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | public struct WaitHeroFuncResponse |
| | | { |
| | | public HeroFuncType type; |
| | | public string guid; |
| | | public float time; |
| | | } |
| | | |
| | | //武将功能类型 |
| | | public enum HeroFuncType |
| | | { |
| | | None = 0, //无功能 |
| | | Break = 1, //突破 |
| | | |
| | | } |