Esempio n. 1
0
    /// <summary>
    /// Reads value from the reader and applies it
    /// </summary>
    /// <param name="stream">The stream to read the value from</param>
    /// <param name="keepDirtyDelta">Whether or not the container should keep the dirty delta, or mark the delta as consumed</param>
    public void ReadDelta(Stream stream, bool keepDirtyDelta)
    {
        using (PooledBitReader reader = PooledBitReader.Get(stream))
        {
            ShotData previousValue = InternalValue;
            InternalValue = (ShotData)reader.ReadObjectPacked((typeof(ShotData)));

            if (keepDirtyDelta)
            {
                isDirty = true;
            }

            OnValueChanged?.Invoke(previousValue, InternalValue);
        }
    }
Esempio n. 2
0
    public void    Poke()
    {
        if (OnChanged != null)
        {
            OnChanged.Invoke(this);
        }

        var call = OnChangedOnceOnly;

        if (call != null)
        {
            OnChangedOnceOnly = null;
            call(this);
        }
    }
Esempio n. 3
0
        // 内部リスナー登録
        private void OnValueChangedInner(float tValue)
        {
            if (m_CallbackDisable == true)
            {
                return;
            }

            if (onValueChangedAction != null || onValueChangedDelegate != null)
            {
                string identity = Identity;
                if (string.IsNullOrEmpty(identity) == true)
                {
                    identity = name;
                }

                onValueChangedAction?.Invoke(identity, this, tValue);
                onValueChangedDelegate?.Invoke(identity, this, tValue);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Calls the OnValueChanged callback
 /// </summary>
 /// <param name="oldValue">The old property value</param>
 /// <param name="newValue">The new property value</param>
 protected virtual void ExecuteOnValueChanged(TValue oldValue, TValue newValue)
 {
     OnValueChanged?.Invoke(Owner, oldValue, newValue);
 }
Esempio n. 5
0
 public void RegisterOnHealthValueChangedEventListener(OnValueChangedDelegate OnValueChangedDelegate)
 {
     this.OnHealthValueChangedEvent += OnValueChangedDelegate;
     /// Initialize the added event by manually calling it
     OnValueChangedDelegate.Invoke(this.CurrentHealth.GetValue(), this.CurrentHealth.GetValue());
 }