| | |
| | | spineComp.enabled = false; |
| | | isPlaying = false; |
| | | onComplete?.Invoke(); |
| | | if (isReleaseImmediately) |
| | | { |
| | | Release(); |
| | | } |
| | | // TODO 会报错暂时注释 |
| | | // if (isReleaseImmediately) |
| | | // { |
| | | // Release(); |
| | | // } |
| | | |
| | | } |
| | | } |
| | |
| | | redpointTreeFree.state = RedPointState.None; |
| | | redpointTreeItem.state = RedPointState.None; |
| | | redpointTree.state = RedPointState.None; |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlessLV)) |
| | | { |
| | | return; |
| | | } |
| | | var config = TreeLVConfig.Get(m_TreeLV); |
| | | if (config == null) return; |
| | | //非升级中检查升级材料 |
| | |
| | | return; |
| | | } |
| | | |
| | | team.AddHero(hero, out pos); |
| | | team.AddHero(hero, out pos, true); |
| | | if (pos != -1) |
| | | { |
| | | selectRect.SetActive(true); |
| | |
| | | team.RemoveAllHeroes(); |
| | | for (int i = 0; i < guidList.Count; i++) |
| | | { |
| | | team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i); |
| | | team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i, true); |
| | | } |
| | | |
| | | TeamChangeEvent(new List<int>() { 0, 1, 2, 3, 4, 5 }, -1, Vector3.zero); |
| | |
| | | |
| | | public partial class HeroUIManager : GameSystemManager<HeroUIManager> |
| | | { |
| | | |
| | | |
| | | |
| | | #region 布阵界面 |
| | | public List<string> heroOnTeamSortList { get; private set; } = new List<string>(); //不同上阵的列表排序 |
| | |
| | | |
| | | var team = TeamManager.Instance.GetTeam(teamType); |
| | | if (team == null) |
| | | { |
| | | { |
| | | return heroCountryCount; |
| | | } |
| | | TeamHero[] teamHeroes = isPreview ? team.tempHeroes : team.serverHeroes; |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 主界面上的武将上阵解锁显示 和 解锁规则 |
| | | |
| | | public int[][] lockHeroCountLimit; |
| | | public List<int> lockIndexList = new List<int>(); |
| | | |
| | | public Action OnUnLockHeroCountEvent; |
| | | public int lockState |
| | | { |
| | | get |
| | | { |
| | | return QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.HeroCountLock, 0); |
| | | } |
| | | set |
| | | { |
| | | QuickSetting.Instance.SetQuickSetting(QuickSettingType.HeroCountLock, value, 0); |
| | | QuickSetting.Instance.SendPackage(); |
| | | RefreshServerLockIndex(); |
| | | } |
| | | } |
| | | |
| | | //解锁上阵英雄的数量限制, 解锁条件在界面上是按顺序排序的,但是锁定的位置是动态变化的 |
| | | //比如 第4,5,6格子锁住了,但第6个的锁先完成了解锁条件,解锁后锁住的位置往后顺推 |
| | | //则 第4的位置显示为解锁状态,5和6是锁住状态,5的解锁条件按配置列表的顺序解锁(即为原4的解锁条件) |
| | | |
| | | // 模拟服务端 这里的index 对应的是配表的 |
| | | public bool IsUnLock(int configIndex) |
| | | { |
| | | //按lockState的位判断 |
| | | return (lockState & (1 << configIndex)) != 0; |
| | | } |
| | | |
| | | public bool SetUnLock(int configIndex) |
| | | { |
| | | if (!CanUnLock(configIndex, true)) |
| | | { |
| | | return false; |
| | | } |
| | | lockState |= 1 << configIndex; |
| | | return true; |
| | | } |
| | | |
| | | // 解锁类型 |
| | | // 1.主公等级达X级开启; |
| | | // 2.通关主线X-X开启;同任务配法 |
| | | // 3.开服时间达到X天开启; |
| | | public bool CanUnLock(int configIndex, bool notify = false) |
| | | { |
| | | int type = lockHeroCountLimit[configIndex][0]; |
| | | int value = lockHeroCountLimit[configIndex][1]; |
| | | if (type == 1) |
| | | { |
| | | if (PlayerDatas.Instance.baseData.LV < value) |
| | | { |
| | | if (notify) |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock1", value); |
| | | return false; |
| | | } |
| | | } |
| | | else if (type == 2) |
| | | { |
| | | //如ExAttr1值为20103代表当前已经过了第2章第1关第3波; value为201 |
| | | if (PlayerDatas.Instance.baseData.ExAttr1 / 100 <= value) |
| | | { |
| | | if (notify) |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock2", value / 100, value % 100); |
| | | return false; |
| | | } |
| | | } |
| | | else if (type == 3) |
| | | { |
| | | if (TimeUtility.OpenDay < value - 1) |
| | | { |
| | | if (notify) |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock3", value); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | public void ShowUnLockTip(int configIndex) |
| | | { |
| | | int type = lockHeroCountLimit[configIndex][0]; |
| | | int value = lockHeroCountLimit[configIndex][1]; |
| | | if (type == 1) |
| | | { |
| | | if (PlayerDatas.Instance.baseData.LV < value) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock1", value); |
| | | return; |
| | | } |
| | | } |
| | | else if (type == 2) |
| | | { |
| | | //如ExAttr1值为20103代表当前已经过了第2章第1关第3波; value为201 |
| | | if (PlayerDatas.Instance.baseData.ExAttr1 / 100 <= value) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock2", value / 100, value % 100); |
| | | return; |
| | | } |
| | | } |
| | | else if (type == 3) |
| | | { |
| | | if (TimeUtility.OpenDay < value - 1) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock3", value); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //可以解锁,但未解锁 |
| | | if (!IsUnLock(configIndex)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock4"); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 刷新未解锁武将上限的配置索引列表 |
| | | public void RefreshServerLockIndex() |
| | | { |
| | | lockIndexList.Clear(); |
| | | for (int i = 0; i < lockHeroCountLimit.Length; i++) |
| | | { |
| | | if (!IsUnLock(i)) |
| | | { |
| | | lockIndexList.Add(i); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool UnLockHeroCnt(int lockIndex) |
| | | { |
| | | if (lockIndex < 0 || lockIndex >= lockIndexList.Count) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return SetUnLock(lockIndexList[lockIndex]); |
| | | |
| | | } |
| | | |
| | | void OnQuickSettingUpdate() |
| | | { |
| | | RefreshServerLockIndex(); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | |
| | |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | TeamManager.Instance.OnTeamChange += OnTeamChangeEvent; |
| | | QuickSetting.Instance.onQuickSettingUpdate += OnQuickSettingUpdate; |
| | | ParseConfig(); |
| | | InitHeroOnTeamRedpointList(); |
| | | InitHeroBookRedpointList(); |
| | |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | TeamManager.Instance.OnTeamChange -= OnTeamChangeEvent; |
| | | QuickSetting.Instance.onQuickSettingUpdate -= OnQuickSettingUpdate; |
| | | } |
| | | |
| | | void ParseConfig() |
| | |
| | | |
| | | config = FuncConfigConfig.Get("HeroRedpoint"); |
| | | heroRedpointItemList = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | |
| | | config = FuncConfigConfig.Get("HeroOnTeam"); |
| | | lockHeroCountLimit = JsonMapper.ToObject<int[][]>(config.Numerical1); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | |
| | | OnFightEvent?.Invoke(true); |
| | | } |
| | | |
| | | public bool CanChallengeBoss() |
| | | { |
| | | //最后一波通过,且当前波还是最后一波;倒退只倒退波不会倒退关卡 |
| | | if (PlayerDatas.Instance.baseData.ExAttr2 != PlayerDatas.Instance.baseData.ExAttr1) |
| | | { |
| | | return false; |
| | | } |
| | | var value = PlayerDatas.Instance.baseData.ExAttr2; |
| | | var chapterID = value / 10000; |
| | | var levelNum = value % 10000 / 100; |
| | | var waveID = value % 100; |
| | | |
| | | var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum); |
| | | if (waveID < MainLevelConfig.GetwaveCount(config)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | var index = team.GetEmptyPosition(); |
| | | if (index < 0) |
| | | { |
| | | team.AddHero(heroInfo, 5); |
| | | team.AddHero(heroInfo, 5, false); |
| | | } |
| | | else |
| | | { |
| | | team.AddHero(heroInfo, index); |
| | | team.AddHero(heroInfo, index, false); |
| | | } |
| | | } |
| | | |
| | |
| | | [SerializeField] FillTween cdTween; |
| | | |
| | | [SerializeField] Button clickEmptyBtn; |
| | | |
| | | [SerializeField] Image emptyLockImg; |
| | | [SerializeField] Image redPointImg; |
| | | [SerializeField] UIEffectPlayer unlockEffect; |
| | | |
| | | void OnEnable() |
| | | { |
| | |
| | | } |
| | | |
| | | string guid; |
| | | public void Display(int index) |
| | | int lockIndex; |
| | | public void Display(int index, List<TeamHero> heros) |
| | | { |
| | | var team = TeamManager.Instance.GetTeam(TeamType.Story); |
| | | var teamHero = team.GetServerHeroByIndex(index); |
| | | TeamHero teamHero = null; |
| | | if (index < heros.Count) |
| | | { |
| | | teamHero = heros[index]; |
| | | } |
| | | guid = teamHero != null ? teamHero.guid : ""; |
| | | if (guid == "") |
| | | { |
| | | clickHeroBtn.SetActive(false); |
| | | clickEmptyBtn.SetActive(true); |
| | | clickEmptyBtn.AddListener(ClickEmpty); |
| | | emptyLockImg.SetActive(false); |
| | | redPointImg.SetActive(false); |
| | | |
| | | int lockCnt = HeroUIManager.Instance.lockIndexList.Count; |
| | | //根据锁数量 倒序判断锁住 |
| | | if (lockCnt > 0) |
| | | { |
| | | lockIndex = lockCnt - (TeamConst.MaxTeamHeroCount - 1 - index) - 1; |
| | | if (lockIndex >= 0 && lockIndex < lockCnt) |
| | | { |
| | | emptyLockImg.SetActive(true); |
| | | redPointImg.SetActive(HeroUIManager.Instance.CanUnLock(HeroUIManager.Instance.lockIndexList[lockIndex])); |
| | | } |
| | | } |
| | | |
| | | return; |
| | | } |
| | | else |
| | |
| | | |
| | | void ClickEmpty() |
| | | { |
| | | if (emptyLockImg.isActiveAndEnabled) |
| | | { |
| | | if (HeroUIManager.Instance.UnLockHeroCnt(lockIndex)) |
| | | { |
| | | unlockEffect.onComplete = () => |
| | | { |
| | | HeroUIManager.Instance.OnUnLockHeroCountEvent?.Invoke(); |
| | | SysNotifyMgr.Instance.ShowTip("HeroCountUnLock5", TeamConst.MaxTeamHeroCount - HeroUIManager.Instance.lockIndexList.Count); |
| | | }; |
| | | unlockEffect.Play(); |
| | | } |
| | | return; |
| | | } |
| | | UIManager.Instance.OpenWindow<HeroCallWin>(); |
| | | } |
| | | void OnSkillCast(bool isfighting) |
| | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange; |
| | | FirstChargeManager.Instance.OnUpdateFirstChargeInfo += OnUpdateFirstChargeInfo; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | HeroUIManager.Instance.OnUnLockHeroCountEvent += OnUnLockHeroCountEvent; |
| | | Display(); |
| | | DisplayFirstChargeBtn(); |
| | | |
| | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange; |
| | | FirstChargeManager.Instance.OnUpdateFirstChargeInfo -= OnUpdateFirstChargeInfo; |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | HeroUIManager.Instance.OnUnLockHeroCountEvent -= OnUnLockHeroCountEvent; |
| | | |
| | | // 关闭的时候把战斗界面也给关了 虽然是在外面开的 |
| | | UIManager.Instance.CloseWindow<BattleWin>(); |
| | |
| | | { |
| | | if (teamType != TeamType.Story) |
| | | return; |
| | | var team = TeamManager.Instance.GetTeam(teamType); |
| | | var heros = team.GetHerosOnTeam(); |
| | | //显示卡牌 |
| | | for (int i = 0; i < heroFightingCardCells.Length; i++) |
| | | { |
| | | heroFightingCardCells[i].Display(i); |
| | | heroFightingCardCells[i].Display(i, heros); |
| | | } |
| | | } |
| | | |
| | |
| | | //【普通】关卡名字1-6 |
| | | levelName.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum); |
| | | |
| | | bool canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss(); |
| | | bool canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss(); |
| | | //BOSS |
| | | if (canChallengeBoss) |
| | | { |
| | |
| | | { |
| | | DisplayFirstChargeBtn(); |
| | | } |
| | | |
| | | void OnUnLockHeroCountEvent() |
| | | { |
| | | DisplayCard(TeamType.Story); |
| | | } |
| | | } |
| | |
| | | |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(levelConfig.FightPower); |
| | | |
| | | var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss(); |
| | | var canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss(); |
| | | |
| | | fightBtn.SetInteractable(canChallengeBoss); |
| | | fightIcon.SetActive(canChallengeBoss); |
| | |
| | | |
| | | void FightBoss() |
| | | { |
| | | if (AutoFightModel.Instance.CanChallengeBoss()) |
| | | if (MainLevelManager.Instance.CanChallengeBoss()) |
| | | { |
| | | var pack = new CB410_tagCMTurnFight(); |
| | | pack.MapID = 2; |
| | |
| | | { |
| | | case PlayerDataType.ExAttr1: |
| | | case PlayerDataType.ExAttr2: |
| | | var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss(); |
| | | var canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss(); |
| | | |
| | | fightBtn.SetInteractable(canChallengeBoss); |
| | | fightIcon.SetActive(canChallengeBoss); |
| | |
| | | } |
| | | OnUpdateDayBooty?.Invoke(); |
| | | } |
| | | |
| | | public bool CanChallengeBoss() |
| | | { |
| | | //最后一波通过,且当前波还是最后一波;倒退只倒退波不会倒退关卡 |
| | | if (PlayerDatas.Instance.baseData.ExAttr2 != PlayerDatas.Instance.baseData.ExAttr1) |
| | | { |
| | | return false; |
| | | } |
| | | var value = PlayerDatas.Instance.baseData.ExAttr2; |
| | | var chapterID = value / 10000; |
| | | var levelNum = value % 10000 / 100; |
| | | var waveID = value % 100; |
| | | |
| | | var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum); |
| | | if (waveID < MainLevelConfig.GetwaveCount(config)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | return _data.Count;
|
| | | }
|
| | |
|
| | | // 获取总的Cell数目(含不显示的)
|
| | | public int GetNumberOfCells()
|
| | | {
|
| | | return _data.Count;
|
| | | }
|
| | |
|
| | | public EnhancedScroller m_Scorller;
|
| | | private ScrollRect m_ScrollRect;
|
| | | public ScrollRect mScrollRect {
|
| | |
| | | quickSettingDic.Add(QuickSettingType.AutoFight_Open, new QuickSettingRange(QuickSettingType.AutoFight_Open, 3, 1)); |
| | | quickSettingDic.Add(QuickSettingType.AutoGoldRush, new QuickSettingRange(QuickSettingType.AutoGoldRush, 4, 10, 1)); //自动淘金,9个物品值,1个自动刷新开关 |
| | | quickSettingDic.Add(QuickSettingType.BattleSpeed, new QuickSettingRange(QuickSettingType.BattleSpeed, 14, 1)); |
| | | quickSettingDic.Add(QuickSettingType.HeroCountLock, new QuickSettingRange(QuickSettingType.HeroCountLock, 15, 2)); |
| | | |
| | | setting = new string(UCharacter, 100); |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; |
| | |
| | | AutoFight_Open, //是否开启自动战斗 |
| | | AutoGoldRush, //自动淘金 |
| | | BattleSpeed, //战斗速度索引 非主线部分 |
| | | HeroCountLock, //上阵人数条件锁定 |
| | | } |
| | | |
| | | public class QuickSettingRange |
| | |
| | | return serverHeroes[index]; |
| | | } |
| | | |
| | | |
| | | //获取所有上阵的武将 |
| | | public List<TeamHero> GetHerosOnTeam() |
| | | { |
| | | List<TeamHero> tmpHeros = new List<TeamHero>(); |
| | | foreach (var hero in tempHeroes) |
| | | { |
| | | if (hero != null) |
| | | { |
| | | tmpHeros.Add(hero); |
| | | } |
| | | } |
| | | return tmpHeros; |
| | | } |
| | | |
| | | public TeamHero GetNextServerHero(string guid) |
| | | { |
| | | if (string.IsNullOrEmpty(guid)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void AddHero(HeroInfo heroInfo, int targetPosition) |
| | | //checkLock :是否验证上阵人数限制 |
| | | public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock) |
| | | { |
| | | if (targetPosition < 0 || targetPosition >= tempHeroes.Length) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (checkLock) |
| | | { |
| | | var lockCnt = HeroUIManager.Instance.lockIndexList.Count; |
| | | if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt) |
| | | { |
| | | HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | SetTeamHero(targetPosition, new TeamHero(heroInfo, targetPosition, this)); |
| | | } |
| | | |
| | | |
| | | |
| | | //checkLock :是否验证上阵人数限制 |
| | | // add只可能是点下面卡牌 |
| | | public bool AddHero(HeroInfo heroInfo, out int pos) |
| | | public bool AddHero(HeroInfo heroInfo, out int pos, bool checkLock) |
| | | { |
| | | pos = -1; |
| | | if (heroInfo == null || heroInfo.itemHero == null) return false; |
| | | |
| | | if (checkLock) |
| | | { |
| | | var lockCnt = HeroUIManager.Instance.lockIndexList.Count; |
| | | if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt) |
| | | { |
| | | HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 同一英雄 只能上阵一个 |
| | | if (GetHeroByHeroID(heroInfo.heroId) != null) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroFunc2"); |
| | | return false; |
| | | return false; |
| | | } |
| | | else |
| | | { |