public NewRepositorySerilizerEventArgs(eEventType EventType, string FilePath, string XML, RepositoryItemBase TargetObj) { this.EventType = EventType; this.FilePath = FilePath; this.XML = XML; this.TargetObj = TargetObj; }
public static void TriggerMailByEvent(CharacterController character, eEventType type, int param0 = 0, int param1 = 0) { //获得该事件影响的条件 var conlist = ConditionManager.EventTriggerCondition(type, param0); if (conlist == null) { return; } //整理这些条件影响了哪些邮件 maillist.Clear(); foreach (var i in conlist) { ConditionMail(character, maillist, i.Key); } //尝试接受这些邮件 foreach (var i in maillist) { //character.mTask.TryAccept(character, i.Key); character.mMail.PushMail(i.Key); } }
/// <summary> /// Creates an instance of the Event object /// </summary> /// <example> /// <code> /// CEvent event = new CEvent(new DateTime(2006,1,1), HOLIDAY, 2, "Christmas"); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 02/15/06 rrr N/A N/A Creation of class /// 04/26/06 rrr N/A N/A Added a string parameter and instance variable /// initialization public CEvent(DateTime objDate, eEventType eType, int intIndex, string strName) { m_strName = strName; m_Date = objDate; m_intIndex = intIndex; m_eEventType = eType; } //CEvent
//根据事件找到所有影响的条件 public Dictionary <int, int> EventTriggerCondition(eEventType type, int nParam) { //检查类型是否存在 Dictionary <int, List <int> > ParamCondi; if (!ConditionManager.EventTypeList.TryGetValue(type, out ParamCondi)) { return(null); } List <int> CondiList; //检查相应参数的Key是否存在 if (!ParamCondi.TryGetValue(nParam, out CondiList)) { return(null); } //整理任务 var result = new Dictionary <int, int>(); foreach (var i in CondiList) { result[i] = 1; } return(result); }
public void Broadcasting <T, U>(eEventType eType, T arg1, U arg2) { _broadcasting.Add(new BroadcastInfo( ) { eType = eType, obj1 = arg1, obj2 = arg2 }); }
public RunnerItemEventArgs(eEventType EventType, RunnerItemPage runnerItemPage, RunnerItemPage.eRunnerItemType runnerItemType, object runnerItemObject) { this.EventType = EventType; this.RunnerItemPage = runnerItemPage; this.RunnerItemType = runnerItemType; this.RunnerItemObject = runnerItemObject; }
static void OnListenerRemoved(eEventType eventType) { if (m_EventTable[eventType] == null) { m_EventTable.Remove(eventType); } }
public void Broadcasting <T>(eEventType eType, T arg1) { _broadcasting.Add(new BroadcastInfo( ) { eType = eType, obj1 = arg1, obj2 = null }); }
public void Broadcasting(eEventType eType) { _broadcasting.Add(new BroadcastInfo( ) { eType = eType, obj1 = null, obj2 = null }); }
public void SpawnEvent(bool type, Unit target) { if (!Live) { return; } //< 스킬이벤트가 활성화중일떈 나감 if (EventUpdate && _eEventType == eEventType.Skill) { return; } if (ActiveEvent == type) { return; } ActiveEvent = type; StopAllCoroutines(); //< 타겟 리스트를 구한다. if (type) { units.Clear(); units.Add(target); SetLayer(target, 14); } _eEventType = eEventType.Spawn; StartCoroutine("CameraUpdate_Spawn", ActiveEvent); }
//初始化一个条件(当事件来的时候,知道哪个条件会被有修改) private void InitOneType(eEventType type, int nConditionId, int nParam) { //是否只有任务需要整理条件,如果是的话,发现条件能触发任务才继续整理 var IsOnlyMission = false; if (IsOnlyMission) { if (!MissionManager.CheckConditionEventMission(nConditionId)) { return; } } //检查类型是否存在,不存在则造一个 Dictionary <int, List <int> > paramCondi; if (!ConditionManager.EventTypeList.TryGetValue(type, out paramCondi)) { paramCondi = new Dictionary <int, List <int> >(); ConditionManager.EventTypeList[type] = paramCondi; } //检查相应参数的Key是否存在,不存在则造一个 List <int> condiList; if (!paramCondi.TryGetValue(nParam, out condiList)) { condiList = new List <int>(); paramCondi[nParam] = condiList; } //添加数据 condiList.Add(nConditionId); }
public uint getSingleBits(eEventType et) { uint[] res = bits.lookup(et); if (res.isEmpty()) { return(0); } Debug.Assert(1 == res.Length); return(res[0]); }
public void RemoveEvent <T, U>(eEventType eType, EventCallback <T, U> handler) { CheckRemoveEvent(eType, handler); _eventTable[eType] = (EventCallback <T, U>)_eventTable[eType] - handler; if (_eventTable[eType] == null) { _eventTable.Remove(eType); } }
public void RegisterEvent <T, U>(eEventType eType, EventCallback <T, U> handler) { if (!_eventTable.ContainsKey(eType)) { _eventTable.Add(eType, null); } CheckRegisterEvent(eType, handler); _eventTable[eType] = (EventCallback <T, U>)_eventTable[eType] + handler; }
static void OnListenerAdding(eEventType eventType, Delegate callBack) { if (!m_EventTable.ContainsKey(eventType)) { m_EventTable.Add(eventType, null); } Delegate d = m_EventTable[eventType]; if (d != null && d.GetType() != callBack.GetType()) { throw new Exception(string.Format("尝试为事件{0}添加不同类型的委托,当前事件对应的的委托是{1},要添加的委托类型是{2}", eventType, d.GetType(), callBack)); } }
public static void Invoke(eEventType type, eEventMessage msg, params object[] obj) { IsInvoking = true; var e = logicEventSet.GetEnumerator(); while (e.MoveNext()) { if (e.Current.Type.HasFlag(type)) { e.Current.Event.OnInvoked(msg, obj); } } IsInvoking = false; }
//public delegate void EventCallback<T, U, V>( T arg1, U arg2, V arg3 ); private void CheckRegisterEvent(eEventType eType, Delegate handler) { if (!_eventTable.ContainsKey(eType)) { return; } Delegate d = _eventTable[eType]; if (d != null && d.GetType( ) != handler.GetType( )) { throw new EventDispatcherException(string.Format("注册一个消息事件出错,类型:{0},原类型:{1},新增类型:{2}", eType, d.GetType( ).Name, handler.GetType( ).Name)); } }
/// <summary> /// Reads the DST dates from the meter from Table 2260 /// </summary> /// <returns>The TOU Schedule object.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 11/20/10 SCW N/Q Created // 11/30/10 jrf 9.70.11 Offseting DST month and day by 1. private List <CDSTDatePair> ReadDSTDates() { if (m_DSTCalendar == null) { m_DSTCalendar = new CENTRON2_MONO_DSTCalendarConfig(m_PSEM); } List <CDSTDatePair> lstDSTDates = new List <CDSTDatePair>(); for (int iYearCounter = 0; iYearCounter < m_DSTCalendar.MaxYears; iYearCounter++) { CalendarEvent[] CalEvents = m_DSTCalendar.Years[iYearCounter].Events; int iYear = 2000 + (int)m_DSTCalendar.Years[iYearCounter].Year; CDSTDatePair DST = new CDSTDatePair(); // Index 0 and Index 1 are the To and From DST Date respectively for (int iDayEvent = 0; iDayEvent < m_DSTCalendar.EventsPerYear; iDayEvent++) { eEventType eType = m_DSTCalendar.GetEventType(CalEvents[iDayEvent].Type); if (eEventType.TO_DST == eType) { // It is a valid event // Month and day are zero based so we are adding one. DST.ToDate = new DateTime(iYear, CalEvents[iDayEvent].Month + 1, CalEvents[iDayEvent].Day + 1, m_DSTCalendar.DSTHour, m_DSTCalendar.DSTMinute, 0); } else if (eEventType.FROM_DST == eType) { // It is a valid event // Month and day are zero based so we are adding one. DST.FromDate = new DateTime(iYear, CalEvents[iDayEvent].Month + 1, CalEvents[iDayEvent].Day + 1, m_DSTCalendar.DSTHour, m_DSTCalendar.DSTMinute, 0); } } lstDSTDates.Add(DST); // It may be possible that some of the years are not filled in so we need to // make sure that the year is valid by checking to see if the next year is // greater than the current if (iYearCounter + 1 < m_DSTCalendar.MaxYears && (int)m_DSTCalendar.Years[iYearCounter + 1].Year + 2000 < iYear) { break; } } return(lstDSTDates); }
/// <summary> /// 广播1参方法 /// </summary> /// <param name="eventType"></param> public static void Broadcast <T>(eEventType eventType, T arg) { Delegate d; if (m_EventTable.TryGetValue(eventType, out d)) { CallBack <T> callBack = d as CallBack <T>; if (callBack != null) { callBack(arg); } else { throw new Exception(string.Format("广播事件错误:事件{0}对应的委托具有不同类型", eventType)); } } }
public static void Broadcast <T, X, Y, Z, W>(eEventType eventType, T arg1, X arg2, Y arg3, Z arg4, W arg5) { Delegate d; if (m_EventTable.TryGetValue(eventType, out d)) { CallBack <T, X, Y, Z, W> callBack = d as CallBack <T, X, Y, Z, W>; if (callBack != null) { callBack(arg1, arg2, arg3, arg4, arg5); } else { throw new Exception(string.Format("广播事件错误:事件{0}对应的委托具有不同类型", eventType)); } } }
void iRawInputSink.handle(ulong timestamp, eEventType eventType, ushort code, int value) { try { nativeTimeStamp = timestamp; switch (eventType) { case eEventType.Synchro: handleSyncro((eSynchroEvent)(code & 0xFF)); return; case eEventType.Key: handleKeyOrButton(code, value); return; case eEventType.Relative: handleRelative((eRelativeAxis)code, value); return; case eEventType.Absolute: handleAbsolute((eAbsoluteAxis)(code & 0xFF), value); return; case eEventType.Miscellaneous: handleMiscellaneous((eMiscEvent)(code & 0xFF), value); return; case eEventType.Switch: handleSwitch((eSwitch)(code & 0xFF), value); return; case eEventType.LED: handleLed((eLed)(code & 0xFF), value); return; } } catch (Exception ex) { // ComLight runtime marshals exceptions into failed HRESULT codes, in this case it would cause the app to shut down the dispatcher and quit. // Hopefully, an exception in user input handler is not a good reason to shut down. ex.logError("RawDeviceBase.iRawInputSink failed"); ConsoleLogger.logDebug("Moar info: {0}", ex.ToString()); } }
private void CheckRemoveEvent(eEventType eType, Delegate handler) { if (!_eventTable.ContainsKey(eType)) { throw new EventDispatcherException(string.Format("删除一个消息事件出错,类型:{0},没找到该消息", eType)); } Delegate d = _eventTable[eType]; if (d == null) { throw new EventDispatcherException(string.Format("删除一个消息事件出错,类型:{0},没找到该消息", eType)); } else if (d.GetType( ) != handler.GetType( )) { throw new EventDispatcherException(string.Format("删除一个消息事件出错,类型:{0},原类型:{1},删除类型:{2}", eType, d.GetType( ).Name, handler.GetType( ).Name)); } }
static void OnListenerRemoving(eEventType eventType, Delegate callBack) { if (m_EventTable.ContainsKey(eventType)) { Delegate d = m_EventTable[eventType]; if (d == null) { throw new Exception(string.Format("移除监听错误:事件{0}没有对应的委托", eventType)); } else if (d.GetType() != callBack.GetType()) { throw new Exception(string.Format("移除监听错误:尝试为事件{0}移除不同类型的委托,当前委托类型为{1}" + ",要移除的委托的类型为{2}", eventType, d.GetType(), callBack.GetType())); } } else { throw new Exception(string.Format("移除监听错误:没有事件码{0}", eventType)); } }
public EventSubscription(VideoDevice videoDevice) { device = videoDevice.file; eEventType[] eventTypes = new eEventType[] { eEventType.EndOfStream, eEventType.SourceChange, }; foreach (var e in eventTypes) { // Subscribe for the events sEventSubscription evt = new sEventSubscription() { type = e }; device.call(eControlCode.SUBSCRIBE_EVENT, ref evt); } }
public static GameEvent FromObject(JsonData jsonObject) { GameEvent gameEvent = null; eEventType gameEventType = (eEventType)((int)jsonObject["event_type"]); Type gameEventClass = GameEvent.GetEventClassForType(gameEventType); if (gameEventClass != null) { long epochTicks = JsonUtilities.ParseLong(jsonObject, "timestamp") + UNIX_EPOCH.Ticks; gameEvent = (GameEvent)Activator.CreateInstance(gameEventClass); gameEvent.EventType = gameEventType; gameEvent.Timestamp = new DateTime(epochTicks); // Parse the child event fields based on type gameEvent.ParseParameters(jsonObject["parameters"] as JsonData); } return(gameEvent); }
private void ExecuteEvent(eEventType eventType) { if (enabled) { int conversationIndex = m_events[(int)eventType]; if (conversationController && !conversationController.IsPlayingDialog && m_activeEvents.Contains(eventType)) { UnityAction onCloseAction = null; if (onCloseEvent != null) { onCloseAction = () => onCloseEvent.Invoke(); } if (conversationIndex < 0) { conversationController.StartConversation(onCloseAction); } else { conversationController.StartConversation(conversationIndex, onCloseAction); } } } }
/// <summary> /// Reads the TOU Schedule from the meter into a TOUSchedule object /// </summary> /// <returns>The TOU Schedule object.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 01/04/07 RCG 8.00.04 Made more generic and promoted from CENTRON_AMI // 04/13/07 RCG 8.00.31 2919 Adding support for Output events. // 03/10/08 KRC 1.50.02 Adding Ability to create TOU Schedule from EDL file // 12/03/10 DEO 9.70.13 Promoted from ANSIDevice public static CTOUSchedule ReadCENTRON2TOUSchedule(TOUConfig TOUConfigTable, CalendarConfig CalendarConfigTable) { Int16Collection NormalDays; Int16Collection HolidayDays; ANSITOUSchedule TOUSchedule = new ANSITOUSchedule(); TOUConfig.TOU_Season CurrentSeason; int iNextEventCounter = 0; int iPatternID = 0; try { // First set up the typical week so that we know which day corresponds to which daytype if (TOUConfigTable.NumberOfSupportedSeasons > 0) { CurrentSeason = TOUConfigTable.Seasons[0]; // We have to assume that the Typical week is that same for all seasons. NOTE: The Day to Daytype is 1 based // so we need to subtract 1 TOUSchedule.TypicalWeek[(int)eTypicalDay.SUNDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalSunday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.MONDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalMonday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.TUESDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalTuesday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.WEDNESDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalWednesday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.THURSDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalThursday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.FRIDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalFriday]; TOUSchedule.TypicalWeek[(int)eTypicalDay.SATURDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalSaturday]; } for (int iSeasonCounter = 0; iSeasonCounter < TOUConfigTable.NumberOfSupportedSeasons; iSeasonCounter++) { // Get the Season that we are dealing with. CurrentSeason = TOUConfigTable.Seasons[iSeasonCounter]; NormalDays = new Int16Collection(); HolidayDays = new Int16Collection(); for (int iDayTypeCounter = 0; iDayTypeCounter < TOUConfigTable.DayTypesPerSeason; iDayTypeCounter++) { CSwitchPointCollection SPColl = new CSwitchPointCollection(); for (int iEventCounter = 0; iEventCounter < TOUConfigTable.EventsPerDayType; iEventCounter++) { // Get the Day Event TOUConfig.DayEvent DayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iEventCounter]; ushort usEvent = DayEvent.Event; if (usEvent != (ushort)TOUConfig.DayEvent.TOUEvent.NoMoreChanges) { if (IsRateChangeEvent(usEvent) == true) { // We have a valid Event, so proceed with createing a SwitchPoint int iHour = (int)DayEvent.Hour; int iMinute = (int)DayEvent.Minute; int iStartTime = (iHour * 60) + iMinute; int iEndTime = 24 * 60; iNextEventCounter = iEventCounter + 1; while (iNextEventCounter < TOUConfigTable.EventsPerDayType) { TOUConfig.DayEvent NextDayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iNextEventCounter]; if (IsRateChangeEvent(NextDayEvent.Event) == true) { iHour = (int)NextDayEvent.Hour; iMinute = (int)NextDayEvent.Minute; iEndTime = (iHour * 60) + iMinute; // We need to stop looking once we find the next rate change event. break; } iNextEventCounter++; } // Add the rate change event int iRateIndex = GetRateIndex(usEvent); // Finally figure out the Switchpoint type CSwitchPoint SchedSwitchPoint = new CSwitchPoint(iStartTime, iEndTime, iRateIndex, eSwitchPointType.RATE); SPColl.Add(SchedSwitchPoint); } else if (IsOutputOnEvent(usEvent) == true) { // We have a valid output on Event, so proceed with createing a SwitchPoint int iHour = (int)DayEvent.Hour; int iMinute = (int)DayEvent.Minute; int iStartTime = (iHour * 60) + iMinute; int iEndTime = 24 * 60; int iOutputIndex = GetOutputIndex(usEvent); // Find the OutputOff event for this rate if one exists iNextEventCounter = iEventCounter + 1; while (iNextEventCounter < TOUConfigTable.EventsPerDayType) { TOUConfig.DayEvent NextDayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iNextEventCounter]; if (IsOutputOffEvent(NextDayEvent.Event) == true) { // Check to see if the index matches if (iOutputIndex == GetOutputIndex(NextDayEvent.Event)) { iHour = (int)NextDayEvent.Hour; iMinute = (int)NextDayEvent.Minute; iEndTime = (iHour * 60) + iMinute; // We need to stop looking once we find the next rate change event. break; } } iNextEventCounter++; } // Finally figure out the Switchpoint type CSwitchPoint SchedSwitchPoint = new CSwitchPoint(iStartTime, iEndTime, iOutputIndex, eSwitchPointType.OUTPUT); SPColl.Add(SchedSwitchPoint); } // We do not need to handle the OutputOff event since they get handled by the OutputOn check } } // Since we have no way of knowing whether the the patterns for the current season are related // to the patterns in other seasons we need to add the patterns regardless of whether or not it // has already been duplicated in another season // To keep the patterns unique we need to add in an offset for the season number iPatternID = iDayTypeCounter + iSeasonCounter * TOUConfigTable.DayTypesPerSeason; CPattern SchedPattern = new CPattern(iPatternID, "Pattern " + iDayTypeCounter.ToString(CultureInfo.InvariantCulture), SPColl); NormalDays.Add((short)iPatternID); // The Day to Daytype conversions are 1's based so subract 1 if (iDayTypeCounter == CurrentSeason.TypicalHoliday) { // This Day Type is a holiday HolidayDays.Add((short)iPatternID); } TOUSchedule.Patterns.Add(SchedPattern); } // Add the season to the schedule CSeason SchedSeason = new CSeason(iSeasonCounter + 1, "Season " + (iSeasonCounter + 1).ToString(CultureInfo.InvariantCulture), NormalDays, HolidayDays); TOUSchedule.Seasons.Add(SchedSeason); } // Now deal with the Calendar part of the config TOUSchedule.TOUID = CalendarConfigTable.CalendarID; for (int iYearCounter = 0; iYearCounter < CalendarConfigTable.MaxYears; iYearCounter++) { CEventCollection EventColl = new CEventCollection(); CalendarEvent[] CalEvents = CalendarConfigTable.Years[iYearCounter].Events; int iYear = 2000 + (int)CalendarConfigTable.Years[iYearCounter].Year; // Start at Index 2, which is the first non-DST Event for (int iDayEvent = CalendarConfigTable.DSTEventsPerYear; iDayEvent < CalendarConfigTable.EventsPerYear; iDayEvent++) { eEventType eType = CalendarConfigTable.GetEventType(CalEvents[iDayEvent].Type); int iEventIndex = iDayEvent; if (eEventType.NO_EVENT != eType) { // It is a valid event DateTime dtDate = new DateTime(iYear, CalEvents[iDayEvent].Month + 1, CalEvents[iDayEvent].Day + 1); // Determine the index for the event if (eType == eEventType.SEASON) { iEventIndex = CalEvents[iDayEvent].Type - (int)CalendarEvent.CalendarEventType.SEASON1 - 1; } else if (eType == eEventType.HOLIDAY) { // Determine which Holiday day type to use // Currently the ANSI devices only support 1 holiday day type so this is always 0 iEventIndex = 0; } CEvent Event = new CEvent(dtDate, eType, iEventIndex, "Event " + iDayEvent.ToString(CultureInfo.InvariantCulture)); EventColl.Add(Event); } } CYear Year = new CYear(iYear, EventColl); TOUSchedule.Years.Add(Year); // It may be possible that some of the years are not filled in so we need to // make sure that the year is valid by checking to see if the next year is // greater than the current if (iYearCounter + 1 < CalendarConfigTable.MaxYears && (int)CalendarConfigTable.Years[iYearCounter + 1].Year + 2000 < iYear) { break; } } } catch (Exception e) { throw (e); } return(TOUSchedule); }
public AutomateEventArgs(eEventType EventType, object Object) { this.EventType = EventType; this.Object = Object; }
//TODO: create event per type!????????????? so can listen to specific events public GingerRunnerEventArgs(eEventType EventType, object Object) { this.EventType = EventType; this.Object = Object; }
public bool IsUsingEvent(eEventType eventType) { return(m_activeEvents.Contains(eventType)); }
public WidgetEvent(eEventType eventType, IWidget eventSource, object eventParameters) { EventType = eventType; EventSource = eventSource; EventParameters = eventParameters; }
private static Type GetEventClassForType(eEventType eventType) { Type eventClass = null; switch(eventType) { case eEventType.character_joined_game: eventClass = typeof(GameEvent_CharacterJoinedGame); break; case eEventType.character_left_game: eventClass = typeof(GameEvent_CharacterLeftGame); break; case eEventType.character_died: eventClass = typeof(GameEvent_CharacterDied); break; case eEventType.character_moved: eventClass = typeof(GameEvent_CharacterMoved); break; case eEventType.character_portaled: eventClass = typeof(GameEvent_CharacterPortaled); break; case eEventType.character_attacked: eventClass = typeof(GameEvent_CharacterAttacked); break; case eEventType.mob_spawned: eventClass = typeof(GameEvent_MobSpawned); break; case eEventType.mob_died: eventClass = typeof(GameEvent_MobDied); break; case eEventType.mob_moved: eventClass = typeof(GameEvent_MobMoved); break; case eEventType.mob_attacked: eventClass = typeof(GameEvent_MobAttacked); break; case eEventType.mob_dialog: eventClass = typeof(GameEvent_MobDialog); break; case eEventType.mob_player_prop_spotted: eventClass = typeof(GameEvent_MobPlayerPropSpotted); break; case eEventType.mob_player_prop_lost_track: eventClass = typeof(GameEvent_MobPlayerPropLostTrack); break; case eEventType.mob_ai_prop_spotted: eventClass = typeof(GameEvent_MobAIPropSpotted); break; case eEventType.mob_energy_tank_prop_spotted: eventClass = typeof(GameEvent_MobEnergyTankPropSpotted); break; case eEventType.energy_tank_drained: eventClass = typeof(GameEvent_EnergyTankDrained); break; case eEventType.energy_tank_hacked: eventClass = typeof(GameEvent_EnergyTankHacked); break; case eEventType.character_updated: eventClass = typeof(GameEvent_CharacterUpdated); break; } return eventClass; }