예제 #1
0
 public void Drop()
 {
     RemoveAllSources();
     col.enabled = true;
     IsCollected = false;
     Dropped?.Invoke();
 }
예제 #2
0
 private void Drop()
 {
     _prevCell = null;
     Dropped.Invoke(0);
     _filledCellsCount = 0;
     _levelSettings.PlayDropSound();
 }
예제 #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();
                }
            }
        }
예제 #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);
        }
예제 #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;
     }
 }
예제 #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);
        }
예제 #8
0
 public void OnGripReleased(object sender, ControllerGripArgs e)
 {
     if (!handIsIn)
     {
         return;
     }
     Connect(sender, false, gameObject);
     Dropped?.Invoke(this);
 }
예제 #9
0
        public Task MarkAsDroppedAsync(IEntity entityWhoDropped)
        {
            if (Dropped != null)
            {
                return(Dropped.Invoke(this, entityWhoDropped));
            }

            return(Task.CompletedTask);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #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);
             }
         }
     }
 }
예제 #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();
        }
예제 #19
0
        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));
            }
        }
예제 #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);
                }
            }
        }
예제 #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);
        }
예제 #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;
            }
        }
예제 #23
0
 private void OnDropped()
 {
     Dropped?.Invoke(this, null);
 }
예제 #24
0
 void Start()
 {
     anim    = GetComponent <Animation>();
     dropped = GetComponent <Dropped>();
     used    = GetComponent <Used>();
 }
예제 #25
0
 internal virtual void OnDropped() => Dropped?.Invoke(this, EventArgs.Empty);
예제 #26
0
 protected virtual void OnDrop()
 {
     isBeingDragged = false;
     Dropped?.Invoke(this, EventArgs.Empty);
 }
예제 #27
0
 public void OnDrop(ItemDroppedEventData data)
 {
     AudioManager.Instance.PlayItemPlace(Item);
     Dropped?.Invoke(data);
 }
예제 #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);
 }