2024-09-02 14:08:35 +08:00
|
|
|
|
using Gameplay;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using Gameplay.Level;
|
|
|
|
|
|
using Gameplay.Net;
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-01-30 15:10:12 +08:00
|
|
|
|
using System.Linq;
|
2023-11-02 20:02:10 +08:00
|
|
|
|
using cfg.RedPoint;
|
2024-01-10 13:40:07 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
2023-11-01 13:33:20 +08:00
|
|
|
|
using Framework;
|
|
|
|
|
|
using Framework.Condition;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using Debug = DebugUtil;
|
2024-01-29 16:30:26 +08:00
|
|
|
|
using System;
|
2024-08-28 12:17:53 +08:00
|
|
|
|
using cfg.LevelCfg;
|
2024-09-02 14:55:43 +08:00
|
|
|
|
using static MapData;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-09-02 14:08:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡信息
|
|
|
|
|
|
/// </summary>
|
2024-06-27 18:55:53 +08:00
|
|
|
|
public class LevelInfo : IRedPointTreeNode
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-09-02 14:08:35 +08:00
|
|
|
|
#region 私有字段
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private LevelData levelData;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 地图数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private MapData mapData;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 服务器关卡数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private Gameplay.Net.LevelInfo serverData;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 解锁条件id
|
|
|
|
|
|
/// </summary>
|
2024-08-13 16:04:49 +08:00
|
|
|
|
private int unLockConditionId;
|
2024-09-02 14:08:35 +08:00
|
|
|
|
#endregion
|
2024-08-13 16:04:49 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
#region config
|
2024-09-02 14:08:35 +08:00
|
|
|
|
/// <summary>
|
2024-09-02 14:55:43 +08:00
|
|
|
|
/// 配置数据
|
2024-09-02 14:08:35 +08:00
|
|
|
|
/// </summary>
|
2024-09-02 18:51:47 +08:00
|
|
|
|
public DataLevel Cfg { get; private set; }
|
2023-11-20 14:10:18 +08:00
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡名
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string Name
|
2024-09-29 18:29:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.LevelName, Cfg.Id); }
|
2024-09-02 15:32:25 +08:00
|
|
|
|
}
|
2023-11-22 15:05:43 +08:00
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡描述
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string Desc
|
|
|
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.LevelDesc, Cfg.Id); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡序号
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string Number
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return CommonUtils.GetLocalizeText(E_LocalizePrefix.LevelNumber, Cfg.Id); }
|
2024-09-02 15:32:25 +08:00
|
|
|
|
}
|
2024-01-04 17:22:36 +08:00
|
|
|
|
|
2024-09-02 19:42:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 章节序号
|
|
|
|
|
|
/// </summary>
|
2024-09-29 18:29:46 +08:00
|
|
|
|
public string ChapterNumber
|
2024-02-06 13:29:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
|
if (null == ChapterInfo)
|
|
|
|
|
|
return string.Empty;
|
2024-02-06 13:29:01 +08:00
|
|
|
|
|
2024-09-29 18:29:46 +08:00
|
|
|
|
return ChapterInfo.Number;
|
2024-02-06 13:29:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-13 14:18:34 +08:00
|
|
|
|
|
2024-09-02 19:42:47 +08:00
|
|
|
|
/// <summary>
|
2024-09-29 18:29:46 +08:00
|
|
|
|
/// 完整序号
|
2024-09-02 19:42:47 +08:00
|
|
|
|
/// </summary>
|
2024-09-29 18:29:46 +08:00
|
|
|
|
public string FullNumebr
|
2024-02-06 13:29:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
|
string chapterNumber = ChapterNumber;
|
|
|
|
|
|
string levelNumber = Number;
|
|
|
|
|
|
if (string.Empty == chapterNumber)
|
2024-02-06 13:29:01 +08:00
|
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
|
if (string.Empty == levelNumber)
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
return $"0-{levelNumber}";
|
2024-02-06 13:29:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-29 18:29:46 +08:00
|
|
|
|
if (string.Empty == levelNumber)
|
|
|
|
|
|
return $"{chapterNumber}-0";
|
2024-09-06 12:22:29 +08:00
|
|
|
|
|
2024-09-29 18:29:46 +08:00
|
|
|
|
return $"{chapterNumber}-{levelNumber}";
|
|
|
|
|
|
}
|
2024-09-06 12:22:29 +08:00
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Data
|
2024-09-02 18:51:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 所属关卡组信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public LevelGroupInfo GroupInfo
|
|
|
|
|
|
{
|
2024-09-05 13:52:02 +08:00
|
|
|
|
get
|
|
|
|
|
|
{
|
2024-09-29 18:29:46 +08:00
|
|
|
|
if (0 == Cfg.LevelGroupID)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
LevelManager.Instance.TryGetLevelGroupInfoByID(Cfg.LevelGroupID, out LevelGroupInfo levelGroupInfo);
|
2024-09-05 13:52:02 +08:00
|
|
|
|
|
2024-09-29 18:29:46 +08:00
|
|
|
|
return levelGroupInfo;
|
2024-09-05 13:52:02 +08:00
|
|
|
|
}
|
2024-09-02 18:51:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 所属章节信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ChapterInfo ChapterInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return GroupInfo?.ChapterInfo; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 环境类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public EnvironmentType Environment
|
2024-04-18 18:14:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2024-09-02 15:32:25 +08:00
|
|
|
|
if (null == MapData)
|
|
|
|
|
|
return EnvironmentType.Desert;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-09-23 19:45:13 +08:00
|
|
|
|
return MapData.environmentType;
|
2024-04-18 18:14:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否锁住
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsLock { get; private set; } = true;
|
2024-04-18 18:14:18 +08:00
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 能否进入
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool CanEnter
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return !IsLock && IsConstEnough(); }
|
2024-04-18 18:14:18 +08:00
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 地图数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public MapData MapData
|
2024-04-13 14:18:34 +08:00
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
get { return mapData ??= MapUtils.LoadMapData(Cfg.MapData); }
|
2024-04-13 14:18:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public LevelData LevelData
|
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
get { return levelData ??= LevelUtils.LoadLevelData(Cfg.Id); }
|
2024-09-02 15:32:25 +08:00
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-09-02 15:32:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否剧情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsStory
|
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
get { return !string.IsNullOrWhiteSpace(Cfg.StoryID); }
|
2024-09-02 15:32:25 +08:00
|
|
|
|
}
|
2024-01-04 17:22:36 +08:00
|
|
|
|
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 环境buff描述
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string EnvironmentBuffString
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return CommonUtils.GetLocalizeText(TableManager.Instance.Tables.EnviormentConfig.Get((int)Environment).DescLocal);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-09-05 13:41:39 +08:00
|
|
|
|
#region 服务器数据
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// <summary>
|
2024-09-05 14:17:27 +08:00
|
|
|
|
/// 完成的星级或分数
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// </summary>
|
2024-09-05 14:17:27 +08:00
|
|
|
|
public int Score
|
2024-09-02 16:01:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (null == serverData)
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
2024-09-05 14:17:27 +08:00
|
|
|
|
return ChapterInfo.Cfg.Type switch
|
|
|
|
|
|
{
|
|
|
|
|
|
E_ChapterType.War => serverData.Score,
|
|
|
|
|
|
_ => serverData.StarCount,
|
|
|
|
|
|
};
|
2024-09-02 16:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-24 14:58:21 +08:00
|
|
|
|
|
2024-09-05 15:48:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 最大星级或者分数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int ScoreMax
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (ChapterInfo.Cfg.Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case E_ChapterType.War:
|
|
|
|
|
|
{
|
|
|
|
|
|
int total = 0;
|
|
|
|
|
|
|
2024-09-23 19:45:13 +08:00
|
|
|
|
if (null == LevelData)
|
2024-09-05 15:48:15 +08:00
|
|
|
|
return total;
|
|
|
|
|
|
|
2024-09-23 19:45:13 +08:00
|
|
|
|
foreach (ConditionModifier conditionModifier in LevelData.scoreTarget)
|
2024-09-05 15:48:15 +08:00
|
|
|
|
{
|
|
|
|
|
|
total += conditionModifier.score;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return total;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
return (int)NLDPB.GlobalDefine.MaxLevelStar;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 15:40:50 +08:00
|
|
|
|
public int GetScoreTarget(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (index >= LevelData.scoreTarget.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"获取战役评价索引超出限制,index:{index}");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
var condition = LevelData.scoreTarget[index];
|
|
|
|
|
|
return condition.score;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-05 15:48:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关卡评级
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public E_WarRating WarRating
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return LevelUtils.GetWarLevelRatingByLevelInfo(this); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 星级达成结果
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool[] StarResult
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (null == serverData)
|
2024-09-05 14:17:27 +08:00
|
|
|
|
return new bool[(int)NLDPB.GlobalDefine.MaxLevelStar];
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2024-09-23 19:33:59 +08:00
|
|
|
|
return serverData.star.Select(s => s > 0).ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool[] ScoreResult
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
bool[] results = new bool[15];
|
|
|
|
|
|
if (null == serverData)
|
|
|
|
|
|
return results;
|
|
|
|
|
|
|
|
|
|
|
|
uint value = serverData.star[1];
|
|
|
|
|
|
for (int i = 0; i < results.Length; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
results[i] = ((value >> i) & 1u) == 1u;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return results;
|
2024-09-02 16:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-02-06 13:29:01 +08:00
|
|
|
|
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否通关
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsPass
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (null == serverData)
|
|
|
|
|
|
return false;
|
2023-10-24 14:58:21 +08:00
|
|
|
|
|
2024-09-02 16:01:34 +08:00
|
|
|
|
return serverData.isPassed;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-02 20:02:10 +08:00
|
|
|
|
|
2024-09-02 16:01:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 红点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public RedPointNode RedPoint { get; private set; }
|
2023-10-19 15:00:19 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-09-02 14:08:35 +08:00
|
|
|
|
public LevelInfo(DataLevel config)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
Cfg = config;
|
2024-09-02 15:32:25 +08:00
|
|
|
|
IsLock = true;
|
2024-08-13 16:04:49 +08:00
|
|
|
|
RefreshServerData(true);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-05 14:17:27 +08:00
|
|
|
|
#region API
|
2024-09-13 14:22:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取解锁条件文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public string GetUnlockLocalizationText()
|
|
|
|
|
|
{
|
2024-10-24 13:50:00 +08:00
|
|
|
|
string res = string.Empty;
|
|
|
|
|
|
foreach (int id in Cfg.Unlock)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (null != res && string.Empty != res)
|
|
|
|
|
|
res += ",";
|
|
|
|
|
|
|
|
|
|
|
|
res += ConditionManager.Instance.GetConditionLocalization(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
2024-09-13 14:22:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-05 14:17:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获得星级目标的文本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="targetIndex"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public string GetStarTargetLocalizationText(int targetIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ConditionModifier> starTarget = LevelData.starTarget;
|
|
|
|
|
|
if (targetIndex < 0 || targetIndex >= starTarget.Count)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
return starTarget[targetIndex].GetConditionLocalization();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 刷新服务器数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="isReset"></param>
|
|
|
|
|
|
public void RefreshServerData(bool isReset)
|
|
|
|
|
|
{
|
|
|
|
|
|
serverData = Actor.Instance.Level.GetLevelInfo((uint)Cfg.Id);
|
|
|
|
|
|
if (isReset)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsLock = true;
|
|
|
|
|
|
AddLockConditionReaction();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 私有方法
|
2024-09-02 18:51:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 体力是否足够
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private bool IsConstEnough()
|
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
if (null == Cfg.CostItems || Cfg.CostItems.Count <= 0)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
bool result = true;
|
2024-09-02 18:51:47 +08:00
|
|
|
|
foreach (cfg.item.ItemCounts costItem in Cfg.CostItems)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
int currCount = (int)Actor.Instance.Item.GetItemCount(costItem.Id);
|
|
|
|
|
|
result &= currCount >= costItem.Count;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
if (!result)
|
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
Debug.LogError($"关卡消耗品不足,level id:{Cfg.Id}");
|
2023-10-19 15:00:19 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-24 14:58:21 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 构造红点树
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parent"></param>
|
2023-11-02 20:02:10 +08:00
|
|
|
|
public void ConstructRedPointTree(RedPointNode parent)
|
|
|
|
|
|
{
|
2024-09-02 18:51:47 +08:00
|
|
|
|
RedPoint = RedPointManager.Instance.AddDynamicNode(NodeType.Level, parent, Cfg.Id);
|
2023-11-02 20:02:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加注册解锁条件
|
|
|
|
|
|
/// </summary>
|
2023-11-01 13:33:20 +08:00
|
|
|
|
private void AddLockConditionReaction()
|
|
|
|
|
|
{
|
2024-08-13 16:04:49 +08:00
|
|
|
|
ConditionReactor.Instance.RemoveReaction(unLockConditionId);
|
2024-09-02 18:51:47 +08:00
|
|
|
|
unLockConditionId = ConditionReactor.Instance.AddReaction(Cfg.Unlock, OnUnlockConditionChanged);
|
2023-11-01 13:33:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-02 18:51:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 解锁回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="result"></param>
|
|
|
|
|
|
/// <param name="callBackParam"></param>
|
|
|
|
|
|
/// <param name="reactionID"></param>
|
2023-11-01 13:33:20 +08:00
|
|
|
|
private void OnUnlockConditionChanged(bool result, object callBackParam, int reactionID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (result)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsLock = false;
|
2024-09-05 13:41:39 +08:00
|
|
|
|
DebugUtil.Log($"关卡未解锁,id:{Cfg.Id}");
|
2024-09-02 18:51:47 +08:00
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.LevelUnlock, Cfg.Id);
|
2023-11-01 13:33:20 +08:00
|
|
|
|
ConditionReactor.Instance.RemoveReaction(reactionID);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-27 18:55:53 +08:00
|
|
|
|
|
|
|
|
|
|
public void ConstructRedPointTree(int parentID)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
2024-09-05 14:17:27 +08:00
|
|
|
|
#endregion
|
2024-09-05 15:48:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 战役评级
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public enum E_WarRating
|
|
|
|
|
|
{
|
|
|
|
|
|
C = 0,
|
|
|
|
|
|
B = 1,
|
|
|
|
|
|
A = 2,
|
|
|
|
|
|
S = 3
|
2024-09-25 15:40:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class WarRating
|
|
|
|
|
|
{
|
|
|
|
|
|
public static Dictionary<E_WarRating, string> WarRatingPath = new Dictionary<E_WarRating, string>()
|
|
|
|
|
|
{
|
|
|
|
|
|
[E_WarRating.C] = "Assets/Art/UI/Texture/LevelSelectNew/War/UI_C.png",
|
|
|
|
|
|
[E_WarRating.B] = "Assets/Art/UI/Texture/LevelSelectNew/War/UI_B.png",
|
|
|
|
|
|
[E_WarRating.A] = "Assets/Art/UI/Texture/LevelSelectNew/War/UI_A.png",
|
|
|
|
|
|
[E_WarRating.S] = "Assets/Art/UI/Texture/LevelSelectNew/War/UI_S.png",
|
|
|
|
|
|
};
|
2023-10-24 14:58:21 +08:00
|
|
|
|
}
|