Exemple #1
0
        /// <summary>
        /// Queue state to process for the future
        /// </summary>
        public void QueueEvent(string state, double time, Action <QueuedEvent> action, Dictionary <object, object> attributes = null)
        {
            if (EventQueue.ContainsKey(state))
            {
                EventQueue.Remove(state);
            }

            EventQueue.TryAdd(state, new QueuedEvent(state, action, RoomTaskManager.GetProcessTime(time), attributes));
        }
Exemple #2
0
        public override void OnTickComplete()
        {
            if (RollingItems.Any() || RollingEntity != null)
            {
                var entity       = RollingEntity;
                var rollingItems = new List <RollingData>(RollingItems);

                if (entity != null)
                {
                    RoomTaskManager.RollerEntityTask.DoRoll(entity, entity.RoomEntity.RollingData.Roller, Item.Room, entity.RoomEntity.RollingData.FromPosition, entity.RoomEntity.RollingData.NextPosition);
                }

                // Perform roll animation for item
                foreach (var item in rollingItems)
                {
                    if (item.RollingItem.IsRollingBlocked)
                    {
                        continue;
                    }

                    RoomTaskManager.RollerItemTask.DoRoll(item.RollingItem, item.Roller, Item.Room, item.FromPosition, item.NextPosition);
                    item.RollingItem.Save();
                }

                // Send roller packet
                if (RollingItems.Count > 0 || RollingEntity != null)
                {
                    Item.Room?.Send(new SlideObjectBundleComposer(Item, rollingItems.Where(x => !x.RollingItem.IsRollingBlocked).ToList(), entity?.RoomEntity?.RollingData));

                    // Delay after rolling finished
                    int delay = (int)(double)(TaskProcessTime * 0.4 * 1000);
                    Task.Delay(delay).ContinueWith(t =>
                    {
                        foreach (RollingData rollingData in rollingItems)
                        {
                            rollingData.RollingItem.IsRollingBlocked = false;
                            rollingData.RollingItem.RollingData      = null;
                        }

                        if (entity != null)
                        {
                            if (entity.RoomEntity.RollingData != null)
                            {
                                entity.RoomEntity.InteractItem();//getRoomUser().invokeItem(null, true);
                                entity.RoomEntity.RollingData = null;
                            }
                        }
                    });
                }
            }

            TicksTimer = RoomTaskManager.GetProcessTime(TaskProcessTime);
        }
Exemple #3
0
        public override void OnTickComplete()
        {
            if (!EventQueue.ContainsKey(PlayerAttribute.TYPING_STATUS))
            {
                QueueEvent(PlayerAttribute.TYPING_STATUS, 1.0, ProcessTypingStatus, null);
            }

            if (!EventQueue.ContainsKey(PlayerAttribute.EFFECT_EXPIRY))
            {
                QueueEvent(PlayerAttribute.EFFECT_EXPIRY, 1.0, ProcessEffectExpiry, null);
            }

            TicksTimer = RoomTaskManager.GetProcessTime(0.5);
        }