Exemple #1
0
        private Action GetCommandAction(List <string> args)
        {
            UInt32 id;

            if (args.Count < 1)
            {
                _logger.LogError($"Get command requires >= 1 args: either an Entity id or a manager name and Entity id;");
            }
            else if (args.Count == 1)
            {
                if (!ValidateId(args[0], out id))
                {
                    return(null);
                }
                var living = _manager.Alive(id) ? "alive" : "not alive";
                _logger.LogInformation($"Entity {args[0]} is {living}");
            }
            else if (args.Count > 1)
            {
                IComponentManager manager = _collection.GetManagerByName(args[0]);
                if (manager == null)
                {
                    return(null);
                }
                if (!ValidateId(args[1], out id))
                {
                    return(null);
                }
                _logger.LogInformation($"{manager.GetInstance(id)}");
            }
            return(null);
        }