You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
2.1 KiB

using System.Collections.Generic;
using Entitas;
namespace CoreGame.Render
{
public class CommandRecvSystem : ReactiveSystem<CombatEntity>
{
readonly CombatContext m_CombatContexts;
private IGroup<CombatEntity> m_CrcGroup;
public CommandRecvSystem(CombatContext combatContexts) : base(combatContexts)
{
m_CombatContexts = combatContexts;
}
protected override ICollector<CombatEntity> GetTrigger(IContext<CombatEntity> context)
{
return context.CreateCollector(CombatMatcher.CmdRecv);
}
protected override bool Filter(CombatEntity entity)
{
return true;
}
protected override void Execute(List<CombatEntity> entities)
{
// ProcessClientCmds(m_CombatContexts.cmdRecv.renderCmds);
// ProcessSvrCmds(m_CombatContexts.cmdRecv.netCmds);
}
public void ProcessSvrCmds(Queue<SvrCmd> svrCmds)
{
while (svrCmds.Count > 0)
{
var command = svrCmds.Dequeue();
{
var entity = m_CombatContexts.GetEntity(command.eid);
if (entity == null)
{
continue;
}
// entity.ReplaceMovementCmpt(1, command);
}
}
}
// public void ProcessClientCmds(Queue<ClientCmd> clientCmds)
// {
// while (clientCmds.Count > 0)
// {
// var command = clientCmds.Dequeue();
// var ent = m_CombatContexts.GetEntity(command.eid);
// if (command.commandType == (int)CommandType.JoyStickEnd)
// {
// m_CombatContexts.ReplaceInput(command.m_joysticDirection);
// ent.ReplaceMovement(0, m_CombatContexts.input.dir);
// return;
// }
// m_CombatContexts.ReplaceInput(command.m_joysticDirection);
// ent.ReplaceMovement(BattleConst.JoySpeed, m_CombatContexts.input.dir);
// }
// }
}
}