using System.Collections.Generic; using Entitas; namespace CoreGame.Render { public class CommandRecvSystem : ReactiveSystem { readonly CombatContext m_CombatContexts; private IGroup m_CrcGroup; public CommandRecvSystem(CombatContext combatContexts) : base(combatContexts) { m_CombatContexts = combatContexts; } protected override ICollector GetTrigger(IContext context) { return context.CreateCollector(CombatMatcher.CmdRecv); } protected override bool Filter(CombatEntity entity) { return true; } protected override void Execute(List entities) { // ProcessClientCmds(m_CombatContexts.cmdRecv.renderCmds); // ProcessSvrCmds(m_CombatContexts.cmdRecv.netCmds); } public void ProcessSvrCmds(Queue 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 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); // } // } } }