private void ActivateObject(ControlContexted obj) { obj.ControlContext.Active = true; if (obj.IsModal) { Game.Instance.ControlContext.SaveFocus(); Game.Instance.ControlContext.Active = false; foreach (Layer l in Layers) { foreach (IGameObject lo in l.Objects) { ControlContexted co = lo as ControlContexted; if (lo == obj || co == null) { continue; } co.ControlContext.SaveFocus(); co.ControlContext.Active = false; } } } }
private void ResetChildContext(GameObject child) { ControlContexted ctxChild = child as ControlContexted; if (ctxChild == null) { return; } ctxChild.ControlContext.parentObject = null; ctxChild.ControlContext.parentContext = null; }
private void InitChildContext(GameObject child) { ControlContexted ctxChild = child as ControlContexted; if (ctxChild == null) { return; } ctxChild.ControlContext.dynamicParent = true; ctxChild.ControlContext.parentObject = this; }
public TouchListener(Predicate <Touch> triggerRule, ControlContexted contexted, string helpText, Delegate handler, params object[] args) { this.isDestroyed = false; this.Destroyed = null; this.isTriggered = triggerRule; this.handler = handler; this._helpText = helpText; this.dynamicContext = true; this.context = null; this.contextedObject = contexted; this.handlerParams = new object[args.Length + 1]; if (args.Length > 0) { Array.ConstrainedCopy(args, 0, handlerParams, 1, handlerParams.Length - 1); } }
/// <summary> /// Kuuntelee tapahtumaa vain tietyssä kontekstissa. /// Esim. Keyboard.Listen(parametrit).InContext(omaIkkuna) kuuntelee /// haluttua näppäimistötapahtumaa ainoastaan kun ikkuna on näkyvissä ja päällimmäisenä. /// </summary> public Listener InContext(ControlContexted obj) { this.dynamicContext = true; this.contextedObject = obj; return(this); }
private ListenContext(ControlContexted parentObj) { this.dynamicParent = true; this.parentObject = parentObj; }