public void Drop()
 {
     RemoveAllSources();
     col.enabled = true;
     IsCollected = false;
     Dropped?.Invoke();
 }
Exemple #2
0
 private void Drop()
 {
     _prevCell = null;
     Dropped.Invoke(0);
     _filledCellsCount = 0;
     _levelSettings.PlayDropSound();
 }
Exemple #3
0
        public void Disconnect()
        {
            lock (DisconnectLock)
            {
                if (ConnectionState == ConnectionStates.Disconnected)
                {
                    return;
                }

                _ackTimer?.Stop();
                _sendTimer?.Stop();

                ConnectionState = ConnectionStates.Disconnected;
                Debug.WriteLine($"Disconnect() ConnectionState={ConnectionState}");

                _client?.Close();

                Local = false;

                Logging.Instance.Log(LogTypes.Info, TAG, nameof(Disconnect), $"connection dropped");

                Dropped?.Invoke();
                Update?.Invoke();

                if (CentralexState == CentralexStates.CentralexConnected)
                {
                    _centralexReconnectTimer.Interval = 5000;
                    _centralexReconnectTimer.Start();
                }
            }
        }
Exemple #4
0
        public override bool MouseUp(MouseButtonEventArgs e)
        {
            if (ClientArea.Contains(e.X, e.Y))
            {
                if (_playerManager.ControlledEntity == null)
                {
                    return(false);
                }

                IEntity entity    = _playerManager.ControlledEntity;
                var     equipment = (EquipmentComponent)entity.GetComponent(ComponentFamily.Equipment);
                var     hands     = (HumanHandsComponent)entity.GetComponent(ComponentFamily.Hands);

                if (CurrentEntity != null && CurrentEntity == _userInterfaceManager.DragInfo.DragEntity &&
                    hands.IsHandEmpty(hands.CurrentHand)) //Dropped from us to us. (Try to) unequip it to active hand.
                {
                    _userInterfaceManager.DragInfo.Reset();
                    equipment.DispatchUnEquipToHand(CurrentEntity.Uid);
                    return(true);
                }

                if (CurrentEntity == null && _userInterfaceManager.DragInfo.IsEntity &&
                    _userInterfaceManager.DragInfo.IsActive)
                {
                    Dropped?.Invoke(this, _userInterfaceManager.DragInfo.DragEntity);
                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
 void Start()
 {
     image      = GetComponent <Image>();
     dropTrue   = false;
     dropped    = item.GetComponent <Dropped>();
     collection = Camera.main.transform.Find("Collection");
     pivot      = Camera.main.transform.Find("Pivot");
 }
 public void ShrinkBack()
 {
     if (Dropped != null)
     {
         Dropped.ShrinkBack();
         Dropped = null;
     }
 }
Exemple #7
0
        Dropped GetRandomDrop(int level)
        {
            var drop   = SelectRandomItem(level);
            var result = new Dropped();

            result.item   = drop.item;
            result.number = drop.GetRandomNumber(level);
            return(result);
        }
Exemple #8
0
 public void OnGripReleased(object sender, ControllerGripArgs e)
 {
     if (!handIsIn)
     {
         return;
     }
     Connect(sender, false, gameObject);
     Dropped?.Invoke(this);
 }
Exemple #9
0
        public Task MarkAsDroppedAsync(IEntity entityWhoDropped)
        {
            if (Dropped != null)
            {
                return(Dropped.Invoke(this, entityWhoDropped));
            }

            return(Task.CompletedTask);
        }
Exemple #10
0
        private Dropped GetRandomDrop(DropLevel drop)
        {
            Dropped       dropped       = new Dropped();
            PotentialDrop potentialDrop = SelectDrop(drop);

            dropped.item   = potentialDrop.item;
            dropped.number = potentialDrop.GetRandomNumber();

            return(dropped);
        }
Exemple #11
0
        public void DoDrop(Collectible prefab)
        {
            var     newcol = Instantiate(prefab, _startPos, Quaternion.identity);
            Dropped s      = new Dropped();
            var     v      = Random.insideUnitCircle * _radiusRange.Value;

            s.Dest    = new Vector3(_startPos.x + v.x, _startPos.y, _startPos.z + v.y);
            s.Collect = newcol;
            _collectibles.Add(s);
        }
Exemple #12
0
        Dropped GetRandomDrop(int dropTier)
        {
            Dropped    randomDrop = new Dropped();
            DropConfig dropConfig = SelectRandomItem(dropTier);

            randomDrop.item   = GetByLevel(dropConfig.item, dropTier);
            randomDrop.number = dropConfig.GetRandomNumber(dropTier);

            return(randomDrop);
        }
Exemple #13
0
        private void ReceiveHandle(object arg)
        {
            var line = arg as String;

            try
            {
                var args = new Answer(line);
                switch (args.Message)
                {
                case "Hello":
                    Reseted?.Invoke();
                    break;

                case "dropped":
                    Dropped?.Invoke(int.Parse(args.Values["N"]));
                    break;

                case "queued":
                    Queued?.Invoke(int.Parse(args.Values["N"]));
                    break;

                case "started":
                    Started?.Invoke(int.Parse(args.Values["N"]));
                    break;

                case "completed":
                    Completed?.Invoke(int.Parse(args.Values["N"]), args.Values);
                    break;

                case "failed":
                    Failed?.Invoke(int.Parse(args.Values["N"]), line);
                    break;

                case "debug":
                    Debug?.Invoke(line);
                    break;

                case "error":
                    Error?.Invoke(line);
                    break;

                default:
                    break;
                }
                if (args.Values.ContainsKey("Q"))
                {
                    SetQ(int.Parse(args.Values["Q"]), int.Parse(args.Values["N"]));
                }
            }
            catch
            {
                Logger.Instance.Error(this, "exception", line);
            }
        }
Exemple #14
0
        /// <summary>
        /// Called when dropping a file onto the row.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Row_Drop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            if (files == null || files.Length != 1)
            {
                return;
            }

            System.Collections.Generic.KeyValuePair <int, string> pair = new System.Collections.Generic.KeyValuePair <int, string>(this.Index, files[0]);

            Dropped?.Invoke(pair, e);
        }
        public bool Drop(object sender, GamePiece sprite, Action <Sprite> onHandled, DragEventArgs e)
        {
            var eventArgs = new DropEventArgs()
            {
                Sprite      = sprite,
                OnHandled   = onHandled,
                DragCurrent = e.DragCurrent,
                DragStart   = e.DragStart,
                DragStop    = e.DragStop,
                Button      = e.Button
            };

            Dropped?.Invoke(sender, eventArgs);
            return(eventArgs.Handled);
        }
Exemple #16
0
 private void Painel_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(Tarefa)))
     {
         Tarefa data = (Tarefa)e.Data.GetData(typeof(Tarefa));
         if (CanDrop(data))
         {
             ResetColor();
             if (Dropped != null)
             {
                 Dropped.Invoke(this, e);
             }
         }
     }
 }
Exemple #17
0
        /// <summary>
        /// Enqueue items to failure queue.
        /// </summary>
        /// <param name="items"></param>
        private void EnqueueFailures(IReadOnlyList <T> items)
        {
            var dropped = new List <T>(items.Count);

            foreach (var item in items)
            {
                if (IsFaultListFull && _faultQueue.TryDequeue(out var drop))
                {
                    dropped.Add(drop);
                }
                _faultQueue.Enqueue(item);
            }

            if (dropped.Any())
            {
                Dropped?.Invoke(dropped);
            }
        }
        public void ImportMousePressed(MouseEvent e)
        {
            int mx = e.X - position.X;
            int my = e.Y - position.Y;

            List <DropListItem> itemList = Dropped.ItemList;

            foreach (DropListItem iter in itemList)
            {
                if (iter.IsIn(mx, my))
                {
                    Dropped.SetSelection(iter);
                    ShrinkBack();
                    return;
                }
            }
            ShrinkBack();
        }
        public void Act(Dropped message)
        {
            if (ProcessHeader(message.Header, message))
            {
                return;
            }
            // My next node disconnected
            // Me --> dead -->
            if (message.Addr == NextAddr)
            {
                _log.LogWarn(_clock, _id, "My Next node dropped.");
                NextAddr = NextNextAddr;

                NextNextAddr = message.NextNextAddr != _options.Address ? message.NextNextAddr : "";
                _log.LogWarn(_clock, _id, $"Next: {NextAddr}, NextNext: {NextNextAddr}, Leader: {leaderId}");
            }
            // My next next node disconnected
            // Me --> node --> dead
            else if (message.Addr == NextNextAddr)
            {
                _log.LogWarn(_clock, _id, "My Next Next node dropped.");
                NextNextAddr   = message.NextAddr;
                message.Header = CreateHeader(message.Header.Id);
                PassMessage(node => node.Drop(message));
                _log.LogWarn(_clock, _id, $"Next: {NextAddr}, NextNext: {NextNextAddr}, Leader: {leaderId}");
            }
            // My previous node disconnected
            else if (message.NextAddr == _options.Address)
            {
                _log.LogWarn(_clock, _id, "My previous node disconnected.");
                message.NextNextAddr = NextAddr;
                message.Header       = CreateHeader(message.Header.Id);
                PassMessage(node => node.Drop(message));
                _log.LogWarn(_clock, _id, $"Next: {NextAddr}, NextNext: {NextNextAddr}, Leader: {leaderId}");
            }
            else
            {
                message.Header = CreateHeader(message.Header.Id);
                PassMessage(node => node.Drop(message));
            }
        }
Exemple #20
0
        public void OnExtendedMessage(IPeerWireClient peerWireClient, byte[] bytes)
        {
            BDict dictionary = (BDict)BencodingUtils.Decode(bytes);

            if (!dictionary.ContainsKey(ADDED_KEY) && !dictionary.ContainsKey(ADDED_FLAGS_KEY) && !dictionary.ContainsKey(DROPPED_KEY))
            {
                return;
            }

            if (dictionary.ContainsKey(ADDED_KEY) && dictionary.ContainsKey(ADDED_FLAGS_KEY))
            {
                var pexList  = (BString)dictionary[ADDED_KEY];
                var pexFlags = (BString)dictionary[ADDED_FLAGS_KEY];

                for (int i = 0; i < pexList.ByteValue.Length / 6; i++)
                {
                    var ip    = Unpack.UInt32(pexList.ByteValue, i * 6, Unpack.Endianness.Little);
                    var port  = Unpack.UInt16(pexList.ByteValue, (i * 6) + 4, Unpack.Endianness.Big);
                    var flags = pexFlags.ByteValue[i];

                    var ipAddr = new IPEndPoint(ip, port);

                    Added?.Invoke(peerWireClient, this, ipAddr, flags);
                }
            }
            else //if (d.ContainsKey(DROPPED_KEY))
            {
                BString pexList = (BString)dictionary[DROPPED_KEY];

                for (int i = 0; i < pexList.ByteValue.Length / 6; i++)
                {
                    var ip   = Unpack.UInt32(pexList.ByteValue, i * 6, Unpack.Endianness.Little);
                    var port = Unpack.UInt16(pexList.ByteValue, (i * 6) + 4, Unpack.Endianness.Big);

                    var ipAddr = new IPEndPoint(ip, port);

                    Dropped?.Invoke(peerWireClient, this, ipAddr);
                }
            }
        }
Exemple #21
0
        public bool Drop(ItemModel item)
        {
            if (item == null)
            {
                return(false);
            }

            if (Dropped == null)
            {
                Dropped = new ObservableCollection <ItemModel>();
            }

            if (Dropped.Contains(item))
            {
                return(true);
            }

            Dropped.Add(item);
            OnPropertyChanged("Dropped");
            OnPropertyChanged("DroppedItems");
            return(true);
        }
Exemple #22
0
        void dragElement_MouseMove(object sender, MouseEventArgs e)
        {
            FrameworkElement dragElement = (FrameworkElement)sender;

            if (startPoint != null && Mouse.LeftButton == MouseButtonState.Pressed)
            {
                Point currentPos = e.GetPosition(null);
                if ((Math.Abs(currentPos.X - startPoint.Value.X) > SystemParameters.MinimumHorizontalDragDistance) ||
                    (Math.Abs(currentPos.Y - startPoint.Value.Y) > SystemParameters.MinimumVerticalDragDistance))
                {
                    object dataObject = dataObjectFactory(dragElement);

                    startPoint = null;

                    DragDropEffects de = DragDrop.DoDragDrop(dragElement, dataObject, allowedEffects); //Leap of faith

                    Dropped?.Invoke(dragElement, de);
                }
            }
            else
            {
                startPoint = null;
            }
        }
Exemple #23
0
 private void OnDropped()
 {
     Dropped?.Invoke(this, null);
 }
Exemple #24
0
 void Start()
 {
     anim    = GetComponent <Animation>();
     dropped = GetComponent <Dropped>();
     used    = GetComponent <Used>();
 }
Exemple #25
0
 internal virtual void OnDropped() => Dropped?.Invoke(this, EventArgs.Empty);
Exemple #26
0
 protected virtual void OnDrop()
 {
     isBeingDragged = false;
     Dropped?.Invoke(this, EventArgs.Empty);
 }
Exemple #27
0
 public void OnDrop(ItemDroppedEventData data)
 {
     AudioManager.Instance.PlayItemPlace(Item);
     Dropped?.Invoke(data);
 }
Exemple #28
0
 private void OnDropped(object sender, EventArgs e)
 {
     Dropped?.Invoke(this, null);
 }
 private void RTSender_Dropped(int N)
 {
     Logger.Instance.Debug(this, "unlock", "dropped");
     waitResponse.Reset();
     Dropped?.Invoke(N);
 }