NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Legion/LegionManager.Net.cs

212 lines
5.0 KiB
C#
Raw Normal View History

2024-12-16 15:50:22 +08:00
using System.Collections.Generic;
using Gameplay.Net;
using NLDPB;
2024-12-16 15:50:22 +08:00
public partial class LegionManager
{
/// <summary>
/// 缓存的服务器下发军团列表信息数据 LegionInfoData
/// </summary>
public List<MSG_LegionData> NetLegionInfoDataList = new();
/// <summary>
/// 缓存服务器下发军团Base数据
/// </summary>
public Lg_Clt_LegionBase NetLegionBaseData;
public readonly List<MSG_LegionActorData> NetLegionApplyDataList = new List<MSG_LegionActorData>();
public readonly List<MSG_LegionActorData> NetLegionMemberList = new();
2024-12-16 15:50:22 +08:00
/// <summary>
/// 解析服务器下发LegionData数据
2024-12-16 15:50:22 +08:00
/// </summary>
private Legion _ParseLegionData(MSG_LegionData legionData)
2024-12-16 15:50:22 +08:00
{
var legion = new Legion(legionData);
return legion;
2024-12-16 15:50:22 +08:00
}
private Legion _ParseLegionData(Lg_Clt_LegionBase legionData)
{
var legion = new Legion(legionData);
return legion;
}
2024-12-16 15:50:22 +08:00
#region API
/// <summary>
/// 请求自身军团数据部件
/// </summary>
/// <param name="part"></param>
public void ReqMyLegionPart(LegionPart part)
{
NetHelper.ReqMyLegionData((uint) part);
}
2024-12-16 15:50:22 +08:00
/// <summary>
/// 请求军团详细信息
2024-12-16 15:50:22 +08:00
/// </summary>
public void ReqLegionInfo(uint id)
{
if (id > 0)
{
//NetHelper.ReqLegionInfo(id);
}
2024-12-16 15:50:22 +08:00
}
/// <summary>
/// 请求创建军团
/// </summary>
public void ReqCreateLegion(Legion legion)
2024-12-16 15:50:22 +08:00
{
var legionData = _TranslateLegion(legion);
if (legionData.Id != 0)
{
DebugUtil.LogError($"创建军团数据有误ID:{legionData.Id}");
return;
}
NetHelper.ReqCreateLegion(legionData);
2024-12-16 15:50:22 +08:00
}
/// <summary>
/// 请求存储军团信息,编辑军团信息
2024-12-16 15:50:22 +08:00
/// </summary>
public void ReqSaveLegionInfo()
2024-12-16 15:50:22 +08:00
{
if (_myLegion == null)
{
DebugUtil.LogError("无法存储编辑军团信息MyLegion为空");
return;
}
// if (_myLegion.ID == 0)
// {
// DebugUtil.LogError($"编辑军团数据有误ID:{_myLegion.ID}");
// return;
// }
var legionData = _TranslateLegion(_myLegion);
NetHelper.ReqSaveEditLegion(legionData);
2024-12-16 15:50:22 +08:00
}
/// <summary>
/// 根据页数请求军团列表信息
/// </summary>
/// <param name="page"></param>
public void ReqLegionListByPage(int page)
{
NetHelper.ReqLegionListByPage((uint)page);
}
/// <summary>
/// 根据key搜索军团列表信息
/// </summary>
/// <param name="key"></param>
public void ReqLegionListByKey(string key)
{
NetHelper.ReqLegionListByKey(key);
}
/// <summary>
/// 获取军团战绩
/// </summary>
/// <param name="id"></param>
public void ReqLegionRecord(uint id)
{
}
/// <summary>
/// 请求加入军团
/// </summary>
/// <param name="id"></param>
public void ReqJoinLegion(uint id)
{
if (id > 0)
{
NetHelper.ReqJoinLegion(id);
}
}
/// <summary>
/// 请求退出军团
/// </summary>
/// <param name="id"></param>
public void ReqLeaveLegion()
{
NetHelper.ReqLeaveLegion();
}
/// <summary>
/// 请求编辑加入申请
/// </summary>
/// <param name="id"></param>
/// <param name="status"></param>
public void ReqExamineApply(uint id, LegionExamineStatus status)
{
NetHelper.ReqExamineApply(id, (uint)status);
}
/// <summary>
/// 团长请求申请加入玩家列表
/// </summary>
public void ReqApplyList()
{
if (_myLegion != null)
{
if (IsPresident)
{
NetHelper.ReqLegionPart((uint)LegionPart.Apply);
}
}
}
/// <summary>
/// 请求 LegionBase 数据
/// </summary>
public void ReqLegionBase()
{
NetHelper.ReqLegionPart((uint)LegionPart.Base);
}
/// <summary>
/// 请求 MyLegion成员 数据
/// </summary>
public void ReqLegionMembers()
{
NetHelper.ReqLegionPart((uint)LegionPart.Member);
}
/// <summary>
/// 请求 MyLegion 军团日志 数据
/// </summary>
public void ReqLegionLogs()
{
NetHelper.ReqLegionPart((uint)LegionPart.Log);
}
/// <summary>
/// 请求编辑成员职位
/// </summary>
/// <param name="id"></param>
/// <param name="post"></param>
2024-12-25 19:37:51 +08:00
public void ReqEditMember(uint id, cfg.LegionCfg.Position post)
{
NetHelper.ReqEditMember(id, (uint)post);
}
/// <summary>
/// 管理员踢出团员
/// </summary>
/// <param name="actorID"></param>
public void DismissMember(uint actorID)
{
//var actorID = Actor.Instance.Base.GetProp(ActorProp.ActorId);
NetHelper.ReqDismissMember(actorID);
}
2024-12-16 15:50:22 +08:00
#endregion
}