2023-10-24 14:58:21 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using cfg.LevelCfg;
|
2023-11-02 20:02:10 +08:00
|
|
|
using cfg.RedPoint;
|
2024-09-29 18:29:46 +08:00
|
|
|
using Gameplay;
|
2023-10-24 14:58:21 +08:00
|
|
|
|
2024-09-02 14:08:35 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 章节信息
|
|
|
|
|
/// </summary>
|
2024-06-27 18:55:53 +08:00
|
|
|
public class ChapterInfo: IRedPointTreeNode
|
2023-10-24 14:58:21 +08:00
|
|
|
{
|
2024-09-02 14:08:35 +08:00
|
|
|
/// <summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
/// 关卡组信息字典
|
2024-09-02 14:08:35 +08:00
|
|
|
/// </summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
private readonly Dictionary<E_LevelDifficulty, LevelGroupInfo> dicLevelGroupInfoList = new();
|
|
|
|
|
|
|
|
|
|
#region 属性
|
2024-09-02 14:08:35 +08:00
|
|
|
/// <summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
/// 配置数据
|
2024-09-02 14:08:35 +08:00
|
|
|
/// </summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
public DataChapter Cfg { get; private set; }
|
|
|
|
|
|
2024-09-02 14:08:35 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 红点
|
|
|
|
|
/// </summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
public RedPointNode RedPoint { get; private set; }
|
2023-10-24 14:58:21 +08:00
|
|
|
|
2024-09-02 14:08:35 +08:00
|
|
|
/// <summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
/// 章节名
|
2024-09-02 14:08:35 +08:00
|
|
|
/// </summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
public string Name
|
2023-10-26 20:20:11 +08:00
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.ChapterName,Cfg.Id); }
|
2023-10-26 20:20:11 +08:00
|
|
|
}
|
2024-01-18 16:02:45 +08:00
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 章节描述
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Desc
|
2023-10-26 20:20:11 +08:00
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.ChapterDesc, Cfg.Id); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 章节序号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Number
|
|
|
|
|
{
|
|
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.ChapterNumber, Cfg.Id); }
|
2024-07-10 18:23:40 +08:00
|
|
|
}
|
|
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否锁住
|
|
|
|
|
/// </summary>
|
2023-10-26 20:20:11 +08:00
|
|
|
public bool IsLock
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
foreach (LevelGroupInfo levelGroupInfo in dicLevelGroupInfoList.Values)
|
2023-10-26 20:20:11 +08:00
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
if (!levelGroupInfo.IsLock)
|
2023-10-26 20:20:11 +08:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-02 14:08:35 +08:00
|
|
|
#endregion
|
2024-01-18 16:02:45 +08:00
|
|
|
|
2024-01-05 19:15:21 +08:00
|
|
|
public ChapterInfo(DataChapter config)
|
2023-10-24 14:58:21 +08:00
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
Cfg = config;
|
2023-10-24 14:58:21 +08:00
|
|
|
}
|
|
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 获取关卡组数据根据难度
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="levelDifficulty"></param>
|
|
|
|
|
/// <param name="levelGroupInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool TryGetGroupInfo(E_LevelDifficulty levelDifficulty, out LevelGroupInfo levelGroupInfo)
|
2023-10-24 14:58:21 +08:00
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
return dicLevelGroupInfoList.TryGetValue(levelDifficulty, out levelGroupInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加关卡组信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info"></param>
|
|
|
|
|
public void AddLevelGroupInfo(LevelGroupInfo info)
|
|
|
|
|
{
|
|
|
|
|
if (dicLevelGroupInfoList.ContainsKey(info.Cfg.LevelDifficulty))
|
2023-10-24 14:58:21 +08:00
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
DebugUtil.LogError($"重复添加关卡组,关卡组id:{info.Cfg.Id}");
|
|
|
|
|
return;
|
2023-10-24 14:58:21 +08:00
|
|
|
}
|
2024-09-02 18:51:47 +08:00
|
|
|
|
|
|
|
|
dicLevelGroupInfoList.Add(info.Cfg.LevelDifficulty, info);
|
2023-10-24 14:58:21 +08:00
|
|
|
}
|
2023-11-02 20:02:10 +08:00
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 计算红点树
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parentID"></param>
|
2023-11-02 20:02:10 +08:00
|
|
|
public void ConstructRedPointTree(int parentID)
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
RedPoint = RedPointManager.Instance.AddDynamicNode(NodeType.Normal, parentID);
|
|
|
|
|
foreach (LevelGroupInfo levelGroupInfo in dicLevelGroupInfoList.Values)
|
2023-11-02 20:02:10 +08:00
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
levelGroupInfo.ConstructRedPointTree(RedPoint);
|
2023-11-02 20:02:10 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-01-18 16:02:45 +08:00
|
|
|
|
2024-06-27 18:55:53 +08:00
|
|
|
public void ConstructRedPointTree(RedPointNode parent)
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
2023-10-24 14:58:21 +08:00
|
|
|
}
|