215 lines
5.1 KiB
C#
215 lines
5.1 KiB
C#
using System.Collections.Generic;
|
||
using cfg.LegionCfg;
|
||
using Gameplay.Net;
|
||
using NLDPB;
|
||
|
||
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();
|
||
|
||
public readonly List<MSG_Lg_Clt_ApplyData> NetMyApplyLegionList = new();
|
||
|
||
/// <summary>
|
||
/// 解析服务器下发LegionData数据
|
||
/// </summary>
|
||
private Legion _ParseLegionData(MSG_LegionData legionData)
|
||
{
|
||
var legion = new Legion(legionData);
|
||
return legion;
|
||
}
|
||
|
||
private Legion _GetParseLegionData(Lg_Clt_LegionBase legionData)
|
||
{
|
||
var legion = new Legion(legionData);
|
||
return legion;
|
||
}
|
||
|
||
#region API
|
||
|
||
/// <summary>
|
||
/// 请求自身军团数据部件
|
||
/// </summary>
|
||
/// <param name="part"></param>
|
||
public void ReqMyLegionPart(LegionPart part)
|
||
{
|
||
NetHelper.ReqMyLegionData((uint) part);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 请求军团详细信息
|
||
/// </summary>
|
||
public void ReqLegionInfo(uint id)
|
||
{
|
||
if (id > 0)
|
||
{
|
||
//NetHelper.ReqLegionInfo(id);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 请求创建军团
|
||
/// </summary>
|
||
public void ReqCreateLegion(Legion legion)
|
||
{
|
||
var legionData = _TranslateLegion(legion);
|
||
if (legionData.Id != 0)
|
||
{
|
||
DebugUtil.LogError($"创建军团数据有误,ID:{legionData.Id}");
|
||
return;
|
||
}
|
||
NetHelper.ReqCreateLegion(legionData);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 请求存储军团信息,编辑军团信息
|
||
/// </summary>
|
||
public void ReqSaveLegionInfo(Legion legion)
|
||
{
|
||
if (legion == null)
|
||
{
|
||
DebugUtil.LogError("无法存储编辑军团信息,MyLegion为空!!");
|
||
return;
|
||
}
|
||
|
||
// if (_myLegion.ID == 0)
|
||
// {
|
||
// DebugUtil.LogError($"编辑军团数据有误,ID:{_myLegion.ID}");
|
||
// return;
|
||
// }
|
||
|
||
var legionData = _TranslateLegion(legion);
|
||
NetHelper.ReqSaveEditLegion(legionData);
|
||
}
|
||
|
||
/// <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 (CheckIsPermission(Permission.ExamineApply))
|
||
{
|
||
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>
|
||
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);
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
} |