Esempio n. 1
0
        /// <summary>
        /// Returns the first event in the Calendar of the desired type
        /// </summary>
        /// <param name="type">The event type desired</param>
        /// <returns>An Event of the desired type or null if no events of that type are found</returns>
        public Event NextEventOfType(EEventType type)
        {
            Type t = null;

            //Switch on the given enum value
            switch (type)
            {
            case EEventType.CallArrive:
                t = typeof(CallArriveEvent);
                break;

            case EEventType.SwitchCompleted:
                t = typeof(SwitchCompletedEvent);
                break;

            case EEventType.CompletedService:
                t = typeof(CompletedServiceEvent);
                break;

            case EEventType.EndReplication:
                t = typeof(EndReplicationEvent);
                break;
            }

            //Get the first event in the events list whose type matches the desired type. If none match then toReturn will be null
            Event toReturn = events.FirstOrDefault(e => (e.GetType() == t));

            return(toReturn);
        }
        private void SetAuditToEntity(object entity, EEventType eventType, int id)
        {
            var entityToAudit = entity as IAuditInfo;
            var today         = DateTime.Now;

            switch (eventType)
            {
            case EEventType.Create:
                entityToAudit.CreatedBy  = id;
                entityToAudit.CreatedOn  = today;
                entityToAudit.ModifiedBy = id;
                entityToAudit.ModifiedOn = today;
                if (entity is IDeletable)
                {
                    var entityDeletable = entity as IDeletable;
                    entityDeletable.IsActive = GlobalConstants.Activated;
                }
                break;

            case EEventType.Update:
                entityToAudit.ModifiedBy = id;
                entityToAudit.ModifiedOn = today;
                break;

            case EEventType.Delete:
                entityToAudit.ModifiedBy = id;
                entityToAudit.ModifiedOn = today;
                if (entity is IDeletable)
                {
                    var entityDeletable = entity as IDeletable;
                    entityDeletable.IsActive = GlobalConstants.Deactivated;
                }
                break;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Will build all events in simulaiton
        /// </summary>
        /// <param name="eventType">EventType</param>
        /// <param name="eventTime">EventTime</param>
        /// <param name="currentEntity">CurrentEntity</param>
        /// <returns></returns>
        public Event Spawn(EEventType eventType, int eventTime, Entity currentEntity)
        {
            Event newEvent = null;

            switch (eventType)
            {
            case EEventType.ARRIVAL:
                newEvent = new ArrivalEvent(eventTime, currentEntity);
                break;

            case EEventType.SWITCH_COMPLETE:
                newEvent = new SwitchCompleteEvent(eventTime, currentEntity);
                break;

            case EEventType.PROCESSING_COMPLETE:
                newEvent = new ProcessingCompleteEvent(eventTime, currentEntity);
                break;

            case EEventType.END_SIMULATION:
                newEvent = new EndSimulationEvent(eventTime, currentEntity);
                break;
            }

            return(newEvent);
        }
Esempio n. 4
0
 public static void OnListenerRemoved(EEventType eventType)
 {
     if (mEventTable[eventType] == null)
     {
         mEventTable.Remove(eventType);
     }
 }
        private void SetAudit(object entity, EEventType eventType)
        {
            var publicKey = HttpContextAccess.GetPublicKey();

            //var id = _userRepository.FindUserByPublicKey(publicKey).Id;
            SetAuditToEntity(entity, eventType, 1);
        }
Esempio n. 6
0
 public ConfigurationEvent(EValueType valueType, EEventType eventType, EEventCode eventCode, uint eventValue = 0)
 {
     ValueType  = valueType;
     EventType  = eventType;
     EventCode  = eventCode;
     EventValue = eventValue;
 }
        // called to create a non-derived event for simple things;
        // but keep other classes limited to calling specific factory
        // methods
        protected static EventOfHurt CreateGeneric(
            EEventType evt, ESubsystem src,
            ESubsystem dest = ESubsystem.Dispatcher,
            Tuple <EventOfHurt, DateTime>[] reasons = null
            )
        {
            EventOfHurt RetVal;

            if (dest == null)
            {
                dest = ESubsystem.Dispatcher;
            }
            List <Tuple <EventOfHurt, DateTime> > ReasonList =
                new List <Tuple <EventOfHurt, DateTime> >();

            if (reasons != null)
            {
                ReasonList.AddRange(reasons);
            }
            // the initializer after the constructor allows for a
            // lot more flexibility than e.g., optional params
            RetVal = new EventOfHurt(evt, src)
            {
                myEventReferences = ReasonList
            };
            return(RetVal);
        }
Esempio n. 8
0
 //标记成不被删除的event
 public static void MarkAsPermanent(EEventType eventType)
 {
     if (!mPermanentMessages.Contains(eventType))
     {
         mPermanentMessages.Add(eventType);
     }
 }
Esempio n. 9
0
 public void Invoke(EEventType mEventType)
 {
     foreach (SubscriberFunction mSubscriberFunction in FunctionList(mEventType))
     {
         mSubscriberFunction.Invoke();
     }
 }
 public void RegisterListener( EEventType eventType, ListenerDelegate delg )
 {
     EventObject obj = new EventObject();
     obj.MyEvent = eventType;
     obj.ThisDelegate = delg;
     listenerObjects.Add( obj );
 }
Esempio n. 11
0
 public void ActivateEvent <T1, T2>(EEventType eventType, T1 arg1, T2 arg2)
 {
     if (TypeCheck(eventType, typeof(Action <T1, T2>)))
     {
         (m_Event[eventType] as Action <T1, T2>)?.Invoke(arg1, arg2);
     }
 }
Esempio n. 12
0
 public void SendEvent(EEventType eEventType)
 {
     if (m_actorEventHandler != null)
     {
         m_actorEventHandler.SendEvent(eEventType);
     }
 }
Esempio n. 13
0
    public void AddEvent(EEventType eEventType, Delegate callback)
    {
        if (callback == null)
        {
            Debug.LogWarning("XX");
            return;
        }

        int idEvent = (int)eEventType;
        List <EventListen> lstListen = null;

        if (!m_dicEvent.TryGetValue(idEvent, out lstListen))
        {
            lstListen = new List <EventListen>();
        }

        for (int i = 0, count = lstListen.Count; i < count; i++)
        {
            EventListen eventListen = lstListen[i];
            if (eventListen.m_callBack == callback)
            {
                Debug.LogWarning("Add Same Key");
            }
        }

        lstListen.Add(new EventListen(null, callback));
        m_dicEvent[idEvent] = lstListen;
    }
Esempio n. 14
0
 public static void UnregisterEvent(EDelayType p_delayType, EEventType p_eventType, EventHandler p_delegate)
 {
     if (p_delegate != null)
     {
         s_eventMap[(Int32)p_delayType][(Int32)p_eventType].Remove(p_delegate);
     }
 }
Esempio n. 15
0
        public IEvent Allocate(EEventType eventType, bool isRemote)
        {
            var rc = (IEvent)_allocators[(int)eventType].Allocate();

            rc.IsRemote = isRemote;
            return(rc);
        }
Esempio n. 16
0
        private static IEnumerator InvokeOnFrameEnd(Object p_sender, EEventType p_eventType, EventArgs p_eventArgs)
        {
            yield return(s_EndOfFrame);

            InvokeEvent(EDelayType.ON_FRAME_END, p_eventType, p_sender, p_eventArgs);
            yield break;
        }
Esempio n. 17
0
        static DelayedEventManager()
        {
            Int32 length = Enum.GetValues(typeof(EDelayType)).Length;

            EEventType[] array = (EEventType[])Enum.GetValues(typeof(EEventType));
            s_eventMap = new List <EventHandler> [length][];
            for (Int32 i = 0; i < s_eventMap.Length; i++)
            {
                s_eventMap[i] = new List <EventHandler> [array.Length];
                for (Int32 j = 0; j < s_eventMap[i].Length; j++)
                {
                    s_eventMap[i][j] = new List <EventHandler>();
                }
            }
            s_defaultFixedDelays[EEventType.PARTY_GET_LOOT]    = 2f;
            s_defaultFixedDelays[EEventType.CHARACTER_BARK]    = 3f;
            s_defaultFixedDelays[EEventType.CHARACTER_XP_GAIN] = 0.85f;
            foreach (KeyValuePair <EEventType, Single> keyValuePair in s_defaultFixedDelays)
            {
                s_fixedDelays.Add(keyValuePair.Key, keyValuePair.Value);
            }
            EEventType[] array2 = array;
            for (Int32 k = 0; k < array2.Length; k++)
            {
                EEventType eeventType    = array2[k];
                EEventType eventTypeCopy = eeventType;
                LegacyLogic.Instance.EventManager.RegisterEvent(eeventType, delegate(Object pSender, EventArgs pArgs)
                {
                    OnEventManagerEvent(pSender, eventTypeCopy, pArgs);
                });
            }
        }
Esempio n. 18
0
 public LTEventData(string id, Action <string> handler, bool inQueue)
 {
     eventID           = id;
     stringParamAction = handler;
     doInQueue         = inQueue;
     eType             = EEventType.STRING;
 }
Esempio n. 19
0
 public LTEventData(string id, Action <int> handler, bool inQueue)
 {
     eventID        = id;
     intParamAction = handler;
     doInQueue      = inQueue;
     eType          = EEventType.INT;
 }
Esempio n. 20
0
 public LTEventData(string id, Action handler, bool inQueue)
 {
     eventID          = id;
     emptyParamAction = handler;
     doInQueue        = inQueue;
     eType            = EEventType.NONE;
 }
Esempio n. 21
0
        /// <summary>
        /// Creates an Event of the designated type, to occure at a specified time, and bound to a given entity
        /// </summary>
        /// <param name="eventType">The type of event to create</param>
        /// <param name="eventTime">The time the event will occur</param>
        /// <param name="entity">The Call this event is bound to (Can be null)</param>
        /// <returns></returns>
        public Event CreateEvent(EEventType eventType, DateTime eventTime, Call entity)
        {
            //Create an event to return
            Event eve = null;

            //Switch on the possible event types
            switch (eventType)
            {
            case EEventType.CallArrive:
                eve = new CallArriveEvent(entity, eventTime);
                break;

            case EEventType.SwitchCompleted:
                eve = new SwitchCompletedEvent(entity, eventTime);
                break;

            case EEventType.CompletedService:
                eve = new CompletedServiceEvent(entity, eventTime);
                break;

            case EEventType.EndReplication:
                eve = new EndReplicationEvent(eventTime);
                break;
            }

            return(eve);
        }
Esempio n. 22
0
        private void SafeSetHandler(EEventType eventType, IEventHandler handler)
        {
            var id = (int)eventType;

            // DebugUtil.MyLog("Safe set eventtype:"+eventType);
            if (ArrayUtility.SafeGet(_allocators, id) == null)
            {
                var msg = String.Format("_allocators id not exist id {0}, type {1}, type {2}", id, _types[id],
                                        handler.GetType());
                AssertUtility.Assert(false, msg);
                _logger.Error(msg);
            }
            else if (ArrayUtility.SafeGet(_eventHandlers, id) != null)
            {
                var msg = String.Format("IEventHandler id already exist id {0}, type {1}, type {2}", id, _types[id],
                                        handler.GetType());
                AssertUtility.Assert(false, msg);
                _logger.Error(msg);
            }
            else
            {
                ArrayUtility.SafeSet(ref _eventHandlers, id, handler);
            }
            _maxId = Mathf.Max(id, _maxId);
        }
Esempio n. 23
0
 public LTEventData(string id, Action <object> handler, bool inQueue)
 {
     eventID        = id;
     objParamAction = handler;
     doInQueue      = inQueue;
     eType          = EEventType.OBJ;
 }
Esempio n. 24
0
 public void RemoveListener <T1, T2>(EEventType eventType, Action <T1, T2> listenerMethod)
 {
     if (TypeCheck(eventType, listenerMethod.GetType()))
     {
         m_Event[eventType] = (Action <T1, T2>)m_Event[eventType] - listenerMethod;
     }
 }
Esempio n. 25
0
 public Event(EEventType type, ERepeat repeat, DateTimeOffset time, Range?owner)
 {
     Type   = type;
     Repeat = repeat;
     Time   = time;
     Owner  = owner;
 }
Esempio n. 26
0
 public void AddLisenter <T1>(EEventType eventType, Action <T1> listenerMethod)
 {
     if (TypeCheck(eventType, listenerMethod.GetType()))
     {
         m_Event[eventType] = (Action <T1>)m_Event[eventType] + listenerMethod;
     }
 }
Esempio n. 27
0
        private bool translateEvent(EEventType type, object[] args, out EEventType out_type, out object[] out_args)
        {
            switch (type)
            {
            case EEventType.TILE_MOVE_RELATIVETY:
            {
                var tile      = args[0] as Logic.Tile;
                var direction = (EDirection)args[1];

                out_type = EEventType.TILE_MOVE;

                out_args    = new object[2];
                out_args[0] = tile;

                if (direction == EDirection.UP)
                {
                    if (tile.Position.Row >= tile.Parent.LayerCollide.Height)
                    {
                        return(false);
                    }

                    out_args[1] = new Logic.TilePosition(tile.Position.Row + 1, tile.Position.Col);
                }
                else if (direction == EDirection.DOWN)
                {
                    if (tile.Position.Row <= 0)
                    {
                        return(false);
                    }

                    out_args[1] = new Logic.TilePosition(tile.Position.Row - 1, tile.Position.Col);
                }
                else if (direction == EDirection.LEFT)
                {
                    if (tile.Position.Col <= 0)
                    {
                        return(false);
                    }

                    out_args[1] = new Logic.TilePosition(tile.Position.Row, tile.Position.Col - 1);
                }
                else if (direction == EDirection.RIGHT)
                {
                    if (tile.Position.Col >= tile.Parent.LayerCollide.Width)
                    {
                        return(false);
                    }

                    out_args[1] = new Logic.TilePosition(tile.Position.Row, tile.Position.Col + 1);
                }

                return(true);
            }
            }

            out_type = type;
            out_args = args;

            return(true);
        }
Esempio n. 28
0
    /**
     * Default constructor
     */
    public SoundEvent()
    {
        EventName        = "";
        EventDescription = "";

        // Hash the name to optimize names lookup
        EventID = EventName.GetHashCode();

        EventAction = EEventAction.None;
        EventType   = EEventType.Sfx;

        // Add a null element
        EventTargets.Add(null);

        EventIsRandom       = false;
        EventIsLooping      = false;
        EventIsVolumeRandom = false;
        EventIsPitchRandom  = false;

        EventMaxInstance = 1;
        EventVolume      = 0.5f;
        EventPitch       = 1.0f;
        EventToStop      = "";

        EventPitchRandomRange  = Vector2.zero;
        EventVolumeRandomRange = Vector2.zero;
        EventRTPC = null;
    }
Esempio n. 29
0
 public void AddEvent(EEventType type, params object[] args)
 {
     if (translateEvent(type, args, out type, out args))
     {
         var data = new EventData(mIdGenerator++, type, args);
         mEventQ.Enqueue(data);
     }
 }
Esempio n. 30
0
 public void AddLisenter(EEventType eventType, IObeserver obeserver)
 {
     if (m_Event[eventType] == null)
     {
         m_Event.Add(eventType, new List <IObeserver>());
     }
     m_Event[eventType].Add(obeserver);
 }
Esempio n. 31
0
 public void RemoveListener(EEventType eventType, IObeserver obeserver)
 {
     if (m_Event[eventType] == null)
     {
         return;
     }
     m_Event[eventType].Remove(obeserver);
 }
 public void ThrowEvent(object sender, EEventType eventType, EventArgs args)
 {
     for( int x=0; x<listenerObjects.Count; ++x )
     {
         EventObject obj = listenerObjects[x];
         if( obj.MyEvent == eventType )
         {
             obj.ThisDelegate( sender, args );
         }
     }
 }
 public void UnregisterListener( EEventType eventType, ListenerDelegate delg )
 {
     EventObject obj;
     for( int x=0; x<listenerObjects.Count; ++x )
     {
         obj = listenerObjects[x];
         if( eventType == obj.MyEvent  )
         {
             if( delg.GetHashCode() == obj.ThisDelegate.GetHashCode() )
             {
                 listenerObjects.RemoveAt( x );
                 break;
             }
         }
     }
 }
Esempio n. 34
0
        /// <summary>
        /// Will build all events in simulaiton 
        /// </summary>
        /// <param name="eventType">EventType</param>
        /// <param name="eventTime">EventTime</param>
        /// <param name="currentEntity">CurrentEntity</param>
        /// <returns></returns>
        public Event Spawn(EEventType eventType, int eventTime, Entity currentEntity)
        {
            Event newEvent = null;

            switch (eventType)
            {
                case EEventType.ARRIVAL:
                    newEvent = new ArrivalEvent(eventTime, currentEntity);
                    break;
                case EEventType.SWITCH_COMPLETE:
                    newEvent = new SwitchCompleteEvent(eventTime, currentEntity);
                    break;
                case EEventType.PROCESSING_COMPLETE:
                    newEvent = new ProcessingCompleteEvent(eventTime, currentEntity);
                    break;
                case EEventType.END_SIMULATION:
                    newEvent = new EndSimulationEvent(eventTime, currentEntity);
                    break;
            }

            return newEvent;
        }
Esempio n. 35
0
    //增加动画事件
    public void AddEvent(BaseActor baseActor, string animationName, EEventType eventType)
    {
        switch (eventType)
        {
            case EEventType.SwapGun:
                {
                    IAction act = ScriptableObject.CreateInstance<IAction>();
                    act.name = EEventType.SwapGun.ToString();
                    act.eventType = (int)EEventType.SwapGun;
                    act.baseActor = baseActor;

                    AnimationEvent evt = new AnimationEvent();                    
                    evt.time = 0.5f;
                    evt.functionName = "OnAnimationEvent";
                    evt.objectReferenceParameter = act as Object;
                    animation.GetClip(animationName).AddEvent(evt);
                }
                break;
            default:
                break;
        }
    }
Esempio n. 36
0
 public Event(EEventType Type)
 {
     this.Type = Type;
 }
Esempio n. 37
0
 public KeyEvent(EEventType Type)
     : base(Type)
 {
 }
Esempio n. 38
0
 public SystemEvent(EEventType Type)
     : base(Type)
 {
 }
Esempio n. 39
0
	internal void FireEvent(EEventType a_type, FFEventParameter a_eventParam = null)
	{
		FireEvent(a_type.ToString());
	}
Esempio n. 40
0
	internal void UnregisterForEvent(EEventType a_type, EventCallback a_callback)
	{
		UnregisterForEvent(a_type.ToString(), a_callback);
	}