80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using RPG.GameCore.Excel;
|
|
using RPG.Network.Proto;
|
|
using RPG.Services.Gameserver.Modules.Attributes;
|
|
using RPG.Services.Gameserver.Session;
|
|
|
|
namespace RPG.Services.Gameserver.Modules;
|
|
internal class TutorialModule : BaseModule
|
|
{
|
|
private readonly ExcelTables _excelTables;
|
|
|
|
public TutorialModule(ExcelTables excelTables)
|
|
{
|
|
_excelTables = excelTables;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdGetTutorialCsReq)]
|
|
public Task OnCmdGetTutorialCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
|
|
{
|
|
GetTutorialScRsp rsp = new();
|
|
rsp.TutorialList.AddRange(_excelTables.GetAllRows(ExcelType.TutorialData)
|
|
.Select(row => new Tutorial
|
|
{
|
|
Id = row.Id,
|
|
Status = TutorialStatus.TutorialFinish
|
|
}));
|
|
|
|
Send(session, CmdType.CmdGetTutorialScRsp, rsp);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdGetTutorialGuideCsReq)]
|
|
public Task OnCmdGetTutorialGuideCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
|
|
{
|
|
Send(session, CmdType.CmdGetTutorialGuideScRsp, new GetTutorialGuideScRsp
|
|
{
|
|
Retcode = 0,
|
|
TutorialGuideList = { }
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdUnlockTutorialGuideCsReq)]
|
|
public Task OnCmdUnlockTutorialGuideCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
|
{
|
|
UnlockTutorialGuideCsReq req = UnlockTutorialGuideCsReq.Parser.ParseFrom(body.Span);
|
|
|
|
Send(session, CmdType.CmdUnlockTutorialGuideScRsp, new UnlockTutorialGuideScRsp
|
|
{
|
|
Retcode = 0,
|
|
TutorialGuide = new TutorialGuide
|
|
{
|
|
Id = req.GroupId,
|
|
Status = TutorialStatus.TutorialUnlock
|
|
}
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdFinishTutorialGuideCsReq)]
|
|
public Task OnCmdFinishTutorialGuideCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
|
{
|
|
FinishTutorialGuideCsReq req = FinishTutorialGuideCsReq.Parser.ParseFrom(body.Span);
|
|
|
|
Send(session, CmdType.CmdFinishTutorialGuideScRsp, new FinishTutorialGuideScRsp
|
|
{
|
|
Retcode = 0,
|
|
Reward = new(),
|
|
TutorialGuide = new TutorialGuide
|
|
{
|
|
Id = req.GroupId,
|
|
Status = TutorialStatus.TutorialFinish
|
|
}
|
|
});
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|