2023-08-22 19:08:45 +08:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//
|
|
|
|
|
|
// 文件:Assets/Code/Scripts/Gameplay/Net/Client/NetHelper.cs
|
|
|
|
|
|
// 作者:Xoen Xie
|
|
|
|
|
|
// 时间:2023/07/19
|
|
|
|
|
|
// 描述:网络相关接口
|
|
|
|
|
|
// 说明:
|
|
|
|
|
|
//
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
using NLDPB;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gameplay.Net
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class NetHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
// 发送服务器消息,请求角色养成
|
|
|
|
|
|
public static void CharacterUpgrade(uint nCharacterID, UpgradeType type, uint nTargetLevel)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_CharacterUpgrade msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGCharacterUpgrade) as MSG_Clt_G_CharacterUpgrade;
|
|
|
|
|
|
msg.mPB.CharacterId = nCharacterID;
|
|
|
|
|
|
msg.mPB.UpgradeType = (uint)type;
|
|
|
|
|
|
msg.mPB.TargetLevel = nTargetLevel;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 进入关卡
|
|
|
|
|
|
public static void EnterLevel(uint nLevelID, uint nTeamIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_EnterLevel msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGEnterLevel) as MSG_Clt_G_EnterLevel;
|
|
|
|
|
|
msg.mPB.LevelId = nLevelID;
|
|
|
|
|
|
msg.mPB.TeamIndex = nTeamIndex;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 退出关卡,关卡结算
|
|
|
|
|
|
public static void ExitLevel(bool isSuccess, uint nStar)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_ExitLevel msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGExitLevel) as MSG_Clt_G_ExitLevel;
|
|
|
|
|
|
msg.mPB.IsSuccess = isSuccess;
|
|
|
|
|
|
msg.mPB.Star = nStar;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 领取章节宝箱
|
|
|
|
|
|
public static void ChapterReward(uint nChapterID, uint nIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_ChapterReward msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGChapterReward) as MSG_Clt_G_ChapterReward;
|
|
|
|
|
|
msg.mPB.Chapter = nChapterID;
|
|
|
|
|
|
msg.mPB.Index = nIndex;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 载具升级
|
2023-11-15 15:23:27 +08:00
|
|
|
|
public static void VehicleUpgrade(uint nVehicleID, uint[] upgrade_type, uint[] upgrade_count)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_VehicleUpgrade msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGVehicleUpgrade) as MSG_Clt_G_VehicleUpgrade;
|
|
|
|
|
|
msg.mPB.VehicleId = nVehicleID;
|
2023-11-15 15:23:27 +08:00
|
|
|
|
msg.mPB.UpgradeType.Clear();
|
|
|
|
|
|
msg.mPB.UpgradeType.AddRange(upgrade_type);
|
|
|
|
|
|
msg.mPB.UpgradeCount.Clear();
|
|
|
|
|
|
msg.mPB.UpgradeCount.AddRange(upgrade_count);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建队伍
|
|
|
|
|
|
public static void CreateTeam(uint nIndex, string name, uint nIcon, uint[] characterIDs, uint nVehicleID)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_CreateTeam msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGCreateTeam) as MSG_Clt_G_CreateTeam;
|
|
|
|
|
|
msg.mPB.Name = name;
|
|
|
|
|
|
msg.mPB.Icon = nIcon;
|
|
|
|
|
|
msg.mPB.Index = nIndex;
|
|
|
|
|
|
|
|
|
|
|
|
msg.mPB.CharacterId.Clear();
|
|
|
|
|
|
for(int i = 0; i < characterIDs.Length; i++)
|
|
|
|
|
|
msg.mPB.CharacterId.Add(characterIDs[i]);
|
|
|
|
|
|
|
|
|
|
|
|
msg.mPB.VehicleId = nVehicleID;
|
|
|
|
|
|
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//普通单抽
|
2023-12-27 16:28:40 +08:00
|
|
|
|
public static void Raffle(uint id,uint raffleType,bool isFree,uint useTicketCounr)
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_Raffle msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGRaffle) as MSG_Clt_G_Raffle;
|
|
|
|
|
|
msg.mPB.Id = id;
|
2023-12-27 16:28:40 +08:00
|
|
|
|
msg.mPB.Type = raffleType;
|
|
|
|
|
|
msg.mPB.IsFree = isFree;
|
|
|
|
|
|
msg.mPB.TicketCount = useTicketCounr;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 机器人初始化
|
|
|
|
|
|
public static void RobotTestInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_TestInit msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGTestInit) as MSG_Clt_G_TestInit;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void GiftCode(string code)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_GiftCode msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGGiftCode) as MSG_Clt_G_GiftCode;
|
|
|
|
|
|
msg.mPB.Code = code;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
2023-11-14 15:54:36 +08:00
|
|
|
|
|
|
|
|
|
|
public static void Relogin()
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_Relogin msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGRelogin) as MSG_Clt_G_Relogin;
|
|
|
|
|
|
msg.mPB.ActorId = Actor.Instance.Base.GetProp(ActorProp.ActorId);
|
|
|
|
|
|
msg.mPB.LoginKey = Actor.Instance.Login.LoginKey;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg, Actor.Instance.Login.ServerID);
|
|
|
|
|
|
}
|
2023-12-06 15:00:26 +08:00
|
|
|
|
|
|
|
|
|
|
// 请求邮件列表
|
|
|
|
|
|
public static void RequestMailList(bool NeedAll)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_Ml_MailRequest msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltMlMailRequest) as MSG_Clt_Ml_MailRequest;
|
|
|
|
|
|
msg.mPB.NeedAll = NeedAll;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 打开一封邮件
|
|
|
|
|
|
public static void OpenMail(ulong id)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_Ml_OpenMail msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltMlOpenMail) as MSG_Clt_Ml_OpenMail;
|
|
|
|
|
|
msg.mPB.Id = id;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 领取邮件附件,如果id为0,则领取所有
|
|
|
|
|
|
public static void CliamMail(ulong id)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_Ml_ClaimMailItems msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltMlClaimMailItems) as MSG_Clt_Ml_ClaimMailItems;
|
|
|
|
|
|
msg.mPB.MailId = id;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void DeleteMail(ulong id)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_Ml_DeleteMail msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltMlDeleteMail) as MSG_Clt_Ml_DeleteMail;
|
|
|
|
|
|
msg.mPB.MailId = id;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
2023-12-19 12:32:03 +08:00
|
|
|
|
|
|
|
|
|
|
// 升级指挥官技能
|
|
|
|
|
|
public static void PlayerSkillUpgrade(uint nSkillID)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_PlayerSkillUpgrade msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGPlayerSkillUpgrade) as MSG_Clt_G_PlayerSkillUpgrade;
|
|
|
|
|
|
msg.mPB.SkillId = nSkillID;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
2023-12-21 15:59:18 +08:00
|
|
|
|
//领取任务奖励
|
2023-12-21 14:19:44 +08:00
|
|
|
|
public static void ClaimTaskReward(uint taskId)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_TaskClaim msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGTaskClaim) as MSG_Clt_G_TaskClaim;
|
|
|
|
|
|
msg.mPB.TaskId = taskId;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
2023-12-21 15:59:18 +08:00
|
|
|
|
|
|
|
|
|
|
public static void GetShopData(uint nShopId)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_GetShopContent msg = NetManager.Instance.GetMessage(NLDMID.MSGID.CltGGetShopContent) as MSG_Clt_G_GetShopContent;
|
|
|
|
|
|
msg.mPB.ShopId = nShopId;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void ShopBuySth(uint nShopId,int index,int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
MSG_Clt_G_ShopPurchase msg=NetManager.Instance.GetMessage(NLDMID.MSGID.CltGShopPurchase) as MSG_Clt_G_ShopPurchase;
|
|
|
|
|
|
msg.mPB.ShopId = nShopId;
|
|
|
|
|
|
msg.mPB.Index = (uint)index;
|
|
|
|
|
|
msg.mPB.Count = (uint)count;
|
|
|
|
|
|
NetManager.Instance.mClient.SendMessage(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|