Exemple #1
0
 protected virtual void OnDisable()
 {
     if (OnDisabled != null)
     {
         OnDisabled.Invoke();
     }
 }
Exemple #2
0
        private void OnDisable()
        {
#if UNITY_EDITOR
            EditorApplication.update     -= EditorAppUpdateCallback;
            SceneView.onSceneGUIDelegate -= HandleOnSceneGUI;
#endif
            OnDisabled?.Invoke();
#if UNITY_EDITOR && LOG_RELOAD_TIME
            Debug.Log("disabled" + EditorApplication.timeSinceStartup.ToString());
            startReloadTime = EditorApplication.timeSinceStartup;
#endif
        }
Exemple #3
0
        /// <summary>
        /// Disables the specified index of <see cref="Step"/>.
        /// </summary>
        /// <param name="index">The index to disable.</param>
        public async Task Disable(int index)
        {
            for (int i = 0; i < ChildComponents.Count; i++)
            {
                GetChild(i).Disable(false);
            }

            GetChild(index).Disable();
            await OnDisabled.InvokeAsync(index);

            NotifyStateChanged();
        }
 protected virtual void OnDisable()
 {
     try
     {
         if (Initialized && Enabled && !Unloaded)
         {
             OnDisabled.RaiseEvent(null, null);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Exemple #5
0
    private void OnTriggerExit(Collider other)
    {
        WeightedObject o = other.GetComponent <WeightedObject>();

        if (o == null)
        {
            return;
        }
        bool wasActivated = Activated;

        activeObjects.Remove(o.gameObject);
        RemoveObject(o);
        if (wasActivated != Activated)
        {
            OnDisabled.Invoke();
        }
    }
Exemple #6
0
        /// <summary>
        /// Return an active pool member so that it can be used again later
        /// </summary>
        /// <param name="item">The reference to the item that is to be returned. This must be alive as currently marked by this pool</param>
        /// <returns>Returns true if the item was returned to the pool. Otherwise false</returns>
        /// <remarks>
        /// Using this functionality will modify the order of items in the pool from their original use order.
        /// This can effect functionality that is dependent on maintaining that order
        /// </remarks>
        public bool ReturnItem(T item)
        {
            // Find the index of the item in the pool
            int index = FindIndex(x => x == item);

            if (index == -1)
            {
                return(false);
            }

            // Swap it around with the last entry
            T temp = itemPool[AliveObjects - 1];

            itemPool[AliveObjects - 1] = item;
            itemPool[index]            = temp;
            --AliveObjects;

            // Disable the element as needed
            OnDisabled?.Invoke(item);
            return(true);
        }
Exemple #7
0
        /// <summary>
        /// Reset the items that are in the pool to a default state
        /// </summary>
        /// <param="_destroyItems">Flags if the pooled items should be destroyed instead<param>
        public void ResetPool(bool _destroyItems)
        {
            if (_destroyItems)
            {
                // Just destroy and clear the list
                for (int i = 0; i < itemPool.Count; ++i)
                {
                    if (itemPool[i] != null)
                    {
                        if (i < AliveObjects)
                        {
                            OnDisabled?.Invoke(itemPool[i]);
                        }
                        OnDestroy?.Invoke(itemPool[i]);
                    }
                }
                itemPool.Clear();
            }
            else
            {
                // Disable the items for later re-use
                for (int i = itemPool.Count - 1; i >= 0; --i)
                {
                    if (itemPool[i] != null)
                    {
                        if (i < AliveObjects)
                        {
                            OnDisabled?.Invoke(itemPool[i]);
                        }
                    }
                    else
                    {
                        itemPool.RemoveAt(i);
                    }
                }
            }

            // Nothing left active
            AliveObjects = 0;
        }
Exemple #8
0
 /// <summary>
 /// 禁用按钮的状态。
 /// </summary>
 /// <param name="disabled">是否禁用按钮。</param>
 public async Task Disable(bool disabled = true)
 {
     Disabled = disabled;
     await OnDisabled.InvokeAsync(disabled);
 }
 private void OnDisable()
 {
     OnDisabled.Invoke();
 }
Exemple #10
0
 private void OnDisable() => OnDisabled?.Invoke();
Exemple #11
0
        /// <summary>
        /// Disables firewall.
        /// </summary>
        public virtual void Disable()
        {
            _mEnabled = false;

            OnDisabled?.Invoke();
        }
Exemple #12
0
 public void Disable()
 {
     OnDisabled?.Invoke(this);
     gameObject.SetActive(false);
 }
Exemple #13
0
 public void Close()
 {
     gameObject.SetActive(false);
     callbackAction?.Invoke();
     OnDisabled?.Invoke(this);
 }
 public void PowerUpDisable(Motor motor)
 {
     OnDisabled?.Invoke();
     Disable(motor);
 }
 protected virtual void OnDisable()
 {
     OnDisabled?.Dispatch();
 }