/// <summary> /// Register Command unit. /// </summary> /// <param name="unit">Command unit.</param> public void RegisterUnit(ICommandUnit unit) { if (unit == null || string.IsNullOrEmpty(unit.Code)) { return; } unit.OnRespondEvent += OnUnitRespond; units.Add(unit.Code, unit); }
/// <summary> /// Register Command unit. /// </summary> /// <param name="unit">Command unit.</param> public void RegisterUnit(ICommandUnit unit) { if (unit == null || string.IsNullOrEmpty(unit.Code)) { LogUtility.LogError("Add unit to manager error: The unit or code of unit is null or empty."); return; } unit.OnRespond.AddListener(OnUnitRespond); units.Add(unit.Code, unit); }