Exemplo n.º 1
0
        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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void ResetChildContext(GameObject child)
        {
            ControlContexted ctxChild = child as ControlContexted;

            if (ctxChild == null)
            {
                return;
            }
            ctxChild.ControlContext.parentObject  = null;
            ctxChild.ControlContext.parentContext = null;
        }
Exemplo n.º 3
0
        private void InitChildContext(GameObject child)
        {
            ControlContexted ctxChild = child as ControlContexted;

            if (ctxChild == null)
            {
                return;
            }
            ctxChild.ControlContext.dynamicParent = true;
            ctxChild.ControlContext.parentObject  = this;
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
 /// <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);
 }
Exemplo n.º 6
0
 private ListenContext(ControlContexted parentObj)
 {
     this.dynamicParent = true;
     this.parentObject  = parentObj;
 }