Пример #1
0
 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));
 }
Пример #2
0
            /// <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));
            }
Пример #3
0
            /// <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));
            }
Пример #4
0
        /// <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()));
        }
Пример #5
0
 /// <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);
     }
 }
Пример #6
0
 /// <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);
     }
 }
Пример #7
0
 /// <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);
     }
 }
Пример #8
0
 /// <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];
Пример #9
0
 public int GetHashCode(IHasKey <T>?obj)
 => obj == null ? 0 : EqualityComparer <T> .Default.GetHashCode(obj.Key);
Пример #10
0
 public virtual bool Matches(IHasKey c)
 {
     return(c.GetResourceKey().Equals(Material));
 }
Пример #11
0
 /// <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]); }
 }
Пример #12
0
        protected override object GetElementKey(ConfigurationElement element)
        {
            IHasKey key = element as IHasKey;

            return(key?.Key);
        }