237 lines
5.2 KiB
C#
237 lines
5.2 KiB
C#
using Gameplay.Net;
|
|
using System.Collections.Generic;
|
|
using Gameplay.Net;
|
|
using NLDPB;
|
|
public partial class LegionManager
|
|
{
|
|
|
|
#region Data
|
|
|
|
private MercenaryActor _myMercenaryActor;
|
|
public MercenaryActor MyMercenaryActor => _myMercenaryActor;
|
|
|
|
/// <summary>
|
|
/// 雇佣兵列表
|
|
/// </summary>
|
|
private List<MercenaryData> _mercenarySignUpList = new();
|
|
public List<MercenaryData> MercenarySignUpList
|
|
{
|
|
get
|
|
{
|
|
return _mercenarySignUpList;
|
|
}
|
|
|
|
set
|
|
{
|
|
_mercenarySignUpList = value;
|
|
}
|
|
}
|
|
|
|
private List<LegionMercenaryHireData> _legionMercenaryHireDatas = new();
|
|
public List<LegionMercenaryHireData> LegionMercenaryHireDatas
|
|
{
|
|
get
|
|
{
|
|
return _legionMercenaryHireDatas;
|
|
}
|
|
|
|
set
|
|
{
|
|
_legionMercenaryHireDatas = value;
|
|
}
|
|
}
|
|
|
|
public MercenaryData MercenarySearchData { get; set; }
|
|
|
|
public void InitMercenaryActor()
|
|
{
|
|
if(_myMercenaryActor == null)
|
|
_myMercenaryActor = new MercenaryActor();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 通信
|
|
|
|
/// <summary>
|
|
/// 申请雇佣兵列表
|
|
/// </summary>
|
|
public void ReqGetMercenaryList(int page, MercenaryDataSortType sortType)
|
|
{
|
|
NetHelper.ReqMercenarySignUpData((uint)page, sortType);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 申请军团招募列表
|
|
/// </summary>
|
|
/// <param name="page"></param>
|
|
public void ReqGetMercenaryHireData(int page, LegionHireSortType sortType)
|
|
{
|
|
NetHelper.ReqMercenaryHireData((uint)page, sortType);
|
|
}
|
|
|
|
public void ReqGetMercenarySearchData(uint uid)
|
|
{
|
|
NetHelper.ReqMercenarySignUpDataSearch(uid);
|
|
}
|
|
/// <summary>
|
|
/// 注册雇佣兵
|
|
/// </summary>
|
|
/// <param name="cost"></param>
|
|
public void ReqMercenarySignUp(int cost)
|
|
{
|
|
NetHelper.ReqMercenarySignUp((uint)cost);
|
|
}
|
|
|
|
public void ReqLegionPostHiring(MercenaryHire hire)
|
|
{
|
|
NetHelper.ReqLegionPostHiring(hire);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 申请加入、招募
|
|
/// </summary>
|
|
/// <param name="legionID"></param>
|
|
public void ReqMercenaryApplyJoin(uint legionID)
|
|
{
|
|
NetHelper.ReqMercenaryApplyJoin(legionID);
|
|
}
|
|
|
|
public void ReqLegionMercenaryHire(uint mercenaryID)
|
|
{
|
|
NetHelper.ReqLegionMercenaryHire(mercenaryID);
|
|
}
|
|
#endregion
|
|
|
|
#region API
|
|
|
|
public bool CheckIsSignUp()
|
|
{
|
|
return _myMercenaryActor?.SignUpStatus == MercenarySignUpStatus.MssNone;
|
|
}
|
|
|
|
public bool CheckIsLegionHired()
|
|
{
|
|
return _myMercenaryActor?.HireLegionID > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否在一个军团中
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool CheckIsInLegion()
|
|
{
|
|
return _myLegion != null || CheckIsLegionHired();
|
|
}
|
|
/// <summary>
|
|
/// 是否散人玩家
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool CheckIsFree()
|
|
{
|
|
return !CheckIsSignUp() && !CheckIsLegionHired();
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#region Class
|
|
|
|
/// <summary>
|
|
/// 自身的雇佣兵相关数据
|
|
/// </summary>
|
|
public class MercenaryActor
|
|
{
|
|
public int SignUpCost;
|
|
public MercenarySignUpStatus SignUpStatus;
|
|
public uint HireLegionID;
|
|
public int HireLegionLevel;
|
|
public int HireLegionHead;
|
|
public string HireLegionName;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 军团雇佣的雇佣兵信息
|
|
/// </summary>
|
|
public class LegionMercenaryData
|
|
{
|
|
public int HireCost;
|
|
public int Total; //总招募数量
|
|
public List<MercenaryMember> MercenaryMemberList;
|
|
public List<MercenaryMember> MercenaryApplyList;
|
|
}
|
|
|
|
public class MercenaryMember
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 客户端发起招募结构
|
|
/// </summary>
|
|
public class MercenaryHire
|
|
{
|
|
public int Count;
|
|
public int LimitLevel;
|
|
public int Cost;
|
|
public bool AutoApprove;
|
|
|
|
public MercenaryHire(int count, int limitLevel, int cost, bool autoApprove)
|
|
{
|
|
Count = count;
|
|
LimitLevel = limitLevel;
|
|
Cost = cost;
|
|
AutoApprove = autoApprove;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 军团发布的雇佣兵招募数据
|
|
/// </summary>
|
|
public class LegionMercenaryHireData
|
|
{
|
|
public uint ID;
|
|
public string Name;
|
|
public int Level;
|
|
public int MinLevel;
|
|
public int Total;
|
|
public int Current;
|
|
public int HireCost;
|
|
|
|
public LegionMercenaryHireData(MSG_LegionMercenaryHireData data)
|
|
{
|
|
ID = data.Id;
|
|
Name = data.Name;
|
|
Level = (int)data.Level;
|
|
MinLevel = (int)data.MinLevel;
|
|
Total = (int)data.Total;
|
|
Current = (int)data.Current;
|
|
HireCost = (int)data.HireCost;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 雇佣兵数据
|
|
/// </summary>
|
|
public class MercenaryData
|
|
{
|
|
public uint ActorID;
|
|
public string Name;
|
|
public int KillNum;
|
|
public int Level;
|
|
public int Cost;
|
|
public MercenarySignUpStatus Status;
|
|
|
|
public MercenaryData(MSG_MercenarySignUpData mercenarySignUpData)
|
|
{
|
|
ActorID = mercenarySignUpData.ActorId;
|
|
Name = mercenarySignUpData.Name;
|
|
KillNum = (int)mercenarySignUpData.KillNum;
|
|
Level = (int)mercenarySignUpData.Level;
|
|
Cost = (int)mercenarySignUpData.Cost;
|
|
Status = (MercenarySignUpStatus)mercenarySignUpData.Status;
|
|
}
|
|
}
|
|
|
|
#endregion
|