2024-12-16 15:50:22 +08:00
|
|
|
|
using System.Collections.Generic;
|
2024-12-17 14:36:37 +08:00
|
|
|
|
using Gameplay.Net;
|
|
|
|
|
|
using NLDPB;
|
2024-12-16 15:50:22 +08:00
|
|
|
|
|
|
|
|
|
|
public partial class LegionManager
|
|
|
|
|
|
{
|
2024-12-18 14:11:00 +08:00
|
|
|
|
/// <summary>
|
2024-12-19 14:46:02 +08:00
|
|
|
|
/// 缓存的服务器下发军团列表信息数据 LegionInfoData
|
2024-12-18 14:11:00 +08:00
|
|
|
|
/// </summary>
|
2024-12-24 17:31:26 +08:00
|
|
|
|
public List<MSG_LegionData> NetLegionInfoDataList = new();
|
2024-12-19 14:46:02 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 缓存服务器下发军团Base数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Lg_Clt_LegionBase NetLegionBaseData;
|
|
|
|
|
|
|
|
|
|
|
|
public readonly List<MSG_LegionActorData> NetLegionApplyDataList = new List<MSG_LegionActorData>();
|
|
|
|
|
|
|
2024-12-23 12:12:52 +08:00
|
|
|
|
public readonly List<MSG_LegionActorData> NetLegionMemberList = new();
|
2024-12-19 14:46:02 +08:00
|
|
|
|
|
2024-12-16 15:50:22 +08:00
|
|
|
|
/// <summary>
|
2024-12-18 14:11:00 +08:00
|
|
|
|
/// 解析服务器下发LegionData数据
|
2024-12-16 15:50:22 +08:00
|
|
|
|
/// </summary>
|
2024-12-17 14:36:37 +08:00
|
|
|
|
private Legion _ParseLegionData(MSG_LegionData legionData)
|
2024-12-16 15:50:22 +08:00
|
|
|
|
{
|
2024-12-17 14:36:37 +08:00
|
|
|
|
var legion = new Legion(legionData);
|
|
|
|
|
|
return legion;
|
2024-12-16 15:50:22 +08:00
|
|
|
|
}
|
2024-12-19 14:46:02 +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
|
|
|
|
|
|
|
2024-12-23 12:12:52 +08:00
|
|
|
|
/// <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-17 14:36:37 +08:00
|
|
|
|
/// 请求军团详细信息
|
2024-12-16 15:50:22 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void ReqLegionInfo(uint id)
|
|
|
|
|
|
{
|
2024-12-18 14:11:00 +08:00
|
|
|
|
if (id > 0)
|
|
|
|
|
|
{
|
2024-12-19 14:46:02 +08:00
|
|
|
|
//NetHelper.ReqLegionInfo(id);
|
2024-12-18 14:11:00 +08:00
|
|
|
|
}
|
2024-12-16 15:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 请求创建军团
|
|
|
|
|
|
/// </summary>
|
2024-12-18 14:11:00 +08:00
|
|
|
|
public void ReqCreateLegion(Legion legion)
|
2024-12-16 15:50:22 +08:00
|
|
|
|
{
|
2024-12-18 14:11:00 +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-17 14:36:37 +08:00
|
|
|
|
/// 请求存储军团信息,编辑军团信息
|
2024-12-16 15:50:22 +08:00
|
|
|
|
/// </summary>
|
2024-12-23 15:34:46 +08:00
|
|
|
|
public void ReqSaveLegionInfo()
|
2024-12-16 15:50:22 +08:00
|
|
|
|
{
|
2024-12-23 15:34:46 +08:00
|
|
|
|
if (_myLegion == null)
|
2024-12-17 14:36:37 +08:00
|
|
|
|
{
|
2024-12-23 15:34:46 +08:00
|
|
|
|
DebugUtil.LogError("无法存储编辑军团信息,MyLegion为空!!");
|
2024-12-17 14:36:37 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-12-18 14:11:00 +08:00
|
|
|
|
|
2024-12-23 15:34:46 +08:00
|
|
|
|
// if (_myLegion.ID == 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// DebugUtil.LogError($"编辑军团数据有误,ID:{_myLegion.ID}");
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
var legionData = _TranslateLegion(_myLegion);
|
2024-12-18 14:11:00 +08:00
|
|
|
|
NetHelper.ReqSaveEditLegion(legionData);
|
2024-12-16 15:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-17 14:36:37 +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);
|
|
|
|
|
|
}
|
2024-12-18 14:11:00 +08:00
|
|
|
|
|
|
|
|
|
|
/// <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();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-19 14:46:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 请求编辑加入申请
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
/// <param name="status"></param>
|
|
|
|
|
|
public void ReqExamineApply(uint id, LegionExamineStatus status)
|
2024-12-18 14:11:00 +08:00
|
|
|
|
{
|
2024-12-19 14:46:02 +08:00
|
|
|
|
NetHelper.ReqExamineApply(id, (uint)status);
|
2024-12-18 14:11:00 +08:00
|
|
|
|
}
|
2024-12-19 14:46:02 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 团长请求申请加入玩家列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void ReqApplyList()
|
|
|
|
|
|
{
|
2024-12-23 15:34:46 +08:00
|
|
|
|
if (_myLegion != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (IsPresident)
|
|
|
|
|
|
{
|
2024-12-24 19:56:05 +08:00
|
|
|
|
NetHelper.ReqLegionPart((uint)LegionPart.Apply);
|
2024-12-23 15:34:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-19 14:46:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-24 19:56:05 +08:00
|
|
|
|
/// <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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 14:11:00 +08:00
|
|
|
|
/// <summary>
|
2024-12-23 12:12:52 +08:00
|
|
|
|
/// 请求编辑成员职位
|
2024-12-18 14:11:00 +08:00
|
|
|
|
/// </summary>
|
2024-12-23 12:12:52 +08:00
|
|
|
|
/// <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)
|
2024-12-18 14:11:00 +08:00
|
|
|
|
{
|
2024-12-23 12:12:52 +08:00
|
|
|
|
NetHelper.ReqEditMember(id, (uint)post);
|
2024-12-18 14:11:00 +08:00
|
|
|
|
}
|
2024-12-23 12:12:52 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 管理员踢出团员
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="actorID"></param>
|
2024-12-24 19:56:05 +08:00
|
|
|
|
public void DismissMember(uint actorID)
|
2024-12-23 12:12:52 +08:00
|
|
|
|
{
|
2024-12-24 19:56:05 +08:00
|
|
|
|
//var actorID = Actor.Instance.Base.GetProp(ActorProp.ActorId);
|
2024-12-23 12:12:52 +08:00
|
|
|
|
NetHelper.ReqDismissMember(actorID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-16 15:50:22 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|