- The Sms will not be showed when the mission runs
This commit is contained in:
Somebody
2024-07-17 14:21:24 +08:00
parent 72ddae8940
commit a100f5d4c4
5 changed files with 97 additions and 8 deletions

View File

@@ -0,0 +1,30 @@
using EggLink.DanhengServer.Data.Config;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EggLink.DanhengServer.Data.Excel
{
[ResourceEntity("PerformanceD.json")]
public class PerformanceDExcel : ExcelResource
{
public int PerformanceID { get; set; }
public string PerformancePath { get; set; } = "";
[JsonIgnore]
public LevelGraphConfigInfo? ActInfo { get; set; }
public override int GetId()
{
return PerformanceID;
}
public override void Loaded()
{
GameData.PerformanceDData.Add(PerformanceID, this);
}
}
}

View File

@@ -120,6 +120,7 @@ namespace EggLink.DanhengServer.Data
public static Dictionary<int, MessageSectionConfigExcel> MessageSectionConfigData { get; private set; } = [];
public static Dictionary<int, MessageContactsConfigExcel> MessageContactsConfigData { get; private set; } = [];
public static Dictionary<int, MessageItemConfigExcel> MessageItemConfigData { get; private set; } = [];
public static Dictionary<int, PerformanceDExcel> PerformanceDData { get; private set; } = [];
public static Dictionary<int, PerformanceEExcel> PerformanceEData { get; private set; } = [];
public static Dictionary<int, StoryLineExcel> StoryLineData { get; private set; } = [];
public static Dictionary<int, StroyLineTrialAvatarDataExcel> StroyLineTrialAvatarDataData { get; private set; } = [];

View File

@@ -398,10 +398,39 @@ namespace EggLink.DanhengServer.Data
{
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name, I18nManager.Translate("Word.Error")), ex);
}
}
if (count < GameData.PerformanceEData.Count)
foreach (var performance in GameData.PerformanceDData.Values)
{
if (performance.PerformancePath == "")
{
count++;
continue;
}
var path = ConfigManager.Config.Path.ResourcePath + "/" + performance.PerformancePath;
var file = new FileInfo(path);
if (!file.Exists) continue;
try
{
using var reader = file.OpenRead();
using StreamReader reader2 = new(reader);
var text = reader2.ReadToEnd().Replace("$type", "Type");
var obj = JObject.Parse(text);
if (obj != null)
{
LevelGraphConfigInfo info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
performance.ActInfo = info;
count++;
}
}
catch (Exception ex)
{
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name, I18nManager.Translate("Word.Error")), ex);
}
}
if (count < GameData.PerformanceEData.Count + GameData.PerformanceDData.Count)
{
// looks like many dont exist
//Logger.Warn("Performance infos are missing, please check your resources folder: " + ConfigManager.Config.Path.ResourcePath + "/Config/Level/Mission/*/Act. Performances may not work!");

View File

@@ -101,8 +101,14 @@ namespace EggLink.DanhengServer.GameServer.Game.Task
{
if (act is TriggerPerformance triggerPerformance)
{
if (triggerPerformance.PerformanceType != ELevelPerformanceTypeEnum.E) return;
Player.TaskManager?.PerformanceTrigger.TriggerPerformance(triggerPerformance.PerformanceID, subMission);
if (triggerPerformance.PerformanceType == ELevelPerformanceTypeEnum.E)
{
Player.TaskManager?.PerformanceTrigger.TriggerPerformanceE(triggerPerformance.PerformanceID, subMission);
}
else if (triggerPerformance.PerformanceType == ELevelPerformanceTypeEnum.D)
{
Player.TaskManager?.PerformanceTrigger.TriggerPerformanceD(triggerPerformance.PerformanceID, subMission);
}
}
}

View File

@@ -15,16 +15,39 @@ namespace EggLink.DanhengServer.Game.Task
{
public PlayerInstance Player { get; } = player;
public void TriggerPerformance(int performanceId, SubMissionExcel subMission)
public void TriggerPerformanceE(int performanceEId, SubMissionExcel subMission)
{
GameData.PerformanceEData.TryGetValue(performanceId, out var excel);
GameData.PerformanceEData.TryGetValue(performanceEId, out var excel);
if (excel != null)
{
TriggerPerformance(excel, subMission);
TriggerPerformanceE(excel, subMission);
}
}
public void TriggerPerformance(PerformanceEExcel excel, SubMissionExcel subMission)
public void TriggerPerformanceE(PerformanceEExcel excel, SubMissionExcel subMission)
{
if (excel.ActInfo == null) return;
foreach (var act in excel.ActInfo.OnInitSequece)
{
Player.TaskManager?.LevelTask.TriggerInitAct(act, subMission);
}
foreach (var act in excel.ActInfo.OnStartSequece)
{
Player.TaskManager?.LevelTask.TriggerStartAct(act, subMission);
}
}
public void TriggerPerformanceD(int performanceDId, SubMissionExcel subMission)
{
GameData.PerformanceDData.TryGetValue(performanceDId, out var excel);
if (excel != null)
{
TriggerPerformanceD(excel, subMission);
}
}
public void TriggerPerformanceD(PerformanceDExcel excel, SubMissionExcel subMission)
{
if (excel.ActInfo == null) return;
foreach (var act in excel.ActInfo.OnInitSequece)