Esempio n. 1
0
 /// <summary>
 /// Enters the monitor. Dispose the returned IDisposable to leave it.
 /// </summary>
 public IDisposable Enter()
 {
     if (_count == 0)
         Entered?.Invoke(this, EventArgs.Empty);
     _count++;
     return Disposable.Create(Leave);
 }
Esempio n. 2
0
        [NotNull] public IScope Enter(object state = null)
        {
            lock (mLock)
            {
                if (EnterTrigger == ScopeEnterTrigger.Entering)
                {
                    mOnEnter?.Invoke();
                }

                EnteringOverride();
                Entering?.Invoke(this, new EventArgs());

                mStateStack.Push(state);

                Entered?.Invoke(this, new EventArgs());
                EnteredOverride();

                if (EnterTrigger == ScopeEnterTrigger.Entered)
                {
                    mOnEnter?.Invoke();
                }
            }

            return(this);
        }
Esempio n. 3
0
        private void onMouseMove(object sender, MouseMoveEventArgs e)
        {
            if (inputEngine.Mouse.CurrentWindow == Window && e.X >= GlobalX + _hitBox.X && e.X <= GlobalX + _hitBox.X + _hitBox.Width && e.Y >= GlobalY + _hitBox.Y && e.Y <= GlobalY + _hitBox.Y + _hitBox.Height)
            {
                if (_state == InteractableState.Normal)
                {
                    _state = InteractableState.Hover;
                    Entered?.Invoke(this, EventArgs.Empty);
                }
            }
            else
            {
                if (_state == InteractableState.Hover)
                {
                    _state = InteractableState.Normal;
                    Exited?.Invoke(this, EventArgs.Empty);
                }
            }

            if (_state == InteractableState.Down)
            {
                tickX       = MathUtil.Clamp(GlobalX, GlobalX + barBitmap.Width, inputEngine.Mouse.X) - GlobalX - tickBitmap.Width / 2.0d;
                needsUpdate = true;
                ValueChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 4
0
        private void Option_MouseEnter(object sender, MouseEventArgs e)
        {
            Entered?.Invoke(sender, e);

            if (!this.OptionCanvas.Children.Contains(_selector))
            {
                this.OptionCanvas.Children.Add(_selector);
            }

            TextBlock senderTextBlock = sender as TextBlock;

            Point location      = senderTextBlock.TranslatePoint(new Point(0, 0), OptionCanvas);
            Point arrowLocation = _selector.TranslatePoint(new Point(0, 0), OptionCanvas);

            // Don't redraw the arrow if it's already where it should be
            if (location.Y + 8.0 != arrowLocation.Y)
            {
                _selector.BeginBounceAnimation(new Point(location.X - 20.0, location.Y + 8.0));
            }

            foreach (var child in CurrentOptions.Children)
            {
                TextBlock option = child as TextBlock;

                DoubleAnimation deselect = new DoubleAnimation(0.8, new Duration(TimeSpan.FromSeconds(0.0)));
                option.BeginAnimation(TextBlock.OpacityProperty, deselect);
            }

            DoubleAnimation select = new DoubleAnimation(1.0, new Duration(TimeSpan.FromSeconds(0.0)));

            senderTextBlock.BeginAnimation(TextBlock.OpacityProperty, select);
        }
Esempio n. 5
0
        private void OnTriggerEnter2D(Collider2D collider)
        {
            if (!this.isOpened)
            {
                return;
            }

            Entered?.Invoke(collider.gameObject);
        }
Esempio n. 6
0
    public override void Enter()
    {
        Debug.Log("SELECT TARGET");
        // wait for player to click a target, or cancel
        _targetController.TargetClicked += OnTargetClicked;
        _input.PressedCancel            += OnPressedCancel;

        Entered?.Invoke();
    }
Esempio n. 7
0
 /// <summary>
 /// Enters the monitor. Dispose the returned IDisposable to leave it.
 /// </summary>
 public IDisposable Enter()
 {
     if (_count == 0)
     {
         Entered?.Invoke(this, EventArgs.Empty);
     }
     _count++;
     return(this);
 }
Esempio n. 8
0
 /// <summary>
 /// Calls the <see cref="onEntered"/> and <see cref="Entered"/> events, if they are valid.
 /// Prefer <see cref="Entered"/> if you are programmatically adding event handlers at
 /// runtime. If you are adding event handlers in the Unity Editor, prefer <see
 /// cref="onEntered"/>. If you are waiting for this event in a subclass of StateController,
 /// prefer overriding the <see cref="OnEntered"/> method.
 /// </summary>
 protected virtual void OnEntered()
 {
     if (!skipEvents)
     {
         if (onEntered != null)
         {
             onEntered.Invoke();
         }
         Entered?.Invoke(this, EventArgs.Empty);
     }
 }
Esempio n. 9
0
        /// <summary>
        ///
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var PART_TextBox = this.Template.FindName("PART_TextBox", this);

            if (PART_TextBox != null && PART_TextBox.Is <TextBoxExt>())
            {
                PART_TextBox.As <TextBoxExt>().Entered += (s, e) => Entered?.Invoke(this, e);
            }
        }
Esempio n. 10
0
 private void OnTriggerEnter(Collider col)
 {
     if (!col.CompareTag("Camera"))
     {
         return;
     }
     if (Entered != null)
     {
         Entered.Invoke();
     }
 }
Esempio n. 11
0
    private void OnTriggerEnter(Collider other)
    {
        if (Entered == null)
        {
            return;
        }

        if (!other.CompareTag("Throwable"))
        {
            return;
        }

        Entered.Invoke(this);
    }
Esempio n. 12
0
 private void onMouseMove(object sender, MouseMoveEventArgs e)
 {
     if (inputEngine.Mouse.CurrentWindow == Window && e.X >= GlobalX + _hitBox.X && e.X <= GlobalX + _hitBox.X + _hitBox.Width && e.Y >= GlobalY + _hitBox.Y && e.Y <= GlobalY + _hitBox.Y + _hitBox.Height)
     {
         if (_state == InteractableState.Normal)
         {
             if (_hoverTexture != null)
             {
                 /*bool update = false;
                  * if (_hitBox.X == X && _hitBox.Y == Y && _hitBox.Width == Width && _hitBox.Height == Height) {
                  *      update = true;
                  * }*/
                 Texture = atlas.GetTexture(_hoverTexture);
                 //if (update) {
                 _hitBox.X      = 0.0d;
                 _hitBox.Y      = 0.0d;
                 _hitBox.Width  = Width;
                 _hitBox.Height = Height;
                 //}
             }
             _state = InteractableState.Hover;
             Entered?.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (_state == InteractableState.Hover)
         {
             /*bool update = false;
              * if (_hitBox.X == X && _hitBox.Y == Y && _hitBox.Width == Width && _hitBox.Height == Height) {
              *      update = true;
              * }*/
             Texture = atlas.GetTexture(_normalTexture);
             //if (update) {
             _hitBox.X      = 0.0d;
             _hitBox.Y      = 0.0d;
             _hitBox.Width  = Width;
             _hitBox.Height = Height;
             //}
             _state = InteractableState.Normal;
             Exited?.Invoke(this, EventArgs.Empty);
         }
     }
 }
Esempio n. 13
0
 private void onMouseMove(object sender, MouseMoveEventArgs e)
 {
     if (inputEngine.Mouse.CurrentWindow == Window && e.X >= GlobalX + _hitBox.X && e.X <= GlobalX + _hitBox.X + _hitBox.Width && e.Y >= GlobalY + _hitBox.Y && e.Y <= GlobalY + _hitBox.Y + _hitBox.Height)
     {
         if (_state == InteractableState.Normal)
         {
             _state = InteractableState.Hover;
             Entered?.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (_state == InteractableState.Hover)
         {
             _state = InteractableState.Normal;
             Exited?.Invoke(this, EventArgs.Empty);
         }
     }
 }
 private void OnCollisionEnter(Collision other)
 => Entered?.Invoke(other);
Esempio n. 15
0
 private void Scene_Entered(object sender, EventArgs e)
 {
     Entered?.Invoke(sender, e);
 }
Esempio n. 16
0
 void OnCollisionEnter2D(Collision2D collision2D)
 {
     //Debug.Log("OnCollisionEnter2D");
     Entered?.Invoke(this, collision2D);
 }
Esempio n. 17
0
 private void OnTriggerEnter(Collider other)
 => Entered?.Invoke(other);
Esempio n. 18
0
 public override bool BecomeFirstResponder()
 {
     Entered?.Invoke(this, EventArgs.Empty);
     return(true);
 }
Esempio n. 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Text"></param>
 protected virtual void OnEntered(string Text)
 {
     Entered?.Invoke(this, new TextSubmittedEventArgs(Text));
 }
Esempio n. 20
0
 protected virtual void OnEntered()
 {
     state = AnimationState.FadeIn;
     Entered?.Invoke(this, new UIMouseEventArgs(Manager.MousePosition));
 }
Esempio n. 21
0
 public override void MouseEntered(NSEvent theEvent)
 {
     Entered?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 22
0
 public virtual void OnEntered(EventArgs e)
 {
     Entered?.Invoke(this, e);
 }
Esempio n. 23
0
 private void Enter()
 {
     Entered?.Invoke(this);
 }
Esempio n. 24
0
 private void Collision2DAgentOnEntered(object sender, Collision2D e) => Entered?.Invoke(this, e);
Esempio n. 25
0
 protected virtual void RaiseEntered(StateEnteredEventArgs args)
 {
     Entered?.Invoke(this, args);
 }
Esempio n. 26
0
 public void Enter()
 {
     IsActive = true;
     Entered?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 27
0
        private async Task Enter_Executed(object arg)
        {
            lock (_loginLock)
            {
                if (IsProgress)
                {
                    return;
                }

                IsProgress = true;
            }

            Error               = "";
            FullError           = null;
            Enter.CanBeExecuted = false;

            try
            {
                NewServerInfo[] uris;
                try
                {
                    var siService = new SIStorageServiceClient();
                    uris = await siService.GetGameServersUrisAsync(_cancellationTokenSource.Token);
                }
                catch
                {
                    uris = null;
                }

                var uri = uris?.FirstOrDefault() ?? new NewServerInfo {
                    Uri = GameServerClientNew.GameServerPredefinedUri, ProtocolVersion = ClientProtocolVersion
                };

                if (uri == null)
                {
                    Error = Resources.CannotGetServerAddress;
                    return;
                }

                if (uri.ProtocolVersion > ClientProtocolVersion)
                {
                    IsProgress          = false;
                    Enter.CanBeExecuted = true;
                    Error = Resources.ObsoleClient;
                    return;
                }

                IGameServerClient client = new GameServerClientNew(uri.Uri);

                await client.OpenAsync(_login, _cancellationTokenSource.Token);

                Entered?.Invoke(_login, client);
            }
            catch (HttpRequestException exc)
            {
                var message = new StringBuilder();

                var innerExc = exc.InnerException ?? exc;
                while (innerExc != null)
                {
                    if (message.Length > 0)
                    {
                        message.AppendLine();
                    }

                    message.Append(innerExc.Message);
                    innerExc = innerExc.InnerException;
                }

                Error = message.ToString();
            }
            catch (Exception exc)
            {
                Error     = exc.Message;
                FullError = exc.ToString();
            }
            finally
            {
                lock (_loginLock)
                {
                    IsProgress = false;
                }

                Enter.CanBeExecuted = true;
            }
        }
Esempio n. 28
0
 public void TriggerEntered()
 {
     Entered?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 29
0
 public void NotifyEntered(Rat rat)
 {
     Entered?.Invoke(rat, EventArgs.Empty);
 }
Esempio n. 30
0
 public void RaiseEntered(StateChangeArgs <TS, TT> e) => Entered?.Invoke(e);