yyl
2026-01-27 ac93e899d5c6331e89ccae552ecbb502a9652d01
Main/System/FuncPreset/FuncPresetManager.cs
@@ -12,18 +12,17 @@
    //对应 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()
    {
@@ -54,7 +53,7 @@
    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)
@@ -79,7 +78,7 @@
    //提前显示
    public bool IsPreShow()
    {
        return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Mingge);
        return FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.FuncPreset);
    }
    void InitFuncPreset()
@@ -100,7 +99,7 @@
            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)
            };
        }
    }
@@ -122,12 +121,13 @@
                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);
    }
    //每个全局方案的存储信息
@@ -146,7 +146,7 @@
                m_FuncPresetSaveDict[batPreset.BatPresetID][funcPreset.FuncPresetType] = funcPreset.FuncPresetID;
            }
        }
        OnFuncPresetUseDataEvent?.Invoke();
        OnFuncPresetUseDataEvent?.Invoke(0);
    }
    //当前战斗功能的全局方案ID使用情况
@@ -156,7 +156,7 @@
        {
            battlePreSetDict[netPack.BatPresetList[i].BatPresetType] = netPack.BatPresetList[i].BatPresetID;
        }
        OnBattelePresetEvent?.Invoke();
        OnFuncPresetUseDataEvent?.Invoke(1);
    }
    //根据战斗获取全局方案ID,如果取不到默认方案1
@@ -222,7 +222,7 @@
        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);
    }
@@ -240,6 +240,7 @@
        pack.FuncPresetType = (byte)funcType;
        pack.PresetID = (byte)presetID;
        GameNetSystem.Instance.SendInfo(pack);
        SysNotifyMgr.Instance.ShowTip("FuncPreset2");
    }
    //要显示的方案数量; 根据情况会包含未解锁
@@ -249,14 +250,14 @@
    {
        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;
@@ -325,7 +326,26 @@
        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);
      }
    }
}