very primitive gacha display

This commit is contained in:
rfi 2023-12-18 21:20:02 +07:00
parent 7208f97f84
commit 2e8eee0977
4 changed files with 159 additions and 3 deletions

View File

@ -1647,7 +1647,7 @@ namespace AscNet.Common.MsgPack
public NotifyTRPGDataBossInfo BossInfo { get; set; }
public List<dynamic> TargetList { get; set; } = new();
public List<dynamic> RewardList { get; set; } = new();
public List<dynamic> FuncList { get; set; } = new();
public List<int> FuncList { get; set; } = new();
public List<dynamic> Characters { get; set; } = new();
[global::MessagePack.MessagePackObject(true)]
public class NotifyTRPGDataShopInfo

View File

@ -4,6 +4,7 @@ using AscNet.Common.Util;
using AscNet.Table.V2.share.chat;
using AscNet.Table.V2.share.guide;
using AscNet.Table.V2.share.photomode;
using AscNet.Table.V2.share.trpg;
using MessagePack;
using System.Diagnostics;
@ -224,6 +225,15 @@ namespace AscNet.GameServer.Handlers
session.SendPush(notifyChatLoginData);
session.SendPush(notifyItemDataList);
session.SendPush(notifyBackground);
session.SendPush(new NotifyTRPGData()
{
CurTargetLink = 10001,
BaseInfo = new()
{
Level = 1
},
BossInfo = new()
});
#region DisclamerMail
NotifyMails notifyMails = new();

View File

@ -4,11 +4,52 @@ namespace AscNet.GameServer.Handlers
{
#region MsgPackScheme
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
[MessagePackObject(true)]
public class DrawGetDrawInfoListResponse
{
public int Code { get; set; }
public List<DrawInfo> DrawInfoList { get; set; } = new();
}
[MessagePackObject(true)]
public class DrawGetDrawGroupListResponse
{
public int Code { get; set; }
public List<dynamic> DrawGroupInfoList { get; set; } = new();
public List<DrawGroupInfo> DrawGroupInfoList { get; set; } = new();
}
[MessagePackObject(true)]
public class DrawGroupInfo
{
public int Id { get; set; }
public int SwitchDrawIdCount { get; set; }
public int UseDrawId { get; set; }
public int MaxSwitchDrawIdCount { get; set; }
public int Tag { get; set; }
public int Order { get; set; }
public int Priority { get; set; }
public int BottomTimes { get; set; }
public int MaxBottomTimes { get; set; }
public long BannerBeginTime { get; set; }
public long BannerEndTime { get; set; }
public long StartTime { get; set; }
public long EndTime { get; set; }
}
[MessagePackObject(true)]
public class DrawInfo
{
public int Id { get; set; }
public string Banner { get; set; }
public int UseItemId { get; set; }
public int GroupId { get; set; }
public List<int> BtnDrawCount { get; set; } = new();
public List<int> PurchaseId { get; set; } = new();
public int UseItemCount { get; set; }
public int BottomTimes { get; set; }
public int MaxBottomTimes { get; set; }
public long StartTime { get; set; }
public long EndTime { get; set; }
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
#endregion
@ -18,7 +59,37 @@ namespace AscNet.GameServer.Handlers
[RequestPacketHandler("DrawGetDrawGroupListRequest")]
public static void DrawGetDrawGroupListRequestHandler(Session session, Packet.Request packet)
{
session.SendResponse(new DrawGetDrawGroupListResponse(), packet.Id);
var rsp = new DrawGetDrawGroupListResponse();
rsp.DrawGroupInfoList.Add(new()
{
Id = 1,
SwitchDrawIdCount = 1,
UseDrawId = 1,
Order = 1,
Tag = 1,
EndTime = DateTimeOffset.Now.ToUnixTimeSeconds() * 2,
BannerEndTime = DateTimeOffset.Now.ToUnixTimeSeconds() * 2
});
session.SendResponse(rsp, packet.Id);
}
[RequestPacketHandler("DrawGetDrawInfoListRequest")]
public static void DrawGetDrawInfoListRequestHandler(Session session, Packet.Request packet)
{
DrawGetDrawInfoListResponse rsp = new();
rsp.DrawInfoList.Add(new()
{
Id = 101,
UseItemId = 1,
UseItemCount = 10,
GroupId = 1,
BtnDrawCount = { 1, 10 },
Banner = "Assets/Product/Ui/Scene3DPrefab/UiMain3dWuqi.prefab",
EndTime = DateTimeOffset.Now.ToUnixTimeSeconds() * 2
});
session.SendResponse(rsp, packet.Id);
}
}
}

View File

@ -0,0 +1,75 @@
using AscNet.Common.MsgPack;
using AscNet.Common.Util;
using AscNet.Table.V2.share.reward;
using AscNet.Table.V2.share.trpg;
using MessagePack;
namespace AscNet.GameServer.Handlers
{
#region MsgPackScheme
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
[MessagePackObject(true)]
public class TRPGFunctionFinishRequest
{
public int FunctionId { get; set; }
}
[MessagePackObject(true)]
public class TRPGFunctionFinishResponse
{
public int Code { get; set; }
public List<RewardGoods> RewardList { get; set; } = new();
}
[MessagePackObject(true)]
public class TRPGChangePageStatusRequest
{
public bool Status { get; set; }
}
[MessagePackObject(true)]
public class TRPGChangePageStatusResponse
{
public int Code { get; set; }
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
#endregion
internal class TRPGModule
{
[RequestPacketHandler("TRPGFunctionFinishRequest")]
public static void TRPGFunctionFinishRequestHandler(Session session, Packet.Request packet)
{
TRPGFunctionFinishRequest request = MessagePackSerializer.Deserialize<TRPGFunctionFinishRequest>(packet.Content);
TRPGFunctionTable? trpgFunction = TableReaderV2.Parse<TRPGFunctionTable>().Find(x => x.Id == request.FunctionId);
var response = new TRPGFunctionFinishResponse();
// TODO: Implement rewards
/*if (trpgFunction?.RewardId is not null)
{
var rewardGoods = TableReaderV2.Parse<RewardGoodsTable>().Where(x => TableReaderV2.Parse<RewardTable>().Find(x => x.Id == trpgFunction.RewardId)?.SubIds.Contains(x.Id) ?? false);
foreach (var goods in rewardGoods)
{
response.RewardList.Add(new()
{
Id = goods.Id,
TemplateId = goods.TemplateId,
Count = goods.Count
});
}
}*/
session.SendResponse(response, packet.Id);
}
[RequestPacketHandler("TRPGChangePageStatusRequest")]
public static void TRPGChangePageStatusRequestHandler(Session session, Packet.Request packet)
{
TRPGChangePageStatusRequest request = MessagePackSerializer.Deserialize<TRPGChangePageStatusRequest>(packet.Content);
session.SendResponse(new TRPGChangePageStatusResponse(), packet.Id);
}
}
}