示例#1
0
        public bool OnCycle()
        {
            long num = Yupi.Now();

            if (num <= _mNext)
            {
                return(false);
            }

            lock (ToWork.SyncRoot)
            {
                while (ToWork.Count > 0)
                {
                    RoomUser roomUser = (RoomUser)ToWork.Dequeue();

                    List <IWiredItem> conditions = Room.GetWiredHandler().GetConditions(this);
                    List <IWiredItem> effects    = Room.GetWiredHandler().GetEffects(this);

                    if (conditions.Any())
                    {
                        foreach (IWiredItem current in conditions)
                        {
                            if (!current.Execute(roomUser))
                            {
                                return(false);
                            }

                            WiredHandler.OnEvent(current);
                        }
                    }

                    if (!effects.Any())
                    {
                        continue;
                    }

                    foreach (IWiredItem current2 in effects.Where(current2 => current2.Execute(roomUser, Type)))
                    {
                        WiredHandler.OnEvent(current2);
                    }
                }
            }

            _mNext = 0L;
            WiredHandler.OnEvent(this);
            return(true);
        }