/// <summary> /// 判断是否值相等 /// </summary> /// <param name="obj"></param> /// <returns>值相等,返回true</returns> public override bool Equals(object obj) { bool result = false; EndValueReadEventStatus <TValue> other = obj as EndValueReadEventStatus <TValue>; result = object.ReferenceEquals(this, other) || (base.Equals(obj) && other != null && EndValue.Equals(other.EndValue)); return(result); }
private void Initialize() { if (null == _proxy) { InitProxy(); } // check if interpolator not defined, and add one from defaults if (null != _proxy && null == _interpolator) { InitInterpolator(); } //Debug.Log("Proxy is null: " + (null == _proxy)); //Debug.Log("StartValue: " + StartValue); //Debug.Log("EndValue: " + EndValue); /** * Note: The priority is as follows: * 1) StartValue is checked. If set, skipping other checks * 2) StartValueReader is checked. If set, it reads the specified property * 3) StartValueReaderFunction is checked. If set, it is being run to get a property value. * - if niether of above steps resulted in having StartValue, we throw an exception * */ if (null != StartValue) { // do nothing } else if (null != StartValueReader) { if (null == StartValueReader.Target && null != Target) { StartValueReader.Target = Target; } if (null == StartValueReader.Property && null != Property) { StartValueReader.Property = Property; } StartValue = StartValueReader.Read(); } else if (null != StartValueReaderFunction) { StartValue = StartValueReaderFunction(Target); } if (CheckStartValue && null == StartValue) { throw new Exception("StartValue, StartValueGetter or StartValueReaderFunction not set: " + this); } if (null != EndValue) { // do nothing } if (null != EndValueReader) { if (null == EndValueReader.Target && null != Target) { EndValueReader.Target = Target; } if (null == EndValueReader.Property && null != Property) { EndValueReader.Property = Property; } EndValue = EndValueReader.Read(); } else if (null != EndValueReaderFunction) { EndValue = EndValueReaderFunction(Target); } if (CheckEndValue && null == EndValue) { throw new Exception("EndValue, EndValueReader or EndValueReaderFunction not set: " + this); } // check if tween is needed if (null != StartValue && null != EndValue && EndValue.Equals(StartValue)) { #if DEBUG if (DebugMode) { Debug.Log("EndValue equals StartValue. Returning..."); } #endif //if (IsChild) //{ // Parent.FinishedCount++; //} return; } #if DEBUG if (DebugMode) { Debug.Log("Playing: " + this); } #endif // go for a tween _startTime = DateTime.Now; //if (reset) _fraction = Starting; /** * Check if this is a root tween * If so, and not connected, connect * */ /*if (null == Parent && !SystemManager.Instance.UpdateSignal.HasSlot(this)) * SystemManager.Instance.UpdateSignal.Connect(this);*/ //Debug.Log("* INIT *"); TweenRegistry.Instance.Add(this); _initialized = true; }