Merge remote-tracking branch 'origin/implement_task_UI' into feature/task-npc-give-award
# Conflicts: # Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs
This commit is contained in:
@@ -1594,6 +1594,13 @@ public abstract partial class CECPlayer : CECObject
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region Team
|
||||
|
||||
// Get team to which this player belongs to
|
||||
// public CECTeam GetTeam() { return m_pTeam; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public struct PlayActionEvent
|
||||
|
||||
@@ -668,5 +668,38 @@ namespace CSNetwork.C2SCommand
|
||||
};
|
||||
return SerializeCommand( CommandID.TASK_NOTIFY, cmd, false);
|
||||
}
|
||||
|
||||
public static Octets CreateAutoTeamSetGoalCommand(int type, int goal_id, int op)
|
||||
{
|
||||
// int iSize = sizeof(cmd_header) + sizeof(cmd_auto_team_set_goal);
|
||||
// uint itemSize = (uint)Marshal.SizeOf<cmd_auto_team_set_goal>();
|
||||
// uint totalLen = contentSize + (uint)itemNum * itemSize;
|
||||
// BYTE* pBuf = (BYTE*)a_malloctemp(iSize);
|
||||
// if(!pBuf) return;
|
||||
//
|
||||
// ((cmd_header*)pBuf)->cmd = C2S::AUTO_TEAM_SET_GOAL;
|
||||
//
|
||||
// cmd_auto_team_set_goal pCmd = (cmd_auto_team_set_goal*)(pBuf + sizeof(cmd_header));
|
||||
cmd_auto_team_set_goal pCmd = new cmd_auto_team_set_goal()
|
||||
{
|
||||
goal_type = type,
|
||||
goal_id = goal_id,
|
||||
op = op
|
||||
};
|
||||
|
||||
//
|
||||
// g_pGame->GetGameSession()->SendGameData(pBuf, iSize);
|
||||
//
|
||||
// a_freetemp(pBuf);
|
||||
// var cmd = new CMD_GetAllData
|
||||
// {
|
||||
// byPack = Convert.ToByte(byPack),
|
||||
// byEquip = Convert.ToByte(byEquip),
|
||||
// byTask = Convert.ToByte(byTask)
|
||||
// };
|
||||
|
||||
// Serialize the command and return the serialized data
|
||||
return SerializeCommand(CommandID.AUTO_TEAM_SET_GOAL, pCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1819,15 +1819,23 @@ namespace CSNetwork.GPDataType
|
||||
public ROLEEXTPROP prop;
|
||||
};
|
||||
|
||||
[ StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_auto_team_set_goal
|
||||
{
|
||||
public int goal_type; // 0 unknown, 1 task, 2 Activity
|
||||
public int op;
|
||||
public int goal_id;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct cmd_task_deliver_item
|
||||
{
|
||||
public int type;
|
||||
public int expire_date;
|
||||
public uint amount;
|
||||
public uint slot_amount;
|
||||
public byte where; //���ĸ���������0 ����2 ����1 װ��
|
||||
public byte index; //��ַ����ĸ�λ��
|
||||
};
|
||||
public int type;
|
||||
public int expire_date;
|
||||
public uint amount;
|
||||
public uint slot_amount;
|
||||
public byte where; //���ĸ���������0 ����2 ����1 װ��
|
||||
public byte index; //��ַ����ĸ�λ��
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -360,6 +360,13 @@ namespace CSNetwork
|
||||
OnPrtcPlayerBaseInfoRe(protocol);
|
||||
break;
|
||||
case ProtocolType.PROTOCOL_GETUICONFIG_RE: OnPrtcGetConfigRe(protocol); break;
|
||||
case ProtocolType.PROTOCOL_AUTOTEAMSETGOAL_RE:
|
||||
{
|
||||
// CECAutoTeam pAutoTeam = CECGameRun.Instance.GetHostPlayer().GetAutoTeam();
|
||||
// if( pAutoTeam !=null)
|
||||
// pAutoTeam.OnPrtcAutoTeamSetGoalRe((AutoTeamSetGoal_Re)protocol);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_logger.Log(LogType.Warning, $"Received unhandled protocol type: {protocol.GetPType()}");
|
||||
break;
|
||||
@@ -1294,5 +1301,12 @@ namespace CSNetwork
|
||||
gamedatasend.Data = C2SCommandFactory.CreateNakeCmd(C2SCommand.CommandID.STAND_UP);
|
||||
SendProtocol(gamedatasend);
|
||||
}
|
||||
|
||||
public void c2s_SendCmdAutoTeamSetGoal(int type, int goal_id, int op)
|
||||
{
|
||||
gamedatasend gamedatasend = new gamedatasend();
|
||||
gamedatasend.Data = C2SCommandFactory.CreateAutoTeamSetGoalCommand(type,goal_id, op);
|
||||
SendProtocol(gamedatasend);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
namespace CSNetwork.Protocols
|
||||
{
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class AutoTeamSetGoal_Re : Protocol
|
||||
{
|
||||
public int roleid { get; set; }
|
||||
public int goal_type { get; set; }
|
||||
public int op { get; set; }
|
||||
public int goal_id { get; set; }
|
||||
public int retcode { get; set; }
|
||||
public int localsid { get; set; }
|
||||
|
||||
public AutoTeamSetGoal_Re() : base(ProtocolType.PROTOCOL_AUTOTEAMSETGOAL_RE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override Protocol Clone() => new AutoTeamSetGoal_Re
|
||||
{
|
||||
roleid = roleid,
|
||||
goal_type = goal_type,
|
||||
op = op,
|
||||
goal_id = goal_id,
|
||||
retcode = retcode,
|
||||
localsid = localsid
|
||||
};
|
||||
|
||||
public override void Marshal(OctetsStream os)
|
||||
{
|
||||
os.Write(roleid);
|
||||
os.Write(goal_type);
|
||||
os.Write(op);
|
||||
os.Write(goal_id);
|
||||
os.Write(retcode);
|
||||
os.Write(localsid);
|
||||
}
|
||||
|
||||
public override void Unmarshal(OctetsStream os)
|
||||
{
|
||||
roleid = os.ReadInt32();
|
||||
goal_type = os.ReadInt32();
|
||||
op = os.ReadInt32();
|
||||
goal_id = os.ReadInt32();
|
||||
retcode = os.ReadInt32();
|
||||
localsid = os.ReadInt32();
|
||||
}
|
||||
|
||||
public override int PriorPolicy() => 1;
|
||||
|
||||
public override bool SizePolicy(int size) => size <= 32;
|
||||
|
||||
public override string ToString => $" Type={Type}"; // - CMD_ID: {Enum.GetName(typeof(CommandID), BitConverter.ToUInt16(Data.ByteArray.Take(2).ToArray()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e2c269d6707b37478238369cf01884f
|
||||
@@ -334,6 +334,11 @@ namespace BrewMonster.Network
|
||||
Instance._gameSession.c2s_SendCmdTaskNotify( pBuf, sz);
|
||||
}
|
||||
|
||||
public static void c2s_CmdAutoTeamSetGoal(int type, int goal_id, int op)
|
||||
{
|
||||
Instance._gameSession.c2s_SendCmdAutoTeamSetGoal(type, goal_id, op);//{ ::c2s_SendCmdAutoTeamSetGoal(type, goal_id, op); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static void GetRoleBaseInfo(int iNumRole, List<int> aRoleIDs)
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
using BrewMonster.Network;
|
||||
using CSNetwork.GPDataType;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class CECAutoTeam
|
||||
{
|
||||
public const float TASK_TEAM_DISTANCE = 300.0f;
|
||||
public enum AutoTeamType
|
||||
{
|
||||
TYPE_UNKNOWN,
|
||||
TYPE_TASK,
|
||||
TYPE_ACTIVITY,
|
||||
}
|
||||
|
||||
protected int m_iType; // Auto team type
|
||||
protected int m_iCurGoal; // For task-based teams: task ID; otherwise activity/event ID
|
||||
protected A3DVECTOR3 m_vTaskPos; // In task teams: player position
|
||||
protected CECCounter m_cntCancel;
|
||||
|
||||
// CECAutoTeam::CECAutoTeam()
|
||||
// {
|
||||
// m_iType = TYPE_UNKNOWN;
|
||||
// m_iCurGoal = 0;
|
||||
// m_vTaskPos.Clear();
|
||||
// m_cntCancel.SetPeriod(500);
|
||||
// m_cntCancel.Reset();
|
||||
// }
|
||||
|
||||
public void Tick(float dwDeltaTime)
|
||||
{
|
||||
if (m_iType == (int)AutoTeamType.TYPE_TASK && m_iCurGoal>0 && m_cntCancel.IncCounter(dwDeltaTime))
|
||||
{
|
||||
A3DVECTOR3 vPos = CECGameRun.Instance.GetHostPlayer().GetPos();
|
||||
var target = m_vTaskPos - vPos;
|
||||
if (target.MagnitudeH() > TASK_TEAM_DISTANCE)
|
||||
{
|
||||
m_vTaskPos = vPos;
|
||||
Cancel((int)AutoTeamType.TYPE_TASK);
|
||||
}
|
||||
m_cntCancel.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public bool DoAutoTeam(int type, int iGoalID)
|
||||
{
|
||||
// if(EC_Game.GetGameRun().GetHostPlayer().GetTeam())
|
||||
// return false;
|
||||
//todo need to get bAutoTeamForTask
|
||||
var bAutoTeamForTask = 1;
|
||||
if( type == (int)AutoTeamType.TYPE_TASK && bAutoTeamForTask<=0)//&& !g_pGame->GetConfigs()->GetGameSettings().bAutoTeamForTask
|
||||
return false;
|
||||
|
||||
// Èç¹ûÕýÔÚ½øÐл×é¶ÓÇëÇó£¬ÔòºöÂÔÆäËûÇëÇó
|
||||
//todo need to get m_iCurGoal
|
||||
if( m_iType == (int)AutoTeamType.TYPE_TASK && m_iCurGoal>0)// && m_iCurGoal
|
||||
return false;
|
||||
|
||||
// ¼Ç¼´ËʱµÄλÖÃ
|
||||
if( type == (int)AutoTeamType.TYPE_TASK )
|
||||
m_vTaskPos = EC_Game.GetGameRun().GetHostPlayer().GetPos();
|
||||
|
||||
if( m_iType == type && m_iCurGoal == iGoalID )
|
||||
return false;
|
||||
|
||||
UnityGameSession.c2s_CmdAutoTeamSetGoal(type, iGoalID, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Cancel(int type)
|
||||
{
|
||||
if (m_iType == type && m_iCurGoal>0)
|
||||
UnityGameSession.c2s_CmdAutoTeamSetGoal(type, m_iCurGoal, 0);
|
||||
}
|
||||
|
||||
// public void OnPrtcAutoTeamSetGoalRe(Protocol p)
|
||||
// {
|
||||
// enum
|
||||
// {
|
||||
// ERR_INVALID_GOAL = -1,
|
||||
// ERR_INVALID_ROLE_STATUS = -2,
|
||||
// };
|
||||
//
|
||||
// using namespace GNET;
|
||||
// AutoTeamSetGoal_Re* pProto = (AutoTeamSetGoal_Re*)p;
|
||||
// if( pProto->retcode == 0 )
|
||||
// {
|
||||
// if( pProto->op == 1 )
|
||||
// {
|
||||
// m_iType = (int)pProto->goal_type;
|
||||
// m_iCurGoal = pProto->goal_id;
|
||||
//
|
||||
// if( pProto->goal_type == TYPE_ACTIVITY )
|
||||
// GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10864), GP_CHAT_MISC);
|
||||
//
|
||||
// // ¸üнçÃæ
|
||||
// CDlgActivity* pDlg = dynamic_cast<CDlgActivity*>(GetGameUIMan()->GetDialog("Win_Activity"));
|
||||
// if( pDlg ) pDlg->UpdateActivityList(true);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if( pProto->goal_type == TYPE_ACTIVITY )
|
||||
// {
|
||||
// if( pProto->op == 1 && pProto->retcode == ERR_INVALID_GOAL )
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10860), MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// else if( pProto->op == 0 && pProto->retcode == ERR_INVALID_ROLE_STATUS )
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10861), MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// void CECAutoTeam::OnPrtcPlayerLeave(GNET::Protocol* p)
|
||||
// {
|
||||
// enum
|
||||
// {
|
||||
// REASON_COMPOSE_TEAM = 0,
|
||||
// REASON_INVALID_STATUS,
|
||||
// REASON_PLAYER_OP,
|
||||
// REASON_JOIN_TEAM,
|
||||
// REASON_TIMEOUT,
|
||||
// };
|
||||
//
|
||||
// using namespace GNET;
|
||||
// AutoTeamPlayerLeave* pProto = (AutoTeamPlayerLeave*)p;
|
||||
// if( m_iType == TYPE_ACTIVITY )
|
||||
// {
|
||||
// switch(pProto->reason)
|
||||
// {
|
||||
// case REASON_INVALID_STATUS:
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10862), MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// break;
|
||||
// case REASON_TIMEOUT:
|
||||
// GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10863), GP_CHAT_MISC);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// m_iCurGoal = 0;
|
||||
// m_iType = TYPE_UNKNOWN;
|
||||
//
|
||||
// // ¸üнçÃæ
|
||||
// CDlgActivity* pDlg = dynamic_cast<CDlgActivity*>(GetGameUIMan()->GetDialog("Win_Activity"));
|
||||
// if( pDlg ) pDlg->UpdateActivityList(true);
|
||||
// }
|
||||
//
|
||||
// void CECAutoTeam::OnWorldChanged()
|
||||
// {
|
||||
// if( !IsMatchingForActivity() )
|
||||
// return;
|
||||
//
|
||||
// bool bFound = false;
|
||||
// int world_id = g_pGame->GetGameRun()->GetWorld()->GetInstanceID();
|
||||
// for( size_t i=0;i<CECUIConfig::Instance().GetGameUI().nAutoTeamTransmitEnabledMap.size();i++ )
|
||||
// {
|
||||
// if( world_id == CECUIConfig::Instance().GetGameUI().nAutoTeamTransmitEnabledMap[i] )
|
||||
// {
|
||||
// bFound = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if( !bFound )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10865), MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// Cancel(TYPE_ACTIVITY);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CECGameUIMan* CECAutoTeam::GetGameUIMan()
|
||||
// {
|
||||
// return g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
|
||||
// }
|
||||
//
|
||||
// CECGameSession* CECAutoTeam::GetGameSession()
|
||||
// {
|
||||
// return g_pGame->GetGameSession();
|
||||
// }
|
||||
//
|
||||
// CECHostPlayer* CECAutoTeam::GetHostPlayer()
|
||||
// {
|
||||
// return g_pGame->GetGameRun()->GetHostPlayer();
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c340e14ce1c73c409d397575cdf8029
|
||||
@@ -462,16 +462,15 @@ namespace BrewMonster.Scripts.Task
|
||||
{
|
||||
// Monster kill count >= 2 triggers auto team
|
||||
// TODO: svr_monster_killed struct not defined; need to define or use alternative
|
||||
// if (sz == Marshal.SizeOf<svr_monster_killed>())
|
||||
// {
|
||||
// svr_monster_killed pKilled = Marshal.PtrToStructure<svr_monster_killed>(handle.AddrOfPinnedObject());
|
||||
// if (pKilled.monster_num >= 2)
|
||||
// {
|
||||
// // TODO: CECAutoTeam and DoAutoTeam not found; implement auto team if needed
|
||||
// // CECAutoTeam pAutoTeam = g_pGame.GetGameRun().GetHostPlayer().GetAutoTeam();
|
||||
// // pAutoTeam.DoAutoTeam(CECAutoTeam.TYPE_TASK, pNotify.task);
|
||||
// }
|
||||
// }
|
||||
if (sz == Marshal.SizeOf<svr_monster_killed>())
|
||||
{
|
||||
svr_monster_killed pKilled = GPDataTypeHelper.FromBytes<svr_monster_killed>(pBuf) ;//Marshal.PtrToStructure<svr_monster_killed>(pNotify.AddrOfPinnedObject());
|
||||
if (pKilled.monster_num >= 2)
|
||||
{
|
||||
// CECAutoTeam pAutoTeam = EC_Game.GetGameRun().GetHostPlayer().GetAutoTeam();
|
||||
// pAutoTeam.DoAutoTeam((int)CECAutoTeam.AutoTeamType.TYPE_TASK, pNotify.task);
|
||||
}
|
||||
}
|
||||
// TODO: CECUIHelper.OnTaskProcessUpdated not found; implement UI update if needed
|
||||
// CECUIHelper.OnTaskProcessUpdated(pNotify.task);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ namespace BrewMonster
|
||||
public uint m_dwMoveRelDir = 0; // Move relative direction flags
|
||||
public ON_AIR_CDR_INFO m_AirCDRInfo;
|
||||
|
||||
private CECAutoTeam m_pAutoTeam; // Player auto team / automatic team grouping
|
||||
|
||||
// ====== Ground cast config ======
|
||||
[Header("Ground Cast")]
|
||||
[Tooltip("Khoảng thêm ngoài skinWidth để SphereCast xuống (m ngắn)")]
|
||||
@@ -138,6 +140,7 @@ namespace BrewMonster
|
||||
public EC_Inventory EquipInventory => m_equipInventory;
|
||||
public EC_Inventory TaskInventory => m_taskInventory;
|
||||
public bool IsMeleeing() { return m_bMelee; }
|
||||
public CECAutoTeam GetAutoTeam() { return m_pAutoTeam; }
|
||||
|
||||
public EC_Inventory GetInventory(byte byPackage)
|
||||
{
|
||||
@@ -271,6 +274,9 @@ namespace BrewMonster
|
||||
|
||||
//m_dwMoveRelDir = 0;
|
||||
m_fVertSpeed = 0.0f;
|
||||
|
||||
// Auto team / Automatic party grouping
|
||||
// m_pAutoTeam.Tick(Time.deltaTime);
|
||||
}
|
||||
|
||||
public void StopMovement()
|
||||
|
||||
Reference in New Issue
Block a user