protected T SetValue <T>(bool changed, T oldValue, T value, string name, ref ElementFieldFlags flag, Action <T, T> onChangedAction = null) { if (changed) { ElementFieldFlags newFlag = FieldFlagMapping.SafeGet(name, ElementFieldFlags.None); if (newFlag != ElementFieldFlags.None) { flag |= newFlag; } onChangedAction?.Invoke(oldValue, value); #if DEBUG && !DEBUG_IN_PROD LogTo.Debug("[{0} {1}] {2}: {3}", GetType().Name, Id, name, value); #endif } return(value); }
protected T SetValue <T>(T oldValue, T value, string name, ref ComponentFieldFlags flag, Action <T, T> onChangedAction = null) { if (Equals(oldValue, value)) { ComponentFieldFlags newFlag = FieldFlagMapping.SafeGet(name, ComponentFieldFlags.None); if (newFlag != ComponentFieldFlags.None) { flag |= newFlag; } onChangedAction?.Invoke(oldValue, value); #if DEBUG //System.Diagnostics.Debug.WriteLine("[{0}] {1}: {2}", // GetType().Name, // name, // value); #endif } return(value); }
protected T SetValue <T>(T oldValue, T value, string name, ref ComponentFieldFlags flag, Action <T, T> onChangedAction = null) { if (Equals(oldValue, value)) { ComponentFieldFlags newFlag = FieldFlagMapping.SafeRead(name, ComponentFieldFlags.None); if (newFlag != ComponentFieldFlags.None) { flag |= newFlag; } onChangedAction?.Invoke(oldValue, value); #if DEBUG_REGISTRIES LogTo.Debug("[{0}] {1}: {2}", GetType().Name, name, value); #endif } return(value); }