Ejemplo n.º 1
0
 public void RemoveSteering(SteeringType Type)
 {
     if (Behaviours.ContainsKey(Type))
     {
         Behaviours.Remove(Type);
     }
 }
Ejemplo n.º 2
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            Behaviours.Remove(behaviour);
            behaviour.Removed -= OnBehaviourRemoved;

            BehaviourRemoved?.Invoke(behaviour);
            AnyBehaviourRemoved?.Invoke(behaviour);
        }
Ejemplo n.º 3
0
        public bool RemoveBehaviour(string abbreviatedName)
        {
            lock (Behaviours)
            {
                IBehaviour behaviour;

                if (!Behaviours.TryGetValue(abbreviatedName, out behaviour))
                {
                    return(false);
                }

                behaviour.Close();
                Behaviours.Remove(abbreviatedName);

                return(true);
            }
        }
Ejemplo n.º 4
0
        public void InitProperties()
        {
            AddValidatedProperty("Gradient", false);
            AddValidatedProperty("Flat", false);
            AddValidatedProperty("CornerRadius", 0);
            AddValidatedProperty("Text", "");
            AddValidatedProperty("TextColor", Color.Navy);
            AddValidatedProperty("MouseIsDown", false);
            AddValidatedProperty("ControlKeyPressed", false);
            Property["Switch", false]
            .Changed += () =>
            {
                if (Switch)
                {
                    Behaviours.Add(Core.Behaviours.Checked(), "checked");
                }
                else
                {
                    Behaviours.Remove("checked");
                }
                Invalidate();
            };
            Value["Down"] = new Func <object>(() => { return(MouseIsDown || Checked || Value["ControlKeyPressed"].AsBoolean()); });

            AddValidatedProperty("Font", new Font("Arial", 8));
            TextAlignment      = StringAlignment.Center;
            DrawFocus          = true;
            Value["FlatIsNow"] = new Func <object>(() => { return(Flat && !MouseIsOver && !Down); });
            Property["Checked", false].Changed += () =>
            {
                Invalidate();
                if (CheckedChanged != null)
                {
                    CheckedChanged(this, new EventArgs());
                }
            };
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes a behaviour from this manager.
 /// </summary>
 /// <param name="behaviour">The behaviour this manager should stop managing.</param>
 /// <returns>
 ///     <c>true</c> if the behaviour was removed; else <c>false</c>.
 /// </returns>
 public virtual bool Remove(T behaviour)
 {
     return(Behaviours.Remove(behaviour));
 }
Ejemplo n.º 6
0
 public void RemoveBehaviour(BaseBehaviour behaviour) => Behaviours.Remove(behaviour);