public bool Equals(IHasKey <T>?x, IHasKey <T>?y) { if (x == null) { return(y == null); } return(y != null && EqualityComparer <T> .Default.Equals(x.Key, y.Key)); }
/// <summary> /// Calls <see cref="AnimancerState.Destroy"/> on the state associated with the <see cref="IHasKey.Key"/> /// (if any). Returns true if the state existed. /// </summary> public bool Destroy(IHasKey hasKey) { if (hasKey == null) { return(false); } return(Destroy(hasKey.Key)); }
/// <summary> /// Passes the <see cref="IHasKey.Key"/> into <see cref="TryGet(object, out AnimancerState)"/> /// and returns the result. /// </summary> public bool TryGet(IHasKey hasKey, out AnimancerState state) { if (hasKey == null) { state = null; return(false); } return(TryGet(hasKey.Key, out state)); }
/// <summary> /// 主键是否相同 /// </summary> /// <param name="newObj"></param> /// <returns></returns> public bool KeyEquals(object newObj) { IHasKey objHasKey = newObj as IHasKey; if (objHasKey == null) { return(false); } return(this.ToKeyString().Equals(objHasKey.ToKeyString())); }
/// <summary> /// Returns true if a state is registered with the <see cref="IHasKey.Key"/> and it is currently playing. /// </summary> public bool IsPlaying(IHasKey hasKey) { if (_Playable != null) { return(_Playable.IsPlaying(hasKey)); } else { return(false); } }
/// <summary> /// Gets the state registered with the <see cref="IHasKey.Key"/>, stops and rewinds it to the start, then /// returns it. /// </summary> public AnimancerState Stop(IHasKey hasKey) { if (_Playable != null) { return(_Playable.Stop(hasKey)); } else { return(null); } }
/// <summary> /// Passes the <see cref="IHasKey.Key"/> into <see cref="TryGet(object, out AnimancerState)"/> /// and returns the result. /// </summary> public bool TryGet(IHasKey hasKey, out AnimancerState state) { if (hasKey != null) { return(States.TryGetValue(hasKey.Key, out state)); } else { state = null; return(false); } }
/// <summary>Returns the state registered with the <see cref="IHasKey.Key"/>.</summary> /// <exception cref="ArgumentNullException">The `key` is null.</exception> /// <exception cref="KeyNotFoundException">No state is registered with the `key`.</exception> public AnimancerState this[IHasKey hasKey] => States[hasKey.Key];
public int GetHashCode(IHasKey <T>?obj) => obj == null ? 0 : EqualityComparer <T> .Default.GetHashCode(obj.Key);
public virtual bool Matches(IHasKey c) { return(c.GetResourceKey().Equals(Material)); }
/// <summary> /// Returns the state registered with the <see cref="IHasKey.Key"/>, or null if none exists. /// </summary> public AnimancerState this[IHasKey hasKey] { get { return(this[hasKey.Key]); } }
protected override object GetElementKey(ConfigurationElement element) { IHasKey key = element as IHasKey; return(key?.Key); }