private void Initialize() { commandExecutor.Initialize(commandsToExecute); commandExecutor.OnCommandStartedExecution += (c) => OnCommandStartedExecution?.Invoke(c); commandExecutor.OnCommandCompleted += (c) => OnCommandCompleted?.Invoke(c); commandExecutor.OnCommandFailed += (c, e) => OnCommandFailed?.Invoke(c, e); commandExecutor.OnCommandProgressChanged += (c, p) => OnCommandProgressChanged?.Invoke(c, p); commandExecutor.OnAllCompleted += (wasErrors) => OnLoadingCompleted?.Invoke(); }
private void OnCommandFailHandler(Exception obj) { Debug.LogError(Current != null ? $"Command failed! {Current.Description} with message {obj}" : $"On command failed in executor! Found null command error = {obj}"); UnsubscribeCommand(Current); failedCommands.Add(Current); OnCommandFailed?.Invoke(Current, obj); Current?.Undo(); StartExecution(); }