| | |
| | | |
| | | //对应 BattlePreSetType 战斗类型 : 全局方案ID |
| | | Dictionary<int, int> battlePreSetDict = new Dictionary<int, int>(); |
| | | public event Action OnBattelePresetEvent; |
| | | |
| | | //所有预设方案的保存信息 全局方案ID :子功能类型(配表):子方案ID |
| | | Dictionary<int, Dictionary<int, int>> m_FuncPresetSaveDict = new Dictionary<int, Dictionary<int, int>>(); |
| | | public event Action OnFuncPresetUseDataEvent; |
| | | public event Action<int> OnFuncPresetUseDataEvent; //0 更换子方案,1 更换全局方案,2 解锁/更改名 |
| | | |
| | | public const int GlobalDefaultPresetID = 1; //默认全局方案ID |
| | | public const int FuncDefaultPresetID = 1; //默认子功能方案ID |
| | | |
| | | public int[] openConditions; //流派预设(也叫全局方案/战斗方案) 开启条件【开服第N天,主线通关X-Y,定军阁达到N层】 |
| | | |
| | | public Action<int, int, bool> OnSelectPresetEvent; //选择功能预设方案事件 功能类型 方案ID 是否展开 |
| | | public Action<int, int, int, bool> OnSelectPresetEvent; //选择功能预设方案事件 功能类型 方案ID 是否展开 |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | public bool IsOpen() |
| | | { |
| | | //特殊约定 |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge)) |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.FuncPreset)) |
| | | return false; |
| | | |
| | | if (TimeUtility.OpenDay < openConditions[0] - 1) |
| | |
| | | //提前显示 |
| | | public bool IsPreShow() |
| | | { |
| | | return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge); |
| | | return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.FuncPreset); |
| | | } |
| | | |
| | | void InitFuncPreset() |
| | |
| | | m_FuncPresetDict[config.PresetType][config.PresetID] = new FuncPreset() |
| | | { |
| | | unLock = config.UnlockType == 0, |
| | | PresetName = Language.Get("Mingge13", config.PresetID) |
| | | PresetName = Language.Get(config.PresetType == 1 ? "FuncPreset10" : "Mingge13", config.PresetID) |
| | | }; |
| | | } |
| | | } |
| | |
| | | m_FuncPresetDict[funcPresetInfo.FuncPresetType][preset.PresetID] = new FuncPreset() |
| | | { |
| | | unLock = _unlock, |
| | | PresetName = string.IsNullOrEmpty(preset.PresetName) ? Language.Get("Mingge13", preset.PresetID) : preset.PresetName, |
| | | PresetName = string.IsNullOrEmpty(preset.PresetName) ? |
| | | Language.Get(funcPresetInfo.FuncPresetType == 1 ? "FuncPreset10" : "Mingge13", preset.PresetID) : preset.PresetName, |
| | | }; |
| | | } |
| | | } |
| | | |
| | | OnFuncPresetUseDataEvent?.Invoke(); |
| | | OnFuncPresetUseDataEvent?.Invoke(2); |
| | | } |
| | | |
| | | //每个全局方案的存储信息 |
| | |
| | | m_FuncPresetSaveDict[batPreset.BatPresetID][funcPreset.FuncPresetType] = funcPreset.FuncPresetID; |
| | | } |
| | | } |
| | | OnFuncPresetUseDataEvent?.Invoke(); |
| | | OnFuncPresetUseDataEvent?.Invoke(0); |
| | | } |
| | | |
| | | //当前战斗功能的全局方案ID使用情况 |
| | |
| | | { |
| | | battlePreSetDict[netPack.BatPresetList[i].BatPresetType] = netPack.BatPresetList[i].BatPresetID; |
| | | } |
| | | OnBattelePresetEvent?.Invoke(); |
| | | OnFuncPresetUseDataEvent?.Invoke(1); |
| | | } |
| | | |
| | | //根据战斗获取全局方案ID,如果取不到默认方案1 |
| | |
| | | var pack = new CB262_tagCSFuncPresetSwitch(); |
| | | pack.FuncPresetType = (byte)funcType; |
| | | pack.PresetID = (byte)presetID; |
| | | pack.BatPresetID = (byte)battleType; |
| | | pack.BatPresetID = (byte)GetGlobalPresetID(battleType); |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | |
| | | pack.FuncPresetType = (byte)funcType; |
| | | pack.PresetID = (byte)presetID; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | SysNotifyMgr.Instance.ShowTip("FuncPreset2"); |
| | | } |
| | | |
| | | //要显示的方案数量; 根据情况会包含未解锁 |
| | |
| | | { |
| | | var unlockCnt = GetUnlockCnt(funcType); |
| | | var maxCount = PresetUnlockConfig.GetFuncPresetMaxCount(funcType); |
| | | var unlockType = PresetUnlockConfig.GetUnlockType((int)FuncPresetType.Mingge); |
| | | var unlockType = PresetUnlockConfig.GetUnlockType(funcType); |
| | | if (unlockType == 2) |
| | | { |
| | | //命格按推演境界解锁 |
| | | //只有1个方案则不显示,大于1个则全显示 |
| | | if (unlockCnt == 1) |
| | | { |
| | | var config = PresetUnlockConfig.GetPresetUnlockConfig((int)FuncPresetType.Mingge, 2); |
| | | var config = PresetUnlockConfig.GetPresetUnlockConfig(funcType, 2); |
| | | if (MinggeManager.Instance.m_GanwuLV >= config.UnlockValue) |
| | | { |
| | | return maxCount; |
| | |
| | | |
| | | SaveFuncPresetID(battleType, funcType, id); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 点击流派/防守预设按钮 |
| | | public void ClickBattlePreset(int battleType) |
| | | { |
| | | if (battleType > 1) |
| | | { |
| | | UIManager.Instance.OpenWindow<FuncPresetWin>(battleType); |
| | | return; |
| | | } |
| | | |
| | | if (!IsOpen()) |
| | | { |
| | | UIManager.Instance.OpenWindow<FuncPresetUnLockWin>(battleType); |
| | | } |
| | | else |
| | | { |
| | | UIManager.Instance.OpenWindow<FuncPresetWin>(battleType); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |